summaryrefslogtreecommitdiff
path: root/lib/libpthread
diff options
context:
space:
mode:
authorthorpej <thorpej@NetBSD.org>2003-11-18 00:56:56 +0000
committerthorpej <thorpej@NetBSD.org>2003-11-18 00:56:56 +0000
commit137c808bb8bb55e5827fd3ce50d2f78831d399cd (patch)
tree808e5e3bdb1d746b3f6efd91741fb4a90ebe3749 /lib/libpthread
parent196dbdcd2be28fc29c01af01c3e0bbd1c0dd6c69 (diff)
Userland portion of fsync_range(2), written by Bill Studenmund, and
contributed by Wasabi Systems, Inc.
Diffstat (limited to 'lib/libpthread')
-rw-r--r--lib/libpthread/pthread_cancelstub.c26
-rw-r--r--lib/libpthread/pthread_testcancel.33
2 files changed, 26 insertions, 3 deletions
diff --git a/lib/libpthread/pthread_cancelstub.c b/lib/libpthread/pthread_cancelstub.c
index faa2a2ab6a1..ba95e201be8 100644
--- a/lib/libpthread/pthread_cancelstub.c
+++ b/lib/libpthread/pthread_cancelstub.c
@@ -1,4 +1,4 @@
-/* $NetBSD: pthread_cancelstub.c,v 1.5 2003/03/08 08:03:35 lukem Exp $ */
+/* $NetBSD: pthread_cancelstub.c,v 1.6 2003/11/18 00:56:57 thorpej Exp $ */
/*-
* Copyright (c) 2002 The NetBSD Foundation, Inc.
@@ -37,7 +37,13 @@
*/
#include <sys/cdefs.h>
-__RCSID("$NetBSD: pthread_cancelstub.c,v 1.5 2003/03/08 08:03:35 lukem Exp $");
+__RCSID("$NetBSD: pthread_cancelstub.c,v 1.6 2003/11/18 00:56:57 thorpej Exp $");
+
+/*
+ * This is necessary because the fsync_range() name is always weak (it is
+ * not a POSIX function).
+ */
+#define fsync_range _fsync_range
#include <sys/msg.h>
#include <sys/types.h>
@@ -69,6 +75,7 @@ int _sys_close(int);
int _sys_connect(int, const struct sockaddr *, socklen_t);
int _sys_fcntl(int, int, ...);
int _sys_fsync(int);
+int _sys_fsync_range(int, int, off_t, off_t);
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);
@@ -157,6 +164,20 @@ fsync(int d)
return retval;
}
+int
+fsync_range(int d, int f, off_t s, off_t e)
+{
+ int retval;
+ pthread_t self;
+
+ self = pthread__self();
+ pthread__testcancel(self);
+ retval = _sys_fsync_range(d, f, s, e);
+ pthread__testcancel(self);
+
+ return retval;
+}
+
ssize_t
msgrcv(int msgid, void *msgp, size_t msgsz, long msgtyp, int msgflg)
{
@@ -347,6 +368,7 @@ writev(int d, const struct iovec *iov, int iovcnt)
__strong_alias(_close, close)
__strong_alias(_fcntl, fcntl)
__strong_alias(_fsync, fsync)
+__weak_alias(fsync_range, _fsync_range)
__strong_alias(_msgrcv, msgrcv)
__strong_alias(_msgsnd, msgsnd)
__strong_alias(___msync13, __msync13)
diff --git a/lib/libpthread/pthread_testcancel.3 b/lib/libpthread/pthread_testcancel.3
index 711dba41d25..e4c74f97cb4 100644
--- a/lib/libpthread/pthread_testcancel.3
+++ b/lib/libpthread/pthread_testcancel.3
@@ -1,4 +1,4 @@
-.\" $NetBSD: pthread_testcancel.3,v 1.2 2003/07/04 08:42:20 wiz Exp $
+.\" $NetBSD: pthread_testcancel.3,v 1.3 2003/11/18 00:56:57 thorpej Exp $
.\"
.\" Copyright (c) 2002 The NetBSD Foundation, Inc.
.\" All rights reserved.
@@ -134,6 +134,7 @@ functions:
.Fn creat ,
.Fn fcntl ,
.Fn fsync ,
+.Fn fsync_range ,
.\".Fn getmsg ,
.\".Fn getpmsg ,
.\".Fn lockf ,