diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-22 13:15:08 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-22 13:15:08 +0000 |
commit | c0d4367d6b581eb5989c02815880cf0fa2851ae8 (patch) | |
tree | 868c266e627e2d7f65ba5a4d5f98a1c421453181 /include/libbb.h | |
parent | f6bad5ef766b0447158e3de2f55c35f1f6cecb58 (diff) | |
parent | da4441c44f6efccb6f7b7588404d9c6bfb7b6af8 (diff) | |
download | busybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.tar.gz busybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.tar.bz2 busybox-w32-c0d4367d6b581eb5989c02815880cf0fa2851ae8.zip |
Merge commit 'da4441c44f6efccb6f7b7588404d9c6bfb7b6af8' into merge
Conflicts:
libbb/vfork_daemon_rexec.c
networking/wget.c
procps/ps.c
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 57 |
1 files changed, 30 insertions, 27 deletions
diff --git a/include/libbb.h b/include/libbb.h index 7efa32349..6564038e9 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -33,10 +33,12 @@ | |||
33 | #include <sys/stat.h> | 33 | #include <sys/stat.h> |
34 | #include <sys/time.h> | 34 | #include <sys/time.h> |
35 | #include <sys/types.h> | 35 | #include <sys/types.h> |
36 | #ifndef major | ||
37 | # include <sys/sysmacros.h> | ||
38 | #endif | ||
36 | #include <sys/wait.h> | 39 | #include <sys/wait.h> |
37 | #include <termios.h> | 40 | #include <termios.h> |
38 | #include <time.h> | 41 | #include <time.h> |
39 | #include <unistd.h> | ||
40 | #include <sys/param.h> | 42 | #include <sys/param.h> |
41 | #ifdef HAVE_MNTENT_H | 43 | #ifdef HAVE_MNTENT_H |
42 | # include <mntent.h> | 44 | # include <mntent.h> |
@@ -875,6 +877,7 @@ void FAST_FUNC update_utmp(pid_t pid, int new_type, const char *tty_name, const | |||
875 | # define update_utmp(pid, new_type, tty_name, username, hostname) ((void)0) | 877 | # define update_utmp(pid, new_type, tty_name, username, hostname) ((void)0) |
876 | #endif | 878 | #endif |
877 | 879 | ||
880 | |||
878 | int execable_file(const char *name) FAST_FUNC; | 881 | int execable_file(const char *name) FAST_FUNC; |
879 | char *find_execable(const char *filename, char **PATHp) FAST_FUNC; | 882 | char *find_execable(const char *filename, char **PATHp) FAST_FUNC; |
880 | int exists_execable(const char *filename) FAST_FUNC; | 883 | int exists_execable(const char *filename) FAST_FUNC; |
@@ -883,14 +886,16 @@ int exists_execable(const char *filename) FAST_FUNC; | |||
883 | * but it may exec busybox and call applet instead of searching PATH. | 886 | * but it may exec busybox and call applet instead of searching PATH. |
884 | */ | 887 | */ |
885 | #if ENABLE_FEATURE_PREFER_APPLETS | 888 | #if ENABLE_FEATURE_PREFER_APPLETS |
886 | int bb_execvp(const char *file, char *const argv[]) FAST_FUNC; | 889 | int BB_EXECVP(const char *file, char *const argv[]) FAST_FUNC; |
887 | #define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd) | ||
888 | #define BB_EXECLP(prog,cmd,...) \ | 890 | #define BB_EXECLP(prog,cmd,...) \ |
889 | execlp((find_applet_by_name(prog) >= 0) ? CONFIG_BUSYBOX_EXEC_PATH : prog, \ | 891 | do { \ |
890 | cmd, __VA_ARGS__) | 892 | if (find_applet_by_name(prog) >= 0) \ |
893 | execlp(bb_busybox_exec_path, cmd, __VA_ARGS__); \ | ||
894 | execlp(prog, cmd, __VA_ARGS__); \ | ||
895 | } while (0) | ||
891 | #else | 896 | #else |
892 | #define BB_EXECVP(prog,cmd) execvp(prog,cmd) | 897 | #define BB_EXECVP(prog,cmd) execvp(prog,cmd) |
893 | #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd, __VA_ARGS__) | 898 | #define BB_EXECLP(prog,cmd,...) execlp(prog,cmd,__VA_ARGS__) |
894 | #endif | 899 | #endif |
895 | int BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; | 900 | int BB_EXECVP_or_die(char **argv) NORETURN FAST_FUNC; |
896 | 901 | ||
@@ -924,19 +929,8 @@ pid_t wait_any_nohang(int *wstat) FAST_FUNC; | |||
924 | int wait4pid(pid_t pid) FAST_FUNC; | 929 | int wait4pid(pid_t pid) FAST_FUNC; |
925 | /* Same as wait4pid(spawn(argv)), but with NOFORK/NOEXEC if configured: */ | 930 | /* Same as wait4pid(spawn(argv)), but with NOFORK/NOEXEC if configured: */ |
926 | int spawn_and_wait(char **argv) FAST_FUNC; | 931 | int spawn_and_wait(char **argv) FAST_FUNC; |
927 | struct nofork_save_area { | ||
928 | jmp_buf die_jmp; | ||
929 | const char *applet_name; | ||
930 | uint32_t option_mask32; | ||
931 | int die_sleep; | ||
932 | uint8_t xfunc_error_retval; | ||
933 | smallint saved; | ||
934 | }; | ||
935 | void save_nofork_data(struct nofork_save_area *save) FAST_FUNC; | ||
936 | void restore_nofork_data(struct nofork_save_area *save) FAST_FUNC; | ||
937 | /* Does NOT check that applet is NOFORK, just blindly runs it */ | 932 | /* Does NOT check that applet is NOFORK, just blindly runs it */ |
938 | int run_nofork_applet(int applet_no, char **argv) FAST_FUNC; | 933 | int run_nofork_applet(int applet_no, char **argv) FAST_FUNC; |
939 | int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **argv) FAST_FUNC; | ||
940 | 934 | ||
941 | /* Helpers for daemonization. | 935 | /* Helpers for daemonization. |
942 | * | 936 | * |
@@ -1417,17 +1411,18 @@ enum { | |||
1417 | }; | 1411 | }; |
1418 | line_input_t *new_line_input_t(int flags) FAST_FUNC; | 1412 | line_input_t *new_line_input_t(int flags) FAST_FUNC; |
1419 | /* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */ | 1413 | /* So far static: void free_line_input_t(line_input_t *n) FAST_FUNC; */ |
1420 | /* maxsize must be >= 2. | 1414 | /* |
1415 | * maxsize must be >= 2. | ||
1421 | * Returns: | 1416 | * Returns: |
1422 | * -1 on read errors or EOF, or on bare Ctrl-D, | 1417 | * -1 on read errors or EOF, or on bare Ctrl-D, |
1423 | * 0 on ctrl-C (the line entered is still returned in 'command'), | 1418 | * 0 on ctrl-C (the line entered is still returned in 'command'), |
1424 | * >0 length of input string, including terminating '\n' | 1419 | * >0 length of input string, including terminating '\n' |
1425 | */ | 1420 | */ |
1426 | int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state) FAST_FUNC; | 1421 | int read_line_input(line_input_t *st, const char *prompt, char *command, int maxsize, int timeout) FAST_FUNC; |
1427 | #else | 1422 | #else |
1428 | #define MAX_HISTORY 0 | 1423 | #define MAX_HISTORY 0 |
1429 | int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC; | 1424 | int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC; |
1430 | #define read_line_input(prompt, command, maxsize, state) \ | 1425 | #define read_line_input(state, prompt, command, maxsize, timeout) \ |
1431 | read_line_input(prompt, command, maxsize) | 1426 | read_line_input(prompt, command, maxsize) |
1432 | #endif | 1427 | #endif |
1433 | 1428 | ||
@@ -1608,16 +1603,24 @@ int print_flags_separated(const int *masks, const char *labels, | |||
1608 | int print_flags(const masks_labels_t *ml, int flags) FAST_FUNC; | 1603 | int print_flags(const masks_labels_t *ml, int flags) FAST_FUNC; |
1609 | 1604 | ||
1610 | typedef struct bb_progress_t { | 1605 | typedef struct bb_progress_t { |
1611 | off_t lastsize; | 1606 | unsigned last_size; |
1612 | unsigned lastupdate_sec; | 1607 | unsigned last_update_sec; |
1608 | unsigned last_change_sec; | ||
1613 | unsigned start_sec; | 1609 | unsigned start_sec; |
1614 | smallint inited; | 1610 | const char *curfile; |
1615 | } bb_progress_t; | 1611 | } bb_progress_t; |
1616 | 1612 | ||
1617 | void bb_progress_init(bb_progress_t *p) FAST_FUNC; | 1613 | #define is_bb_progress_inited(p) ((p)->curfile != NULL) |
1618 | void bb_progress_update(bb_progress_t *p, const char *curfile, | 1614 | #define bb_progress_free(p) do { \ |
1619 | off_t beg_range, off_t transferred, | 1615 | if (ENABLE_UNICODE_SUPPORT) free((char*)((p)->curfile)); \ |
1620 | off_t totalsize) FAST_FUNC; | 1616 | (p)->curfile = NULL; \ |
1617 | } while (0) | ||
1618 | void bb_progress_init(bb_progress_t *p, const char *curfile) FAST_FUNC; | ||
1619 | void bb_progress_update(bb_progress_t *p, | ||
1620 | uoff_t beg_range, | ||
1621 | uoff_t transferred, | ||
1622 | uoff_t totalsize) FAST_FUNC; | ||
1623 | |||
1621 | 1624 | ||
1622 | extern const char *applet_name; | 1625 | extern const char *applet_name; |
1623 | 1626 | ||