svn commit: r197968 - in head/lib: libc/include libc/sys libthr
libthr/thread
Jilles Tjoelker
jilles at FreeBSD.org
Sun Oct 11 20:19:46 UTC 2009
Author: jilles
Date: Sun Oct 11 20:19:45 2009
New Revision: 197968
URL: http://svn.freebsd.org/changeset/base/197968
Log:
Make openat(2) a cancellation point.
This is required by POSIX and matches open(2).
Reviewed by: kib, jhb
MFC after: 1 month
Modified:
head/lib/libc/include/namespace.h
head/lib/libc/include/un-namespace.h
head/lib/libc/sys/Symbol.map
head/lib/libthr/pthread.map
head/lib/libthr/thread/thr_private.h
head/lib/libthr/thread/thr_syscalls.c
Modified: head/lib/libc/include/namespace.h
==============================================================================
--- head/lib/libc/include/namespace.h Sun Oct 11 18:21:55 2009 (r197967)
+++ head/lib/libc/include/namespace.h Sun Oct 11 20:19:45 2009 (r197968)
@@ -80,6 +80,7 @@
#define listen _listen
#define nanosleep _nanosleep
#define open _open
+#define openat _openat
#define poll _poll
#define pthread_atfork _pthread_atfork
#define pthread_attr_destroy _pthread_attr_destroy
Modified: head/lib/libc/include/un-namespace.h
==============================================================================
--- head/lib/libc/include/un-namespace.h Sun Oct 11 18:21:55 2009 (r197967)
+++ head/lib/libc/include/un-namespace.h Sun Oct 11 20:19:45 2009 (r197968)
@@ -61,6 +61,7 @@
#undef listen
#undef nanosleep
#undef open
+#undef openat
#undef poll
#undef pthread_atfork
#undef pthread_attr_destroy
Modified: head/lib/libc/sys/Symbol.map
==============================================================================
--- head/lib/libc/sys/Symbol.map Sun Oct 11 18:21:55 2009 (r197967)
+++ head/lib/libc/sys/Symbol.map Sun Oct 11 20:19:45 2009 (r197968)
@@ -769,6 +769,8 @@ FBSDprivate_1.0 {
__sys_olio_listio;
_open;
__sys_open;
+ _openat;
+ __sys_openat;
_pathconf;
__sys_pathconf;
_pipe;
Modified: head/lib/libthr/pthread.map
==============================================================================
--- head/lib/libthr/pthread.map Sun Oct 11 18:21:55 2009 (r197967)
+++ head/lib/libthr/pthread.map Sun Oct 11 20:19:45 2009 (r197968)
@@ -195,6 +195,7 @@ FBSDprivate_1.0 {
__msync;
__nanosleep;
__open;
+ __openat;
__poll;
__pthread_cond_timedwait;
__pthread_cond_wait;
@@ -406,3 +407,7 @@ FBSD_1.1 {
pthread_mutex_setspinloops_np;
pthread_mutex_setyieldloops_np;
};
+
+FBSD_1.2 {
+ openat;
+};
Modified: head/lib/libthr/thread/thr_private.h
==============================================================================
--- head/lib/libthr/thread/thr_private.h Sun Oct 11 18:21:55 2009 (r197967)
+++ head/lib/libthr/thread/thr_private.h Sun Oct 11 20:19:45 2009 (r197968)
@@ -668,6 +668,7 @@ void _pthread_cleanup_pop(int);
#ifdef _SYS_FCNTL_H_
int __sys_fcntl(int, int, ...);
int __sys_open(const char *, int, ...);
+int __sys_openat(int, const char *, int, ...);
#endif
/* #include <signal.h> */
Modified: head/lib/libthr/thread/thr_syscalls.c
==============================================================================
--- head/lib/libthr/thread/thr_syscalls.c Sun Oct 11 18:21:55 2009 (r197967)
+++ head/lib/libthr/thread/thr_syscalls.c Sun Oct 11 20:19:45 2009 (r197968)
@@ -139,6 +139,7 @@ int __fsync(int);
int __msync(void *, size_t, int);
int __nanosleep(const struct timespec *, struct timespec *);
int __open(const char *, int,...);
+int __openat(int, const char *, int,...);
int __poll(struct pollfd *, unsigned int, int);
ssize_t __read(int, void *buf, size_t);
ssize_t __readv(int, const struct iovec *, int);
@@ -341,6 +342,33 @@ __open(const char *path, int flags,...)
return ret;
}
+__weak_reference(__openat, openat);
+
+int
+__openat(int fd, const char *path, int flags, ...)
+{
+ struct pthread *curthread = _get_curthread();
+ int ret;
+ int mode = 0;
+ va_list ap;
+
+ _thr_cancel_enter(curthread);
+
+ /* Check if the file is being created: */
+ if (flags & O_CREAT) {
+ /* Get the creation mode: */
+ va_start(ap, flags);
+ mode = va_arg(ap, int);
+ va_end(ap);
+ }
+
+ ret = __sys_openat(fd, path, flags, mode);
+
+ _thr_cancel_leave(curthread);
+
+ return ret;
+}
+
__weak_reference(__poll, poll);
int
More information about the svn-src-all
mailing list