]> git.proxmox.com Git - mirror_lxc.git/blobdiff - src/lxc/syscall_wrappers.h
tree-wide: wipe direct or indirect linux/mount.h inclusion
[mirror_lxc.git] / src / lxc / syscall_wrappers.h
index 4a9dda83d1f5409e7ce6f3e263e76facd0ba8657..22ce536b44d5e929c7e5d370388138e9305a7e14 100644 (file)
@@ -10,6 +10,7 @@
 #include <linux/keyctl.h>
 #include <sched.h>
 #include <stdint.h>
+#include <sys/mount.h>
 #include <sys/prctl.h>
 #include <sys/syscall.h>
 #include <sys/types.h>
@@ -210,16 +211,18 @@ extern int fsmount(int fs_fd, unsigned int flags, unsigned int attr_flags);
 /*
  * mount_setattr()
  */
-struct lxc_mount_attr {
+#if !HAVE_STRUCT_MOUNT_ATTR
+struct mount_attr {
        __u64 attr_set;
        __u64 attr_clr;
        __u64 propagation;
        __u64 userns_fd;
 };
+#endif
 
 #if !HAVE_MOUNT_SETATTR
 static inline int mount_setattr(int dfd, const char *path, unsigned int flags,
-                               struct lxc_mount_attr *attr, size_t size)
+                               struct mount_attr *attr, size_t size)
 {
        return syscall(__NR_mount_setattr, dfd, path, flags, attr, size);
 }
@@ -367,17 +370,21 @@ static inline bool core_scheduling_cookie_valid(__u64 cookie)
        return (cookie > 0) && (cookie != INVALID_SCHED_CORE_COOKIE);
 }
 
-static inline __u64 core_scheduling_cookie_get(pid_t pid)
+static inline int core_scheduling_cookie_get(pid_t pid, __u64 *cookie)
 {
-       __u64 cookie;
        int ret;
 
+       if (!cookie)
+               return ret_errno(EINVAL);
+
        ret = prctl(PR_SCHED_CORE, PR_SCHED_CORE_GET, pid,
-                   PR_SCHED_CORE_SCOPE_THREAD, (unsigned long)&cookie);
-       if (ret)
-               return INVALID_SCHED_CORE_COOKIE;
+                   PR_SCHED_CORE_SCOPE_THREAD, (unsigned long)cookie);
+       if (ret) {
+               *cookie = INVALID_SCHED_CORE_COOKIE;
+               return -errno;
+       }
 
-       return cookie;
+       return 0;
 }
 
 static inline int core_scheduling_cookie_create_threadgroup(pid_t pid)