mirror of
git://sourceware.org/git/glibc.git
synced 2026-09-09 11:58:23 +08:00
Compare commits
26
Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
69168c5934 | ||
|
|
1967bfd36b | ||
|
|
196d8d5ac0 | ||
|
|
fe7f3fe7f8 | ||
|
|
c93a787fa3 | ||
|
|
81d33619b5 | ||
|
|
d767ca43b8 | ||
|
|
e0b25191ab | ||
|
|
f9a778269a | ||
|
|
59eee3275b | ||
|
|
c108ce5c71 | ||
|
|
c837ea7168 | ||
|
|
e6509797f8 | ||
|
|
ac0ba6febb | ||
|
|
73e1a225ad | ||
|
|
eb11588418 | ||
|
|
401c63072f | ||
|
|
a19e646fd7 | ||
|
|
2b19200610 | ||
|
|
954b0b3eb3 | ||
|
|
acfb96832a | ||
|
|
3b395246aa | ||
|
|
23a3c1501f | ||
|
|
49f28ea934 | ||
|
|
191fbd3aeb | ||
|
|
aff7fcc5ee |
@@ -129,11 +129,9 @@ static
|
||||
void
|
||||
__nptl_set_robust (struct pthread *self)
|
||||
{
|
||||
#ifdef __NR_set_robust_list
|
||||
INTERNAL_SYSCALL_DECL (err);
|
||||
INTERNAL_SYSCALL (set_robust_list, err, 2, &self->robust_head,
|
||||
sizeof (struct robust_list_head));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
@@ -254,7 +252,6 @@ __pthread_initialize_minimal_internal (void)
|
||||
pd->robust_prev = &pd->robust_head;
|
||||
#endif
|
||||
pd->robust_head.list = &pd->robust_head;
|
||||
#ifdef __NR_set_robust_list
|
||||
pd->robust_head.futex_offset = (offsetof (pthread_mutex_t, __data.__lock)
|
||||
- offsetof (pthread_mutex_t,
|
||||
__data.__list.__next));
|
||||
@@ -262,7 +259,6 @@ __pthread_initialize_minimal_internal (void)
|
||||
int res = INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
|
||||
sizeof (struct robust_list_head));
|
||||
if (INTERNAL_SYSCALL_ERROR_P (res, err))
|
||||
#endif
|
||||
set_robust_list_not_avail ();
|
||||
}
|
||||
|
||||
|
||||
@@ -389,10 +389,9 @@ START_THREAD_DEFN
|
||||
if (__glibc_unlikely (atomic_exchange_acq (&pd->setxid_futex, 0) == -2))
|
||||
futex_wake (&pd->setxid_futex, 1, FUTEX_PRIVATE);
|
||||
|
||||
#ifdef __NR_set_robust_list
|
||||
# ifndef __ASSUME_SET_ROBUST_LIST
|
||||
#ifndef __ASSUME_SET_ROBUST_LIST
|
||||
if (__set_robust_list_avail >= 0)
|
||||
# endif
|
||||
#endif
|
||||
{
|
||||
INTERNAL_SYSCALL_DECL (err);
|
||||
/* This call should never fail because the initial call in init.c
|
||||
@@ -400,7 +399,6 @@ START_THREAD_DEFN
|
||||
INTERNAL_SYSCALL (set_robust_list, err, 2, &pd->robust_head,
|
||||
sizeof (struct robust_list_head));
|
||||
}
|
||||
#endif
|
||||
|
||||
/* If the parent was running cancellation handlers while creating
|
||||
the thread the new thread inherited the signal mask. Reset the
|
||||
|
||||
+4
-6
@@ -83,7 +83,6 @@ __libc_fork (void)
|
||||
if (__fork_generation_pointer != NULL)
|
||||
*__fork_generation_pointer += __PTHREAD_ONCE_FORK_GEN_INCR;
|
||||
|
||||
#ifdef __NR_set_robust_list
|
||||
/* Initialize the robust mutex list setting in the kernel which has
|
||||
been reset during the fork. We do not check for errors because if
|
||||
it fails here, it must have failed at process startup as well and
|
||||
@@ -94,19 +93,18 @@ __libc_fork (void)
|
||||
inherit the correct value from the parent. We do not need to clear
|
||||
the pending operation because it must have been zero when fork was
|
||||
called. */
|
||||
# if __PTHREAD_MUTEX_HAVE_PREV
|
||||
#if __PTHREAD_MUTEX_HAVE_PREV
|
||||
self->robust_prev = &self->robust_head;
|
||||
# endif
|
||||
#endif
|
||||
self->robust_head.list = &self->robust_head;
|
||||
# ifdef SHARED
|
||||
#ifdef SHARED
|
||||
if (__builtin_expect (__libc_pthread_functions_init, 0))
|
||||
PTHFCT_CALL (ptr_set_robust, (self));
|
||||
# else
|
||||
#else
|
||||
extern __typeof (__nptl_set_robust) __nptl_set_robust
|
||||
__attribute__((weak));
|
||||
if (__builtin_expect (__nptl_set_robust != NULL, 0))
|
||||
__nptl_set_robust (self);
|
||||
# endif
|
||||
#endif
|
||||
|
||||
/* Reset the lock state in the multi-threaded case. */
|
||||
|
||||
@@ -27,9 +27,7 @@ _exit (int status)
|
||||
{
|
||||
while (1)
|
||||
{
|
||||
#ifdef __NR_exit_group
|
||||
INLINE_SYSCALL (exit_group, 1, status);
|
||||
#endif
|
||||
INLINE_SYSCALL (exit, 1, status);
|
||||
|
||||
#ifdef ABORT_INSTRUCTION
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include <aio_misc.h>
|
||||
|
||||
#ifdef __NR_rt_sigqueueinfo
|
||||
|
||||
/* Return any pending signal or wait for one for the given time. */
|
||||
int
|
||||
__aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
|
||||
@@ -46,6 +44,3 @@ __aio_sigqueue (int sig, const union sigval val, pid_t caller_pid)
|
||||
|
||||
return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
|
||||
}
|
||||
#else
|
||||
# include <rt/aio_sigqueue.c>
|
||||
#endif
|
||||
|
||||
@@ -542,7 +542,6 @@ init_iosys (void)
|
||||
|
||||
/* First try the pciconfig_iobase syscall added to 2.2.15 and 2.3.99. */
|
||||
|
||||
#ifdef __NR_pciconfig_iobase
|
||||
addr = __pciconfig_iobase (IOBASE_DENSE_MEM, 0, 0);
|
||||
if (addr != -1)
|
||||
{
|
||||
@@ -584,7 +583,6 @@ init_iosys (void)
|
||||
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Second, collect the contents of /etc/alpha_systype or /proc/cpuinfo. */
|
||||
|
||||
|
||||
@@ -25,11 +25,6 @@ copy_file_range (int infd, __off64_t *pinoff,
|
||||
int outfd, __off64_t *poutoff,
|
||||
size_t length, unsigned int flags)
|
||||
{
|
||||
#ifdef __NR_copy_file_range
|
||||
return SYSCALL_CANCEL (copy_file_range, infd, pinoff, outfd, poutoff,
|
||||
length, flags);
|
||||
#else
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -23,8 +23,6 @@
|
||||
#include <sysdep-cancel.h>
|
||||
#include <sys/syscall.h>
|
||||
|
||||
#ifdef __NR_epoll_pwait
|
||||
|
||||
/* Wait for events on an epoll instance "epfd". Returns the number of
|
||||
triggered events returned in "events" buffer. Or -1 in case of
|
||||
error with the "errno" variable set to the specific error code. The
|
||||
@@ -42,18 +40,4 @@ int epoll_pwait (int epfd, struct epoll_event *events,
|
||||
return SYSCALL_CANCEL (epoll_pwait, epfd, events, maxevents,
|
||||
timeout, set, _NSIG / 8);
|
||||
}
|
||||
|
||||
#else
|
||||
|
||||
int epoll_pwait (int epfd, struct epoll_event *events,
|
||||
int maxevents, int timeout,
|
||||
const sigset_t *set)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
stub_warning (epoll_pwait)
|
||||
|
||||
#endif
|
||||
|
||||
libc_hidden_def (epoll_pwait)
|
||||
|
||||
@@ -26,8 +26,6 @@
|
||||
|
||||
#include "gai_misc.h"
|
||||
|
||||
#ifdef __NR_rt_sigqueueinfo
|
||||
|
||||
/* Return any pending signal or wait for one for the given time. */
|
||||
int
|
||||
__gai_sigqueue (int sig, const union sigval val, pid_t caller_pid)
|
||||
@@ -46,6 +44,3 @@ __gai_sigqueue (int sig, const union sigval val, pid_t caller_pid)
|
||||
|
||||
return INLINE_SYSCALL (rt_sigqueueinfo, 3, info.si_pid, sig, &info);
|
||||
}
|
||||
#else
|
||||
# include <resolv/gai_sigqueue.c>
|
||||
#endif
|
||||
|
||||
@@ -25,11 +25,3 @@
|
||||
#ifdef __NR_llseek
|
||||
# define __NR__llseek __NR_llseek
|
||||
#endif
|
||||
|
||||
#if __WORDSIZE == 64
|
||||
/* By defining the older names, glibc will build syscall wrappers for
|
||||
both pread and pread64; sysdeps/unix/sysv/linux/wordsize-64/pread64.c
|
||||
will suppress generating any separate code for pread64.c. */
|
||||
#define __NR_pread __NR_pread64
|
||||
#define __NR_pwrite __NR_pwrite64
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <errno.h>
|
||||
#include <unistd.h>
|
||||
|
||||
#ifdef __NR_getrandom
|
||||
/* Write LENGTH bytes of randomness starting at BUFFER. Return 0 on
|
||||
success and -1 on failure. */
|
||||
int
|
||||
@@ -63,11 +62,3 @@ getentropy (void *buffer, size_t length)
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
#else
|
||||
int
|
||||
getentropy (void *buffer, size_t length)
|
||||
{
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
|
||||
@@ -21,7 +21,6 @@
|
||||
#include <unistd.h>
|
||||
#include <sysdep-cancel.h>
|
||||
|
||||
#ifdef __NR_getrandom
|
||||
/* Write up to LENGTH bytes of randomness starting at BUFFER.
|
||||
Return the number of bytes written, or -1 on error. */
|
||||
ssize_t
|
||||
@@ -29,17 +28,5 @@ __getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
{
|
||||
return SYSCALL_CANCEL (getrandom, buffer, length, flags);
|
||||
}
|
||||
#else
|
||||
/* Always provide a definition, even if the kernel headers lack the
|
||||
system call number. */
|
||||
ssize_t
|
||||
__getrandom (void *buffer, size_t length, unsigned int flags)
|
||||
{
|
||||
/* Ideally, we would add a cancellation point here, but we currently
|
||||
cannot do so inside libc. */
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
}
|
||||
#endif
|
||||
libc_hidden_def (__getrandom)
|
||||
weak_alias (__getrandom, getrandom)
|
||||
|
||||
@@ -17,9 +17,12 @@
|
||||
# License along with the GNU C Library; if not, see
|
||||
# <http://www.gnu.org/licenses/>.
|
||||
|
||||
import os
|
||||
import re
|
||||
|
||||
import glibcextract
|
||||
if __name__ != '__main__':
|
||||
# When called as a main program, this is not needed.
|
||||
import glibcextract
|
||||
|
||||
def extract_system_call_name(macro):
|
||||
"""Convert the macro name (with __NR_) to a system call name."""
|
||||
@@ -168,3 +171,84 @@ def linux_kernel_version(cc):
|
||||
val = glibcextract.compute_c_consts(sym_data, cc)['LINUX_VERSION_CODE']
|
||||
val = int(val)
|
||||
return ((val & 0xff0000) >> 16, (val & 0xff00) >> 8)
|
||||
|
||||
class ArchSyscall:
|
||||
"""Canonical name and location of a syscall header."""
|
||||
|
||||
def __init__(self, name, path):
|
||||
self.name = name
|
||||
self.path = path
|
||||
|
||||
def __repr__(self):
|
||||
return 'ArchSyscall(name={!r}, patch={!r})'.format(
|
||||
self.name, self.path)
|
||||
|
||||
def list_arch_syscall_headers(topdir):
|
||||
"""A generator which returns all the ArchSyscall objects in a tree."""
|
||||
|
||||
sysdeps = os.path.join(topdir, 'sysdeps', 'unix', 'sysv', 'linux')
|
||||
for root, dirs, files in os.walk(sysdeps):
|
||||
if root != sysdeps:
|
||||
for filename in files:
|
||||
if filename == 'arch-syscall.h':
|
||||
yield ArchSyscall(
|
||||
name=os.path.relpath(root, sysdeps),
|
||||
path=os.path.join(root, filename))
|
||||
|
||||
def __main():
|
||||
"""Entry point when called as the main program."""
|
||||
|
||||
import sys
|
||||
|
||||
# Top-level directory of the source tree.
|
||||
topdir = os.path.realpath(os.path.join(
|
||||
os.path.dirname(os.path.realpath(__file__)), *('..',) * 4))
|
||||
|
||||
def usage(status):
|
||||
print('usage: glibcsyscalls list-headers')
|
||||
print(' glibcsyscalls query-syscall SYSCALL...')
|
||||
sys.exit(status)
|
||||
|
||||
if len(sys.argv) <= 1:
|
||||
usage(0)
|
||||
|
||||
command = sys.argv[1]
|
||||
if command == 'list-headers':
|
||||
# Print the absolute paths of all arch-syscall.h header files.
|
||||
if len(sys.argv) != 2:
|
||||
usage(1)
|
||||
for header in sorted([syscall.path for syscall
|
||||
in list_arch_syscall_headers(topdir)]):
|
||||
print(header)
|
||||
|
||||
elif command == 'query-syscall':
|
||||
# Summarize the implementation status of the specified system calls.
|
||||
if len(sys.argv) < 3:
|
||||
usage(1)
|
||||
|
||||
# List of system call tables.
|
||||
tables = sorted(list_arch_syscall_headers(topdir),
|
||||
key=lambda syscall: syscall.name)
|
||||
for table in tables:
|
||||
table.numbers = load_arch_syscall_header(table.path)
|
||||
|
||||
for nr in sys.argv[2:]:
|
||||
defined = [table.name for table in tables
|
||||
if nr in table.numbers]
|
||||
undefined = [table.name for table in tables
|
||||
if nr not in table.numbers]
|
||||
if not defined:
|
||||
print('{}: not defined on any architecture'.format(nr))
|
||||
elif not undefined:
|
||||
print('{}: defined on all architectures'.format(nr))
|
||||
else:
|
||||
print('{}:'.format(nr))
|
||||
print(' defined: {}'.format(' '.join(defined)))
|
||||
print(' undefined: {}'.format(' '.join(undefined)))
|
||||
|
||||
else:
|
||||
# Unrecognized command.
|
||||
usage(1)
|
||||
|
||||
if __name__ == '__main__':
|
||||
__main()
|
||||
|
||||
@@ -46,12 +46,6 @@
|
||||
#undef SYS_ify
|
||||
#define SYS_ify(syscall_name) __NR_##syscall_name
|
||||
|
||||
/* This is to help the old kernel headers where __NR_semtimedop is not
|
||||
available. */
|
||||
#ifndef __NR_semtimedop
|
||||
# define __NR_semtimedop 1247
|
||||
#endif
|
||||
|
||||
#if defined USE_DL_SYSINFO \
|
||||
&& (IS_IN (libc) \
|
||||
|| IS_IN (libpthread) || IS_IN (librt))
|
||||
|
||||
@@ -28,20 +28,16 @@
|
||||
int
|
||||
__getpagesize (void)
|
||||
{
|
||||
#ifdef __NR_getpagesize
|
||||
int result;
|
||||
#endif
|
||||
|
||||
if (GLRO(dl_pagesize) != 0)
|
||||
return GLRO(dl_pagesize);
|
||||
|
||||
#ifdef __NR_getpagesize
|
||||
INTERNAL_SYSCALL_DECL (err);
|
||||
result = INTERNAL_SYSCALL (getpagesize, err, 0);
|
||||
/* The only possible error is ENOSYS. */
|
||||
if (!INTERNAL_SYSCALL_ERROR_P (result, err))
|
||||
return result;
|
||||
#endif
|
||||
|
||||
return 4096;
|
||||
}
|
||||
|
||||
@@ -28,11 +28,7 @@
|
||||
|
||||
ENTRY (__vfork)
|
||||
|
||||
#ifdef __NR_vfork
|
||||
DO_CALL (vfork, 0)
|
||||
#else
|
||||
DO_CALL (fork, 0)
|
||||
#endif
|
||||
addik r12,r0,-4095
|
||||
cmpu r12,r12,r3
|
||||
bgei r12,SYSCALL_ERROR_LABEL
|
||||
|
||||
@@ -34,7 +34,6 @@ __getdents64 (int fd, void *buf, size_t nbytes)
|
||||
if (nbytes > INT_MAX)
|
||||
nbytes = INT_MAX;
|
||||
|
||||
#ifdef __NR_getdents64
|
||||
static int getdents64_supported = true;
|
||||
if (atomic_load_relaxed (&getdents64_supported))
|
||||
{
|
||||
@@ -44,7 +43,6 @@ __getdents64 (int fd, void *buf, size_t nbytes)
|
||||
|
||||
atomic_store_relaxed (&getdents64_supported, false);
|
||||
}
|
||||
#endif
|
||||
|
||||
/* Unfortunately getdents64 was only wire-up for MIPS n64 on Linux 3.10.
|
||||
If the syscall is not available it need to fallback to the non-LFS one.
|
||||
|
||||
@@ -27,11 +27,9 @@ mlock2 (const void *addr, size_t length, unsigned int flags)
|
||||
#else
|
||||
if (flags == 0)
|
||||
return INLINE_SYSCALL_CALL (mlock, addr, length);
|
||||
# ifdef __NR_mlock2
|
||||
int ret = INLINE_SYSCALL_CALL (mlock2, addr, length, flags);
|
||||
if (ret == 0 || errno != ENOSYS)
|
||||
return ret;
|
||||
# endif /* __NR_mlock2 */
|
||||
/* Treat the missing system call as an invalid (non-zero) flag
|
||||
argument. */
|
||||
__set_errno (EINVAL);
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include <mqueue.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifdef __NR_mq_open
|
||||
|
||||
/* Removes the association between message queue descriptor MQDES and its
|
||||
message queue. */
|
||||
int
|
||||
@@ -28,7 +26,3 @@ mq_close (mqd_t mqdes)
|
||||
{
|
||||
return INLINE_SYSCALL (close, 1, mqdes);
|
||||
}
|
||||
|
||||
#else
|
||||
# include <rt/mq_close.c>
|
||||
#endif
|
||||
|
||||
@@ -20,15 +20,9 @@
|
||||
#include <stddef.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifdef __NR_mq_getsetattr
|
||||
|
||||
/* Query status and attributes of message queue MQDES. */
|
||||
int
|
||||
mq_getattr (mqd_t mqdes, struct mq_attr *mqstat)
|
||||
{
|
||||
return mq_setattr (mqdes, NULL, mqstat);
|
||||
}
|
||||
|
||||
#else
|
||||
# include <rt/mq_getattr.c>
|
||||
#endif
|
||||
|
||||
@@ -31,8 +31,6 @@
|
||||
#include <nptl/pthreadP.h>
|
||||
|
||||
|
||||
#ifdef __NR_mq_notify
|
||||
|
||||
/* Defined in the kernel headers: */
|
||||
#define NOTIFY_COOKIE_LEN 32 /* Length of the cookie used. */
|
||||
#define NOTIFY_WOKENUP 1 /* Code for notifcation. */
|
||||
@@ -276,7 +274,3 @@ mq_notify (mqd_t mqdes, const struct sigevent *notification)
|
||||
|
||||
return retval;
|
||||
}
|
||||
|
||||
#else
|
||||
# include <rt/mq_notify.c>
|
||||
#endif
|
||||
|
||||
@@ -22,8 +22,6 @@
|
||||
#include <stdio.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifdef __NR_mq_open
|
||||
|
||||
/* Establish connection between a process and a message queue NAME and
|
||||
return message queue descriptor or (mqd_t) -1 on error. OFLAG determines
|
||||
the type of access used. If O_CREAT is on OFLAG, the third argument is
|
||||
@@ -61,6 +59,3 @@ __mq_open_2 (const char *name, int oflag)
|
||||
|
||||
return __mq_open (name, oflag);
|
||||
}
|
||||
#else
|
||||
# include <rt/mq_open.c>
|
||||
#endif
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include <stddef.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifdef __NR_mq_timedreceive
|
||||
|
||||
/* Receive the oldest from highest priority messages in message queue
|
||||
MQDES. */
|
||||
ssize_t
|
||||
@@ -30,7 +28,3 @@ mq_receive (mqd_t mqdes, char *msg_ptr, size_t msg_len,
|
||||
{
|
||||
return __mq_timedreceive (mqdes, msg_ptr, msg_len, msg_prio, NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
# include <rt/mq_receive.c>
|
||||
#endif
|
||||
|
||||
@@ -20,8 +20,6 @@
|
||||
#include <stddef.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifdef __NR_mq_timedsend
|
||||
|
||||
/* Add message pointed by MSG_PTR to message queue MQDES. */
|
||||
int
|
||||
mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
|
||||
@@ -29,7 +27,3 @@ mq_send (mqd_t mqdes, const char *msg_ptr, size_t msg_len,
|
||||
{
|
||||
return __mq_timedsend (mqdes, msg_ptr, msg_len, msg_prio, NULL);
|
||||
}
|
||||
|
||||
#else
|
||||
# include <rt/mq_send.c>
|
||||
#endif
|
||||
|
||||
@@ -19,8 +19,6 @@
|
||||
#include <mqueue.h>
|
||||
#include <sysdep.h>
|
||||
|
||||
#ifdef __NR_mq_unlink
|
||||
|
||||
/* Remove message queue named NAME. */
|
||||
int
|
||||
mq_unlink (const char *name)
|
||||
@@ -43,7 +41,3 @@ mq_unlink (const char *name)
|
||||
|
||||
return ret;
|
||||
}
|
||||
|
||||
#else
|
||||
# include <rt/mq_unlink.c>
|
||||
#endif
|
||||
|
||||
@@ -25,7 +25,6 @@
|
||||
int
|
||||
setup_thread (struct database_dyn *db)
|
||||
{
|
||||
#ifdef __NR_set_tid_address
|
||||
/* Only supported when NPTL is used. */
|
||||
char buf[100];
|
||||
if (confstr (_CS_GNU_LIBPTHREAD_VERSION, buf, sizeof (buf)) >= sizeof (buf)
|
||||
@@ -43,7 +42,6 @@ setup_thread (struct database_dyn *db)
|
||||
So, set the field to a nonzero value which indicates that nscd
|
||||
is certainly running and clients can skip the test. */
|
||||
return db->head->nscd_certainly_running = 1;
|
||||
#endif
|
||||
|
||||
return 0;
|
||||
}
|
||||
|
||||
@@ -24,14 +24,5 @@
|
||||
int
|
||||
open_by_handle_at (int mount_fd, struct file_handle *handle, int flags)
|
||||
{
|
||||
#ifdef __NR_open_by_handle_at
|
||||
return SYSCALL_CANCEL (open_by_handle_at, mount_fd, handle, flags);
|
||||
#else
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifndef __NR_open_by_handle_at
|
||||
stub_warning (open_by_handle_at)
|
||||
#endif
|
||||
|
||||
@@ -28,10 +28,5 @@ pkey_mprotect (void *addr, size_t len, int prot, int pkey)
|
||||
/* If the key is -1, the system call is precisely equivalent to
|
||||
mprotect. */
|
||||
return __mprotect (addr, len, prot);
|
||||
#ifdef __NR_pkey_mprotect
|
||||
return INLINE_SYSCALL_CALL (pkey_mprotect, addr, len, prot, pkey);
|
||||
#else
|
||||
__set_errno (ENOSYS);
|
||||
return -1;
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -21,14 +21,10 @@
|
||||
|
||||
#ifndef __OFF_T_MATCHES_OFF64_T
|
||||
|
||||
# ifndef __NR_pread
|
||||
# define __NR_pread __NR_pread64
|
||||
# endif
|
||||
|
||||
ssize_t
|
||||
__libc_pread (int fd, void *buf, size_t count, off_t offset)
|
||||
{
|
||||
return SYSCALL_CANCEL (pread, fd, buf, count, SYSCALL_LL_PRW (offset));
|
||||
return SYSCALL_CANCEL (pread64, fd, buf, count, SYSCALL_LL_PRW (offset));
|
||||
}
|
||||
|
||||
strong_alias (__libc_pread, __pread)
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
#include <unistd.h>
|
||||
#include <sysdep-cancel.h>
|
||||
|
||||
#ifndef __NR_pread64
|
||||
# define __NR_pread64 __NR_pread
|
||||
#endif
|
||||
|
||||
ssize_t
|
||||
__libc_pread64 (int fd, void *buf, size_t count, off64_t offset)
|
||||
{
|
||||
|
||||
@@ -20,10 +20,6 @@
|
||||
#include <sysdep-cancel.h>
|
||||
#include <not-cancel.h>
|
||||
|
||||
#ifndef __NR_pread64
|
||||
# define __NR_pread64 __NR_pread
|
||||
#endif
|
||||
|
||||
ssize_t
|
||||
__pread64_nocancel (int fd, void *buf, size_t count, off64_t offset)
|
||||
{
|
||||
|
||||
@@ -22,10 +22,6 @@
|
||||
|
||||
# ifdef __ASSUME_PREADV
|
||||
|
||||
# ifndef __NR_preadv
|
||||
# define __NR_preadv __NR_preadv64
|
||||
# endif
|
||||
|
||||
ssize_t
|
||||
preadv (int fd, const struct iovec *vector, int count, off_t offset)
|
||||
{
|
||||
@@ -37,12 +33,10 @@ static ssize_t __atomic_preadv_replacement (int, const struct iovec *,
|
||||
ssize_t
|
||||
preadv (int fd, const struct iovec *vector, int count, off_t offset)
|
||||
{
|
||||
# ifdef __NR_preadv
|
||||
ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
|
||||
LO_HI_LONG (offset));
|
||||
if (result >= 0 || errno != ENOSYS)
|
||||
return result;
|
||||
# endif
|
||||
return __atomic_preadv_replacement (fd, vector, count, offset);
|
||||
}
|
||||
# define PREADV static __atomic_preadv_replacement
|
||||
|
||||
@@ -21,20 +21,15 @@
|
||||
|
||||
#ifndef __OFF_T_MATCHES_OFF64_T
|
||||
|
||||
# if !defined (__NR_preadv2) && defined (__NR_pread64v2)
|
||||
# define __NR_preadv2 __NR_pread64v2
|
||||
# endif
|
||||
|
||||
ssize_t
|
||||
preadv2 (int fd, const struct iovec *vector, int count, off_t offset,
|
||||
int flags)
|
||||
{
|
||||
# ifdef __NR_preadv2
|
||||
ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
|
||||
LO_HI_LONG (offset), flags);
|
||||
if (result >= 0 || errno != ENOSYS)
|
||||
return result;
|
||||
# endif
|
||||
|
||||
/* Trying to emulate the preadv2 syscall flags is troublesome:
|
||||
|
||||
* We can not temporary change the file state of the O_DSYNC and O_SYNC
|
||||
|
||||
@@ -20,14 +20,10 @@
|
||||
|
||||
#ifdef __ASSUME_PREADV
|
||||
|
||||
# ifndef __NR_preadv64
|
||||
# define __NR_preadv64 __NR_preadv
|
||||
# endif
|
||||
|
||||
ssize_t
|
||||
preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
|
||||
{
|
||||
return SYSCALL_CANCEL (preadv64, fd, vector, count, LO_HI_LONG (offset));
|
||||
return SYSCALL_CANCEL (preadv, fd, vector, count, LO_HI_LONG (offset));
|
||||
}
|
||||
#else
|
||||
static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,
|
||||
@@ -35,12 +31,10 @@ static ssize_t __atomic_preadv64_replacement (int, const struct iovec *,
|
||||
ssize_t
|
||||
preadv64 (int fd, const struct iovec *vector, int count, off64_t offset)
|
||||
{
|
||||
#ifdef __NR_preadv64
|
||||
ssize_t result = SYSCALL_CANCEL (preadv64, fd, vector, count,
|
||||
ssize_t result = SYSCALL_CANCEL (preadv, fd, vector, count,
|
||||
LO_HI_LONG (offset));
|
||||
if (result >= 0 || errno != ENOSYS)
|
||||
return result;
|
||||
#endif
|
||||
return __atomic_preadv64_replacement (fd, vector, count, offset);
|
||||
}
|
||||
# define PREADV static __atomic_preadv64_replacement
|
||||
|
||||
@@ -19,20 +19,15 @@
|
||||
#include <sys/uio.h>
|
||||
#include <sysdep-cancel.h>
|
||||
|
||||
#if !defined(__NR_preadv64v2) && defined(__NR_preadv2)
|
||||
# define __NR_preadv64v2 __NR_preadv2
|
||||
#endif
|
||||
|
||||
ssize_t
|
||||
preadv64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
|
||||
int flags)
|
||||
{
|
||||
#ifdef __NR_preadv64v2
|
||||
ssize_t result = SYSCALL_CANCEL (preadv64v2, fd, vector, count,
|
||||
ssize_t result = SYSCALL_CANCEL (preadv2, fd, vector, count,
|
||||
LO_HI_LONG (offset), flags);
|
||||
if (result >= 0 || errno != ENOSYS)
|
||||
return result;
|
||||
#endif
|
||||
|
||||
/* Trying to emulate the preadv2 syscall flags is troublesome:
|
||||
|
||||
* We can not temporary change the file state of the O_DSYNC and O_SYNC
|
||||
|
||||
@@ -21,14 +21,10 @@
|
||||
|
||||
#ifndef __OFF_T_MATCHES_OFF64_T
|
||||
|
||||
# ifndef __NR_pwrite
|
||||
# define __NR_pwrite __NR_pwrite64
|
||||
# endif
|
||||
|
||||
ssize_t
|
||||
__libc_pwrite (int fd, const void *buf, size_t count, off_t offset)
|
||||
{
|
||||
return SYSCALL_CANCEL (pwrite, fd, buf, count, SYSCALL_LL_PRW (offset));
|
||||
return SYSCALL_CANCEL (pwrite64, fd, buf, count, SYSCALL_LL_PRW (offset));
|
||||
}
|
||||
|
||||
strong_alias (__libc_pwrite, __pwrite)
|
||||
|
||||
@@ -19,10 +19,6 @@
|
||||
#include <unistd.h>
|
||||
#include <sysdep-cancel.h>
|
||||
|
||||
#ifndef __NR_pwrite64
|
||||
# define __NR_pwrite64 __NR_pwrite
|
||||
#endif
|
||||
|
||||
ssize_t
|
||||
__libc_pwrite64 (int fd, const void *buf, size_t count, off64_t offset)
|
||||
{
|
||||
|
||||
@@ -22,10 +22,6 @@
|
||||
|
||||
# ifdef __ASSUME_PREADV
|
||||
|
||||
# ifndef __NR_pwritev
|
||||
# define __NR_pwritev __NR_pwritev64
|
||||
# endif
|
||||
|
||||
ssize_t
|
||||
pwritev (int fd, const struct iovec *vector, int count, off_t offset)
|
||||
{
|
||||
@@ -37,12 +33,10 @@ static ssize_t __atomic_pwritev_replacement (int, const struct iovec *,
|
||||
ssize_t
|
||||
pwritev (int fd, const struct iovec *vector, int count, off_t offset)
|
||||
{
|
||||
# ifdef __NR_pwritev
|
||||
ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,
|
||||
LO_HI_LONG (offset));
|
||||
if (result >= 0 || errno != ENOSYS)
|
||||
return result;
|
||||
# endif
|
||||
return __atomic_pwritev_replacement (fd, vector, count, offset);
|
||||
}
|
||||
# define PWRITEV static __atomic_pwritev_replacement
|
||||
|
||||
@@ -25,12 +25,12 @@ ssize_t
|
||||
pwritev2 (int fd, const struct iovec *vector, int count, off_t offset,
|
||||
int flags)
|
||||
{
|
||||
# ifdef __NR_pwritev2
|
||||
|
||||
ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
|
||||
LO_HI_LONG (offset), flags);
|
||||
if (result >= 0 || errno != ENOSYS)
|
||||
return result;
|
||||
# endif
|
||||
|
||||
/* Trying to emulate the pwritev2 syscall flags is troublesome:
|
||||
|
||||
* We can not temporary change the file state of the O_DSYNC and O_SYNC
|
||||
|
||||
@@ -20,14 +20,10 @@
|
||||
|
||||
#ifdef __ASSUME_PWRITEV
|
||||
|
||||
# ifndef __NR_pwritev64
|
||||
# define __NR_pwritev64 __NR_pwritev
|
||||
# endif
|
||||
|
||||
ssize_t
|
||||
pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
|
||||
{
|
||||
return SYSCALL_CANCEL (pwritev64, fd, vector, count, LO_HI_LONG (offset));
|
||||
return SYSCALL_CANCEL (pwritev, fd, vector, count, LO_HI_LONG (offset));
|
||||
}
|
||||
#else
|
||||
static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,
|
||||
@@ -35,12 +31,10 @@ static ssize_t __atomic_pwritev64_replacement (int, const struct iovec *,
|
||||
ssize_t
|
||||
pwritev64 (int fd, const struct iovec *vector, int count, off64_t offset)
|
||||
{
|
||||
#ifdef __NR_pwritev64
|
||||
ssize_t result = SYSCALL_CANCEL (pwritev64, fd, vector, count,
|
||||
ssize_t result = SYSCALL_CANCEL (pwritev, fd, vector, count,
|
||||
LO_HI_LONG (offset));
|
||||
if (result >= 0 || errno != ENOSYS)
|
||||
return result;
|
||||
#endif
|
||||
return __atomic_pwritev64_replacement (fd, vector, count, offset);
|
||||
}
|
||||
# define PWRITEV static __atomic_pwritev64_replacement
|
||||
|
||||
@@ -19,20 +19,15 @@
|
||||
#include <sys/uio.h>
|
||||
#include <sysdep-cancel.h>
|
||||
|
||||
#if !defined(__NR_pwritev64v2) && defined(__NR_pwritev2)
|
||||
# define __NR_pwritev64v2 __NR_pwritev2
|
||||
#endif
|
||||
|
||||
ssize_t
|
||||
pwritev64v2 (int fd, const struct iovec *vector, int count, off64_t offset,
|
||||
int flags)
|
||||
{
|
||||
#ifdef __NR_pwritev64v2
|
||||
ssize_t result = SYSCALL_CANCEL (pwritev64v2, fd, vector, count,
|
||||
ssize_t result = SYSCALL_CANCEL (pwritev2, fd, vector, count,
|
||||
LO_HI_LONG (offset), flags);
|
||||
if (result >= 0 || errno != ENOSYS)
|
||||
return result;
|
||||
#endif
|
||||
|
||||
/* Trying to emulate the pwritev2 syscall flags is troublesome:
|
||||
|
||||
* We can not temporary change the file state of the O_DSYNC and O_SYNC
|
||||
|
||||
@@ -29,15 +29,14 @@ __renameat2 (int oldfd, const char *old, int newfd, const char *new,
|
||||
#else
|
||||
if (flags == 0)
|
||||
return __renameat (oldfd, old, newfd, new);
|
||||
# ifdef __NR_renameat2
|
||||
|
||||
/* For non-zero flags, try the renameat2 system call. */
|
||||
int ret = INLINE_SYSCALL_CALL (renameat2, oldfd, old, newfd, new, flags);
|
||||
if (ret != -1 || errno != ENOSYS)
|
||||
/* Preserve non-error/non-ENOSYS return values. */
|
||||
return ret;
|
||||
# endif
|
||||
/* No kernel (header) support for renameat2. All flags are
|
||||
unknown. */
|
||||
|
||||
/* No kernel support for renameat2. All flags are unknown. */
|
||||
__set_errno (EINVAL);
|
||||
return -1;
|
||||
#endif
|
||||
|
||||
@@ -39,17 +39,6 @@
|
||||
/* In newer 2.1 kernels __NR_syscall is missing so we define it here. */
|
||||
#define __NR_syscall 0
|
||||
|
||||
/*
|
||||
* Newer kernel versions redefined __NR_pread and __NR_pwrite to
|
||||
* __NR_pread64 and __NR_pwrite64.
|
||||
*/
|
||||
#ifndef __NR_pread
|
||||
# define __NR_pread __NR_pread64
|
||||
#endif
|
||||
#ifndef __NR_pwrite
|
||||
# define __NR_pwrite __NR_pwrite64
|
||||
#endif
|
||||
|
||||
#undef SYS_ify
|
||||
#define SYS_ify(syscall_name) __NR_##syscall_name
|
||||
|
||||
|
||||
@@ -24,11 +24,10 @@
|
||||
#include <shlib-compat.h>
|
||||
|
||||
|
||||
#ifdef __NR_sched_getaffinity
|
||||
# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
|
||||
extern int __sched_getaffinity_new (pid_t, size_t, cpu_set_t *);
|
||||
libc_hidden_proto (__sched_getaffinity_new)
|
||||
# endif
|
||||
#endif
|
||||
|
||||
int
|
||||
__sched_getaffinity_new (pid_t pid, size_t cpusetsize, cpu_set_t *cpuset)
|
||||
@@ -48,7 +47,7 @@ versioned_symbol (libc, __sched_getaffinity_new, sched_getaffinity,
|
||||
GLIBC_2_3_4);
|
||||
|
||||
|
||||
# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
|
||||
libc_hidden_def (__sched_getaffinity_new)
|
||||
|
||||
int
|
||||
@@ -59,7 +58,4 @@ __sched_getaffinity_old (pid_t pid, cpu_set_t *cpuset)
|
||||
return __sched_getaffinity_new (pid, 128, cpuset);
|
||||
}
|
||||
compat_symbol (libc, __sched_getaffinity_old, sched_getaffinity, GLIBC_2_3_3);
|
||||
# endif
|
||||
#else
|
||||
# include <posix/sched_getaffinity.c>
|
||||
#endif
|
||||
|
||||
@@ -24,8 +24,6 @@
|
||||
#include <shlib-compat.h>
|
||||
|
||||
|
||||
#ifdef __NR_sched_setaffinity
|
||||
|
||||
extern int __sched_setaffinity_new (pid_t, size_t, const cpu_set_t *);
|
||||
libc_hidden_proto (__sched_setaffinity_new)
|
||||
|
||||
@@ -46,7 +44,7 @@ versioned_symbol (libc, __sched_setaffinity_new, sched_setaffinity,
|
||||
GLIBC_2_3_4);
|
||||
|
||||
|
||||
# if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
|
||||
#if SHLIB_COMPAT (libc, GLIBC_2_3_3, GLIBC_2_3_4)
|
||||
int
|
||||
attribute_compat_text_section
|
||||
__sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset)
|
||||
@@ -55,7 +53,4 @@ __sched_setaffinity_old (pid_t pid, const cpu_set_t *cpuset)
|
||||
return __sched_setaffinity_new (pid, 128, cpuset);
|
||||
}
|
||||
compat_symbol (libc, __sched_setaffinity_old, sched_setaffinity, GLIBC_2_3_3);
|
||||
# endif
|
||||
#else
|
||||
# include <posix/sched_setaffinity.c>
|
||||
#endif
|
||||
|
||||
@@ -22,7 +22,6 @@
|
||||
#include <sys/syscall.h>
|
||||
|
||||
|
||||
#ifdef __NR_sigaltstack
|
||||
int
|
||||
sigstack (struct sigstack *ss, struct sigstack *oss)
|
||||
{
|
||||
@@ -61,6 +60,3 @@ sigstack (struct sigstack *ss, struct sigstack *oss)
|
||||
}
|
||||
|
||||
link_warning (sigstack, "the `sigstack' function is dangerous. `sigaltstack' should be used instead.")
|
||||
#else
|
||||
# include <signal/sigstack.c>
|
||||
#endif
|
||||
|
||||
@@ -25,17 +25,14 @@ int
|
||||
statx (int fd, const char *path, int flags,
|
||||
unsigned int mask, struct statx *buf)
|
||||
{
|
||||
#ifdef __NR_statx
|
||||
int ret = INLINE_SYSCALL_CALL (statx, fd, path, flags, mask, buf);
|
||||
# ifdef __ASSUME_STATX
|
||||
#ifdef __ASSUME_STATX
|
||||
return ret;
|
||||
# else
|
||||
#else
|
||||
if (ret == 0 || errno != ENOSYS)
|
||||
/* Preserve non-error/non-ENOSYS return values. */
|
||||
return ret;
|
||||
# endif
|
||||
#endif
|
||||
#ifndef __ASSUME_STATX
|
||||
return statx_generic (fd, path, flags, mask, buf);
|
||||
else
|
||||
return statx_generic (fd, path, flags, mask, buf);
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -33,13 +33,6 @@
|
||||
#undef SYS_ify
|
||||
#define SYS_ify(syscall_name) __NR_##syscall_name
|
||||
|
||||
/* This is to help the old kernel headers where __NR_semtimedop is not
|
||||
available. */
|
||||
#ifndef __NR_semtimedop
|
||||
# define __NR_semtimedop 220
|
||||
#endif
|
||||
|
||||
|
||||
#ifdef __ASSEMBLER__
|
||||
|
||||
/* Linux uses a negative return value to indicate syscall errors,
|
||||
|
||||
Reference in New Issue
Block a user