struct utmp * getutline(struct utmp * utmp_entry) { struct utmp * utmp; if (ut_fd==-1) setutent(); if (ut_fd==-1) return NULL; #if 0 /* This is driving me nuts. It's not an implementation problem - it's a matter of how things _SHOULD_ behave. Groan. */ lseek(ut_fd, SEEK_CUR, -sizeof(struct utmp)); #endif while ((utmp=__getutent(ut_fd))!=NULL) { if ((utmp->ut_type==USER_PROCESS || utmp->ut_type==LOGIN_PROCESS) && !strcmp(utmp->ut_line, utmp_entry->ut_line)) return utmp; } return NULL; }
/* This function must be called with the LOCK held */ static struct utmp *__getutid(const struct utmp *utmp_entry) { struct utmp *lutmp; while ((lutmp = __getutent(static_fd)) != NULL) { if ( (utmp_entry->ut_type == RUN_LVL || utmp_entry->ut_type == BOOT_TIME || utmp_entry->ut_type == NEW_TIME || utmp_entry->ut_type == OLD_TIME) && lutmp->ut_type == utmp_entry->ut_type) { return lutmp; } if ( (utmp_entry->ut_type == INIT_PROCESS || utmp_entry->ut_type == DEAD_PROCESS || utmp_entry->ut_type == LOGIN_PROCESS || utmp_entry->ut_type == USER_PROCESS) && !strncmp(lutmp->ut_id, utmp_entry->ut_id, sizeof(lutmp->ut_id))) { return lutmp; } } return NULL; }
struct utmp * getutid(struct utmp * utmp_entry) { struct utmp * utmp; if (ut_fd==-1) setutent(); if (ut_fd==-1) return NULL; while ((utmp=__getutent(ut_fd))!=NULL) { if ((utmp_entry->ut_type==RUN_LVL || utmp_entry->ut_type==BOOT_TIME || utmp_entry->ut_type==NEW_TIME || utmp_entry->ut_type==OLD_TIME) && utmp->ut_type==utmp_entry->ut_type) return utmp; if ((utmp_entry->ut_type==INIT_PROCESS || utmp_entry->ut_type==DEAD_PROCESS || utmp_entry->ut_type==LOGIN_PROCESS || utmp_entry->ut_type==USER_PROCESS) && !strcmp(utmp->ut_id, utmp_entry->ut_id)) return utmp; } return NULL; }
struct utmp * getutent(void) { if (ut_fd==-1) setutent(); if (ut_fd==-1) return NULL; return __getutent(ut_fd); }
struct utmp *getutent(void) { struct utmp *ret = NULL; __UCLIBC_MUTEX_LOCK(utmplock); ret = __getutent(static_fd); __UCLIBC_MUTEX_UNLOCK(utmplock); return ret; }
/* Read next entry from a utmp-like file. */ struct utmp32 * getutent32 (void) { struct utmp *out64; ALLOCATE_UTMP32_OUT (out32); out64 = __getutent (); if (!out64) return NULL; utmp_convert64to32 (out64, out32); return out32; }
struct utmp *getutline(const struct utmp *utmp_entry) { struct utmp *lutmp = NULL; __UCLIBC_MUTEX_LOCK(utmplock); while ((lutmp = __getutent(static_fd)) != NULL) { if ((lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) && !strcmp(lutmp->ut_line, utmp_entry->ut_line)) { break; } } __UCLIBC_MUTEX_UNLOCK(utmplock); return lutmp; }
/* Locking is done in __getutent */ struct utmp *getutline(const struct utmp *utmp_entry) { struct utmp *lutmp; while ((lutmp = __getutent(static_fd)) != NULL) { if ((lutmp->ut_type == USER_PROCESS || lutmp->ut_type == LOGIN_PROCESS) && !strcmp(lutmp->ut_line, utmp_entry->ut_line)) { return lutmp; } } return NULL; }
struct utmpx * getutxent (void) { return (struct utmpx *) __getutent (); }
/* Locking is done in __getutent */ struct utmp *getutent(void) { return __getutent(static_fd); }