chiark / gitweb /
memfd: always create our memfds with CLOEXEC set
[elogind.git] / src / shared / missing.h
index 00e02871d2f4e39ae6d880c3bfa8c758c1638f4a..0d7c55952ee3f885ecf8c0cd3121c1dfd40ce374 100644 (file)
 #endif
 
 #ifndef MFD_ALLOW_SEALING
-#define MFD_ALLOW_SEALING 0x0002ULL
+#define MFD_ALLOW_SEALING 0x0002U
+#endif
+
+#ifndef MFD_CLOEXEC
+#define MFD_CLOEXEC 0x0001U
 #endif
 
 #ifndef IP_FREEBIND
@@ -136,7 +140,7 @@ static inline int memfd_create(const char *name, unsigned int flags) {
 
 #ifndef __NR_getrandom
 #  if defined __x86_64__
-#    define __NR_getrandom 278
+#    define __NR_getrandom 318
 #  else
 #    warning "__NR_getrandom unknown for your architecture"
 #    define __NR_getrandom 0xffffffff
@@ -149,6 +153,14 @@ static inline int getrandom(void *buffer, size_t count, unsigned flags) {
 }
 #endif
 
+#ifndef GRND_NONBLOCK
+#define GRND_NONBLOCK 0x0001
+#endif
+
+#ifndef GRND_RANDOM
+#define GRND_RANDOM 0x0002
+#endif
+
 #ifndef BTRFS_IOCTL_MAGIC
 #define BTRFS_IOCTL_MAGIC 0x94
 #endif