[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[commits] r3185 - in /trunk/libc: ./ debug/ login/ posix/ sysdeps/gnu/
- To: commits@xxxxxxxxxx
- Subject: [commits] r3185 - in /trunk/libc: ./ debug/ login/ posix/ sysdeps/gnu/
- From: jimb@xxxxxxxxxx
- Date: Sat, 18 Aug 2007 05:37:11 -0000
Author: jimb
Date: Fri Aug 17 22:37:11 2007
New Revision: 3185
Log:
Implement the OPTION_EGLIBC_UTMP, OPTION_EGLIBC_UTMPX, and
OPTION_EGLIBC_GETLOGIN option groups.
* option-groups.def (OPTION_EGLIBC_UTMP, OPTION_EGLIBC_UTMPX)
(OPTION_EGLIBC_GETLOGIN): New entry.
* option-groups.defaults (OPTION_EGLIBC_UTMP, OPTION_EGLIBC_UTMPX)
(OPTION_EGLIBC_GETLOGIN): Initialize.
* Makerules (sysdep_routines): Include value of sysdep_routines-y.
* debug/Makefile: Include option-groups.mak.
(routines): Put getlogin_r_chk in the OPTION_EGLIBC_GETLOGIN group.
* sysdeps/gnu/Makefile (sysdep_routines): For the login
subdirectory, put setutxent, getutxent, endutxent, getutxid,
getutxline, pututxline, utmpxname, updwtmpx, getutmpx, and getutmp
in the OPTION_EGLIBC_UTMPX group.
* login/Makefile: Include option-groups.mak.
(routines): Put getutent, getutent_r, getutid, getutline,
getutid_r, getutline_r, utmp_file, utmpname, and updwtmp in the
OPTION_EGLIBC_UTMP option group.
(others): Put utmpdump in the OPTION_EGLIBC_UTMP group.
(extra-libs): Put libutil in the OPTION_EGLIBC_UTMP group.
(extra-libs-others): Initialize from $(extra-libs-y).
* posix/glob.c (glob): If OPTION_EGLIBC_GETLOGIN is not defined,
don't try to call getlogin to find the username to use for tilde
expansion.
* posix/Makefile (routines): Put getlogin and getlogin_r in the
OPTION_EGLIBC_GETLOGIN group.
(CFLAGS-glob.c): Define OPTION_EGLIBC_GETLOGIN as appropriate.
Modified:
trunk/libc/ChangeLog.eglibc
trunk/libc/Makerules
trunk/libc/debug/Makefile
trunk/libc/login/Makefile
trunk/libc/option-groups.def
trunk/libc/option-groups.defaults
trunk/libc/posix/Makefile
trunk/libc/posix/glob.c
trunk/libc/sysdeps/gnu/Makefile
Modified: trunk/libc/ChangeLog.eglibc
==============================================================================
--- trunk/libc/ChangeLog.eglibc (original)
+++ trunk/libc/ChangeLog.eglibc Fri Aug 17 22:37:11 2007
@@ -1,4 +1,32 @@
2007-08-17 Jim Blandy <jimb@xxxxxxxxxxxxxxxx>
+
+ Implement the OPTION_EGLIBC_UTMP, OPTION_EGLIBC_UTMPX, and
+ OPTION_EGLIBC_GETLOGIN option groups.
+
+ * option-groups.def (OPTION_EGLIBC_UTMP, OPTION_EGLIBC_UTMPX)
+ (OPTION_EGLIBC_GETLOGIN): New entry.
+ * option-groups.defaults (OPTION_EGLIBC_UTMP, OPTION_EGLIBC_UTMPX)
+ (OPTION_EGLIBC_GETLOGIN): Initialize.
+ * Makerules (sysdep_routines): Include value of sysdep_routines-y.
+ * debug/Makefile: Include option-groups.mak.
+ (routines): Put getlogin_r_chk in the OPTION_EGLIBC_GETLOGIN group.
+ * sysdeps/gnu/Makefile (sysdep_routines): For the login
+ subdirectory, put setutxent, getutxent, endutxent, getutxid,
+ getutxline, pututxline, utmpxname, updwtmpx, getutmpx, and getutmp
+ in the OPTION_EGLIBC_UTMPX group.
+ * login/Makefile: Include option-groups.mak.
+ (routines): Put getutent, getutent_r, getutid, getutline,
+ getutid_r, getutline_r, utmp_file, utmpname, and updwtmp in the
+ OPTION_EGLIBC_UTMP option group.
+ (others): Put utmpdump in the OPTION_EGLIBC_UTMP group.
+ (extra-libs): Put libutil in the OPTION_EGLIBC_UTMP group.
+ (extra-libs-others): Initialize from $(extra-libs-y).
+ * posix/glob.c (glob): If OPTION_EGLIBC_GETLOGIN is not defined,
+ don't try to call getlogin to find the username to use for tilde
+ expansion.
+ * posix/Makefile (routines): Put getlogin and getlogin_r in the
+ OPTION_EGLIBC_GETLOGIN group.
+ (CFLAGS-glob.c): Define OPTION_EGLIBC_GETLOGIN as appropriate.
Implement the OPTION_EGLIBC_SPAWN option group.
Modified: trunk/libc/Makerules
==============================================================================
--- trunk/libc/Makerules (original)
+++ trunk/libc/Makerules Fri Aug 17 22:37:11 2007
@@ -417,6 +417,7 @@
others += $(others-y)
routines += $(routines-y)
static-only-routines += $(static-only-routines-y)
+sysdep_routines += $(sysdep_routines-y)
test-srcs += $(test-srcs-y)
tests += $(tests-y)
xtests += $(xtests-y)
Modified: trunk/libc/debug/Makefile
==============================================================================
--- trunk/libc/debug/Makefile (original)
+++ trunk/libc/debug/Makefile Fri Aug 17 22:37:11 2007
@@ -19,6 +19,8 @@
#
# Sub-makefile for debug portion of the library.
#
+include ../option-groups.mak
+
subdir := debug
headers := execinfo.h
@@ -38,12 +40,13 @@
wcpncpy_chk \
swprintf_chk vswprintf_chk wprintf_chk fwprintf_chk \
vwprintf_chk vfwprintf_chk fgetws_chk fgetws_u_chk \
- confstr_chk getgroups_chk ttyname_r_chk getlogin_r_chk \
+ confstr_chk getgroups_chk ttyname_r_chk \
gethostname_chk getdomainname_chk wcrtomb_chk mbsnrtowcs_chk \
wcsnrtombs_chk mbsrtowcs_chk wcsrtombs_chk mbstowcs_chk \
wcstombs_chk \
stack_chk_fail fortify_fail \
$(static-only-routines)
+routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin_r_chk
static-only-routines := warning-nop stack_chk_fail_local
CFLAGS-backtrace.c = -fno-omit-frame-pointer
Modified: trunk/libc/login/Makefile
==============================================================================
--- trunk/libc/login/Makefile (original)
+++ trunk/libc/login/Makefile Fri Aug 17 22:37:11 2007
@@ -19,17 +19,21 @@
#
# Sub-makefile for login portion of the library.
#
+include ../option-groups.mak
subdir := login
headers := utmp.h bits/utmp.h lastlog.h pty.h
-routines := getutent getutent_r getutid getutline getutid_r getutline_r \
- utmp_file utmpname updwtmp getpt grantpt unlockpt ptsname
+routines := getpt grantpt unlockpt ptsname
+routines-$(OPTION_EGLIBC_UTMP) \
+ += getutent getutent_r getutid getutline getutid_r getutline_r \
+ utmp_file utmpname updwtmp
CFLAGS-grantpt.c = -DLIBEXECDIR='"$(libexecdir)"'
-others = utmpdump pt_chown
+others = pt_chown
+others-$(OPTION_EGLIBC_UTMP) += utmpdump
install-others = $(inst_libexecdir)/pt_chown
distribute := utmp-private.h utmp-equal.h pty-private.h
@@ -40,8 +44,8 @@
tests := tst-utmp tst-utmpx tst-grantpt
# Build the -lutil library with these extra functions.
-extra-libs := libutil
-extra-libs-others := $(extra-libs)
+extra-libs-$(OPTION_EGLIBC_UTMP) := libutil
+extra-libs-others := $(extra-libs-y)
libutil-routines:= login login_tty logout logwtmp openpty forkpty
Modified: trunk/libc/option-groups.def
==============================================================================
--- trunk/libc/option-groups.def (original)
+++ trunk/libc/option-groups.def Fri Aug 17 22:37:11 2007
@@ -143,6 +143,18 @@
endfsent getfsspec
getfsent setfsent
getfsfile
+
+config OPTION_EGLIBC_GETLOGIN
+ bool "The getlogin function"
+ depends OPTION_EGLIBC_UTMP
+ help
+ This function group includes the 'getlogin' and 'getlogin_r'
+ functions, which return the user name associated by the login
+ activity with the current process's controlling terminal.
+
+ With this option group disabled, the 'glob' function will not
+ fall back on 'getlogin' to find the user's login name for tilde
+ expansion when the 'HOME' environment variable is not set.
config OPTION_EGLIBC_INET
bool "Networking support"
@@ -463,6 +475,56 @@
This option group includes support for the Sun RPC protocols,
including the 'rpcgen' and 'rpcinfo' programs.
+config OPTION_EGLIBC_UTMP
+ bool "Older access functions for 'utmp' login records"
+ help
+ This option group includes the older 'utent' family of
+ functions for accessing user login records in the 'utmp' file.
+ POSIX omits these functions in favor of the 'utxent' family,
+ and they are obsolete on systems other than Linux.
+
+ This option group includes the following functions:
+
+ endutent
+ getutent
+ getutent_r
+ getutid
+ getutid_r
+ getutline
+ getutline_r
+ logwtmp
+ pututline
+ setutent
+ updwtmp
+ utmpname
+
+ This option group includes the following libraries:
+
+ libutil.so (and libutil.a)
+
+config OPTION_EGLIBC_UTMPX
+ bool "POSIX access functions for 'utmp' login records"
+ depends OPTION_EGLIBC_UTMP
+ help
+ This option group includes the POSIX functions for reading and
+ writing user login records in the 'utmp' file (usually
+ '/var/run/utmp'). The POSIX functions operate on 'struct
+ utmpx' structures, as opposed to the family of older 'utent'
+ functions, which operate on 'struct utmp' structures.
+
+ This option group includes the following functions:
+
+ endutxent
+ getutmp
+ getutmpx
+ getutxent
+ getutxid
+ getutxline
+ pututxline
+ setutxent
+ updwtmpx
+ utmpxname
+
config OPTION_POSIX_REGEXP
bool "Regular expressions"
help
Modified: trunk/libc/option-groups.defaults
==============================================================================
--- trunk/libc/option-groups.defaults (original)
+++ trunk/libc/option-groups.defaults Fri Aug 17 22:37:11 2007
@@ -12,6 +12,7 @@
OPTION_EGLIBC_CHARSETS = y
OPTION_EGLIBC_ENVZ = y
OPTION_EGLIBC_FSTAB = y
+OPTION_EGLIBC_GETLOGIN = y
OPTION_EGLIBC_INET = y
OPTION_EGLIBC_LIBM = y
OPTION_EGLIBC_LOCALES = y
@@ -21,4 +22,6 @@
OPTION_EGLIBC_RCMD = y
OPTION_EGLIBC_SPAWN = y
OPTION_EGLIBC_SUNRPC = y
+OPTION_EGLIBC_UTMP = y
+OPTION_EGLIBC_UTMPX = y
OPTION_POSIX_REGEXP = y
Modified: trunk/libc/posix/Makefile
==============================================================================
--- trunk/libc/posix/Makefile (original)
+++ trunk/libc/posix/Makefile Fri Aug 17 22:37:11 2007
@@ -50,7 +50,7 @@
getuid geteuid getgid getegid getgroups setuid setgid group_member \
getpgid setpgid getpgrp bsd-getpgrp setpgrp getsid setsid \
getresuid getresgid setresuid setresgid \
- getlogin getlogin_r setlogin \
+ setlogin \
pathconf sysconf fpathconf \
glob glob64 fnmatch \
confstr \
@@ -73,6 +73,7 @@
spawnattr_getpgroup spawnattr_setpgroup spawn spawnp spawni \
spawnattr_getsigmask spawnattr_getschedpolicy spawnattr_getschedparam \
spawnattr_setsigmask spawnattr_setschedpolicy spawnattr_setschedparam
+routines-$(OPTION_EGLIBC_GETLOGIN) += getlogin getlogin_r
include ../Makeconfig
@@ -149,6 +150,8 @@
# eglibc: endif
OPTION_EGLIBC_INET-CFLAGS-$(OPTION_EGLIBC_INET) = -DUSE_NSCD=1
+OPTION_EGLIBC_GETLOGIN-CFLAGS-$(OPTION_EGLIBC_GETLOGIN) \
+ = -DOPTION_EGLIBC_GETLOGIN
CFLAGS-regex.c = -Wno-strict-prototypes
CFLAGS-getaddrinfo.c = -DRESOLVER -fexceptions $(OPTION_EGLIBC_INET-CFLAGS-y)
@@ -173,7 +176,8 @@
CFLAGS-spawni.c = -fexceptions
CFLAGS-spawni.os = -fomit-frame-pointer
CFLAGS-pause.c = -fexceptions
-CFLAGS-glob.c = $(uses-callbacks) -fexceptions
+CFLAGS-glob.c = $(uses-callbacks) -fexceptions \
+ $(OPTION_EGLIBC_GETLOGIN-CFLAGS-y)
CFLAGS-glob64.c = $(uses-callbacks) -fexceptions
CFLAGS-getconf.c = -DGETCONF_DIR='"$(libexecdir)/getconf"'
CFLAGS-execve.os = -fomit-frame-pointer
Modified: trunk/libc/posix/glob.c
==============================================================================
--- trunk/libc/posix/glob.c (original)
+++ trunk/libc/posix/glob.c Fri Aug 17 22:37:11 2007
@@ -564,6 +564,7 @@
if (home_dir == NULL || home_dir[0] == '\0')
home_dir = "c:/users/default"; /* poor default */
# else
+# if OPTION_EGLIBC_GETLOGIN
if (home_dir == NULL || home_dir[0] == '\0')
{
int success;
@@ -580,18 +581,18 @@
if (success)
{
struct passwd *p;
-# if defined HAVE_GETPWNAM_R || defined _LIBC
+# if defined HAVE_GETPWNAM_R || defined _LIBC
long int pwbuflen = GETPW_R_SIZE_MAX ();
char *pwtmpbuf;
struct passwd pwbuf;
int save = errno;
-# ifndef _LIBC
+# ifndef _LIBC
if (pwbuflen == -1)
/* `sysconf' does not support _SC_GETPW_R_SIZE_MAX.
Try a moderate value. */
pwbuflen = 1024;
-# endif
+# endif
pwtmpbuf = (char *) __alloca (pwbuflen);
while (getpwnam_r (name, &pwbuf, pwtmpbuf, pwbuflen, &p)
@@ -602,22 +603,23 @@
p = NULL;
break;
}
-# ifdef _LIBC
+# ifdef _LIBC
pwtmpbuf = extend_alloca (pwtmpbuf, pwbuflen,
2 * pwbuflen);
-# else
+# else
pwbuflen *= 2;
pwtmpbuf = (char *) __alloca (pwbuflen);
-# endif
+# endif
__set_errno (save);
}
-# else
+# else
p = getpwnam (name);
-# endif
+# endif
if (p != NULL)
home_dir = p->pw_dir;
}
}
+# endif /* OPTION_EGLIBC_GETLOGIN */
if (home_dir == NULL || home_dir[0] == '\0')
{
if (flags & GLOB_TILDE_CHECK)
Modified: trunk/libc/sysdeps/gnu/Makefile
==============================================================================
--- trunk/libc/sysdeps/gnu/Makefile (original)
+++ trunk/libc/sysdeps/gnu/Makefile Fri Aug 17 22:37:11 2007
@@ -62,7 +62,8 @@
endif
ifeq ($(subdir),login)
-sysdep_routines += setutxent getutxent endutxent getutxid getutxline \
+sysdep_routines-$(OPTION_EGLIBC_UTMPX) \
+ += setutxent getutxent endutxent getutxid getutxline \
pututxline utmpxname updwtmpx getutmpx getutmp
sysdep_headers += utmpx.h bits/utmpx.h