+ fdflags = fcntl(fd, F_GETFD);
+ if (fdflags < 0) {
+ fprintf(stderr, "%d: fcntl(F_GETFD): %s\n", fd, strerror(errno));
+ exit(1);
+ }
+ if (fcntl(fd, F_SETFD, fdflags & ~FD_CLOEXEC) < 0) {
+ fprintf(stderr, "%d: fcntl(F_SETFD): %s\n", fd, strerror(errno));
+ exit(1);
+ }
+}
+int nonblock(int fd) {
+ int fdflags;
+
+ fdflags = fcntl(fd, F_GETFL);
+ if (fdflags < 0) {
+ fprintf(stderr, "%d: fcntl(F_GETFL): %s\n", fd, strerror(errno));
+ exit(1);
+ }
+ if (fcntl(fd, F_SETFL, fdflags | O_NONBLOCK) < 0) {
+ fprintf(stderr, "%d: fcntl(F_SETFL): %s\n", fd, strerror(errno));
+ exit(1);
+ }
+
+ return fdflags & O_NONBLOCK;
+}
+int no_nonblock(int fd) {
+ int fdflags;
+
+ fdflags = fcntl(fd, F_GETFL);
+ if (fdflags < 0) {
+ fprintf(stderr, "%d: fcntl(F_GETFL): %s\n", fd, strerror(errno));
+ exit(1);
+ }
+ if (fcntl(fd, F_SETFL, fdflags & ~O_NONBLOCK) < 0) {
+ fprintf(stderr, "%d: fcntl(F_SETFL): %s\n", fd, strerror(errno));
+ exit(1);
+ }
+
+ return fdflags & O_NONBLOCK;
+}
+
+FILE *f_open(const Filename *filename, char const *mode, int is_private)