about summary refs log tree commit diff
path: root/sysdeps/gnu
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/gnu')
-rw-r--r--sysdeps/gnu/Makefile7
-rw-r--r--sysdeps/gnu/bits/utmpx.h19
-rw-r--r--sysdeps/gnu/updwtmp.c30
-rw-r--r--sysdeps/gnu/utmp_file.c30
-rw-r--r--sysdeps/gnu/utmpx.h67
5 files changed, 150 insertions, 3 deletions
diff --git a/sysdeps/gnu/Makefile b/sysdeps/gnu/Makefile
index e491fa2be4..762f79b866 100644
--- a/sysdeps/gnu/Makefile
+++ b/sysdeps/gnu/Makefile
@@ -28,3 +28,10 @@ $(..)sysdeps/gnu/errlist.c: $(..)sysdeps/gnu/errlist.awk \
 ifeq ($(with-cvs),yes)
 	test ! -d CVS || cvs commit -m'Regenerated from $^' $@
 endif
+
+ifeq ($(subdir),login)
+sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
+                   pututxline utmpxname updwtmpx
+
+sysdep_headers += utmpx.h bits/utmpx.h
+endif
diff --git a/sysdeps/gnu/bits/utmpx.h b/sysdeps/gnu/bits/utmpx.h
index 4ecbb3a026..b367bfba3c 100644
--- a/sysdeps/gnu/bits/utmpx.h
+++ b/sysdeps/gnu/bits/utmpx.h
@@ -1,5 +1,5 @@
 /* Structures and defenitions for the user accounting database.  GNU version.
-   Copyright (C) 1997 Free Software Foundation, Inc.
+   Copyright (C) 1997, 1998 Free Software Foundation, Inc.
 
    The GNU C Library is free software; you can redistribute it and/or
    modify it under the terms of the GNU Library General Public License as
@@ -24,6 +24,13 @@
 #include <sys/time.h>
 
 
+#ifdef __USE_GNU
+# include <paths.h>
+# define _PATH_UTMPX	_PATH_UTMP
+# define _PATH_WTMPX	_PATH_WTMP
+#endif
+
+
 #define __UT_LINESIZE	32
 #define __UT_NAMESIZE	32
 #define __UT_HOSTSIZE	256
@@ -56,10 +63,12 @@ struct utmpx
 };
 
 
-/* Values for the `ut_type' field of a `struct utmp'.  */
+/* Values for the `ut_type' field of a `struct utmpx'.  */
 #define EMPTY		0	/* No valid user accounting information.  */
 
-#define RUN_LVL		1	/* The system's runlevel.  */
+#ifdef __USE_GNU
+# define RUN_LVL	1	/* The system's runlevel.  */
+#endif
 #define BOOT_TIME	2	/* Time of system boot.  */
 #define NEW_TIME	3	/* Time after system clock changed.  */
 #define OLD_TIME	4	/* Time when system clock changed.  */
@@ -68,3 +77,7 @@ struct utmpx
 #define LOGIN_PROCESS	6	/* Session leader of a logged in user.  */
 #define USER_PROCESS	7	/* Normal process.  */
 #define DEAD_PROCESS	8	/* Terminated process.  */
+
+#ifdef __USE_GNU
+# define ACCOUNTING	9	/* System accounting.  */
+#endif
diff --git a/sysdeps/gnu/updwtmp.c b/sysdeps/gnu/updwtmp.c
new file mode 100644
index 0000000000..19a77657b3
--- /dev/null
+++ b/sysdeps/gnu/updwtmp.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <string.h>
+#include <unistd.h>
+
+#define TRANSFORM_UTMP_FILE_NAME(file_name) \
+    ((strcmp (file_name, _PATH_UTMP "x") == 0 \
+      && __access (_PATH_UTMP "x", F_OK) != 0) ? _PATH_UTMP : \
+     ((strcmp (file_name, _PATH_WTMP "x") == 0 \
+       && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
+      file_name))
+
+#include <sysdeps/generic/updwtmp.c>
diff --git a/sysdeps/gnu/utmp_file.c b/sysdeps/gnu/utmp_file.c
new file mode 100644
index 0000000000..05bbcd1ce1
--- /dev/null
+++ b/sysdeps/gnu/utmp_file.c
@@ -0,0 +1,30 @@
+/* Copyright (C) 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1998.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#include <string.h>
+#include <unistd.>
+
+#define TRANSFORM_UTMP_FILE_NAME(file_name) \
+    ((strcmp (file_name, _PATH_UTMP "x") == 0 \
+      && __access (_PATH_UTMP "x", F_OK) != 0) ? _PATH_UTMP : \
+     ((strcmp (file_name, _PATH_WTMP "x") == 0 \
+       && __access (_PATH_WTMP "x", F_OK) != 0) ? _PATH_WTMP : \
+      file_name))
+
+#include <sysdeps/generic/utmp_file.c>
diff --git a/sysdeps/gnu/utmpx.h b/sysdeps/gnu/utmpx.h
new file mode 100644
index 0000000000..e9f2389b75
--- /dev/null
+++ b/sysdeps/gnu/utmpx.h
@@ -0,0 +1,67 @@
+/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+   Contributed by Mark Kettenis <kettenis@phys.uva.nl>, 1997.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Library General Public License as
+   published by the Free Software Foundation; either version 2 of the
+   License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Library General Public License for more details.
+
+   You should have received a copy of the GNU Library General Public
+   License along with the GNU C Library; see the file COPYING.LIB.  If not,
+   write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+   Boston, MA 02111-1307, USA.  */
+
+#ifndef	_UTMPX_H
+#define	_UTMPX_H	1
+
+#include <features.h>
+
+__BEGIN_DECLS
+
+/* Get system dependent values and data structures.  */
+#include <bits/utmpx.h>
+
+#ifdef __USE_GNU
+/* Compatibility names for the strings of the canonical file names.  */
+# define UTMPX_FILE	_PATH_UTMPX
+# define UTMPX_FILENAME	_PATH_UTMPX
+# define WTMPX_FILE	_PATH_WTMPX
+# define WTMPX_FILENAME	_PATH_WTMPX
+#endif
+
+/* Open user accounting database.  */
+extern void setutxent __P ((void));
+
+/* Close user accounting database.  */
+extern void endutxent __P ((void));
+
+/* Get the next entry from the user accounting database.  */
+extern struct utmpx *getutxent __P ((void));
+
+/* Get the user accounting database entry corresponding to ID.  */
+extern struct utmpx *getutxid __P ((const struct utmpx *__id));
+
+/* Get the user accounting database entry corresponding to LINE.  */
+extern struct utmpx *getutxline __P ((const struct utmpx *__line));
+
+/* Write the entry UTMPX into the user accounting database.  */
+extern struct utmpx *pututxline __P ((const struct utmpx *__utmpx));
+
+#ifdef __USE_GNU
+/* Change name of the utmpx file to be examined.  */
+extern int utmpxname __P ((__const char *__file));
+
+/* Append entry UTMP to the wtmpx-like file WTMPX_FILE.  */
+extern void updwtmpx __P ((__const char *__wtmpx_file,
+			   __const struct utmpx *__utmpx));
+#endif
+
+__END_DECLS
+
+#endif /* utmpx.h  */