Jakub Jelinek <jakub@redhat.com>

* sysdeps/unix/sysv/linux/Makefile
	($(objpfx)syscall-%.h $(objpfx)syscall-%.d): Take code from
	sparc/Makefile to produce a bi-arch file as needed.
	That's now parameterized by the variable $(64bit-predefine).
	Use LC_ALL=C for `comm' commands in that rule.
	No longer conditional on [$(no_syscall_list_h)].
	* sysdeps/unix/sysv/linux/sparc/Makefile: Remove replacement rules.
	(64bit-predefine): New variable.
	* sysdeps/unix/sysv/linux/x86_64/Makefile: Likewise.
	* sysdeps/unix/sysv/linux/s390/Makefile: New file.
	* sysdeps/unix/sysv/linux/powerpc/Makefile
	(64bit-predefine): New variable.

2002-10-15  Roland McGrath  <roland@redhat.com>

	* sysdeps/unix/sysv/linux/Makefile
	($(objpfx)syscall-%.h $(objpfx)syscall-%.d)

	* login/utmp-private.h: Declare __libc_utmp_lock.
	* sysdeps/unix/getlogin_r.c (getlogin_r): Take __libc_utmp_lock once
	call __libc_utmp_jump_table functions directly, instead of using
	__setutent et al.

	* sysdeps/unix/sysv/linux/configure.in: Use case instead of if.
	* sysdeps/unix/sysv/linux/configure: Regenerated.
This commit is contained in:
Roland McGrath 2002-10-16 03:03:00 +00:00
parent c55dca8d85
commit abe7b661ff
10 changed files with 100 additions and 113 deletions

View file

@ -1,4 +1,31 @@
2002-10-15 Roland McGrath <roland@redhat.com>
Jakub Jelinek <jakub@redhat.com>
* sysdeps/unix/sysv/linux/Makefile
($(objpfx)syscall-%.h $(objpfx)syscall-%.d): Take code from
sparc/Makefile to produce a bi-arch file as needed.
That's now parameterized by the variable $(64bit-predefine).
Use LC_ALL=C for `comm' commands in that rule.
No longer conditional on [$(no_syscall_list_h)].
* sysdeps/unix/sysv/linux/sparc/Makefile: Remove replacement rules.
(64bit-predefine): New variable.
* sysdeps/unix/sysv/linux/x86_64/Makefile: Likewise.
* sysdeps/unix/sysv/linux/s390/Makefile: New file.
* sysdeps/unix/sysv/linux/powerpc/Makefile
(64bit-predefine): New variable.
2002-10-15 Roland McGrath <roland@redhat.com>
* sysdeps/unix/sysv/linux/Makefile
($(objpfx)syscall-%.h $(objpfx)syscall-%.d)
* login/utmp-private.h: Declare __libc_utmp_lock.
* sysdeps/unix/getlogin_r.c (getlogin_r): Take __libc_utmp_lock once
call __libc_utmp_jump_table functions directly, instead of using
__setutent et al.
* sysdeps/unix/sysv/linux/configure.in: Use case instead of if.
* sysdeps/unix/sysv/linux/configure: Regenerated.
* sysdeps/gnu/bits/utmp.h: Include <bits/wordsize.h>.
(struct lastlog) [__WORDSIZE == 64 && __WORDSIZE_COMPAT32]:

View file

@ -23,6 +23,7 @@
#define _UTMP_PRIVATE_H 1
#include <utmp.h>
#include <bits/libc-lock.h>
/* The structure describing the functions in a backend. */
struct utfuncs
@ -46,4 +47,8 @@ extern struct utfuncs *__libc_utmp_jump_table attribute_hidden;
/* Current file name. */
extern const char *__libc_utmp_file_name attribute_hidden;
/* Locks access to the global data. */
__libc_lock_define (extern, __libc_utmp_lock attribute_hidden)
#endif /* utmp-private.h */

View file

@ -25,6 +25,7 @@
#include <fcntl.h>
#include <utmp.h>
#include "../login/utmp-private.h"
/* Return at most NAME_LEN characters of the login name of the user in NAME.
If it cannot be determined or some other error occurred, return the error
@ -37,7 +38,7 @@ getlogin_r (name, name_len)
{
char tty_pathname[2 + 2 * NAME_MAX];
char *real_tty_path = tty_pathname;
int result = 0;
int result;
struct utmp *ut, line, buffer;
/* Get name of tty connected to fd 0. Return if not a tty or
@ -56,10 +57,16 @@ getlogin_r (name, name_len)
return result;
real_tty_path += 5; /* Remove "/dev/". */
__setutent ();
strncpy (line.ut_line, real_tty_path, sizeof line.ut_line);
if (__getutline_r (&line, &buffer, &ut) < 0)
/* We don't use the normal entry points __setutent et al, because we
want setutent + getutline_r + endutent all to happen with the lock
held so that our search is thread-safe. */
__libc_lock_lock (__libc_utmp_lock);
(*__libc_utmp_jump_table->setutent) ();
result = (*__libc_utmp_jump_table->getutline_r) (&line, &buffer, &ut);
if (result < 0)
{
if (errno == ESRCH)
/* The caller expects ENOENT if nothing is found. */
@ -67,7 +74,11 @@ getlogin_r (name, name_len)
else
result = errno;
}
else
(*__libc_utmp_jump_table->endutent) ();
__libc_utmp_jump_table = &__libc_utmp_unknown_functions;
__libc_lock_unlock (__libc_utmp_lock);
if (result == 0)
{
size_t needed = strlen (ut->ut_user) + 1;
@ -82,7 +93,6 @@ getlogin_r (name, name_len)
result = 0;
}
}
__endutent ();
return result;
}

