2008-12-29 18:08:03 +03:00
|
|
|
/* $NetBSD: pthread_cancelstub.c,v 1.24 2008/12/29 15:08:03 christos Exp $ */
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
/*-
|
2007-03-04 23:07:13 +03:00
|
|
|
* Copyright (c) 2002, 2007 The NetBSD Foundation, Inc.
|
2003-01-18 13:32:11 +03:00
|
|
|
* All rights reserved.
|
|
|
|
*
|
|
|
|
* This code is derived from software contributed to The NetBSD Foundation
|
2007-03-04 23:07:13 +03:00
|
|
|
* by Nathan J. Williams and Andrew Doran.
|
2003-01-18 13:32:11 +03:00
|
|
|
*
|
|
|
|
* Redistribution and use in source and binary forms, with or without
|
|
|
|
* modification, are permitted provided that the following conditions
|
|
|
|
* are met:
|
|
|
|
* 1. Redistributions of source code must retain the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer.
|
|
|
|
* 2. Redistributions in binary form must reproduce the above copyright
|
|
|
|
* notice, this list of conditions and the following disclaimer in the
|
|
|
|
* documentation and/or other materials provided with the distribution.
|
|
|
|
*
|
|
|
|
* THIS SOFTWARE IS PROVIDED BY THE NETBSD FOUNDATION, INC. AND CONTRIBUTORS
|
|
|
|
* ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED
|
|
|
|
* TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
|
|
|
|
* PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE FOUNDATION OR CONTRIBUTORS
|
|
|
|
* BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
|
|
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
|
|
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
|
|
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
|
|
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
|
|
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
|
|
* POSSIBILITY OF SUCH DAMAGE.
|
|
|
|
*/
|
|
|
|
|
2003-03-08 11:03:34 +03:00
|
|
|
#include <sys/cdefs.h>
|
2008-12-29 18:08:03 +03:00
|
|
|
__RCSID("$NetBSD: pthread_cancelstub.c,v 1.24 2008/12/29 15:08:03 christos Exp $");
|
2008-06-28 20:50:43 +04:00
|
|
|
|
|
|
|
#ifndef lint
|
|
|
|
|
2003-11-18 03:56:56 +03:00
|
|
|
|
|
|
|
/*
|
2005-03-18 14:23:44 +03:00
|
|
|
* This is necessary because the names are always weak (they are not
|
|
|
|
* POSIX functions).
|
2003-11-18 03:56:56 +03:00
|
|
|
*/
|
|
|
|
#define fsync_range _fsync_range
|
2005-03-18 14:23:44 +03:00
|
|
|
#define pollts _pollts
|
2003-03-08 11:03:34 +03:00
|
|
|
|
2005-03-10 03:34:23 +03:00
|
|
|
/*
|
|
|
|
* XXX this is necessary to get the prototypes for the __sigsuspend14
|
|
|
|
* XXX and __msync13 internal names, instead of the application-visible
|
|
|
|
* XXX sigsuspend and msync names. It's kind of gross, but we're pretty
|
|
|
|
* XXX intimate with libc already.
|
|
|
|
*/
|
|
|
|
#define __LIBC12_SOURCE__
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
#include <sys/msg.h>
|
|
|
|
#include <sys/types.h>
|
|
|
|
#include <sys/uio.h>
|
|
|
|
#include <sys/wait.h>
|
2007-10-09 22:18:33 +04:00
|
|
|
#include <aio.h>
|
2003-01-18 13:32:11 +03:00
|
|
|
#include <fcntl.h>
|
2007-10-09 22:18:33 +04:00
|
|
|
#include <mqueue.h>
|
2003-01-18 13:32:11 +03:00
|
|
|
#include <poll.h>
|
|
|
|
#include <stdarg.h>
|
|
|
|
#include <unistd.h>
|
|
|
|
|
|
|
|
#include <signal.h>
|
|
|
|
#include <sys/mman.h>
|
2005-03-21 12:00:49 +03:00
|
|
|
#include <sys/select.h>
|
2003-01-27 23:57:41 +03:00
|
|
|
#include <sys/socket.h>
|
2003-01-18 13:32:11 +03:00
|
|
|
|
2005-09-13 06:45:38 +04:00
|
|
|
#include <compat/sys/mman.h>
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
#include "pthread.h"
|
|
|
|
#include "pthread_int.h"
|
|
|
|
|
2005-03-10 03:34:23 +03:00
|
|
|
int pthread__cancel_stub_binder;
|
|
|
|
|
2003-01-27 23:57:41 +03:00
|
|
|
int _sys_accept(int, struct sockaddr *, socklen_t *);
|
2008-12-29 18:08:03 +03:00
|
|
|
int _sys_aio_suspend(const struct aiocb * const [], int,
|
2007-10-09 22:18:33 +04:00
|
|
|
const struct timespec *);
|
2003-01-18 13:32:11 +03:00
|
|
|
int _sys_close(int);
|
2003-01-27 23:57:41 +03:00
|
|
|
int _sys_connect(int, const struct sockaddr *, socklen_t);
|
2003-01-18 13:32:11 +03:00
|
|
|
int _sys_fcntl(int, int, ...);
|
2004-05-21 21:15:42 +04:00
|
|
|
int _sys_fdatasync(int);
|
2003-01-18 13:32:11 +03:00
|
|
|
int _sys_fsync(int);
|
2003-11-18 03:56:56 +03:00
|
|
|
int _sys_fsync_range(int, int, off_t, off_t);
|
2007-10-09 22:18:33 +04:00
|
|
|
int _sys_mq_send(mqd_t, const char *, size_t, unsigned);
|
|
|
|
ssize_t _sys_mq_receive(mqd_t, char *, size_t, unsigned *);
|
2008-12-29 18:08:03 +03:00
|
|
|
int _sys_mq_timedsend(mqd_t, const char *, size_t, unsigned,
|
2007-10-09 22:18:33 +04:00
|
|
|
const struct timespec *);
|
2008-12-29 18:08:03 +03:00
|
|
|
ssize_t _sys_mq_timedreceive(mqd_t, char *, size_t, unsigned *,
|
2007-10-09 22:18:33 +04:00
|
|
|
const struct timespec *);
|
2003-01-18 13:32:11 +03:00
|
|
|
ssize_t _sys_msgrcv(int, void *, size_t, long, int);
|
|
|
|
int _sys_msgsnd(int, const void *, size_t, int);
|
|
|
|
int _sys___msync13(void *, size_t, int);
|
|
|
|
int _sys_open(const char *, int, ...);
|
|
|
|
int _sys_poll(struct pollfd *, nfds_t, int);
|
2008-12-29 18:08:03 +03:00
|
|
|
int _sys_pollts(struct pollfd *, nfds_t, const struct timespec *,
|
2005-03-18 14:23:44 +03:00
|
|
|
const sigset_t *);
|
2003-01-18 13:32:11 +03:00
|
|
|
ssize_t _sys_pread(int, void *, size_t, off_t);
|
2008-12-29 18:08:03 +03:00
|
|
|
int _sys_pselect(int, fd_set *, fd_set *, fd_set *,
|
2005-03-18 14:23:44 +03:00
|
|
|
const struct timespec *, const sigset_t *);
|
2003-01-18 13:32:11 +03:00
|
|
|
ssize_t _sys_pwrite(int, const void *, size_t, off_t);
|
|
|
|
ssize_t _sys_read(int, void *, size_t);
|
|
|
|
ssize_t _sys_readv(int, const struct iovec *, int);
|
2008-12-29 18:08:03 +03:00
|
|
|
int _sys_select(int, fd_set *, fd_set *, fd_set *, struct timeval *);
|
|
|
|
int _sys_wait4(pid_t, int *, int, struct rusage *);
|
2003-01-18 13:32:11 +03:00
|
|
|
ssize_t _sys_write(int, const void *, size_t);
|
|
|
|
ssize_t _sys_writev(int, const struct iovec *, int);
|
2007-03-04 23:07:13 +03:00
|
|
|
int _sys___sigsuspend14(const sigset_t *);
|
2008-12-29 18:08:03 +03:00
|
|
|
int _sigtimedwait(const sigset_t * __restrict, siginfo_t * __restrict,
|
2007-03-04 23:07:13 +03:00
|
|
|
const struct timespec * __restrict);
|
|
|
|
int __sigsuspend14(const sigset_t *);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
2003-11-22 02:03:13 +03:00
|
|
|
#define TESTCANCEL(id) do { \
|
|
|
|
if (__predict_false((id)->pt_cancel)) \
|
2007-12-24 19:04:20 +03:00
|
|
|
pthread__cancelled(); \
|
2003-11-25 02:23:17 +03:00
|
|
|
} while (/*CONSTCOND*/0)
|
2003-11-22 02:03:13 +03:00
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
|
2003-01-27 23:57:41 +03:00
|
|
|
int
|
|
|
|
accept(int s, struct sockaddr *addr, socklen_t *addrlen)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-27 23:57:41 +03:00
|
|
|
retval = _sys_accept(s, addr, addrlen);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-27 23:57:41 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2008-10-08 12:27:07 +04:00
|
|
|
int
|
2008-12-29 18:08:03 +03:00
|
|
|
aio_suspend(const struct aiocb * const list[], int nent,
|
2008-10-08 12:27:07 +04:00
|
|
|
const struct timespec *timeout)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
2008-12-29 18:08:03 +03:00
|
|
|
retval = _sys_aio_suspend(list, nent, timeout);
|
2008-10-08 12:27:07 +04:00
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
int
|
|
|
|
close(int d)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_close(d);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-01-27 23:57:41 +03:00
|
|
|
int
|
|
|
|
connect(int s, const struct sockaddr *addr, socklen_t namelen)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-27 23:57:41 +03:00
|
|
|
retval = _sys_connect(s, addr, namelen);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-27 23:57:41 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
int
|
|
|
|
fcntl(int fd, int cmd, ...)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
va_start(ap, cmd);
|
|
|
|
retval = _sys_fcntl(fd, cmd, va_arg(ap, void *));
|
|
|
|
va_end(ap);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2004-05-21 21:15:42 +04:00
|
|
|
int
|
|
|
|
fdatasync(int d)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
|
|
|
retval = _sys_fdatasync(d);
|
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
int
|
|
|
|
fsync(int d)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_fsync(d);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-11-18 03:56:56 +03:00
|
|
|
int
|
|
|
|
fsync_range(int d, int f, off_t s, off_t e)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-11-18 03:56:56 +03:00
|
|
|
retval = _sys_fsync_range(d, f, s, e);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-11-18 03:56:56 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2008-10-08 12:27:07 +04:00
|
|
|
int
|
|
|
|
mq_send(mqd_t mqdes, const char *msg_ptr, size_t msg_len, unsigned msg_prio)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
|
|
|
retval = _sys_mq_send(mqdes, msg_ptr, msg_len, msg_prio);
|
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
ssize_t
|
|
|
|
mq_receive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
|
|
|
retval = _sys_mq_receive(mqdes, msg_ptr, msg_len, msg_prio);
|
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2008-12-29 18:08:03 +03:00
|
|
|
mq_timedsend(mqd_t mqdes, const char *msg_ptr, size_t msg_len,
|
2008-10-08 12:27:07 +04:00
|
|
|
unsigned msg_prio, const struct timespec *abst)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
2008-12-29 18:08:03 +03:00
|
|
|
retval = _sys_mq_timedsend(mqdes, msg_ptr, msg_len, msg_prio, abst);
|
2008-10-08 12:27:07 +04:00
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
ssize_t
|
2008-12-29 18:08:03 +03:00
|
|
|
mq_timedreceive(mqd_t mqdes, char *msg_ptr, size_t msg_len, unsigned *msg_prio,
|
2008-10-08 12:27:07 +04:00
|
|
|
const struct timespec *abst)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
2008-12-29 18:08:03 +03:00
|
|
|
retval = _sys_mq_timedreceive(mqdes, msg_ptr, msg_len, msg_prio, abst);
|
2008-10-08 12:27:07 +04:00
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
ssize_t
|
|
|
|
msgrcv(int msgid, void *msgp, size_t msgsz, long msgtyp, int msgflg)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_msgrcv(msgid, msgp, msgsz, msgtyp, msgflg);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
msgsnd(int msgid, const void *msgp, size_t msgsz, int msgflg)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_msgsnd(msgid, msgp, msgsz, msgflg);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
__msync13(void *addr, size_t len, int flags)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys___msync13(addr, len, flags);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
open(const char *path, int flags, ...)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
va_list ap;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
va_start(ap, flags);
|
|
|
|
retval = _sys_open(path, flags, va_arg(ap, mode_t));
|
|
|
|
va_end(ap);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
|
|
|
poll(struct pollfd *fds, nfds_t nfds, int timeout)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_poll(fds, nfds, timeout);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2005-03-18 14:23:44 +03:00
|
|
|
int
|
2008-12-29 18:08:03 +03:00
|
|
|
pollts(struct pollfd *fds, nfds_t nfds, const struct timespec *ts,
|
2005-03-18 14:23:44 +03:00
|
|
|
const sigset_t *sigmask)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
2008-12-29 18:08:03 +03:00
|
|
|
retval = _sys_pollts(fds, nfds, ts, sigmask);
|
2005-03-18 14:23:44 +03:00
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
ssize_t
|
|
|
|
pread(int d, void *buf, size_t nbytes, off_t offset)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_pread(d, buf, nbytes, offset);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2005-03-18 14:23:44 +03:00
|
|
|
int
|
2008-12-29 18:08:03 +03:00
|
|
|
pselect(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
2005-03-18 14:23:44 +03:00
|
|
|
const struct timespec *timeout, const sigset_t *sigmask)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
2008-12-29 18:08:03 +03:00
|
|
|
retval = _sys_pselect(nfds, readfds, writefds, exceptfds, timeout,
|
2005-03-18 14:23:44 +03:00
|
|
|
sigmask);
|
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
ssize_t
|
|
|
|
pwrite(int d, const void *buf, size_t nbytes, off_t offset)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_pwrite(d, buf, nbytes, offset);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2008-02-02 20:09:29 +03:00
|
|
|
#ifdef _FORTIFY_SOURCE
|
|
|
|
#undef read
|
|
|
|
#endif
|
|
|
|
|
2003-01-18 13:32:11 +03:00
|
|
|
ssize_t
|
|
|
|
read(int d, void *buf, size_t nbytes)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_read(d, buf, nbytes);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
ssize_t
|
|
|
|
readv(int d, const struct iovec *iov, int iovcnt)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_readv(d, iov, iovcnt);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2008-12-29 18:08:03 +03:00
|
|
|
select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds,
|
2003-01-18 13:32:11 +03:00
|
|
|
struct timeval *timeout)
|
|
|
|
{
|
|
|
|
int retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2008-12-29 18:08:03 +03:00
|
|
|
retval = _sys_select(nfds, readfds, writefds, exceptfds, timeout);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
pid_t
|
2008-12-29 18:08:03 +03:00
|
|
|
wait4(pid_t wpid, int *status, int options, struct rusage *rusage)
|
2003-01-18 13:32:11 +03:00
|
|
|
{
|
|
|
|
pid_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2008-12-29 18:08:03 +03:00
|
|
|
retval = _sys_wait4(wpid, status, options, rusage);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
ssize_t
|
|
|
|
write(int d, const void *buf, size_t nbytes)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_write(d, buf, nbytes);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
ssize_t
|
|
|
|
writev(int d, const struct iovec *iov, int iovcnt)
|
|
|
|
{
|
|
|
|
ssize_t retval;
|
|
|
|
pthread_t self;
|
|
|
|
|
|
|
|
self = pthread__self();
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
retval = _sys_writev(d, iov, iovcnt);
|
2003-11-22 02:03:13 +03:00
|
|
|
TESTCANCEL(self);
|
2003-01-18 13:32:11 +03:00
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
2007-03-04 23:07:13 +03:00
|
|
|
int
|
|
|
|
__sigsuspend14(const sigset_t *sigmask)
|
|
|
|
{
|
|
|
|
pthread_t self;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
|
|
|
retval = _sys___sigsuspend14(sigmask);
|
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
|
|
|
|
|
|
|
int
|
2008-12-29 18:08:03 +03:00
|
|
|
sigtimedwait(const sigset_t * __restrict set, siginfo_t * __restrict info,
|
|
|
|
const struct timespec * __restrict timeout)
|
2007-03-04 23:07:13 +03:00
|
|
|
{
|
|
|
|
pthread_t self;
|
|
|
|
int retval;
|
|
|
|
|
|
|
|
self = pthread__self();
|
|
|
|
TESTCANCEL(self);
|
2008-12-29 18:08:03 +03:00
|
|
|
retval = _sigtimedwait(set, info, timeout);
|
2007-03-04 23:07:13 +03:00
|
|
|
TESTCANCEL(self);
|
|
|
|
|
|
|
|
return retval;
|
|
|
|
}
|
2003-01-18 13:32:11 +03:00
|
|
|
|
2008-12-29 18:08:03 +03:00
|
|
|
__strong_alias(_aio_suspend, aio_suspend)
|
2003-01-18 13:32:11 +03:00
|
|
|
__strong_alias(_close, close)
|
|
|
|
__strong_alias(_fcntl, fcntl)
|
2004-05-21 21:15:42 +04:00
|
|
|
__strong_alias(_fdatasync, fdatasync)
|
2003-01-18 13:32:11 +03:00
|
|
|
__strong_alias(_fsync, fsync)
|
2003-11-18 03:56:56 +03:00
|
|
|
__weak_alias(fsync_range, _fsync_range)
|
2008-10-08 12:27:07 +04:00
|
|
|
__strong_alias(_mq_send, mq_send)
|
|
|
|
__strong_alias(_mq_receive, mq_receive)
|
2008-12-29 18:08:03 +03:00
|
|
|
__strong_alias(_mq_timedsend, mq_timedsend)
|
|
|
|
__strong_alias(_mq_timedreceive, mq_timedreceive)
|
2003-01-18 13:32:11 +03:00
|
|
|
__strong_alias(_msgrcv, msgrcv)
|
|
|
|
__strong_alias(_msgsnd, msgsnd)
|
|
|
|
__strong_alias(___msync13, __msync13)
|
|
|
|
__strong_alias(_open, open)
|
|
|
|
__strong_alias(_poll, poll)
|
2008-12-29 18:08:03 +03:00
|
|
|
__weak_alias(pollts, _pollts)
|
2003-01-18 13:32:11 +03:00
|
|
|
__strong_alias(_pread, pread)
|
2008-12-29 18:08:03 +03:00
|
|
|
__strong_alias(_pselect, pselect)
|
2003-01-18 13:32:11 +03:00
|
|
|
__strong_alias(_pwrite, pwrite)
|
|
|
|
__strong_alias(_read, read)
|
|
|
|
__strong_alias(_readv, readv)
|
2008-12-29 18:08:03 +03:00
|
|
|
__strong_alias(_select, select)
|
|
|
|
__strong_alias(_wait4, wait4)
|
2003-01-18 13:32:11 +03:00
|
|
|
__strong_alias(_write, write)
|
|
|
|
__strong_alias(_writev, writev)
|
2008-06-28 20:50:43 +04:00
|
|
|
|
|
|
|
#endif /* !lint */
|