diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 20 | ||||
-rw-r--r-- | include/platform.h | 1 |
2 files changed, 16 insertions, 5 deletions
diff --git a/include/libbb.h b/include/libbb.h index e540f2a90..740c25528 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -691,6 +691,7 @@ void xsetgid(gid_t gid) FAST_FUNC; | |||
691 | void xsetuid(uid_t uid) FAST_FUNC; | 691 | void xsetuid(uid_t uid) FAST_FUNC; |
692 | void xsetegid(gid_t egid) FAST_FUNC; | 692 | void xsetegid(gid_t egid) FAST_FUNC; |
693 | void xseteuid(uid_t euid) FAST_FUNC; | 693 | void xseteuid(uid_t euid) FAST_FUNC; |
694 | int chdir_or_warn(const char *path) FAST_FUNC; | ||
694 | void xchdir(const char *path) FAST_FUNC; | 695 | void xchdir(const char *path) FAST_FUNC; |
695 | void xfchdir(int fd) FAST_FUNC; | 696 | void xfchdir(int fd) FAST_FUNC; |
696 | void xchroot(const char *path) FAST_FUNC; | 697 | void xchroot(const char *path) FAST_FUNC; |
@@ -1776,7 +1777,7 @@ extern void selinux_or_die(void) FAST_FUNC; | |||
1776 | 1777 | ||
1777 | 1778 | ||
1778 | /* setup_environment: | 1779 | /* setup_environment: |
1779 | * if !SETUP_ENV_NO_CHDIR: | 1780 | * if SETUP_ENV_CHDIR: |
1780 | * if cd(pw->pw_dir): ok: else if SETUP_ENV_TO_TMP: cd(/tmp) else: cd(/) or die | 1781 | * if cd(pw->pw_dir): ok: else if SETUP_ENV_TO_TMP: cd(/tmp) else: cd(/) or die |
1781 | * if SETUP_ENV_CLEARENV: cd(pw->pw_dir), clear environment, then set | 1782 | * if SETUP_ENV_CLEARENV: cd(pw->pw_dir), clear environment, then set |
1782 | * TERM=(old value) | 1783 | * TERM=(old value) |
@@ -1784,7 +1785,7 @@ extern void selinux_or_die(void) FAST_FUNC; | |||
1784 | * PATH=bb_default_[root_]path | 1785 | * PATH=bb_default_[root_]path |
1785 | * HOME=pw->pw_dir | 1786 | * HOME=pw->pw_dir |
1786 | * SHELL=shell | 1787 | * SHELL=shell |
1787 | * else if SETUP_ENV_CHANGEENV: | 1788 | * else if SETUP_ENV_CHANGEENV | SETUP_ENV_CHANGEENV_LOGNAME: |
1788 | * if not root (if pw->pw_uid != 0) or if SETUP_ENV_CHANGEENV_LOGNAME: | 1789 | * if not root (if pw->pw_uid != 0) or if SETUP_ENV_CHANGEENV_LOGNAME: |
1789 | * USER=pw->pw_name, LOGNAME=pw->pw_name | 1790 | * USER=pw->pw_name, LOGNAME=pw->pw_name |
1790 | * HOME=pw->pw_dir | 1791 | * HOME=pw->pw_dir |
@@ -1798,7 +1799,7 @@ extern void selinux_or_die(void) FAST_FUNC; | |||
1798 | #define SETUP_ENV_CHANGEENV_LOGNAME (1 << 1) | 1799 | #define SETUP_ENV_CHANGEENV_LOGNAME (1 << 1) |
1799 | #define SETUP_ENV_CLEARENV (1 << 2) | 1800 | #define SETUP_ENV_CLEARENV (1 << 2) |
1800 | #define SETUP_ENV_TO_TMP (1 << 3) | 1801 | #define SETUP_ENV_TO_TMP (1 << 3) |
1801 | #define SETUP_ENV_NO_CHDIR (1 << 4) | 1802 | #define SETUP_ENV_CHDIR (1 << 4) |
1802 | void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC; | 1803 | void setup_environment(const char *shell, int flags, const struct passwd *pw) FAST_FUNC; |
1803 | void nuke_str(char *str) FAST_FUNC; | 1804 | void nuke_str(char *str) FAST_FUNC; |
1804 | #if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM | 1805 | #if ENABLE_FEATURE_SECURETTY && !ENABLE_PAM |
@@ -1955,6 +1956,8 @@ enum { | |||
1955 | * (unless fd is in non-blocking mode), | 1956 | * (unless fd is in non-blocking mode), |
1956 | * subsequent reads will time out after a few milliseconds. | 1957 | * subsequent reads will time out after a few milliseconds. |
1957 | * Return of -1 means EOF or error (errno == 0 on EOF). | 1958 | * Return of -1 means EOF or error (errno == 0 on EOF). |
1959 | * Nonzero errno is not preserved across the call: | ||
1960 | * if there was no error, errno will be cleared to 0. | ||
1958 | * buffer[0] is used as a counter of buffered chars and must be 0 | 1961 | * buffer[0] is used as a counter of buffered chars and must be 0 |
1959 | * on first call. | 1962 | * on first call. |
1960 | * timeout: | 1963 | * timeout: |
@@ -1963,6 +1966,12 @@ enum { | |||
1963 | * >=0: poll() for TIMEOUT milliseconds, return -1/EAGAIN on timeout | 1966 | * >=0: poll() for TIMEOUT milliseconds, return -1/EAGAIN on timeout |
1964 | */ | 1967 | */ |
1965 | int64_t read_key(int fd, char *buffer, int timeout) FAST_FUNC; | 1968 | int64_t read_key(int fd, char *buffer, int timeout) FAST_FUNC; |
1969 | #if ENABLE_PLATFORM_MINGW32 | ||
1970 | #define safe_read_key(f, b, t) read_key(f, b, t) | ||
1971 | #else | ||
1972 | /* This version loops on EINTR: */ | ||
1973 | int64_t safe_read_key(int fd, char *buffer, int timeout) FAST_FUNC; | ||
1974 | #endif | ||
1966 | void read_key_ungets(char *buffer, const char *str, unsigned len) FAST_FUNC; | 1975 | void read_key_ungets(char *buffer, const char *str, unsigned len) FAST_FUNC; |
1967 | 1976 | ||
1968 | 1977 | ||
@@ -2016,7 +2025,8 @@ enum { | |||
2016 | USERNAME_COMPLETION = 4 * ENABLE_FEATURE_USERNAME_COMPLETION, | 2025 | USERNAME_COMPLETION = 4 * ENABLE_FEATURE_USERNAME_COMPLETION, |
2017 | VI_MODE = 8 * ENABLE_FEATURE_EDITING_VI, | 2026 | VI_MODE = 8 * ENABLE_FEATURE_EDITING_VI, |
2018 | WITH_PATH_LOOKUP = 0x10, | 2027 | WITH_PATH_LOOKUP = 0x10, |
2019 | FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, | 2028 | LI_INTERRUPTIBLE = 0x20, |
2029 | FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION | LI_INTERRUPTIBLE, | ||
2020 | }; | 2030 | }; |
2021 | line_input_t *new_line_input_t(int flags) FAST_FUNC; | 2031 | line_input_t *new_line_input_t(int flags) FAST_FUNC; |
2022 | #if ENABLE_FEATURE_EDITING_SAVEHISTORY | 2032 | #if ENABLE_FEATURE_EDITING_SAVEHISTORY |
@@ -2361,7 +2371,7 @@ struct globals; | |||
2361 | /* '*const' ptr makes gcc optimize code much better. | 2371 | /* '*const' ptr makes gcc optimize code much better. |
2362 | * Magic prevents ptr_to_globals from going into rodata. | 2372 | * Magic prevents ptr_to_globals from going into rodata. |
2363 | * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */ | 2373 | * If you want to assign a value, use SET_PTR_TO_GLOBALS(x) */ |
2364 | extern struct globals *const ptr_to_globals; | 2374 | extern struct globals *BB_GLOBAL_CONST ptr_to_globals; |
2365 | 2375 | ||
2366 | #define barrier() asm volatile ("":::"memory") | 2376 | #define barrier() asm volatile ("":::"memory") |
2367 | 2377 | ||
diff --git a/include/platform.h b/include/platform.h index 3fb1a2dc8..8ae5ed4bc 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -367,6 +367,7 @@ typedef unsigned smalluint; | |||
367 | # define ALIGN4 | 367 | # define ALIGN4 |
368 | #endif | 368 | #endif |
369 | #define ALIGN8 __attribute__((aligned(8))) | 369 | #define ALIGN8 __attribute__((aligned(8))) |
370 | #define ALIGN_INT __attribute__((aligned(sizeof(int)))) | ||
370 | #define ALIGN_PTR __attribute__((aligned(sizeof(void*)))) | 371 | #define ALIGN_PTR __attribute__((aligned(sizeof(void*)))) |
371 | 372 | ||
372 | /* | 373 | /* |