• Which function are used by getutxent?
  • Does getutxent open file for each call?
  • Please list each funtion that are called from getutxent until the libc/syscall that open files?
  • If it doesn’t open file each time, where the file is cached.
  • Which functions (more then one) can be used to cache this file.
  • What function is used to parse data from file.
  1. getutxent uses getfutxent,setutxent,setutxdb

  2. No,It only open file once. It only read when the FILE *uf points to null

  3. the sequence of call:getutxent-getfutxent-setutxent()-setutxdb

  4. It is assigned to static _Thread_local FILE *uf and status store in udb

  5. fopen ,fstat

  6. parsing data:
    setutxent() using fread with fseek if neccessary

last: only getfutxent is private because it is static.