mirror of
https://sourceware.org/git/glibc.git
synced 2025-07-30 22:43:12 +03:00
2003-03-27 Philip Blundell <philb@gnu.org>
* sysdeps/unix/sysv/linux/kernel-features.h (__ASSUME_VFORK_SYSCALL): Define for kernel 2.4 on arm. * sysdeps/unix/sysv/linux/arm/vfork.S: Elide compatibility code when __ASSUME_VFORK_SYSCALL is defined. * sysdeps/unix/sysv/linux/arm/mmap64.S: Likewise for __ASSUME_MMAP2_SYSCALL. * sysdeps/unix/sysv/linux/arm/sigaction.c: Likewise for __ASSUME_REALTIME_SIGNALS.
This commit is contained in:
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 2000 Free Software Foundation, Inc.
|
/* Copyright (C) 2000, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
|
|
||||||
The GNU C Library is free software; you can redistribute it and/or
|
The GNU C Library is free software; you can redistribute it and/or
|
||||||
@ -21,6 +21,8 @@
|
|||||||
#define EINVAL 22
|
#define EINVAL 22
|
||||||
#define ENOSYS 38
|
#define ENOSYS 38
|
||||||
|
|
||||||
|
#include "kernel-features.h"
|
||||||
|
|
||||||
/* The mmap2 system call takes six arguments, all in registers. */
|
/* The mmap2 system call takes six arguments, all in registers. */
|
||||||
.text
|
.text
|
||||||
ENTRY (__mmap64)
|
ENTRY (__mmap64)
|
||||||
@ -39,6 +41,10 @@ ENTRY (__mmap64)
|
|||||||
swi SYS_ify (mmap2)
|
swi SYS_ify (mmap2)
|
||||||
cmn r0, $4096
|
cmn r0, $4096
|
||||||
LOADREGS(ccfd, sp!, {r4, r5, pc})
|
LOADREGS(ccfd, sp!, {r4, r5, pc})
|
||||||
|
# ifdef __ASSUME_MMAP2_SYSCALL
|
||||||
|
ldmfd sp!, {r4, r5, lr}
|
||||||
|
b PLTJMP(syscall_error)
|
||||||
|
# else
|
||||||
cmn r0, $ENOSYS
|
cmn r0, $ENOSYS
|
||||||
ldmnefd sp!, {r4, r5, lr}
|
ldmnefd sp!, {r4, r5, lr}
|
||||||
bne PLTJMP(syscall_error)
|
bne PLTJMP(syscall_error)
|
||||||
@ -49,6 +55,7 @@ ENTRY (__mmap64)
|
|||||||
teq r5, $0
|
teq r5, $0
|
||||||
ldmeqfd sp!, {r4, r5, lr}
|
ldmeqfd sp!, {r4, r5, lr}
|
||||||
beq PLTJMP(__mmap)
|
beq PLTJMP(__mmap)
|
||||||
|
# endif
|
||||||
.Linval:
|
.Linval:
|
||||||
mov r0, $-EINVAL
|
mov r0, $-EINVAL
|
||||||
ldmfd sp!, {r4, r5, lr}
|
ldmfd sp!, {r4, r5, lr}
|
||||||
|
@ -22,6 +22,7 @@
|
|||||||
|
|
||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#include <sys/syscall.h>
|
#include <sys/syscall.h>
|
||||||
|
#include <kernel-features.h>
|
||||||
|
|
||||||
/* The difference here is that the sigaction structure used in the
|
/* 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
|
kernel is not the same as we use in the libc. Therefore we must
|
||||||
@ -60,15 +61,21 @@ __libc_sigaction (sig, act, oact)
|
|||||||
const struct sigaction *act;
|
const struct sigaction *act;
|
||||||
struct sigaction *oact;
|
struct sigaction *oact;
|
||||||
{
|
{
|
||||||
|
#ifndef __ASSUME_REALTIME_SIGNALS
|
||||||
struct old_kernel_sigaction k_sigact, k_osigact;
|
struct old_kernel_sigaction k_sigact, k_osigact;
|
||||||
|
#endif
|
||||||
int result;
|
int result;
|
||||||
|
|
||||||
#ifdef __NR_rt_sigaction
|
#ifdef __NR_rt_sigaction
|
||||||
/* First try the RT signals. */
|
/* First try the RT signals. */
|
||||||
|
# ifndef __ASSUME_REALTIME_SIGNALS
|
||||||
if (!__libc_missing_rt_sigs)
|
if (!__libc_missing_rt_sigs)
|
||||||
|
# endif
|
||||||
{
|
{
|
||||||
struct kernel_sigaction kact, koact;
|
struct kernel_sigaction kact, koact;
|
||||||
|
# ifndef __ASSUME_REALTIME_SIGNALS
|
||||||
int saved_errno = errno;
|
int saved_errno = errno;
|
||||||
|
# endif
|
||||||
|
|
||||||
if (act)
|
if (act)
|
||||||
{
|
{
|
||||||
@ -99,7 +106,9 @@ __libc_sigaction (sig, act, oact)
|
|||||||
act ? __ptrvalue (&kact) : NULL,
|
act ? __ptrvalue (&kact) : NULL,
|
||||||
oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
|
oact ? __ptrvalue (&koact) : NULL, _NSIG / 8);
|
||||||
|
|
||||||
|
# ifndef __ASSUME_REALTIME_SIGNALS
|
||||||
if (result >= 0 || errno != ENOSYS)
|
if (result >= 0 || errno != ENOSYS)
|
||||||
|
# endif
|
||||||
{
|
{
|
||||||
if (oact && result >= 0)
|
if (oact && result >= 0)
|
||||||
{
|
{
|
||||||
@ -113,17 +122,20 @@ __libc_sigaction (sig, act, oact)
|
|||||||
return result;
|
return result;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# ifndef __ASSUME_REALTIME_SIGNALS
|
||||||
__set_errno (saved_errno);
|
__set_errno (saved_errno);
|
||||||
__libc_missing_rt_sigs = 1;
|
__libc_missing_rt_sigs = 1;
|
||||||
|
# endif
|
||||||
}
|
}
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ASSUME_REALTIME_SIGNALS
|
||||||
if (act)
|
if (act)
|
||||||
{
|
{
|
||||||
k_sigact.k_sa_handler = act->sa_handler;
|
k_sigact.k_sa_handler = act->sa_handler;
|
||||||
k_sigact.sa_mask = act->sa_mask.__val[0];
|
k_sigact.sa_mask = act->sa_mask.__val[0];
|
||||||
k_sigact.sa_flags = act->sa_flags;
|
k_sigact.sa_flags = act->sa_flags;
|
||||||
#ifdef HAVE_SA_RESTORER
|
# ifdef HAVE_SA_RESTORER
|
||||||
/* See the comments above for why we test SA_ONSTACK. */
|
/* See the comments above for why we test SA_ONSTACK. */
|
||||||
if (k_sigact.sa_flags & (SA_RESTORER | SA_ONSTACK))
|
if (k_sigact.sa_flags & (SA_RESTORER | SA_ONSTACK))
|
||||||
k_sigact.sa_restorer = act->sa_restorer;
|
k_sigact.sa_restorer = act->sa_restorer;
|
||||||
@ -132,7 +144,7 @@ __libc_sigaction (sig, act, oact)
|
|||||||
k_sigact.sa_restorer = choose_restorer (k_sigact.sa_flags);
|
k_sigact.sa_restorer = choose_restorer (k_sigact.sa_flags);
|
||||||
k_sigact.sa_flags |= SA_RESTORER;
|
k_sigact.sa_flags |= SA_RESTORER;
|
||||||
}
|
}
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
result = INLINE_SYSCALL (sigaction, 3, sig,
|
result = INLINE_SYSCALL (sigaction, 3, sig,
|
||||||
act ? __ptrvalue (&k_sigact) : NULL,
|
act ? __ptrvalue (&k_sigact) : NULL,
|
||||||
@ -142,11 +154,12 @@ __libc_sigaction (sig, act, oact)
|
|||||||
oact->sa_handler = k_osigact.k_sa_handler;
|
oact->sa_handler = k_osigact.k_sa_handler;
|
||||||
oact->sa_mask.__val[0] = k_osigact.sa_mask;
|
oact->sa_mask.__val[0] = k_osigact.sa_mask;
|
||||||
oact->sa_flags = k_osigact.sa_flags;
|
oact->sa_flags = k_osigact.sa_flags;
|
||||||
#ifdef HAVE_SA_RESTORER
|
# ifdef HAVE_SA_RESTORER
|
||||||
oact->sa_restorer = k_osigact.sa_restorer;
|
oact->sa_restorer = k_osigact.sa_restorer;
|
||||||
#endif
|
# endif
|
||||||
}
|
}
|
||||||
return result;
|
return result;
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
libc_hidden_def (__libc_sigaction)
|
libc_hidden_def (__libc_sigaction)
|
||||||
|
|
||||||
|
@ -1,4 +1,4 @@
|
|||||||
/* Copyright (C) 1999, 2002 Free Software Foundation, Inc.
|
/* Copyright (C) 1999, 2002, 2003 Free Software Foundation, Inc.
|
||||||
This file is part of the GNU C Library.
|
This file is part of the GNU C Library.
|
||||||
Contributed by Philip Blundell <philb@gnu.org>.
|
Contributed by Philip Blundell <philb@gnu.org>.
|
||||||
|
|
||||||
@ -20,6 +20,7 @@
|
|||||||
#include <sysdep.h>
|
#include <sysdep.h>
|
||||||
#define _ERRNO_H 1
|
#define _ERRNO_H 1
|
||||||
#include <bits/errno.h>
|
#include <bits/errno.h>
|
||||||
|
#include <kernel-features.h>
|
||||||
|
|
||||||
/* Clone the calling process, but without copying the whole address space.
|
/* Clone the calling process, but without copying the whole address space.
|
||||||
The calling process is suspended until the new process exits or is
|
The calling process is suspended until the new process exits or is
|
||||||
@ -33,17 +34,23 @@ ENTRY (__vfork)
|
|||||||
cmn a1, #4096
|
cmn a1, #4096
|
||||||
RETINSTR(movcc, pc, lr)
|
RETINSTR(movcc, pc, lr)
|
||||||
|
|
||||||
|
# ifdef __ASSUME_VFORK_SYSCALL
|
||||||
|
b PLTJMP(C_SYMBOL_NAME(__syscall_error))
|
||||||
|
# else
|
||||||
/* Check if vfork syscall is known at all. */
|
/* Check if vfork syscall is known at all. */
|
||||||
ldr a2, =-ENOSYS
|
ldr a2, =-ENOSYS
|
||||||
teq a1, a2
|
teq a1, a2
|
||||||
bne PLTJMP(C_SYMBOL_NAME(__syscall_error))
|
bne PLTJMP(C_SYMBOL_NAME(__syscall_error))
|
||||||
|
# endif
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
#ifndef __ASSUME_VFORK_SYSCALL
|
||||||
/* If we don't have vfork, fork is close enough. */
|
/* If we don't have vfork, fork is close enough. */
|
||||||
swi __NR_fork
|
swi __NR_fork
|
||||||
cmn a1, #4096
|
cmn a1, #4096
|
||||||
RETINSTR(movcc, pc, lr)
|
RETINSTR(movcc, pc, lr)
|
||||||
b PLTJMP(C_SYMBOL_NAME(__syscall_error))
|
b PLTJMP(C_SYMBOL_NAME(__syscall_error))
|
||||||
|
#endif
|
||||||
|
|
||||||
PSEUDO_END (__vfork)
|
PSEUDO_END (__vfork)
|
||||||
libc_hidden_def (__vfork)
|
libc_hidden_def (__vfork)
|
||||||
|
@ -229,8 +229,8 @@
|
|||||||
# define __ASSUME_SET_THREAD_AREA_SYSCALL 1
|
# define __ASSUME_SET_THREAD_AREA_SYSCALL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
/* The vfork syscall on x86 was definitely available in 2.4. */
|
/* The vfork syscall on x86 and arm was definitely available in 2.4. */
|
||||||
#if __LINUX_KERNEL_VERSION >= 132097 && defined __i386__
|
#if __LINUX_KERNEL_VERSION >= 132097 && (defined __i386__ || defined __arm__)
|
||||||
# define __ASSUME_VFORK_SYSCALL 1
|
# define __ASSUME_VFORK_SYSCALL 1
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
Reference in New Issue
Block a user