diff options
author | Ron Yorston <rmy@pobox.com> | 2019-08-16 09:42:39 +0100 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2019-08-16 09:45:21 +0100 |
commit | 517cf74f6265ec4308b790b637b3f9778cbdc6e0 (patch) | |
tree | be9337069b60ca1bb03565d8575bacfc71181003 /include | |
parent | ae65dc37bcc9b1d9cef0b111131c79dc4ba1bf51 (diff) | |
parent | ac78f2ac96b3efd6551a08e7dc609efa1fb69481 (diff) | |
download | busybox-w32-517cf74f6265ec4308b790b637b3f9778cbdc6e0.tar.gz busybox-w32-517cf74f6265ec4308b790b637b3f9778cbdc6e0.tar.bz2 busybox-w32-517cf74f6265ec4308b790b637b3f9778cbdc6e0.zip |
Merge branch 'busybox' into merge
Diffstat (limited to 'include')
-rw-r--r-- | include/libbb.h | 54 |
1 files changed, 50 insertions, 4 deletions
diff --git a/include/libbb.h b/include/libbb.h index 9da94638b..84811c4f2 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -727,6 +727,7 @@ int xsocket_stream(len_and_sockaddr **lsap) FAST_FUNC; | |||
727 | /* NB: these set SO_REUSEADDR before bind */ | 727 | /* NB: these set SO_REUSEADDR before bind */ |
728 | int create_and_bind_stream_or_die(const char *bindaddr, int port) FAST_FUNC; | 728 | int create_and_bind_stream_or_die(const char *bindaddr, int port) FAST_FUNC; |
729 | int create_and_bind_dgram_or_die(const char *bindaddr, int port) FAST_FUNC; | 729 | int create_and_bind_dgram_or_die(const char *bindaddr, int port) FAST_FUNC; |
730 | int create_and_bind_to_netlink(int proto, int grp, unsigned rcvbuf) FAST_FUNC; | ||
730 | /* Create client TCP socket connected to peer:port. Peer cannot be NULL. | 731 | /* Create client TCP socket connected to peer:port. Peer cannot be NULL. |
731 | * Peer can be numeric IP ("N.N.N.N"), numeric IPv6 address or hostname, | 732 | * Peer can be numeric IP ("N.N.N.N"), numeric IPv6 address or hostname, |
732 | * and can have ":PORT" suffix (for IPv6 use "[X:X:...:X]:PORT"). | 733 | * and can have ":PORT" suffix (for IPv6 use "[X:X:...:X]:PORT"). |
@@ -1176,7 +1177,7 @@ void exec_prog_or_SHELL(char **argv) NORETURN FAST_FUNC; | |||
1176 | ({ \ | 1177 | ({ \ |
1177 | pid_t bb__xvfork_pid = vfork(); \ | 1178 | pid_t bb__xvfork_pid = vfork(); \ |
1178 | if (bb__xvfork_pid < 0) \ | 1179 | if (bb__xvfork_pid < 0) \ |
1179 | bb_perror_msg_and_die("vfork"); \ | 1180 | bb_simple_perror_msg_and_die("vfork"); \ |
1180 | bb__xvfork_pid; \ | 1181 | bb__xvfork_pid; \ |
1181 | }) | 1182 | }) |
1182 | #else | 1183 | #else |
@@ -1366,13 +1367,17 @@ extern void (*die_func)(void); | |||
1366 | void xfunc_die(void) NORETURN FAST_FUNC; | 1367 | void xfunc_die(void) NORETURN FAST_FUNC; |
1367 | void bb_show_usage(void) NORETURN FAST_FUNC; | 1368 | void bb_show_usage(void) NORETURN FAST_FUNC; |
1368 | void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; | 1369 | void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; |
1370 | void bb_simple_error_msg(const char *s) FAST_FUNC; | ||
1369 | void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; | 1371 | void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; |
1372 | void bb_simple_error_msg_and_die(const char *s) NORETURN FAST_FUNC; | ||
1370 | void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; | 1373 | void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; |
1371 | void bb_simple_perror_msg(const char *s) FAST_FUNC; | 1374 | void bb_simple_perror_msg(const char *s) FAST_FUNC; |
1372 | void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; | 1375 | void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; |
1373 | void bb_simple_perror_msg_and_die(const char *s) NORETURN FAST_FUNC; | 1376 | void bb_simple_perror_msg_and_die(const char *s) NORETURN FAST_FUNC; |
1374 | void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; | 1377 | void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; |
1378 | void bb_simple_herror_msg(const char *s) FAST_FUNC; | ||
1375 | void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; | 1379 | void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; |
1380 | void bb_simple_herror_msg_and_die(const char *s) NORETURN FAST_FUNC; | ||
1376 | void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC; | 1381 | void bb_perror_nomsg_and_die(void) NORETURN FAST_FUNC; |
1377 | void bb_perror_nomsg(void) FAST_FUNC; | 1382 | void bb_perror_nomsg(void) FAST_FUNC; |
1378 | void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC; | 1383 | void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC; |
@@ -1381,12 +1386,51 @@ void bb_logenv_override(void) FAST_FUNC; | |||
1381 | 1386 | ||
1382 | #if ENABLE_FEATURE_SYSLOG_INFO | 1387 | #if ENABLE_FEATURE_SYSLOG_INFO |
1383 | void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; | 1388 | void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; |
1389 | void bb_simple_info_msg(const char *s) FAST_FUNC; | ||
1384 | void bb_vinfo_msg(const char *s, va_list p) FAST_FUNC; | 1390 | void bb_vinfo_msg(const char *s, va_list p) FAST_FUNC; |
1385 | #else | 1391 | #else |
1386 | #define bb_info_msg bb_error_msg | 1392 | #define bb_info_msg bb_error_msg |
1393 | #define bb_simple_info_msg bb_simple_error_msg | ||
1387 | #define bb_vinfo_msg(s,p) bb_verror_msg(s,p,NULL) | 1394 | #define bb_vinfo_msg(s,p) bb_verror_msg(s,p,NULL) |
1388 | #endif | 1395 | #endif |
1389 | 1396 | ||
1397 | #if ENABLE_WARN_SIMPLE_MSG | ||
1398 | /* If enabled, cause calls to bb_error_msg() et al that only take a single | ||
1399 | * parameter to generate a warning. | ||
1400 | */ | ||
1401 | static inline void __attribute__ ((deprecated("use bb_simple_error_msg instead"))) | ||
1402 | bb_not_simple_error_msg(const char *s) { bb_simple_error_msg(s); } | ||
1403 | static inline void __attribute__ ((deprecated("use bb_simple_error_msg_and_die instead"))) NORETURN | ||
1404 | bb_not_simple_error_msg_and_die(const char *s) { bb_simple_error_msg_and_die(s); } | ||
1405 | static inline void __attribute__ ((deprecated("use bb_simple_perror_msg instead"))) | ||
1406 | bb_not_simple_perror_msg(const char *s) { bb_simple_perror_msg(s); } | ||
1407 | static inline void __attribute__ ((deprecated("use bb_simple_perror_msg_and_die instead"))) NORETURN | ||
1408 | bb_not_simple_perror_msg_and_die(const char *s) { bb_simple_perror_msg_and_die(s); } | ||
1409 | static inline void __attribute__ ((deprecated("use bb_simple_herror_msg instead"))) | ||
1410 | bb_not_simple_herror_msg(const char *s) { bb_simple_herror_msg(s); } | ||
1411 | static inline void __attribute__ ((deprecated("use bb_simple_herror_msg_and_die instead"))) NORETURN | ||
1412 | bb_not_simple_herror_msg_and_die(const char *s) { bb_simple_herror_msg_and_die(s); } | ||
1413 | static inline void __attribute__ ((deprecated("use bb_simple_info_msg instead"))) | ||
1414 | bb_not_simple_info_msg(const char *s) { bb_simple_info_msg(s); } | ||
1415 | /* Override bb_error_msg() and related functions with macros that will | ||
1416 | * substitute them for the equivalent bb_not_simple_error_msg() function when | ||
1417 | * they are used with only a single parameter. Macro approach inspired by | ||
1418 | * https://gustedt.wordpress.com/2010/06/08/detect-empty-macro-arguments and | ||
1419 | * https://gustedt.wordpress.com/2010/06/03/default-arguments-for-c99 | ||
1420 | */ | ||
1421 | #define _ARG18(_0, _1, _2, _3, _4, _5, _6, _7, _8, _9, _10, _11, _12, _13, _14, _15, _16, _17, ...) _17 | ||
1422 | #define BB_MSG_KIND(...) _ARG18(__VA_ARGS__, , , , , , , , , , , , , , , , , _not_simple) | ||
1423 | #define _BB_MSG(name, kind, ...) bb##kind##name(__VA_ARGS__) | ||
1424 | #define BB_MSG(name, kind, ...) _BB_MSG(name, kind, __VA_ARGS__) | ||
1425 | #define bb_error_msg(...) BB_MSG(_error_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__) | ||
1426 | #define bb_error_msg_and_die(...) BB_MSG(_error_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__) | ||
1427 | #define bb_perror_msg(...) BB_MSG(_perror_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__) | ||
1428 | #define bb_perror_msg_and_die(...) BB_MSG(_perror_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__) | ||
1429 | #define bb_herror_msg(...) BB_MSG(_herror_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__) | ||
1430 | #define bb_herror_msg_and_die(...) BB_MSG(_herror_msg_and_die, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__) | ||
1431 | #define bb_info_msg(...) BB_MSG(_info_msg, BB_MSG_KIND(__VA_ARGS__), __VA_ARGS__) | ||
1432 | #endif | ||
1433 | |||
1390 | /* We need to export XXX_main from libbusybox | 1434 | /* We need to export XXX_main from libbusybox |
1391 | * only if we build "individual" binaries | 1435 | * only if we build "individual" binaries |
1392 | */ | 1436 | */ |
@@ -1503,17 +1547,19 @@ extern void bb_warn_ignoring_args(char *arg) FAST_FUNC; | |||
1503 | 1547 | ||
1504 | extern int get_linux_version_code(void) FAST_FUNC; | 1548 | extern int get_linux_version_code(void) FAST_FUNC; |
1505 | 1549 | ||
1506 | extern char *query_loop(const char *device) FAST_FUNC; | 1550 | char *query_loop(const char *device) FAST_FUNC; |
1507 | extern int del_loop(const char *device) FAST_FUNC; | 1551 | int get_free_loop(void) FAST_FUNC; |
1552 | int del_loop(const char *device) FAST_FUNC; | ||
1508 | /* | 1553 | /* |
1509 | * If *devname is not NULL, use that name, otherwise try to find free one, | 1554 | * If *devname is not NULL, use that name, otherwise try to find free one, |
1510 | * malloc and return it in *devname. | 1555 | * malloc and return it in *devname. |
1511 | * return value is the opened fd to the loop device, or < on error | 1556 | * return value is the opened fd to the loop device, or < on error |
1512 | */ | 1557 | */ |
1513 | extern int set_loop(char **devname, const char *file, unsigned long long offset, unsigned flags) FAST_FUNC; | 1558 | int set_loop(char **devname, const char *file, unsigned long long offset, unsigned flags) FAST_FUNC; |
1514 | /* These constants match linux/loop.h (without BB_ prefix): */ | 1559 | /* These constants match linux/loop.h (without BB_ prefix): */ |
1515 | #define BB_LO_FLAGS_READ_ONLY 1 | 1560 | #define BB_LO_FLAGS_READ_ONLY 1 |
1516 | #define BB_LO_FLAGS_AUTOCLEAR 4 | 1561 | #define BB_LO_FLAGS_AUTOCLEAR 4 |
1562 | #define BB_LO_FLAGS_PARTSCAN 8 | ||
1517 | 1563 | ||
1518 | /* Returns malloced str */ | 1564 | /* Returns malloced str */ |
1519 | char *bb_ask_noecho(int fd, int timeout, const char *prompt) FAST_FUNC; | 1565 | char *bb_ask_noecho(int fd, int timeout, const char *prompt) FAST_FUNC; |