]> git.saurik.com Git - apple/launchd.git/blobdiff - launchd/testing/vproc_gsk_test.c
launchd-257.tar.gz
[apple/launchd.git] / launchd / testing / vproc_gsk_test.c
diff --git a/launchd/testing/vproc_gsk_test.c b/launchd/testing/vproc_gsk_test.c
new file mode 100644 (file)
index 0000000..5df62c0
--- /dev/null
@@ -0,0 +1,27 @@
+#include <stdio.h>
+#include <stdbool.h>
+#include <assert.h>
+#include <vproc.h>
+
+int main(void)
+{
+       int64_t val;
+       bool is_native;
+       pid_t p;
+       uid_t u;
+
+       /* we assign val to p or u due to 64 bit to 32 bit trucation */
+
+       assert(vproc_swap_integer(NULL, VPROC_GSK_MGR_PID, NULL, &val) == NULL);
+       p = val;
+
+       assert(vproc_swap_integer(NULL, VPROC_GSK_MGR_UID, NULL, &val) == NULL);
+       u = val;
+
+       assert(vproc_swap_integer(NULL, VPROC_GSK_IS_NATIVE, NULL, &val) == NULL);
+       is_native = val;
+
+       fprintf(stdout, "UID = %u PID = %u Native = %u\n", u, p, is_native);
+
+       return 0;
+}