diff options
author | Waldemar Brodkorb <wbx@openadk.org> | 2015-03-29 04:50:56 -0500 |
---|---|---|
committer | Waldemar Brodkorb <wbx@openadk.org> | 2015-03-29 04:50:56 -0500 |
commit | cd5f92704e1e17bbc0c15d197f3bc236c7dc9bf2 (patch) | |
tree | 1400302b543e4528aedea5d72731983559cfcf36 /libutil | |
parent | ad2bffbf1926051ef333f9899344f6bddf2c03cf (diff) | |
parent | 24946289317ea23bb0d1814cca0a499a905f7d6f (diff) |
merge uClibc git master
Diffstat (limited to 'libutil')
-rw-r--r-- | libutil/Makefile.in | 8 | ||||
-rw-r--r-- | libutil/forkpty.c | 3 | ||||
-rw-r--r-- | libutil/login.c | 6 | ||||
-rw-r--r-- | libutil/login_tty.c | 1 | ||||
-rw-r--r-- | libutil/logout.c | 8 | ||||
-rw-r--r-- | libutil/logwtmp.c | 23 | ||||
-rw-r--r-- | libutil/openpty.c | 1 |
7 files changed, 18 insertions, 32 deletions
diff --git a/libutil/Makefile.in b/libutil/Makefile.in index f904fc7e1..98b178ef9 100644 --- a/libutil/Makefile.in +++ b/libutil/Makefile.in @@ -27,6 +27,14 @@ ifneq ($(UCLIBC_HAS_PTY),y) libutil_SRC := $(filter-out $(libutil_DIR)/openpty.c $(libutil_DIR)/forkpty.c \ ,$(libutil_SRC)) endif +ifeq ($(UCLIBC_HAS_UTMP)$(UCLIBC_HAS_UTMPX),) +libutil_SRC := $(filter-out \ + $(libutil_DIR)/logwtmp.c \ + $(libutil_DIR)/login.c \ + $(libutil_DIR)/logout.c \ + ,$(libutil_SRC)) +endif + libutil_OBJ := $(patsubst $(libutil_DIR)/%.c,$(libutil_OUT)/%.o,$(libutil_SRC)) ifeq ($(DOPIC),y) diff --git a/libutil/forkpty.c b/libutil/forkpty.c index ec490f053..24643330c 100644 --- a/libutil/forkpty.c +++ b/libutil/forkpty.c @@ -22,9 +22,6 @@ #include <utmp.h> #include <pty.h> -libutil_hidden_proto(openpty) -libutil_hidden_proto(login_tty) - int forkpty (int *amaster, char *name, struct termios *termp, struct winsize *winp) { diff --git a/libutil/login.c b/libutil/login.c index 4007e4c7e..971997d4a 100644 --- a/libutil/login.c +++ b/libutil/login.c @@ -3,7 +3,7 @@ #include <string.h> #include <unistd.h> #include <stdlib.h> -#include <utmp.h> +#include "internal/utmp.h" /* Write the given entry into utmp and wtmp. * Note: the match in utmp is done against ut_id field, @@ -11,7 +11,7 @@ */ void login(const struct utmp *entry) { - struct utmp copy; + struct UT copy; char tty_name[sizeof(copy.ut_line) + 6]; int fd; @@ -20,7 +20,7 @@ void login(const struct utmp *entry) // (if there is such a field) with the value USER_PROCESS, // and fills the field ut->ut_pid (if there is such a field) // with the process ID of the calling process. - copy = *entry; + copy = *((const struct UT *)(entry)); #if _HAVE_UT_TYPE - 0 copy.ut_type = USER_PROCESS; #endif diff --git a/libutil/login_tty.c b/libutil/login_tty.c index 3979adcec..366585834 100644 --- a/libutil/login_tty.c +++ b/libutil/login_tty.c @@ -36,7 +36,6 @@ #include <fcntl.h> #include <utmp.h> -libutil_hidden_proto(login_tty) int login_tty(int fd) { (void) setsid(); diff --git a/libutil/logout.c b/libutil/logout.c index 9c7440b19..0181e23aa 100644 --- a/libutil/logout.c +++ b/libutil/logout.c @@ -18,14 +18,14 @@ #include <errno.h> #include <string.h> -#include <utmp.h> #include <sys/time.h> +#include "internal/utmp.h" int logout (const char *line) { - struct utmp tmp; - struct utmp *ut; + struct UT tmp; + struct UT *ut; int result = 0; /* if (utmpname (_PATH_UTMP) == -1) return 0; - why? @@ -50,7 +50,7 @@ logout (const char *line) memset (ut->ut_host, 0, sizeof ut->ut_host); #endif #if _HAVE_UT_TV - 0 -# if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0 +# if !defined __WORDSIZE_TIME64_COMPAT32 gettimeofday (&ut->ut_tv, NULL); # else { diff --git a/libutil/logwtmp.c b/libutil/logwtmp.c index 2a6f28a48..99b772fc4 100644 --- a/libutil/logwtmp.c +++ b/libutil/logwtmp.c @@ -9,13 +9,13 @@ #include <sys/time.h> #include <time.h> #include <unistd.h> -#include <utmp.h> #include <fcntl.h> #include <sys/file.h> +#include "internal/utmp.h" void logwtmp(const char *line, const char *name, const char *host) { - struct utmp lutmp; + struct UT lutmp; memset(&lutmp, 0, sizeof(lutmp)); lutmp.ut_type = (name && *name) ? USER_PROCESS : DEAD_PROCESS; @@ -23,7 +23,7 @@ void logwtmp(const char *line, const char *name, const char *host) strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1); strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1); strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1); -#if !defined __WORDSIZE_COMPAT32 || __WORDSIZE_COMPAT32 == 0 +#if !defined __WORDSIZE_TIME64_COMPAT32 gettimeofday(&lutmp.ut_tv, NULL); #else { @@ -36,20 +36,3 @@ void logwtmp(const char *line, const char *name, const char *host) updwtmp(_PATH_WTMP, &lutmp); } - -#if 0 -/* This is enabled in uClibc/libc/misc/utmp/wtent.c */ -void updwtmp(const char *wtmp_file, const struct utmp *lutmp) -{ - int fd; - - fd = open(wtmp_file, O_APPEND | O_WRONLY); - if (fd >= 0) { - if (lockf(fd, F_LOCK, 0) == 0) { - write(fd, lutmp, sizeof(*lutmp)); - lockf(fd, F_ULOCK, 0); - close(fd); - } - } -} -#endif diff --git a/libutil/openpty.c b/libutil/openpty.c index bd8b8d9a4..848dc8d38 100644 --- a/libutil/openpty.c +++ b/libutil/openpty.c @@ -84,7 +84,6 @@ pts_name (int fd, char **pts, size_t buf_len) /* Create pseudo tty master slave pair and set terminal attributes according to TERMP and WINP. Return handles for both ends in AMASTER and ASLAVE, and return the name of the slave end in NAME. */ -libutil_hidden_proto(openpty) int openpty (int *amaster, int *aslave, char *name, struct termios *termp, struct winsize *winp) |