BBS的用户相关的东西。这块非常复杂,分成好几个部分。

UTMP

UTMPHEAD

struct UTMPHEAD {
    int next[USHM_SIZE];
    int hashhead[UTMP_HASHSIZE + 1];    /* use UCACHE_HASHSIZE/32 */
    int number;
    int listhead;
    int list_prev[USHM_SIZE];   /* sorted list prev ptr */
    int list_next[USHM_SIZE];   /* sorted list next ptr */
    time_t uptime;
};

static struct UTMPHEAD *utmphead;

utmphead其实指向一块shared memory,key = UTMP_SHMKEY


utmp.c

get_utmpshm_addr()
  • Utmp.utmpshm
longlock [(int signo)]
  • inside Utmp.Lock()
utmp_lock
  • Utmp.Lock()
utmp_unlock [(int fd)]
  • Utmp.Unlock()
utmp_setreadonly [(int readonly)]
  • UtmpHead.SetReadOnly()
detach_utmp

仅在WWW中使用。

resolve_utmp
  • Utmp.Init()
utmp_hash [(const char *userid)]
  • Utmp.Hash()
   logloop
getnewutmpent [(struct user_info *up)]
  • Utmp.GetNewUtmpEntry()
getnewutmpent2 [(struct user_info *up)]

仅在WWW中使用。

   rebuild_list [(struct user_info *up, char *arg, int p)]
   apply_ulist [(APPLY_UTMP_FUNC fptr, void *arg)]
   apply_ulist_addr [(APPLY_UTMP_FUNC fptr, void *arg)]
   apply_utmpuid [(APPLY_UTMP_FUNC fptr, int uid, void *arg)]
   apply_utmp [(APPLY_UTMP_FUNC fptr, int maxcount,const char *userid, void *arg)]
   search_ulist [(struct user_info *uentp, int (*fptr) (int, struct user_info *), int farg)]
clear_utmp2 [(int uent)]
  • Utmp.Clear()
   clear_utmp [(int uent, int useridx, int pid)]
get_utmp_number
  • UtmpHead.GetNumber()
   get_utmpent [(int utmpnum)]
   get_utmpent_num [(struct user_info *uent)]
   cmpfuid [(const void*a,const void*b)]
   getfriendstr [(struct userec* user,struct user_info* puinfo)]
   myfriend [(int uid, char *fexp)]
   hisfriend [(int uid,struct user_info* him)]