POSIX requires certain interfaces to include cancellation points, permits
it for others, and the rest of the POSIX interfaces are banned from being
cancellation points.
Our shm_open(), sysconf(), tcflow(), and tcsendbreak() are in the third
group and therefore shouldn't be cancellation points. However they are
built on sycalls whose public versions are cancellation points: open,
close, write, and nanosleep. So, they need to invoke the underlying,
non-cancellation point versions of those functions.
ok?
Philip
Index: gen/shm_open.c
===================================================================
RCS file: /data/src/openbsd/src/lib/libc/gen/shm_open.c,v
retrieving revision 1.8
diff -u -p -r1.8 shm_open.c
--- gen/shm_open.c 10 Dec 2015 13:03:22 -0000 1.8
+++ gen/shm_open.c 5 Sep 2017 04:57:35 -0000
@@ -61,16 +61,16 @@ shm_open(const char *path, int flags, mo
makeshmpath(path, shmpath, sizeof(shmpath));
- fd = open(shmpath, flags, mode);
+ fd = HIDDEN(open)(shmpath, flags, mode);
if (fd == -1)
return -1;
if (fstat(fd, &sb) == -1 || !S_ISREG(sb.st_mode)) {
- close(fd);
+ HIDDEN(close)(fd);
errno = EINVAL;
return -1;
}
if (sb.st_uid != geteuid()) {
- close(fd);
+ HIDDEN(close)(fd);
errno = EPERM;
return -1;
}
Index: gen/sysconf.c
===================================================================
RCS file: /data/src/openbsd/src/lib/libc/gen/sysconf.c,v
retrieving revision 1.24
diff -u -p -r1.24 sysconf.c
--- gen/sysconf.c 20 Mar 2016 02:32:40 -0000 1.24
+++ gen/sysconf.c 30 Aug 2017 05:35:33 -0000
@@ -241,7 +241,7 @@ sysconf(int name)
value = socket(PF_INET6, SOCK_DGRAM, 0);
errno = sverrno;
if (value >= 0) {
- close(value);
+ HIDDEN(close)(value);
return (200112L);
} else
return (0);
Index: termios/tcflow.c
===================================================================
RCS file: /data/src/openbsd/src/lib/libc/termios/tcflow.c,v
retrieving revision 1.5
diff -u -p -r1.5 tcflow.c
--- termios/tcflow.c 5 Aug 2005 13:03:00 -0000 1.5
+++ termios/tcflow.c 5 Sep 2017 05:00:43 -0000
@@ -49,7 +49,8 @@ tcflow(int fd, int action)
if (tcgetattr(fd, &term) == -1)
return (-1);
c = term.c_cc[action == TCIOFF ? VSTOP : VSTART];
- if (c != _POSIX_VDISABLE && write(fd, &c, sizeof(c)) == -1)
+ if (c != _POSIX_VDISABLE &&
+ HIDDEN(write)(fd, &c, sizeof(c)) == -1)
return (-1);
return (0);
default:
Index: termios/tcsendbreak.c
===================================================================
RCS file: /data/src/openbsd/src/lib/libc/termios/tcsendbreak.c,v
retrieving revision 1.9
diff -u -p -r1.9 tcsendbreak.c
--- termios/tcsendbreak.c 1 Nov 2015 03:45:29 -0000 1.9
+++ termios/tcsendbreak.c 5 Sep 2017 05:01:01 -0000
@@ -42,7 +42,7 @@ tcsendbreak(int fd, int len)
if (ioctl(fd, TIOCSBRK, 0) == -1)
return (-1);
- (void)nanosleep(&sleepytime, NULL);
+ HIDDEN(nanosleep)(&sleepytime, NULL);
if (ioctl(fd, TIOCCBRK, 0) == -1)
return (-1);
return (0);