View file

@ -24,8 +24,9 @@ sysdep_headers += sys/mount.h sys/acct.h sys/sysctl.h \
install-others += $(inst_includedir)/bits/syscall.h
ifndef no_syscall_list_h
# Generate the list of SYS_* macros for the system calls (__NR_* macros).
# For bi-arch platforms, the CPU/Makefile defines 64bit-predefine and
# we generate a file that uses <bits/wordsize.h>.
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
rm -f $(@:.h=.d)-t
{ \
@ -36,8 +37,26 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscal
echo '#endif'; \
echo ''; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
$(CC) -E -x c $(sysincludes) $< -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p'; \
$(CC) -E -x c $(sysincludes) $< $(addprefix -U,$(64bit-predefine)) -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
LC_ALL=C sort > $(@:.d=.h).new32; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
$(CC) -E -x c $(sysincludes) $< $(addprefix -D,$(64bit-predefine)) -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
LC_ALL=C sort > $(@:.d=.h).new64; \
if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \
cat $(@:.d=.h).new32; \
else \
echo '#include <bits/wordsize.h>'; \
echo ''; \
LC_ALL=C comm -12 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#if __WORDSIZE == 64'; \
LC_ALL=C comm -13 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#else'; \
LC_ALL=C comm -23 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#endif'; \
fi; \
rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \
} > $(@:.d=.h).new
mv -f $(@:.d=.h).new $(@:.d=.h)
sed < $(@:.h=.d)-t > $(@:.h=.d)-t2 \
@ -45,7 +64,7 @@ $(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscal
$(@:.d=.h) $(@:.h=.d)),'
rm -f $(@:.h=.d)-t
mv -f $(@:.h=.d)-t2 $(@:.h=.d)
endif
$(inst_includedir)/bits/syscall.h: $(objpfx)syscall-list.h $(+force)
$(make-target-directory)

View file

@ -182,20 +182,22 @@ fi
# files. I.e., when the installation prefix is "/usr" we have to place
# shared library objects and the configuration files on the root partition
# in /lib and /etc.
if test "$prefix" = "/usr" -o "$prefix" = "/usr/"; then
# 64bit libraries on sparc go to /lib64 and not /lib
if test "$machine" = "sparc/sparc64" -o "$machine" = "x86_64" \
-o "$machine" = "powerpc/powerpc64" \
-o "$machine" = "s390/s390-64"; then
case "$prefix" in
/usr | /usr/)
# 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
case $machine in
sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 )
libc_cv_slibdir="/lib64"
if test "$libdir" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/lib64';
# Locale data can be shared between 32bit and 64bit libraries
libc_cv_localedir='${exec_prefix}/lib/locale'
fi
else
;;
*)
libc_cv_slibdir="/lib"
fi
;;
esac
# Allow the user to override the path with --sysconfdir
if test $sysconfdir = '${prefix}/etc'; then
libc_cv_sysconfdir=/etc
@ -203,7 +205,8 @@ if test "$prefix" = "/usr" -o "$prefix" = "/usr/"; then
libc_cv_sysconfdir=$sysconfdir
fi
libc_cv_rootsbindir="/sbin"
fi
;;
esac
# Under Linux the LinuxThreads or NPTL add-on should be available.
case $add_ons in
@ -297,7 +300,7 @@ if test $host = $build; then
ac_prefix=$ac_default_prefix
fi
echo $ac_n "checking for symlinks in ${ac_prefix}/include""... $ac_c" 1>&6
echo "configure:300: checking for symlinks in ${ac_prefix}/include" >&5
echo "configure:304: checking for symlinks in ${ac_prefix}/include" >&5
ac_message=
if test -L ${ac_prefix}/include/net; then
ac_message="$ac_message

View file

