svn commit: r201638 - in user/ed/utmpx: include lib/libc/gen
Ed Schouten
ed at FreeBSD.org
Wed Jan 6 10:41:27 UTC 2010
Author: ed
Date: Wed Jan 6 10:41:27 2010
New Revision: 201638
URL: http://svn.freebsd.org/changeset/base/201638
Log:
Reintroduce getutxuser().
This function will be used by applications that crawl through the
lastlogin database.
Modified:
user/ed/utmpx/include/utmpx.h
user/ed/utmpx/lib/libc/gen/Symbol.map
user/ed/utmpx/lib/libc/gen/getutxent.c
Modified: user/ed/utmpx/include/utmpx.h
==============================================================================
--- user/ed/utmpx/include/utmpx.h Wed Jan 6 10:29:53 2010 (r201637)
+++ user/ed/utmpx/include/utmpx.h Wed Jan 6 10:41:27 2010 (r201638)
@@ -78,6 +78,7 @@ struct utmpx *pututxline(const struct ut
void setutxent(void);
#if __BSD_VISIBLE
+struct utmpx *getutxuser(const char *);
int setutxdb(int, const char *);
#endif
__END_DECLS
Modified: user/ed/utmpx/lib/libc/gen/Symbol.map
==============================================================================
--- user/ed/utmpx/lib/libc/gen/Symbol.map Wed Jan 6 10:29:53 2010 (r201637)
+++ user/ed/utmpx/lib/libc/gen/Symbol.map Wed Jan 6 10:41:27 2010 (r201638)
@@ -372,6 +372,7 @@ FBSD_1.2 {
getutxent;
getutxid;
getutxline;
+ getutxuser;
pututxline;
setutxdb;
setutxent;
Modified: user/ed/utmpx/lib/libc/gen/getutxent.c
==============================================================================
--- user/ed/utmpx/lib/libc/gen/getutxent.c Wed Jan 6 10:29:53 2010 (r201637)
+++ user/ed/utmpx/lib/libc/gen/getutxent.c Wed Jan 6 10:41:27 2010 (r201638)
@@ -238,3 +238,25 @@ found:
futx_to_utx(fu, &utx);
return (&utx);
}
+
+struct utmpx *
+getutxuser(const char *user)
+{
+ struct futx *fu;
+
+ for (;;) {
+ fu = getfutxent();
+ if (fu == NULL)
+ return (NULL);
+
+ switch (fu->fu_type) {
+ case USER_PROCESS:
+ if (strncmp(fu->fu_user, user, sizeof fu->fu_user) == 0)
+ goto found;
+ }
+ }
+
+found:
+ futx_to_utx(fu, &utx);
+ return (&utx);
+}
More information about the svn-src-user
mailing list