aboutsummaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
authorRob Landley <rob@landley.net>2016-02-10 23:27:55 -0600
committerRob Landley <rob@landley.net>2016-02-10 23:27:55 -0600
commitdf07fb73be98dc1087346c184877666970a88f4a (patch)
tree32771caccb0008ccced29c99dbeeab0cef88f5ec /lib
parent187649de817b618c967d234f0707008e90e52504 (diff)
downloadtoybox-df07fb73be98dc1087346c184877666970a88f4a.tar.gz
Wean scripts/install.c off toys.h so cross compiling less brittle.
Diffstat (limited to 'lib')
-rw-r--r--lib/lsm.h4
-rw-r--r--lib/toyflags.h27
2 files changed, 27 insertions, 4 deletions
diff --git a/lib/lsm.h b/lib/lsm.h
index aacabe08..d7e7de9c 100644
--- a/lib/lsm.h
+++ b/lib/lsm.h
@@ -3,8 +3,6 @@
* Copyright 2015 Rob Landley <rob@landley.net>
*/
-#ifndef BUILD_FOR_HOST
-
#if CFG_TOYBOX_SELINUX
#include <selinux/selinux.h>
#else
@@ -115,5 +113,3 @@ static inline int lsm_fget_context(int file, char **context)
return smack_new_label_from_file(file, XATTR_NAME_SMACK, context);
return fgetfilecon(file, context);
}
-
-#endif // BUILD_FOR_HOST
diff --git a/lib/toyflags.h b/lib/toyflags.h
new file mode 100644
index 00000000..963295cc
--- /dev/null
+++ b/lib/toyflags.h
@@ -0,0 +1,27 @@
+/* Flags values for the third argument of NEWTOY()
+ *
+ * Included from both main.c (runs in toys.h context) and scripts/install.c
+ * (which may build on crazy things like macosx when cross compiling).
+ */
+
+// Flags describing command behavior.
+
+#define TOYFLAG_USR (1<<0)
+#define TOYFLAG_BIN (1<<1)
+#define TOYFLAG_SBIN (1<<2)
+#define TOYMASK_LOCATION ((1<<4)-1)
+
+// This is a shell built-in function, running in the same process context.
+#define TOYFLAG_NOFORK (1<<4)
+
+// Start command with a umask of 0 (saves old umask in this.old_umask)
+#define TOYFLAG_UMASK (1<<5)
+
+// This command runs as root.
+#define TOYFLAG_STAYROOT (1<<6)
+#define TOYFLAG_NEEDROOT (1<<7)
+#define TOYFLAG_ROOTONLY (TOYFLAG_STAYROOT|TOYFLAG_NEEDROOT)
+
+// Call setlocale to listen to environment variables.
+// This invalidates sprintf("%.*s", size, string) as a valid length constraint.
+#define TOYFLAG_LOCALE (1<<8)