chiark / gitweb /
machined: beef up machined image listing with creation/modification times of subvolumes
[elogind.git] / src / shared / missing.h
index f226197555facdbd7a98e4bc705587860b243a66..dd7bef4d9d70c1fe83d134ccbb2425849b555b00 100644 (file)
 #include <asm/sgidefs.h>
 #endif
 
+#ifdef HAVE_LINUX_BTRFS_H
+#include <linux/btrfs.h>
+#endif
+
 #include "macro.h"
 
 #ifndef RLIMIT_RTTIME
@@ -246,6 +250,14 @@ struct btrfs_ioctl_fs_info_args {
                                  struct btrfs_ioctl_vol_args)
 #endif
 
+#ifndef BTRFS_FIRST_FREE_OBJECTID
+#define BTRFS_FIRST_FREE_OBJECTID 256
+#endif
+
+#ifndef BTRFS_ROOT_ITEM_KEY
+#define BTRFS_ROOT_ITEM_KEY 132
+#endif
+
 #ifndef BTRFS_SUPER_MAGIC
 #define BTRFS_SUPER_MAGIC 0x9123683E
 #endif
@@ -631,3 +643,17 @@ static inline int setns(int fd, int nstype) {
 #ifndef CAP_AUDIT_READ
 #define CAP_AUDIT_READ 37
 #endif
+
+static inline int raw_clone(unsigned long flags, void *child_stack) {
+#if defined(__s390__) || defined(__CRIS__)
+        /* On s390 and cris the order of the first and second arguments
+         * of the raw clone() system call is reversed. */
+        return (int) syscall(__NR_clone, child_stack, flags);
+#else
+        return (int) syscall(__NR_clone, flags, child_stack);
+#endif
+}
+
+static inline pid_t raw_getpid(void) {
+        return (pid_t) syscall(__NR_getpid);
+}