summaryrefslogtreecommitdiffstats
path: root/lib/librthread/rthread_libc.c
diff options
context:
space:
mode:
authorguenther <guenther@openbsd.org>2011-12-05 04:02:03 +0000
committerguenther <guenther@openbsd.org>2011-12-05 04:02:03 +0000
commit77995a4277c0bb39aec9a27b1b48d3ad8b8a32cd (patch)
tree9099939b44cb0137deba85d1c7c8a66263988802 /lib/librthread/rthread_libc.c
parentAs requested by kristaps@, add and improve comments related to -Omdoc; (diff)
downloadwireguard-openbsd-77995a4277c0bb39aec9a27b1b48d3ad8b8a32cd.tar.xz
wireguard-openbsd-77995a4277c0bb39aec9a27b1b48d3ad8b8a32cd.zip
Implement cancelation for the basic syscall cancelation points,
using previously allocated SIGTHR to interrupt in-process syscalls and fixing the spelling of "cancelled" along the way. Modeled on FreeBSD's libthr
Diffstat (limited to 'lib/librthread/rthread_libc.c')
-rw-r--r--lib/librthread/rthread_libc.c191
1 files changed, 1 insertions, 190 deletions
diff --git a/lib/librthread/rthread_libc.c b/lib/librthread/rthread_libc.c
index 3c263ba6e38..26abe3d0928 100644
--- a/lib/librthread/rthread_libc.c
+++ b/lib/librthread/rthread_libc.c
@@ -1,4 +1,4 @@
-/* $OpenBSD: rthread_libc.c,v 1.8 2011/11/06 11:48:59 guenther Exp $ */
+/* $OpenBSD: rthread_libc.c,v 1.9 2011/12/05 04:02:03 guenther Exp $ */
/* $snafu: libc_tag.c,v 1.4 2004/11/30 07:00:06 marc Exp $ */
/* PUBLIC DOMAIN: No Rights Reserved. Marco S Hyman <marc@snafu.org> */
@@ -202,192 +202,3 @@ _thread_arc4_unlock(void)
_spinunlock(&arc4_lock);
}
-#if 0
-/*
- * miscellaneous libc exported symbols we want to override
- */
-int
-close(int fd)
-{
- int rv;
-
- pthread_testcancel();
- rv = _thread_sys_close(fd);
- pthread_testcancel();
- return (rv);
-}
-
-#if 0
-/* libc calls open */
-int
-creat(const char *path, mode_t mode)
-{
-
-}
-#endif
-
-#if 0
-int
-fcntl(int fd, int cmd, ...)
-{
- va_list ap;
- int rv;
-
- pthread_testcancel();
- va_start(ap, cmd);
- rv = _thread_sys_fcntl(fd, cmd, va_arg(cmd, void *));
- va_end(ap);
- pthread_testcancel();
- return (rv);
-}
-#endif
-
-int
-fsync(int fd)
-{
- int rv;
-
- pthread_testcancel();
- rv = _thread_sys_fsync(fd);
- pthread_testcancel();
- return (rv);
-}
-
-int
-msync(void *addr, size_t len, int flags)
-{
- int rv;
-
- pthread_testcancel();
- rv = _thread_sys_msync(addr, len, flags);
- pthread_testcancel();
- return (rv);
-}
-
-int
-nanosleep(const struct timespec *rqtp, struct timespec *rmtp)
-{
- int rv;
-
- pthread_testcancel();
- rv = _thread_sys_nanosleep(rqtp, rmtp);
- pthread_testcancel();
- return (rv);
-}
-
-#if 0
-int
-open(const char *path, int flags, ...)
-{
-
- va_list ap;
- int rv;
-
- pthread_testcancel();
- va_start(ap, cmd);
- rv = _thread_sys_open(fd, cmd, va_arg(cmd, mode_t));
- va_end(ap);
- pthread_testcancel();
- return (rv);
-}
-#endif
-
-#if 0
-int
-pause(void)
-{
-
-}
-#endif
-
-ssize_t
-read(int fd, void *buf, size_t nbytes)
-{
- ssize_t rv;
-
- pthread_testcancel();
- rv = read(fd, buf, nbytes);
- pthread_testcancel();
- return (rv);
-}
-
-#if 0
-int
-sigwaitinfo()
-{
-
-}
-#endif
-
-int
-sigsuspend(const sigset_t *sigmask)
-{
- int rv;
-
- pthread_testcancel();
- rv = sigsuspend(sigmask);
- pthread_testcancel();
- return (rv);
-}
-
-#if 0
-/* libc sleep(3) calls nanosleep(2), so we'll catch it there */
-unsigned int
-sleep(unsigned int seconds)
-{
-
-}
-#endif
-
-#if 0
-int system(const char *string)
-{
-
-}
-#endif
-
-#if 0
-int
-tcdrain(int fd)
-{
-
-}
-#endif
-
-#if 0
-/* wait and waitpid will be handled by libc calling wait4 */
-pid_t
-wait(int *status)
-{
-
-}
-
-pid_t
-waitpid(pid_t wpid, int *status, int options)
-{
-
-}
-#endif
-
-pid_t
-wait4(pid_t wpid, int *status, int options, struct rusage *rusage)
-{
- pid_t rv;
-
- pthread_testcancel();
- rv = _thread_sys_wait4(wpid, status, options, rusage);
- pthread_testcancel();
- return (rv);
-}
-
-ssize_t
-write(int fd, const void *buf, size_t nbytes)
-{
- ssize_t rv;
-
- pthread_testcancel();
- rv = _thread_sys_write(fd, buf, nbytes);
- pthread_testcancel();
- return (rv);
-}
-#endif