mirror of
https://sourceware.org/git/glibc.git
synced 2024-11-26 23:10:06 +00:00
cc7375ce02
* crypt/crypt.c: Changed copying permission notice to Lesser GPL from Library GPL. * crypt/crypt_util.c: Likewise. * crypt/ufc.c: Likewise. * elf/dl-conflict.c: Likewise. * elf/dl-iteratephdr.c: Likewise. * iconv/iconvconfig.h: Likewise. * linuxthreads/Examples/ex10.c: Likewise. * linuxthreads/Examples/ex11.c: Likewise. * linuxthreads/Examples/ex13.c: Likewise. * linuxthreads/Examples/ex8.c: Likewise. * linuxthreads/Examples/ex9.c: Likewise. * linuxthreads/barrier.c: Likewise. * linuxthreads/events.c: Likewise. * linuxthreads/lockfile.c: Likewise. * linuxthreads/no-tsd.c: Likewise. * linuxthreads/pt-machine.c: Likewise. * linuxthreads/ptclock_gettime.c: Likewise. * linuxthreads/ptclock_settime.c: Likewise. * linuxthreads/rwlock.c: Likewise. * linuxthreads/sysdeps/alpha/pspinlock.c: Likewise. * linuxthreads/sysdeps/alpha/pt-machine.h: Likewise. * linuxthreads/sysdeps/arm/pspinlock.c: Likewise. * linuxthreads/sysdeps/arm/pt-machine.h: Likewise. * linuxthreads/sysdeps/cris/pspinlock.c: Likewise. * linuxthreads/sysdeps/cris/pt-machine.h: Likewise. * linuxthreads/sysdeps/hppa/pspinlock.c: Likewise. * linuxthreads/sysdeps/hppa/pt-machine.h: Likewise. * linuxthreads/sysdeps/i386/i686/pt-machine.h: Likewise. * linuxthreads/sysdeps/i386/pspinlock.c: Likewise. * linuxthreads/sysdeps/i386/pt-machine.h: Likewise. * linuxthreads/sysdeps/i386/useldt.h: Likewise. * linuxthreads/sysdeps/ia64/pspinlock.c: Likewise. * linuxthreads/sysdeps/ia64/pt-machine.h: Likewise. * linuxthreads/sysdeps/m68k/pspinlock.c: Likewise. * linuxthreads/sysdeps/m68k/pt-machine.h: Likewise. * linuxthreads/sysdeps/mips/pspinlock.c: Likewise. * linuxthreads/sysdeps/mips/pt-machine.h: Likewise. * linuxthreads/sysdeps/powerpc/pspinlock.c: Likewise. * linuxthreads/sysdeps/powerpc/pt-machine.h: Likewise. * linuxthreads/sysdeps/pthread/bits/initspin.h: Likewise. * linuxthreads/sysdeps/pthread/bits/libc-lock.h: Likewise. * linuxthreads/sysdeps/pthread/bits/libc-tsd.h: Likewise. * linuxthreads/sysdeps/pthread/getcpuclockid.c: Likewise. * linuxthreads/sysdeps/pthread/posix-timer.h: Likewise. * linuxthreads/sysdeps/pthread/timer_create.c: Likewise. * linuxthreads/sysdeps/pthread/timer_delete.c: Likewise. * linuxthreads/sysdeps/pthread/timer_getoverr.c: Likewise. * linuxthreads/sysdeps/pthread/timer_gettime.c: Likewise. * linuxthreads/sysdeps/pthread/timer_routines.c: Likewise. * linuxthreads/sysdeps/pthread/timer_settime.c: Likewise. * linuxthreads/sysdeps/pthread/tst-timer.c: Likewise. * linuxthreads/sysdeps/s390/pspinlock.c: Likewise. * linuxthreads/sysdeps/s390/s390-32/pt-machine.h: Likewise. * linuxthreads/sysdeps/s390/s390-64/pt-machine.h: Likewise. * linuxthreads/sysdeps/sh/pspinlock.c: Likewise. * linuxthreads/sysdeps/sh/pt-machine.h: Likewise. * linuxthreads/sysdeps/sparc/sparc32/pspinlock.c: Likewise. * linuxthreads/sysdeps/sparc/sparc32/pt-machine.h: Likewise. * linuxthreads/sysdeps/sparc/sparc32/sparcv9/pspinlock.c: Likewise. * linuxthreads/sysdeps/sparc/sparc64/pspinlock.c: Likewise. * linuxthreads/sysdeps/sparc/sparc64/pt-machine.h: Likewise. * linuxthreads/sysdeps/unix/sysv/linux/bits/local_lim.h: Likewise. * linuxthreads/sysdeps/unix/sysv/linux/bits/posix_opt.h: Likewise. * linuxthreads/sysdeps/unix/sysv/linux/bits/sigthread.h: Likewise. * linuxthreads/sysdeps/unix/sysv/linux/hppa/bits/initspin.h: Likewise. * linuxthreads/sysdeps/unix/sysv/linux/i386/bits/posix_opt.h: Likewise. * linuxthreads/tststack.c: Likewise. * linuxthreads/unload.c: Likewise. * linuxthreads/weaks.c: Likewise. * linuxthreads/wrapsyscall.c: Likewise. * malloc/arena.c: Likewise. * malloc/hooks.c: Likewise. * malloc/malloc.c: Likewise. * posix/glob/Makefile.ami: Likewise. * posix/glob/Makefile.in: Likewise. * stdlib/gmp-impl.h: Likewise. * stdlib/gmp.h: Likewise. * sysdeps/generic/dl-iteratephdr-static.c: Likewise. * sysdeps/generic/strnlen.c: Likewise. * sysdeps/mach/hurd/powerpc/bits/sigcontext.h: Likewise. * sysdeps/mach/hurd/recvmsg.c: Likewise. * sysdeps/mach/hurd/sendmsg.c: Likewise. * sysdeps/mach/hurd/spawni.c: Likewise. * sysdeps/mach/powerpc/machine-sp.h: Likewise. * sysdeps/mach/powerpc/sysdep.h: Likewise. * sysdeps/mach/powerpc/thread_state.h: Likewise. * sysdeps/unix/bsd/bsd4.4/bits/socket.h: Likewise. * sysdeps/unix/sysv/linux/ia64/dl-iteratephdr-static.c: Likewise. * sysdeps/x86_64/gmp-mparam.h: Likewise.
227 lines
6.4 KiB
C
227 lines
6.4 KiB
C
/* Wrapper arpund system calls to provide cancelation points.
|
|
Copyright (C) 1996,1997,1998,1999,2000,2001 Free Software Foundation, Inc.
|
|
This file is part of the GNU C Library.
|
|
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
|
|
|
|
The GNU C Library is free software; you can redistribute it and/or
|
|
modify it under the terms of the GNU Lesser General Public License as
|
|
published by the Free Software Foundation; either version 2.1 of the
|
|
License, or (at your option) any later version.
|
|
|
|
The GNU C Library is distributed in the hope that it will be useful,
|
|
but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
|
|
Lesser General Public License for more details.
|
|
|
|
You should have received a copy of the GNU Lesser General Public
|
|
License along with the GNU C Library; see the file COPYING.LIB. If not,
|
|
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
|
|
Boston, MA 02111-1307, USA. */
|
|
|
|
#include <fcntl.h>
|
|
#include <sys/mman.h>
|
|
#include <pthread.h>
|
|
#include <unistd.h>
|
|
#include <stdarg.h>
|
|
#include <stddef.h>
|
|
#include <stdlib.h>
|
|
#include <termios.h>
|
|
#include <sys/resource.h>
|
|
#include <sys/wait.h>
|
|
#include <sys/socket.h>
|
|
|
|
|
|
#ifndef SHARED
|
|
/* We need a hook to force this file to be linked in when static
|
|
libpthread is used. */
|
|
const int __pthread_provide_wrappers = 0;
|
|
#endif
|
|
|
|
|
|
#define CANCELABLE_SYSCALL(res_type, name, param_list, params) \
|
|
res_type __libc_##name param_list; \
|
|
res_type \
|
|
__attribute__ ((weak)) \
|
|
name param_list \
|
|
{ \
|
|
res_type result; \
|
|
int oldtype; \
|
|
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); \
|
|
result = __libc_##name params; \
|
|
pthread_setcanceltype (oldtype, NULL); \
|
|
return result; \
|
|
}
|
|
|
|
#define CANCELABLE_SYSCALL_VA(res_type, name, param_list, params, last_arg) \
|
|
res_type __libc_##name param_list; \
|
|
res_type \
|
|
__attribute__ ((weak)) \
|
|
name param_list \
|
|
{ \
|
|
res_type result; \
|
|
int oldtype; \
|
|
va_list ap; \
|
|
pthread_setcanceltype (PTHREAD_CANCEL_ASYNCHRONOUS, &oldtype); \
|
|
va_start (ap, last_arg); \
|
|
result = __libc_##name params; \
|
|
va_end (ap); \
|
|
pthread_setcanceltype (oldtype, NULL); \
|
|
return result; \
|
|
}
|
|
|
|
|
|
/* close(2). */
|
|
CANCELABLE_SYSCALL (int, close, (int fd), (fd))
|
|
strong_alias (close, __close)
|
|
|
|
|
|
/* fcntl(2). */
|
|
CANCELABLE_SYSCALL_VA (int, fcntl, (int fd, int cmd, ...),
|
|
(fd, cmd, va_arg (ap, long int)), cmd)
|
|
strong_alias (fcntl, __fcntl)
|
|
|
|
|
|
/* fsync(2). */
|
|
CANCELABLE_SYSCALL (int, fsync, (int fd), (fd))
|
|
|
|
|
|
/* lseek(2). */
|
|
CANCELABLE_SYSCALL (off_t, lseek, (int fd, off_t offset, int whence),
|
|
(fd, offset, whence))
|
|
strong_alias (lseek, __lseek)
|
|
|
|
|
|
/* lseek64(2). */
|
|
CANCELABLE_SYSCALL (off64_t, lseek64, (int fd, off64_t offset, int whence),
|
|
(fd, offset, whence))
|
|
|
|
|
|
/* msync(2). */
|
|
CANCELABLE_SYSCALL (int, msync, (__ptr_t addr, size_t length, int flags),
|
|
(addr, length, flags))
|
|
|
|
|
|
/* nanosleep(2). */
|
|
CANCELABLE_SYSCALL (int, nanosleep, (const struct timespec *requested_time,
|
|
struct timespec *remaining),
|
|
(requested_time, remaining))
|
|
strong_alias (nanosleep, __nanosleep)
|
|
|
|
|
|
/* open(2). */
|
|
CANCELABLE_SYSCALL_VA (int, open, (const char *pathname, int flags, ...),
|
|
(pathname, flags, va_arg (ap, mode_t)), flags)
|
|
strong_alias (open, __open)
|
|
|
|
|
|
/* open64(3). */
|
|
CANCELABLE_SYSCALL_VA (int, open64, (const char *pathname, int flags, ...),
|
|
(pathname, flags, va_arg (ap, mode_t)), flags)
|
|
strong_alias (open64, __open64)
|
|
|
|
|
|
/* pause(2). */
|
|
CANCELABLE_SYSCALL (int, pause, (void), ())
|
|
|
|
|
|
/* pread(3). */
|
|
CANCELABLE_SYSCALL (ssize_t, pread, (int fd, void *buf, size_t count,
|
|
off_t offset),
|
|
(fd, buf, count, offset))
|
|
|
|
|
|
/* pread64(3). */
|
|
CANCELABLE_SYSCALL (ssize_t, pread64, (int fd, void *buf, size_t count,
|
|
off64_t offset),
|
|
(fd, buf, count, offset))
|
|
strong_alias (pread64, __pread64)
|
|
|
|
|
|
/* pwrite(3). */
|
|
CANCELABLE_SYSCALL (ssize_t, pwrite, (int fd, const void *buf, size_t n,
|
|
off_t offset),
|
|
(fd, buf, n, offset))
|
|
|
|
|
|
/* pwrite64(3). */
|
|
CANCELABLE_SYSCALL (ssize_t, pwrite64, (int fd, const void *buf, size_t n,
|
|
off64_t offset),
|
|
(fd, buf, n, offset))
|
|
strong_alias (pwrite64, __pwrite64)
|
|
|
|
|
|
/* read(2). */
|
|
CANCELABLE_SYSCALL (ssize_t, read, (int fd, void *buf, size_t count),
|
|
(fd, buf, count))
|
|
strong_alias (read, __read)
|
|
|
|
|
|
/* system(3). */
|
|
CANCELABLE_SYSCALL (int, system, (const char *line), (line))
|
|
|
|
|
|
/* tcdrain(2). */
|
|
CANCELABLE_SYSCALL (int, tcdrain, (int fd), (fd))
|
|
|
|
|
|
/* wait(2). */
|
|
CANCELABLE_SYSCALL (__pid_t, wait, (__WAIT_STATUS_DEFN stat_loc), (stat_loc))
|
|
strong_alias (wait, __wait)
|
|
|
|
|
|
/* waitpid(2). */
|
|
CANCELABLE_SYSCALL (__pid_t, waitpid, (__pid_t pid, int *stat_loc,
|
|
int options),
|
|
(pid, stat_loc, options))
|
|
|
|
|
|
/* write(2). */
|
|
CANCELABLE_SYSCALL (ssize_t, write, (int fd, const void *buf, size_t n),
|
|
(fd, buf, n))
|
|
strong_alias (write, __write)
|
|
|
|
|
|
/* The following system calls are thread cancellation points specified
|
|
in XNS. */
|
|
|
|
/* accept(2). */
|
|
CANCELABLE_SYSCALL (int, accept, (int fd, __SOCKADDR_ARG addr,
|
|
socklen_t *addr_len),
|
|
(fd, addr, addr_len))
|
|
|
|
/* connect(2). */
|
|
CANCELABLE_SYSCALL (int, connect, (int fd, __CONST_SOCKADDR_ARG addr,
|
|
socklen_t len),
|
|
(fd, addr, len))
|
|
strong_alias (connect, __connect)
|
|
|
|
/* recv(2). */
|
|
CANCELABLE_SYSCALL (ssize_t, recv, (int fd, __ptr_t buf, size_t n, int flags),
|
|
(fd, buf, n, flags))
|
|
|
|
/* recvfrom(2). */
|
|
CANCELABLE_SYSCALL (ssize_t, recvfrom, (int fd, __ptr_t buf, size_t n, int flags,
|
|
__SOCKADDR_ARG addr, socklen_t *addr_len),
|
|
(fd, buf, n, flags, addr, addr_len))
|
|
|
|
/* recvmsg(2). */
|
|
CANCELABLE_SYSCALL (ssize_t, recvmsg, (int fd, struct msghdr *message, int flags),
|
|
(fd, message, flags))
|
|
|
|
/* send(2). */
|
|
CANCELABLE_SYSCALL (ssize_t, send, (int fd, const __ptr_t buf, size_t n,
|
|
int flags),
|
|
(fd, buf, n, flags))
|
|
strong_alias (send, __send)
|
|
|
|
/* sendmsg(2). */
|
|
CANCELABLE_SYSCALL (ssize_t, sendmsg, (int fd, const struct msghdr *message,
|
|
int flags),
|
|
(fd, message, flags))
|
|
|
|
/* sendto(2). */
|
|
CANCELABLE_SYSCALL (ssize_t, sendto, (int fd, const __ptr_t buf, size_t n,
|
|
int flags, __CONST_SOCKADDR_ARG addr,
|
|
socklen_t addr_len),
|
|
(fd, buf, n, flags, addr, addr_len))
|