4 * This module handles states which are global to the entire server.
23 struct CitControl CitControl;
26 * get_control - read the control record into memory.
31 /* Zero it out. If the control record on disk is missing or short,
32 * the system functions with all control record fields initialized
35 bzero(&CitControl, sizeof(struct CitControl));
36 fp = fopen("citadel.control", "rb");
37 if (fp == NULL) return;
39 fread(&CitControl, sizeof(struct CitControl), 1, fp);
44 * put_control - write the control record to disk.
49 fp = fopen("citadel.control", "wb");
51 fwrite(&CitControl, sizeof(struct CitControl), 1, fp);
57 * get_new_message_number() - Obtain a new, unique ID to be used for a message.
59 long get_new_message_number() {
61 begin_critical_section(S_CONTROL);
63 ++CitControl.MMhighest;
65 end_critical_section(S_CONTROL);
66 return(CitControl.MMhighest);
71 * get_new_user_number() - Obtain a new, unique ID to be used for a user.
73 long get_new_user_number() {
75 begin_critical_section(S_CONTROL);
77 ++CitControl.MMnextuser;
79 end_critical_section(S_CONTROL);
80 return(CitControl.MMhighest);