1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-12-24 17:51:17 +03:00
1999-05-26  Ulrich Drepper  <drepper@cygnus.com>

	* config.h.in: Add __LINUX_KERNEL_VERSION.
	* configure.in: Recognize --enable-kernel.
	* sysdeps/unix/sysv/linux/configure.in: Check for correct kernel
	headers if --enable-kernel is given and set __LINUX_KERNEL_VERSION
	appropriately.
	* sysdeps/unix/sysv/linux/init-first.c: If minimal kernel version is
	given perform runtime test.

	* sysdeps/unix/sysv/linux/kernel-features.h: New file.
	* sysdeps/unix/sysv/linux/getcwd.c: Elide compatibility code if
	minimal supported kernel is known to have the feature.
	* sysdeps/unix/sysv/linux/poll.c: Likewise.
	* sysdeps/unix/sysv/linux/pread.c: Likewise.
	* sysdeps/unix/sysv/linux/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/pwrite64.c: Likewise.
	* sysdeps/unix/sysv/linux/seteuid.c: Likewise.
	* sysdeps/unix/sysv/linux/sigaction.c: Likewise.
	* sysdeps/unix/sysv/linux/sigprocmask.c: Likewise.
	* sysdeps/unix/sysv/linux/sigsuspend.c: Likewise.
	* sysdeps/unix/sysv/linux/testrtsig.h: Likewise.
	* sysdeps/unix/sysv/linux/i386/chown.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/pread.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/pread64.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/pwrite.c: Likewise.
	* sysdeps/unix/sysv/linux/i386/pwrite64.c: Likewise.

	* sysdeps/unix/sysv/linux/sysctl.c: Add __sysctl alias.
This commit is contained in:
Ulrich Drepper
1999-05-26 23:37:38 +00:00
parent 475e390e80
commit 958f238f36
26 changed files with 744 additions and 262 deletions

View File

@@ -23,20 +23,27 @@
#include <sysdep.h>
#include <sys/syscall.h>
#include "kernel-features.h"
/* The difference here is that the sigaction structure used in the
kernel is not the same as we use in the libc. Therefore we must
translate it here. */
#include <kernel_sigaction.h>
extern int __syscall_sigaction (int, const struct old_kernel_sigaction *,
struct old_kernel_sigaction *);
extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
struct kernel_sigaction *, size_t);
#if __ASSUME_REALTIME_SIGNALS == 0
/* The variable is shared between all wrappers around signal handling
functions which have RT equivalents. This is the definition. */
int __libc_missing_rt_sigs;
extern int __syscall_sigaction (int, const struct old_kernel_sigaction *,
struct old_kernel_sigaction *);
# define rtsignals_guaranteed 0
#else
# define rtsignals_guaranteed 1
#endif
extern int __syscall_rt_sigaction (int, const struct kernel_sigaction *,
struct kernel_sigaction *, size_t);
/* If ACT is not NULL, change the action for SIG to *ACT.
If OACT is not NULL, put the old action for SIG in *OACT. */
@@ -49,12 +56,18 @@ __sigaction (sig, act, oact)
struct old_kernel_sigaction k_sigact, k_osigact;
int result;
#ifdef __NR_rt_sigaction
#if defiend __NR_rt_sigaction || __ASSUME_REALTIME_SIGNALS > 0
/* First try the RT signals. */
# if __ASSUME_REALTIME_SIGNALS == 0
if (!__libc_missing_rt_sigs)
# endif
{
struct kernel_sigaction kact, koact;
/* Save the current error value for later. We need not do this
if we are guaranteed to have realtime signals. */
# if __ASSUME_REALTIME_SIGNALS == 0
int saved_errno = errno;
# endif
if (act)
{
@@ -71,7 +84,9 @@ __sigaction (sig, act, oact)
result = INLINE_SYSCALL (rt_sigaction, 4, sig, act ? &kact : NULL,
oact ? &koact : NULL, _NSIG / 8);
# if __ASSUME_REALTIME_SIGNALS == 0
if (result >= 0 || errno != ENOSYS)
# endif
{
if (oact && result >= 0)
{
@@ -85,19 +100,22 @@ __sigaction (sig, act, oact)
return result;
}
# if __ASSUME_REALTIME_SIGNALS == 0
__set_errno (saved_errno);
__libc_missing_rt_sigs = 1;
# endif
}
#endif
#if __ASSUME_REALTIME_SIGNALS == 0
if (act)
{
k_sigact.k_sa_handler = act->sa_handler;
k_sigact.sa_mask = act->sa_mask.__val[0];
k_sigact.sa_flags = act->sa_flags;
#ifdef HAVE_SA_RESTORER
# ifdef HAVE_SA_RESTORER
k_sigact.sa_restorer = act->sa_restorer;
#endif
# endif
}
result = INLINE_SYSCALL (sigaction, 3, sig, act ? &k_sigact : NULL,
oact ? &k_osigact : NULL);
@@ -106,11 +124,12 @@ __sigaction (sig, act, oact)
oact->sa_handler = k_osigact.k_sa_handler;
oact->sa_mask.__val[0] = k_osigact.sa_mask;
oact->sa_flags = k_osigact.sa_flags;
#ifdef HAVE_SA_RESTORER
# ifdef HAVE_SA_RESTORER
oact->sa_restorer = k_osigact.sa_restorer;
#endif
# endif
}
return result;
#endif
}
weak_alias (__sigaction, sigaction)