diff --git a/share/libc/fcntl.h b/share/libc/fcntl.h
index a8ea0805a836b296e62470cef64a96765cbf825e..5a48a56000820e2a52846ef138ae85bbdcd42c35 100644
--- a/share/libc/fcntl.h
+++ b/share/libc/fcntl.h
@@ -93,6 +93,10 @@ __PUSH_FC_STDLIB
 #define POSIX_FADV_SEQUENTIAL 2
 #define POSIX_FADV_WILLNEED 3
 
+// Non-POSIX, but used in some code
+#define O_BINARY 0
+#define O_TEXT 0
+
 __BEGIN_DECLS
 
 struct flock
diff --git a/share/libc/sys/stat.h b/share/libc/sys/stat.h
index 84cb183263707d83fee1afe745ac2e60dfd84fcb..190c944be8249e58ea6a2fd5d15f9e330fc04f0c 100644
--- a/share/libc/sys/stat.h
+++ b/share/libc/sys/stat.h
@@ -30,8 +30,11 @@ __BEGIN_DECLS
 #include "../__fc_string_axiomatic.h"
 
 extern int    chmod(const char *, mode_t);
+extern int    fchmodat(int fd, const char *path, mode_t mode, int flag);
 extern int    fchmod(int, mode_t);
 extern int    fstat(int, struct stat *);
+extern int    fstatat(int fd, const char *restrict path,
+                      struct stat *restrict buf, int flag);
 
 /*@ // missing: may assign to errno: EACCES, ELOOP, ENAMETOOLONG,
     //                               ENOENT, ENOMEM, ENOTDIR, EOVERFLOW,
@@ -96,6 +99,11 @@ extern int    stat(const char *pathname, struct stat *buf);
 */
 extern mode_t umask(mode_t cmask);
 
+#define S_TYPEISMQ(buf) ((buf)->st_mode - (buf)->st_mode)
+#define S_TYPEISSEM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define S_TYPEISSHM(buf) ((buf)->st_mode - (buf)->st_mode)
+#define S_TYPEISTMO(buf) (0)
+
 __END_DECLS
 __POP_FC_STDLIB
 #endif
diff --git a/share/libc/unistd.h b/share/libc/unistd.h
index 301ce7d5e4b7e692c54b054ec569f03bd4fc3735..c0c279864ed3d9f96f2e2da5b868b321a617a4ab 100644
--- a/share/libc/unistd.h
+++ b/share/libc/unistd.h
@@ -848,6 +848,8 @@ extern int          execvp(const char *path, char *const argv[]);
 extern void         _exit(int) __attribute__ ((__noreturn__));
 
 extern int          fchown(int, uid_t, gid_t);
+extern int          fchownat(int fd, const char *path, uid_t owner,
+                             gid_t group, int flag);
 extern int          fchdir(int);
 extern int          fdatasync(int);