aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/busybox.h15
-rw-r--r--include/libbb.h32
2 files changed, 26 insertions, 21 deletions
diff --git a/include/busybox.h b/include/busybox.h
index b1e31e5ee..737627bd0 100644
--- a/include/busybox.h
+++ b/include/busybox.h
@@ -15,25 +15,20 @@ PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
15/* Keep in sync with applets/applet_tables.c! */ 15/* Keep in sync with applets/applet_tables.c! */
16extern const char applet_names[] ALIGN1; 16extern const char applet_names[] ALIGN1;
17extern int (*const applet_main[])(int argc, char **argv); 17extern int (*const applet_main[])(int argc, char **argv);
18extern const uint16_t applet_nameofs[]; 18extern const uint8_t applet_flags[] ALIGN1;
19extern const uint8_t applet_suid[] ALIGN1;
19extern const uint8_t applet_install_loc[] ALIGN1; 20extern const uint8_t applet_install_loc[] ALIGN1;
20 21
21#if ENABLE_FEATURE_SUID || ENABLE_FEATURE_PREFER_APPLETS
22# define APPLET_NAME(i) (applet_names + (applet_nameofs[i] & 0x0fff))
23#else
24# define APPLET_NAME(i) (applet_names + applet_nameofs[i])
25#endif
26
27#if ENABLE_FEATURE_PREFER_APPLETS 22#if ENABLE_FEATURE_PREFER_APPLETS
28# define APPLET_IS_NOFORK(i) (applet_nameofs[i] & (1 << 12)) 23# define APPLET_IS_NOFORK(i) (applet_flags[(i)/4] & (1 << (2 * ((i)%4))))
29# define APPLET_IS_NOEXEC(i) (applet_nameofs[i] & (1 << 13)) 24# define APPLET_IS_NOEXEC(i) (applet_flags[(i)/4] & (1 << ((2 * ((i)%4))+1)))
30#else 25#else
31# define APPLET_IS_NOFORK(i) 0 26# define APPLET_IS_NOFORK(i) 0
32# define APPLET_IS_NOEXEC(i) 0 27# define APPLET_IS_NOEXEC(i) 0
33#endif 28#endif
34 29
35#if ENABLE_FEATURE_SUID 30#if ENABLE_FEATURE_SUID
36# define APPLET_SUID(i) ((applet_nameofs[i] >> 14) & 0x3) 31# define APPLET_SUID(i) ((applet_suid[(i)/4] >> (2 * ((i)%4)) & 3))
37#endif 32#endif
38 33
39#if ENABLE_FEATURE_INSTALLER 34#if ENABLE_FEATURE_INSTALLER
diff --git a/include/libbb.h b/include/libbb.h
index cb61faad9..ffe1504e1 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -148,14 +148,18 @@
148# include <ws2tcpip.h> 148# include <ws2tcpip.h>
149#else 149#else
150# include <arpa/inet.h> 150# include <arpa/inet.h>
151# if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED) 151//This breaks on bionic:
152/* We #define socklen_t *after* includes, otherwise we get 152//# if !defined(__socklen_t_defined) && !defined(_SOCKLEN_T_DECLARED)
153 * typedef redefinition errors from system headers 153///* We #define socklen_t *after* includes, otherwise we get
154 * (in case "is it defined already" detection above failed) 154// * typedef redefinition errors from system headers
155 */ 155// * (in case "is it defined already" detection above failed)
156# define socklen_t bb_socklen_t 156// */
157 typedef unsigned socklen_t; 157//# define socklen_t bb_socklen_t
158# endif 158// typedef unsigned socklen_t;
159//# endif
160//if this is still needed, add a fix along the lines of
161// ifdef SPECIFIC_BROKEN_LIBC_CHECK / typedef socklen_t / endif
162//in platform.h instead!
159#endif 163#endif
160#ifndef HAVE_CLEARENV 164#ifndef HAVE_CLEARENV
161# define clearenv() do { if (environ) environ[0] = NULL; } while (0) 165# define clearenv() do { if (environ) environ[0] = NULL; } while (0)
@@ -507,6 +511,7 @@ void xsetuid(uid_t uid) FAST_FUNC;
507void xsetegid(gid_t egid) FAST_FUNC; 511void xsetegid(gid_t egid) FAST_FUNC;
508void xseteuid(uid_t euid) FAST_FUNC; 512void xseteuid(uid_t euid) FAST_FUNC;
509void xchdir(const char *path) FAST_FUNC; 513void xchdir(const char *path) FAST_FUNC;
514void xfchdir(int fd) FAST_FUNC;
510void xchroot(const char *path) FAST_FUNC; 515void xchroot(const char *path) FAST_FUNC;
511void xsetenv(const char *key, const char *value) FAST_FUNC; 516void xsetenv(const char *key, const char *value) FAST_FUNC;
512void bb_unsetenv(const char *key) FAST_FUNC; 517void bb_unsetenv(const char *key) FAST_FUNC;
@@ -1001,9 +1006,10 @@ int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC;
1001#define BB_EXECVP(prog,cmd) execvp(prog,cmd) 1006#define BB_EXECVP(prog,cmd) execvp(prog,cmd)
1002#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__) 1007#define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__)
1003#endif 1008#endif
1004int BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; 1009void BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC;
1010void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC;
1005 1011
1006/* xvfork() can't be a _function_, return after vfork mangles stack 1012/* xvfork() can't be a _function_, return after vfork in child mangles stack
1007 * in the parent. It must be a macro. */ 1013 * in the parent. It must be a macro. */
1008#define xvfork() \ 1014#define xvfork() \
1009({ \ 1015({ \
@@ -1015,6 +1021,7 @@ int BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC;
1015#if BB_MMU 1021#if BB_MMU
1016pid_t xfork(void) FAST_FUNC; 1022pid_t xfork(void) FAST_FUNC;
1017#endif 1023#endif
1024void xvfork_parent_waits_and_exits(void) FAST_FUNC;
1018 1025
1019/* NOMMU friendy fork+exec: */ 1026/* NOMMU friendy fork+exec: */
1020pid_t spawn(char **argv) FAST_FUNC; 1027pid_t spawn(char **argv) FAST_FUNC;
@@ -1031,6 +1038,7 @@ pid_t wait_any_nohang(int *wstat) FAST_FUNC;
1031 * if (rc > 0) bb_error_msg("exit code: %d", rc & 0xff); 1038 * if (rc > 0) bb_error_msg("exit code: %d", rc & 0xff);
1032 */ 1039 */
1033int wait4pid(pid_t pid) FAST_FUNC; 1040int wait4pid(pid_t pid) FAST_FUNC;
1041int wait_for_exitstatus(pid_t pid) FAST_FUNC;
1034/* Same as wait4pid(spawn(argv)), but with NOFORK/NOEXEC if configured: */ 1042/* Same as wait4pid(spawn(argv)), but with NOFORK/NOEXEC if configured: */
1035int spawn_and_wait(char **argv) FAST_FUNC; 1043int spawn_and_wait(char **argv) FAST_FUNC;
1036/* Does NOT check that applet is NOFORK, just blindly runs it */ 1044/* Does NOT check that applet is NOFORK, just blindly runs it */
@@ -1160,7 +1168,6 @@ extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1,
1160extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; 1168extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
1161extern void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC; 1169extern void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC;
1162extern void bb_perror_nomsg(void) FAST_FUNC; 1170extern void bb_perror_nomsg(void) FAST_FUNC;
1163extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
1164extern void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC; 1171extern void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC;
1165extern void bb_logenv_override(void) FAST_FUNC; 1172extern void bb_logenv_override(void) FAST_FUNC;
1166 1173
@@ -1784,6 +1791,9 @@ void bb_progress_update(bb_progress_t *p,
1784 uoff_t transferred, 1791 uoff_t transferred,
1785 uoff_t totalsize) FAST_FUNC; 1792 uoff_t totalsize) FAST_FUNC;
1786 1793
1794unsigned ubi_devnum_from_devname(const char *str) FAST_FUNC;
1795int ubi_get_volid_by_name(unsigned ubi_devnum, const char *vol_name) FAST_FUNC;
1796
1787 1797
1788extern const char *applet_name; 1798extern const char *applet_name;
1789 1799