From 4cafcd839f8c002c290ec96c64b6d85e87e270e8 Mon Sep 17 00:00:00 2001 From: Samuel Thibault Date: Sun, 28 Jun 2020 14:27:36 +0000 Subject: hurd: make open and openat cancellation points and add _nocancel variants. * sysdeps/mach/hurd/Makefile [io] (sysdep_routines): Add open_nocancel openat_nocancel. * sysdeps/mach/hurd/Versions (libc.GLIBC_PRIVATE, ld.GLIBC_PRIVATE): Add __open_nocancel. * sysdeps/mach/hurd/dl-sysdep.c (__open_nocancel): Add alias, check it is not hidden. * sysdeps/mach/hurd/i386/localplt.data (__open_nocancel): Allow PLT. * sysdeps/mach/hurd/not-cancel.h (__open_nocancel, __openat_nocancel: Replace macros with declarations with hidden proto. (__open64_nocancel, __openat64_nocancel): Call __open_nocancel and __openat_nocancel instead of __open64 and __openat64. * sysdeps/mach/hurd/open.c: Include (__libc_open): Surround __file_name_lookup with enabling async cancel. * sysdeps/mach/hurd/openat.c: Likewise. * sysdeps/mach/hurd/open_nocancel.c, sysdeps/mach/hurd/openat_nocancel.c: New files. --- sysdeps/mach/hurd/openat.c | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'sysdeps/mach/hurd/openat.c') diff --git a/sysdeps/mach/hurd/openat.c b/sysdeps/mach/hurd/openat.c index 7e241cd36f..5842da05d7 100644 --- a/sysdeps/mach/hurd/openat.c +++ b/sysdeps/mach/hurd/openat.c @@ -24,6 +24,7 @@ #include #include #include +#include /* Open FILE with access OFLAG. Interpret relative paths relative to the directory associated with FD. If O_CREAT or O_TMPFILE is in OFLAG, a @@ -33,6 +34,7 @@ __openat (int fd, const char *file, int oflag, ...) { mode_t mode; io_t port; + int cancel_oldtype; if (__OPEN_NEEDS_MODE (oflag)) { @@ -44,7 +46,10 @@ __openat (int fd, const char *file, int oflag, ...) else mode = 0; + cancel_oldtype = LIBC_CANCEL_ASYNC(); port = __file_name_lookup_at (fd, 0, file, oflag, mode); + LIBC_CANCEL_RESET (cancel_oldtype); + if (port == MACH_PORT_NULL) return -1; -- cgit 1.4.1