diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/ar_.h (renamed from include/ar.h) | 0 | ||||
-rw-r--r-- | include/libbb.h | 78 | ||||
-rw-r--r-- | include/mingw.h | 1 | ||||
-rw-r--r-- | include/platform.h | 4 | ||||
-rw-r--r-- | include/rtc_.h | 6 | ||||
-rw-r--r-- | include/usage.src.h | 6 |
6 files changed, 79 insertions, 16 deletions
diff --git a/include/ar.h b/include/ar_.h index 386fe0456..386fe0456 100644 --- a/include/ar.h +++ b/include/ar_.h | |||
diff --git a/include/libbb.h b/include/libbb.h index eb8b63895..3d6a6a0cf 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -106,7 +106,11 @@ | |||
106 | # define updwtmpx updwtmp | 106 | # define updwtmpx updwtmp |
107 | # define _PATH_UTMPX _PATH_UTMP | 107 | # define _PATH_UTMPX _PATH_UTMP |
108 | # else | 108 | # else |
109 | # include <utmp.h> | 109 | # if !defined(__FreeBSD__) |
110 | # include <utmp.h> | ||
111 | # else | ||
112 | # define _PATH_UTMPX "/var/run/utx.active" | ||
113 | # endif | ||
110 | # include <utmpx.h> | 114 | # include <utmpx.h> |
111 | # if defined _PATH_UTMP && !defined _PATH_UTMPX | 115 | # if defined _PATH_UTMP && !defined _PATH_UTMPX |
112 | # define _PATH_UTMPX _PATH_UTMP | 116 | # define _PATH_UTMPX _PATH_UTMP |
@@ -405,6 +409,32 @@ void* xrealloc_vector_helper(void *vector, unsigned sizeof_and_shift, int idx) F | |||
405 | char *xstrdup(const char *s) FAST_FUNC RETURNS_MALLOC; | 409 | char *xstrdup(const char *s) FAST_FUNC RETURNS_MALLOC; |
406 | char *xstrndup(const char *s, int n) FAST_FUNC RETURNS_MALLOC; | 410 | char *xstrndup(const char *s, int n) FAST_FUNC RETURNS_MALLOC; |
407 | void *xmemdup(const void *s, int n) FAST_FUNC RETURNS_MALLOC; | 411 | void *xmemdup(const void *s, int n) FAST_FUNC RETURNS_MALLOC; |
412 | void *mmap_read(int fd, size_t size) FAST_FUNC; | ||
413 | void *mmap_anon(size_t size) FAST_FUNC; | ||
414 | void *xmmap_anon(size_t size) FAST_FUNC; | ||
415 | |||
416 | #if defined(__x86_64__) || defined(i386) | ||
417 | # define BB_ARCH_FIXED_PAGESIZE 4096 | ||
418 | #elif defined(__arm__) /* only 32bit, 64bit ARM has variable page size */ | ||
419 | # define BB_ARCH_FIXED_PAGESIZE 4096 | ||
420 | #else /* if defined(ARCH) */ | ||
421 | /* add you favorite arch today! */ | ||
422 | //From Linux kernel inspection: | ||
423 | //xtenza,s390[x],riscv,nios2,csky,sparc32: fixed 4k pages | ||
424 | //sparc64,alpha,openrisc: fixed 8k pages | ||
425 | #endif | ||
426 | |||
427 | #if defined BB_ARCH_FIXED_PAGESIZE | ||
428 | # define IF_VARIABLE_ARCH_PAGESIZE(...) /*nothing*/ | ||
429 | # define bb_getpagesize() BB_ARCH_FIXED_PAGESIZE | ||
430 | # define INIT_PAGESIZE(var) ((void)0) | ||
431 | # define cached_pagesize(var) BB_ARCH_FIXED_PAGESIZE | ||
432 | #else | ||
433 | # define IF_VARIABLE_ARCH_PAGESIZE(...) __VA_ARGS__ | ||
434 | # define bb_getpagesize() getpagesize() | ||
435 | # define INIT_PAGESIZE(var) ((var) = getpagesize()) | ||
436 | # define cached_pagesize(var) (var) | ||
437 | #endif | ||
408 | 438 | ||
409 | 439 | ||
410 | //TODO: supply a pointer to char[11] buffer (avoid statics)? | 440 | //TODO: supply a pointer to char[11] buffer (avoid statics)? |
@@ -670,6 +700,9 @@ void parse_datestr(const char *date_str, struct tm *ptm) FAST_FUNC; | |||
670 | time_t validate_tm_time(const char *date_str, struct tm *ptm) FAST_FUNC; | 700 | time_t validate_tm_time(const char *date_str, struct tm *ptm) FAST_FUNC; |
671 | char *strftime_HHMMSS(char *buf, unsigned len, time_t *tp) FAST_FUNC; | 701 | char *strftime_HHMMSS(char *buf, unsigned len, time_t *tp) FAST_FUNC; |
672 | char *strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp) FAST_FUNC; | 702 | char *strftime_YYYYMMDDHHMMSS(char *buf, unsigned len, time_t *tp) FAST_FUNC; |
703 | void xgettimeofday(struct timeval *tv) FAST_FUNC; | ||
704 | void xsettimeofday(const struct timeval *tv) FAST_FUNC; | ||
705 | |||
673 | 706 | ||
674 | int xsocket(int domain, int type, int protocol) FAST_FUNC; | 707 | int xsocket(int domain, int type, int protocol) FAST_FUNC; |
675 | void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) FAST_FUNC; | 708 | void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) FAST_FUNC; |
@@ -1065,8 +1098,9 @@ void generate_uuid(uint8_t *buf) FAST_FUNC; | |||
1065 | /* Last element is marked by mult == 0 */ | 1098 | /* Last element is marked by mult == 0 */ |
1066 | struct suffix_mult { | 1099 | struct suffix_mult { |
1067 | char suffix[4]; | 1100 | char suffix[4]; |
1068 | unsigned mult; | 1101 | uint32_t mult; |
1069 | }; | 1102 | }; |
1103 | #define ALIGN_SUFFIX ALIGN4 | ||
1070 | extern const struct suffix_mult bkm_suffixes[]; | 1104 | extern const struct suffix_mult bkm_suffixes[]; |
1071 | #define km_suffixes (bkm_suffixes + 1) | 1105 | #define km_suffixes (bkm_suffixes + 1) |
1072 | extern const struct suffix_mult cwbkMG_suffixes[]; | 1106 | extern const struct suffix_mult cwbkMG_suffixes[]; |
@@ -1178,7 +1212,6 @@ int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC; | |||
1178 | #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__) | 1212 | #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__) |
1179 | #endif | 1213 | #endif |
1180 | void BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; | 1214 | void BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; |
1181 | void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC; | ||
1182 | 1215 | ||
1183 | /* xvfork() can't be a _function_, return after vfork in child mangles stack | 1216 | /* xvfork() can't be a _function_, return after vfork in child mangles stack |
1184 | * in the parent. It must be a macro. */ | 1217 | * in the parent. It must be a macro. */ |
@@ -1644,12 +1677,14 @@ char *bb_simplify_path(const char *path) FAST_FUNC; | |||
1644 | /* Returns ptr to NUL */ | 1677 | /* Returns ptr to NUL */ |
1645 | char *bb_simplify_abs_path_inplace(char *path) FAST_FUNC; | 1678 | char *bb_simplify_abs_path_inplace(char *path) FAST_FUNC; |
1646 | 1679 | ||
1647 | #ifndef LOGIN_FAIL_DELAY | 1680 | void pause_after_failed_login(void) FAST_FUNC; |
1648 | #define LOGIN_FAIL_DELAY 3 | 1681 | void bb_do_delay(unsigned seconds) FAST_FUNC; |
1649 | #endif | 1682 | void msleep(unsigned ms) FAST_FUNC; |
1650 | extern void bb_do_delay(int seconds) FAST_FUNC; | 1683 | void sleep1(void) FAST_FUNC; |
1651 | extern void change_identity(const struct passwd *pw) FAST_FUNC; | 1684 | void change_identity(const struct passwd *pw) FAST_FUNC; |
1652 | extern void run_shell(const char *shell, int loginshell, const char **args) NORETURN FAST_FUNC; | 1685 | void exec_shell(const char *shell, int loginshell, const char **args) NORETURN FAST_FUNC; |
1686 | void exec_login_shell(const char *shell) NORETURN FAST_FUNC; | ||
1687 | void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC; | ||
1653 | 1688 | ||
1654 | /* Returns $SHELL, getpwuid(getuid())->pw_shell, or DEFAULT_SHELL. | 1689 | /* Returns $SHELL, getpwuid(getuid())->pw_shell, or DEFAULT_SHELL. |
1655 | * Note that getpwuid result might need xstrdup'ing | 1690 | * Note that getpwuid result might need xstrdup'ing |
@@ -1884,14 +1919,20 @@ typedef const char *get_exe_name_t(int i) FAST_FUNC; | |||
1884 | typedef struct line_input_t { | 1919 | typedef struct line_input_t { |
1885 | int flags; | 1920 | int flags; |
1886 | int timeout; | 1921 | int timeout; |
1922 | # if ENABLE_FEATURE_TAB_COMPLETION | ||
1923 | # if ENABLE_SHELL_ASH | ||
1887 | const char *path_lookup; | 1924 | const char *path_lookup; |
1888 | # if ENABLE_FEATURE_TAB_COMPLETION \ | 1925 | # define EDITING_HAS_path_lookup 1 |
1889 | && (ENABLE_ASH || ENABLE_SH_IS_ASH || ENABLE_BASH_IS_ASH \ | 1926 | # else |
1890 | || ENABLE_HUSH || ENABLE_SH_IS_HUSH || ENABLE_BASH_IS_HUSH \ | 1927 | # define EDITING_HAS_path_lookup 0 |
1891 | ) | 1928 | # endif |
1929 | # if ENABLE_SHELL_ASH || ENABLE_SHELL_HUSH | ||
1892 | /* function to fetch additional application-specific names to match */ | 1930 | /* function to fetch additional application-specific names to match */ |
1893 | get_exe_name_t *get_exe_name; | 1931 | get_exe_name_t *get_exe_name; |
1894 | # define EDITING_HAS_get_exe_name 1 | 1932 | # define EDITING_HAS_get_exe_name 1 |
1933 | # else | ||
1934 | # define EDITING_HAS_get_exe_name 0 | ||
1935 | # endif | ||
1895 | # endif | 1936 | # endif |
1896 | # if MAX_HISTORY | 1937 | # if MAX_HISTORY |
1897 | int cnt_history; | 1938 | int cnt_history; |
@@ -1919,7 +1960,11 @@ enum { | |||
1919 | FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, | 1960 | FOR_SHELL = DO_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, |
1920 | }; | 1961 | }; |
1921 | line_input_t *new_line_input_t(int flags) FAST_FUNC; | 1962 | line_input_t *new_line_input_t(int flags) FAST_FUNC; |
1963 | #if ENABLE_FEATURE_EDITING_SAVEHISTORY | ||
1922 | void free_line_input_t(line_input_t *n) FAST_FUNC; | 1964 | void free_line_input_t(line_input_t *n) FAST_FUNC; |
1965 | #else | ||
1966 | # define free_line_input_t(n) free(n) | ||
1967 | #endif | ||
1923 | /* | 1968 | /* |
1924 | * maxsize must be >= 2. | 1969 | * maxsize must be >= 2. |
1925 | * Returns: | 1970 | * Returns: |
@@ -2079,14 +2124,17 @@ char *percent_decode_in_place(char *str, int strict) FAST_FUNC; | |||
2079 | 2124 | ||
2080 | 2125 | ||
2081 | extern const char bb_uuenc_tbl_base64[] ALIGN1; | 2126 | extern const char bb_uuenc_tbl_base64[] ALIGN1; |
2127 | extern const char bb_uuenc_tbl_base32[] ALIGN1; | ||
2082 | extern const char bb_uuenc_tbl_std[] ALIGN1; | 2128 | extern const char bb_uuenc_tbl_std[] ALIGN1; |
2083 | void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC; | 2129 | void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC; |
2084 | enum { | 2130 | enum { |
2085 | BASE64_FLAG_UU_STOP = 0x100, | 2131 | BASE64_FLAG_UU_STOP = 0x100, |
2132 | BASE64_32 = 0x200, /* base32 */ | ||
2086 | /* Sign-extends to a value which never matches fgetc result: */ | 2133 | /* Sign-extends to a value which never matches fgetc result: */ |
2087 | BASE64_FLAG_NO_STOP_CHAR = 0x80, | 2134 | BASE64_FLAG_NO_STOP_CHAR = 0x80, |
2088 | }; | 2135 | }; |
2089 | const char *decode_base64(char **pp_dst, const char *src) FAST_FUNC; | 2136 | char *decode_base64(char *dst, const char **pp_src) FAST_FUNC; |
2137 | char *decode_base32(char *dst, const char **pp_src) FAST_FUNC; | ||
2090 | void read_base64(FILE *src_stream, FILE *dst_stream, int flags) FAST_FUNC; | 2138 | void read_base64(FILE *src_stream, FILE *dst_stream, int flags) FAST_FUNC; |
2091 | 2139 | ||
2092 | typedef struct md5_ctx_t { | 2140 | typedef struct md5_ctx_t { |
diff --git a/include/mingw.h b/include/mingw.h index 8af2e3938..d1e638231 100644 --- a/include/mingw.h +++ b/include/mingw.h | |||
@@ -31,6 +31,7 @@ int inet_pton(int af, const char *src, void *dst); | |||
31 | #define O_NONBLOCK 0 | 31 | #define O_NONBLOCK 0 |
32 | #define O_NOFOLLOW 0 | 32 | #define O_NOFOLLOW 0 |
33 | #define O_NOCTTY 0 | 33 | #define O_NOCTTY 0 |
34 | #define O_DIRECT 0 | ||
34 | #define O_SPECIAL 0x800000 | 35 | #define O_SPECIAL 0x800000 |
35 | 36 | ||
36 | /* | 37 | /* |
diff --git a/include/platform.h b/include/platform.h index f1c09c4d2..ea97d2682 100644 --- a/include/platform.h +++ b/include/platform.h | |||
@@ -335,7 +335,7 @@ typedef unsigned smalluint; | |||
335 | #endif | 335 | #endif |
336 | 336 | ||
337 | /* Define bb_setpgrp */ | 337 | /* Define bb_setpgrp */ |
338 | #if defined(__digital__) && defined(__unix__) | 338 | #if (defined(__digital__) && defined(__unix__)) || defined(__FreeBSD__) |
339 | /* use legacy setpgrp(pid_t, pid_t) for now. move to platform.c */ | 339 | /* use legacy setpgrp(pid_t, pid_t) for now. move to platform.c */ |
340 | # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0) | 340 | # define bb_setpgrp() do { pid_t __me = getpid(); setpgrp(__me, __me); } while (0) |
341 | #else | 341 | #else |
@@ -358,6 +358,8 @@ typedef unsigned smalluint; | |||
358 | # define ALIGN2 | 358 | # define ALIGN2 |
359 | # define ALIGN4 | 359 | # define ALIGN4 |
360 | #endif | 360 | #endif |
361 | #define ALIGN8 __attribute__((aligned(8))) | ||
362 | #define ALIGN_PTR __attribute__((aligned(sizeof(void*)))) | ||
361 | 363 | ||
362 | /* | 364 | /* |
363 | * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably. | 365 | * For 0.9.29 and svn, __ARCH_USE_MMU__ indicates no-mmu reliably. |
diff --git a/include/rtc_.h b/include/rtc_.h index 750fc20ec..24ff5363f 100644 --- a/include/rtc_.h +++ b/include/rtc_.h | |||
@@ -11,6 +11,12 @@ | |||
11 | 11 | ||
12 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN | 12 | PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN |
13 | 13 | ||
14 | #if ENABLE_FEATURE_HWCLOCK_ADJTIME_FHS | ||
15 | # define ADJTIME_PATH "/var/lib/hwclock/adjtime" | ||
16 | #else | ||
17 | # define ADJTIME_PATH "/etc/adjtime" | ||
18 | #endif | ||
19 | |||
14 | int rtc_adjtime_is_utc(void) FAST_FUNC; | 20 | int rtc_adjtime_is_utc(void) FAST_FUNC; |
15 | int rtc_xopen(const char **default_rtc, int flags) FAST_FUNC; | 21 | int rtc_xopen(const char **default_rtc, int flags) FAST_FUNC; |
16 | void rtc_read_tm(struct tm *ptm, int fd) FAST_FUNC; | 22 | void rtc_read_tm(struct tm *ptm, int fd) FAST_FUNC; |
diff --git a/include/usage.src.h b/include/usage.src.h index d22efd3ba..1ac252d1b 100644 --- a/include/usage.src.h +++ b/include/usage.src.h | |||
@@ -25,6 +25,12 @@ | |||
25 | " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")" | 25 | " (default "CONFIG_FEATURE_DEFAULT_PASSWD_ALGO")" |
26 | #endif | 26 | #endif |
27 | 27 | ||
28 | #if ENABLE_FEATURE_HWCLOCK_ADJTIME_FHS | ||
29 | # define ADJTIME_PATH "/var/lib/hwclock/adjtime" | ||
30 | #else | ||
31 | # define ADJTIME_PATH "/etc/adjtime" | ||
32 | #endif | ||
33 | |||
28 | INSERT | 34 | INSERT |
29 | 35 | ||
30 | #define busybox_notes_usage \ | 36 | #define busybox_notes_usage \ |