@ -152,20 +152,22 @@ fi
# files. I.e., when the installation prefix is "/usr" we have to place
# shared library objects and the configuration files on the root partition
# in /lib and /etc.
if test "$prefix" = "/usr" -o "$prefix" = "/usr/"; then
# 64bit libraries on sparc go to /lib64 and not /lib
if test "$machine" = "sparc/sparc64" -o "$machine" = "x86_64" \
-o "$machine" = "powerpc/powerpc64" \
-o "$machine" = "s390/s390-64"; then
case "$prefix" in
/usr | /usr/)
# 64-bit libraries on bi-arch platforms go in /lib64 instead of /lib
case $machine in
sparc/sparc64 | x86_64 | powerpc/powerpc64 | s390/s390-64 )
libc_cv_slibdir="/lib64"
if test "$libdir" = '${exec_prefix}/lib'; then
libdir='${exec_prefix}/lib64';
# Locale data can be shared between 32bit and 64bit libraries
libc_cv_localedir='${exec_prefix}/lib/locale'
fi
else
;;
*)
libc_cv_slibdir="/lib"
fi
;;
esac
# Allow the user to override the path with --sysconfdir
if test $sysconfdir = '${prefix}/etc'; then
libc_cv_sysconfdir=/etc
@ -173,7 +175,8 @@ if test "$prefix" = "/usr" -o "$prefix" = "/usr/"; then
libc_cv_sysconfdir=$sysconfdir
fi
libc_cv_rootsbindir="/sbin"
fi
;;
esac
# Under Linux the LinuxThreads or NPTL add-on should be available.
case $add_ons in

View file

@ -1,3 +1,5 @@
64bit-predefine = __powerpc64__
ifeq ($(subdir),signal)
sysdep_routines += rt_sigsuspend rt_sigprocmask rt_sigtimedwait \
rt_sigqueueinfo rt_sigaction rt_sigpending

View file

@ -0,0 +1 @@
64bit-predefine = __s390x__

View file

@ -1,44 +1 @@
ifeq ($(subdir),misc)
no_syscall_list_h = 1
# Generate the list of SYS_* macros for the system calls (__NR_* macros).
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
rm -f $(@:.h=.d)-t
{ \
echo '/* Generated at libc build time from kernel syscall list. */';\
echo ''; \
echo '#ifndef _SYSCALL_H'; \
echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
echo '#endif'; \
echo ''; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
$(CC) -E -x c $(sysincludes) $< -U__sparc_v9__ -U__arch64__ -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
LC_ALL=C sort > $(@:.d=.h).new32; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
$(CC) -E -x c $(sysincludes) $< -D__sparc_v9__ -D__arch64__ -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
LC_ALL=C sort > $(@:.d=.h).new64; \
if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \
cat $(@:.d=.h).new32; \
else \
echo '#include <bits/wordsize.h>'; \
echo ''; \
comm -12 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#if __WORDSIZE == 64'; \
comm -13 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#else'; \
comm -23 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#endif'; \
fi; \
rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \
} > $(@:.d=.h).new
mv -f $(@:.d=.h).new $(@:.d=.h)
sed < $(@:.h=.d)-t > $(@:.h=.d)-t2 \
-e 's,$(subst .,\.,$@),$(patsubst $(objpfx)%,$$(objpfx)%,\
$(@:.d=.h) $(@:.h=.d)),'
rm -f $(@:.h=.d)-t
mv -f $(@:.h=.d)-t2 $(@:.h=.d)
endif
64bit-predefine = __sparc_v9__ __arch64__

View file

@ -1,48 +1,8 @@
64bit-predefine = __x86_64__
ifeq ($(subdir),misc)
sysdep_routines += ioperm iopl
sysdep_headers += sys/perm.h sys/reg.h sys/debugreg.h sys/io.h
no_syscall_list_h = 1
# Generate the list of SYS_* macros for the system calls (__NR_* macros).
$(objpfx)syscall-%.h $(objpfx)syscall-%.d: ../sysdeps/unix/sysv/linux/sys/syscall.h
rm -f $(@:.h=.d)-t
{ \
echo '/* Generated at libc build time from kernel syscall list. */';\
echo ''; \
echo '#ifndef _SYSCALL_H'; \
echo '# error "Never use <bits/syscall.h> directly; include <sys/syscall.h> instead."'; \
echo '#endif'; \
echo ''; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
$(CC) -E -x c $(sysincludes) $< -U__x86_64__ -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
LC_ALL=C sort > $(@:.d=.h).new32; \
SUNPRO_DEPENDENCIES='$(@:.h=.d)-t $@' \
$(CC) -E -x c $(sysincludes) $< -D__x86_64 -D_LIBC -dM | \
sed -n 's@^#define __NR_\([^ ]*\) .*$$@#define SYS_\1 __NR_\1@p' | \
LC_ALL=C sort > $(@:.d=.h).new64; \
if cmp -s $(@:.d=.h).new32 $(@:.d=.h).new64; then \
cat $(@:.d=.h).new32; \
else \
echo '#include <bits/wordsize.h>'; \
echo ''; \
comm -12 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#if __WORDSIZE == 64'; \
comm -13 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#else'; \
comm -23 $(@:.d=.h).new32 $(@:.d=.h).new64; \
echo '#endif'; \
fi; \
rm -f $(@:.d=.h).new32 $(@:.d=.h).new64; \
} > $(@:.d=.h).new
mv -f $(@:.d=.h).new $(@:.d=.h)
sed < $(@:.h=.d)-t > $(@:.h=.d)-t2 \
-e 's,$(subst .,\.,$@),$(patsubst $(objpfx)%,$$(objpfx)%,\
$(@:.d=.h) $(@:.h=.d)),'
rm -f $(@:.h=.d)-t
mv -f $(@:.h=.d)-t2 $(@:.h=.d)
endif
ifeq ($(subdir),stdlib)