aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/dump.h6
-rw-r--r--include/inet_common.h8
-rw-r--r--include/libbb.h634
-rw-r--r--include/platform.h7
-rw-r--r--include/rtc_.h6
-rw-r--r--include/unarchive.h78
-rw-r--r--include/xatonum.h40
-rw-r--r--include/xregex.h4
8 files changed, 394 insertions, 389 deletions
diff --git a/include/dump.h b/include/dump.h
index 20c39c41e..a060c1479 100644
--- a/include/dump.h
+++ b/include/dump.h
@@ -44,9 +44,9 @@ typedef struct _fs { /* format strings */
44 int bcnt; 44 int bcnt;
45} FS; 45} FS;
46 46
47extern void bb_dump_add(const char *fmt); 47extern void bb_dump_add(const char *fmt) FAST_FUNC;
48extern int bb_dump_dump(char **argv); 48extern int bb_dump_dump(char **argv) FAST_FUNC;
49extern int bb_dump_size(FS * fs); 49extern int bb_dump_size(FS * fs) FAST_FUNC;
50 50
51extern FS *bb_dump_fshead; /* head of format strings */ 51extern FS *bb_dump_fshead; /* head of format strings */
52extern int bb_dump_blocksize; /* data block size */ 52extern int bb_dump_blocksize; /* data block size */
diff --git a/include/inet_common.h b/include/inet_common.h
index eb4cb7325..f4374e5a2 100644
--- a/include/inet_common.h
+++ b/include/inet_common.h
@@ -12,15 +12,15 @@
12/* hostfirst!=0 If we expect this to be a hostname, 12/* hostfirst!=0 If we expect this to be a hostname,
13 try hostname database first 13 try hostname database first
14 */ 14 */
15int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst); 15int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst) FAST_FUNC;
16 16
17/* numeric: & 0x8000: "default" instead of "*", 17/* numeric: & 0x8000: "default" instead of "*",
18 * & 0x4000: host instead of net, 18 * & 0x4000: host instead of net,
19 * & 0x0fff: don't resolve 19 * & 0x0fff: don't resolve
20 */ 20 */
21 21
22int INET6_resolve(const char *name, struct sockaddr_in6 *sin6); 22int INET6_resolve(const char *name, struct sockaddr_in6 *sin6) FAST_FUNC;
23 23
24/* These return malloced string */ 24/* These return malloced string */
25char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask); 25char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask) FAST_FUNC;
26char *INET6_rresolve(struct sockaddr_in6 *sin6, int numeric); 26char *INET6_rresolve(struct sockaddr_in6 *sin6, int numeric) FAST_FUNC;
diff --git a/include/libbb.h b/include/libbb.h
index e92dbc4c0..d74f8021b 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -237,18 +237,18 @@ extern int *const bb_errno;
237#define errno (*bb_errno) 237#define errno (*bb_errno)
238#endif 238#endif
239 239
240unsigned long long monotonic_us(void); 240unsigned long long monotonic_us(void) FAST_FUNC;
241unsigned monotonic_sec(void); 241unsigned monotonic_sec(void) FAST_FUNC;
242 242
243extern void chomp(char *s); 243extern void chomp(char *s) FAST_FUNC;
244extern void trim(char *s); 244extern void trim(char *s) FAST_FUNC;
245extern char *skip_whitespace(const char *); 245extern char *skip_whitespace(const char *) FAST_FUNC;
246extern char *skip_non_whitespace(const char *); 246extern char *skip_non_whitespace(const char *) FAST_FUNC;
247extern char *strrstr(const char *haystack, const char *needle); 247extern char *strrstr(const char *haystack, const char *needle) FAST_FUNC;
248 248
249//TODO: supply a pointer to char[11] buffer (avoid statics)? 249//TODO: supply a pointer to char[11] buffer (avoid statics)?
250extern const char *bb_mode_string(mode_t mode); 250extern const char *bb_mode_string(mode_t mode) FAST_FUNC;
251extern int is_directory(const char *name, int followLinks, struct stat *statBuf); 251extern int is_directory(const char *name, int followLinks, struct stat *statBuf) FAST_FUNC;
252enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ 252enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
253 FILEUTILS_PRESERVE_STATUS = 1, 253 FILEUTILS_PRESERVE_STATUS = 1,
254 FILEUTILS_DEREFERENCE = 2, 254 FILEUTILS_DEREFERENCE = 2,
@@ -264,12 +264,12 @@ enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */
264#endif 264#endif
265}; 265};
266#define FILEUTILS_CP_OPTSTR "pdRfilsL" USE_SELINUX("c") 266#define FILEUTILS_CP_OPTSTR "pdRfilsL" USE_SELINUX("c")
267extern int remove_file(const char *path, int flags); 267extern int remove_file(const char *path, int flags) FAST_FUNC;
268/* NB: without FILEUTILS_RECUR in flags, it will basically "cat" 268/* NB: without FILEUTILS_RECUR in flags, it will basically "cat"
269 * the source, not copy (unless "source" is a directory). 269 * the source, not copy (unless "source" is a directory).
270 * This makes "cp /dev/null file" and "install /dev/null file" (!!!) 270 * This makes "cp /dev/null file" and "install /dev/null file" (!!!)
271 * work coreutils-compatibly. */ 271 * work coreutils-compatibly. */
272extern int copy_file(const char *source, const char *dest, int flags); 272extern int copy_file(const char *source, const char *dest, int flags) FAST_FUNC;
273 273
274enum { 274enum {
275 ACTION_RECURSE = (1 << 0), 275 ACTION_RECURSE = (1 << 0),
@@ -279,49 +279,49 @@ enum {
279 /*ACTION_REVERSE = (1 << 4), - unused */ 279 /*ACTION_REVERSE = (1 << 4), - unused */
280}; 280};
281extern int recursive_action(const char *fileName, unsigned flags, 281extern int recursive_action(const char *fileName, unsigned flags,
282 int (*fileAction) (const char *fileName, struct stat* statbuf, void* userData, int depth), 282 int FAST_FUNC (*fileAction)(const char *fileName, struct stat* statbuf, void* userData, int depth),
283 int (*dirAction) (const char *fileName, struct stat* statbuf, void* userData, int depth), 283 int FAST_FUNC (*dirAction)(const char *fileName, struct stat* statbuf, void* userData, int depth),
284 void* userData, unsigned depth); 284 void* userData, unsigned depth) FAST_FUNC;
285extern int device_open(const char *device, int mode); 285extern int device_open(const char *device, int mode) FAST_FUNC;
286enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */ 286enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */
287extern int xgetpty(char *line); 287extern int xgetpty(char *line) FAST_FUNC;
288extern int get_console_fd(void); 288extern int get_console_fd(void) FAST_FUNC;
289extern void console_make_active(int fd, const int vt_num); 289extern void console_make_active(int fd, const int vt_num) FAST_FUNC;
290extern char *find_block_device(const char *path); 290extern char *find_block_device(const char *path) FAST_FUNC;
291/* bb_copyfd_XX print read/write errors and return -1 if they occur */ 291/* bb_copyfd_XX print read/write errors and return -1 if they occur */
292extern off_t bb_copyfd_eof(int fd1, int fd2); 292extern off_t bb_copyfd_eof(int fd1, int fd2) FAST_FUNC;
293extern off_t bb_copyfd_size(int fd1, int fd2, off_t size); 293extern off_t bb_copyfd_size(int fd1, int fd2, off_t size) FAST_FUNC;
294extern void bb_copyfd_exact_size(int fd1, int fd2, off_t size); 294extern void bb_copyfd_exact_size(int fd1, int fd2, off_t size) FAST_FUNC;
295/* "short" copy can be detected by return value < size */ 295/* "short" copy can be detected by return value < size */
296/* this helper yells "short read!" if param is not -1 */ 296/* this helper yells "short read!" if param is not -1 */
297extern void complain_copyfd_and_die(off_t sz) ATTRIBUTE_NORETURN; 297extern void complain_copyfd_and_die(off_t sz) ATTRIBUTE_NORETURN FAST_FUNC;
298extern char bb_process_escape_sequence(const char **ptr); 298extern char bb_process_escape_sequence(const char **ptr) FAST_FUNC;
299/* xxxx_strip version can modify its parameter: 299/* xxxx_strip version can modify its parameter:
300 * "/" -> "/" 300 * "/" -> "/"
301 * "abc" -> "abc" 301 * "abc" -> "abc"
302 * "abc/def" -> "def" 302 * "abc/def" -> "def"
303 * "abc/def/" -> "def" !! 303 * "abc/def/" -> "def" !!
304 */ 304 */
305extern char *bb_get_last_path_component_strip(char *path); 305extern char *bb_get_last_path_component_strip(char *path) FAST_FUNC;
306/* "abc/def/" -> "" and it never modifies 'path' */ 306/* "abc/def/" -> "" and it never modifies 'path' */
307extern char *bb_get_last_path_component_nostrip(const char *path); 307extern char *bb_get_last_path_component_nostrip(const char *path) FAST_FUNC;
308 308
309int ndelay_on(int fd); 309int ndelay_on(int fd) FAST_FUNC;
310int ndelay_off(int fd); 310int ndelay_off(int fd) FAST_FUNC;
311int close_on_exec_on(int fd); 311int close_on_exec_on(int fd) FAST_FUNC;
312void xdup2(int, int); 312void xdup2(int, int) FAST_FUNC;
313void xmove_fd(int, int); 313void xmove_fd(int, int) FAST_FUNC;
314 314
315 315
316DIR *xopendir(const char *path); 316DIR *xopendir(const char *path) FAST_FUNC;
317DIR *warn_opendir(const char *path); 317DIR *warn_opendir(const char *path) FAST_FUNC;
318 318
319/* UNUSED: char *xmalloc_realpath(const char *path); */ 319/* UNUSED: char *xmalloc_realpath(const char *path) FAST_FUNC; */
320char *xmalloc_readlink(const char *path); 320char *xmalloc_readlink(const char *path) FAST_FUNC;
321char *xmalloc_readlink_or_warn(const char *path); 321char *xmalloc_readlink_or_warn(const char *path) FAST_FUNC;
322char *xrealloc_getcwd_or_warn(char *cwd); 322char *xrealloc_getcwd_or_warn(char *cwd) FAST_FUNC;
323 323
324char *xmalloc_follow_symlinks(const char *path); 324char *xmalloc_follow_symlinks(const char *path) FAST_FUNC;
325 325
326 326
327enum { 327enum {
@@ -354,43 +354,43 @@ enum {
354 + (1LL << SIGUSR2) 354 + (1LL << SIGUSR2)
355 + 0), 355 + 0),
356}; 356};
357void bb_signals(int sigs, void (*f)(int)); 357void bb_signals(int sigs, void (*f)(int)) FAST_FUNC;
358/* Unlike signal() and bb_signals, sets handler with sigaction() 358/* Unlike signal() and bb_signals, sets handler with sigaction()
359 * and in a way that while signal handler is run, no other signals 359 * and in a way that while signal handler is run, no other signals
360 * will be blocked: */ 360 * will be blocked: */
361void bb_signals_recursive(int sigs, void (*f)(int)); 361void bb_signals_recursive(int sigs, void (*f)(int)) FAST_FUNC;
362/* syscalls like read() will be interrupted with EINTR: */ 362/* syscalls like read() will be interrupted with EINTR: */
363void signal_no_SA_RESTART_empty_mask(int sig, void (*handler)(int)); 363void signal_no_SA_RESTART_empty_mask(int sig, void (*handler)(int)) FAST_FUNC;
364/* syscalls like read() won't be interrupted (though select/poll will be): */ 364/* syscalls like read() won't be interrupted (though select/poll will be): */
365void signal_SA_RESTART_empty_mask(int sig, void (*handler)(int)); 365void signal_SA_RESTART_empty_mask(int sig, void (*handler)(int)) FAST_FUNC;
366void wait_for_any_sig(void); 366void wait_for_any_sig(void) FAST_FUNC;
367void kill_myself_with_sig(int sig) ATTRIBUTE_NORETURN; 367void kill_myself_with_sig(int sig) ATTRIBUTE_NORETURN FAST_FUNC;
368void sig_block(int sig); 368void sig_block(int sig) FAST_FUNC;
369void sig_unblock(int sig); 369void sig_unblock(int sig) FAST_FUNC;
370/* Will do sigaction(signum, act, NULL): */ 370/* Will do sigaction(signum, act, NULL): */
371int sigaction_set(int sig, const struct sigaction *act); 371int sigaction_set(int sig, const struct sigaction *act) FAST_FUNC;
372/* SIG_BLOCK/SIG_UNBLOCK all signals: */ 372/* SIG_BLOCK/SIG_UNBLOCK all signals: */
373int sigprocmask_allsigs(int how); 373int sigprocmask_allsigs(int how) FAST_FUNC;
374 374
375 375
376void xsetgid(gid_t gid); 376void xsetgid(gid_t gid) FAST_FUNC;
377void xsetuid(uid_t uid); 377void xsetuid(uid_t uid) FAST_FUNC;
378void xchdir(const char *path); 378void xchdir(const char *path) FAST_FUNC;
379void xchroot(const char *path); 379void xchroot(const char *path) FAST_FUNC;
380void xsetenv(const char *key, const char *value); 380void xsetenv(const char *key, const char *value) FAST_FUNC;
381void xunlink(const char *pathname); 381void xunlink(const char *pathname) FAST_FUNC;
382void xstat(const char *pathname, struct stat *buf); 382void xstat(const char *pathname, struct stat *buf) FAST_FUNC;
383int xopen(const char *pathname, int flags); 383int xopen(const char *pathname, int flags) FAST_FUNC FAST_FUNC;
384int xopen3(const char *pathname, int flags, int mode); 384int xopen3(const char *pathname, int flags, int mode) FAST_FUNC;
385int open_or_warn(const char *pathname, int flags); 385int open_or_warn(const char *pathname, int flags) FAST_FUNC;
386int open3_or_warn(const char *pathname, int flags, int mode); 386int open3_or_warn(const char *pathname, int flags, int mode) FAST_FUNC;
387int open_or_warn_stdin(const char *pathname); 387int open_or_warn_stdin(const char *pathname) FAST_FUNC;
388void xrename(const char *oldpath, const char *newpath); 388void xrename(const char *oldpath, const char *newpath) FAST_FUNC;
389int rename_or_warn(const char *oldpath, const char *newpath); 389int rename_or_warn(const char *oldpath, const char *newpath) FAST_FUNC;
390off_t xlseek(int fd, off_t offset, int whence); 390off_t xlseek(int fd, off_t offset, int whence) FAST_FUNC;
391off_t fdlength(int fd); 391off_t fdlength(int fd) FAST_FUNC;
392 392
393void xpipe(int filedes[2]); 393void xpipe(int filedes[2]) FAST_FUNC;
394/* In this form code with pipes is much more readable */ 394/* In this form code with pipes is much more readable */
395struct fd_pair { int rd; int wr; }; 395struct fd_pair { int rd; int wr; };
396#define piped_pair(pair) pipe(&((pair).rd)) 396#define piped_pair(pair) pipe(&((pair).rd))
@@ -424,22 +424,22 @@ struct BUG_too_small {
424}; 424};
425 425
426 426
427int xsocket(int domain, int type, int protocol); 427int xsocket(int domain, int type, int protocol) FAST_FUNC;
428void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); 428void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) FAST_FUNC;
429void xlisten(int s, int backlog); 429void xlisten(int s, int backlog) FAST_FUNC;
430void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen); 430void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) FAST_FUNC;
431ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, 431ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to,
432 socklen_t tolen); 432 socklen_t tolen) FAST_FUNC;
433/* SO_REUSEADDR allows a server to rebind to an address that is already 433/* SO_REUSEADDR allows a server to rebind to an address that is already
434 * "in use" by old connections to e.g. previous server instance which is 434 * "in use" by old connections to e.g. previous server instance which is
435 * killed or crashed. Without it bind will fail until all such connections 435 * killed or crashed. Without it bind will fail until all such connections
436 * time out. Linux does not allow multiple live binds on same ip:port 436 * time out. Linux does not allow multiple live binds on same ip:port
437 * regardless of SO_REUSEADDR (unlike some other flavors of Unix). 437 * regardless of SO_REUSEADDR (unlike some other flavors of Unix).
438 * Turn it on before you call bind(). */ 438 * Turn it on before you call bind(). */
439void setsockopt_reuseaddr(int fd); /* On Linux this never fails. */ 439void setsockopt_reuseaddr(int fd) FAST_FUNC; /* On Linux this never fails. */
440int setsockopt_broadcast(int fd); 440int setsockopt_broadcast(int fd) FAST_FUNC;
441/* NB: returns port in host byte order */ 441/* NB: returns port in host byte order */
442unsigned bb_lookup_port(const char *port, const char *protocol, unsigned default_port); 442unsigned bb_lookup_port(const char *port, const char *protocol, unsigned default_port) FAST_FUNC;
443typedef struct len_and_sockaddr { 443typedef struct len_and_sockaddr {
444 socklen_t len; 444 socklen_t len;
445 union { 445 union {
@@ -468,87 +468,87 @@ enum {
468 * and if kernel doesn't support it, IPv4. 468 * and if kernel doesn't support it, IPv4.
469 */ 469 */
470#if ENABLE_FEATURE_IPV6 470#if ENABLE_FEATURE_IPV6
471int xsocket_type(len_and_sockaddr **lsap, int af, int sock_type); 471int xsocket_type(len_and_sockaddr **lsap, int af, int sock_type) FAST_FUNC;
472#else 472#else
473int xsocket_type(len_and_sockaddr **lsap, int sock_type); 473int xsocket_type(len_and_sockaddr **lsap, int sock_type) FAST_FUNC;
474#define xsocket_type(lsap, af, sock_type) xsocket_type((lsap), (sock_type)) 474#define xsocket_type(lsap, af, sock_type) xsocket_type((lsap), (sock_type))
475#endif 475#endif
476int xsocket_stream(len_and_sockaddr **lsap); 476int xsocket_stream(len_and_sockaddr **lsap) FAST_FUNC;
477/* Create server socket bound to bindaddr:port. bindaddr can be NULL, 477/* Create server socket bound to bindaddr:port. bindaddr can be NULL,
478 * numeric IP ("N.N.N.N") or numeric IPv6 address, 478 * numeric IP ("N.N.N.N") or numeric IPv6 address,
479 * and can have ":PORT" suffix (for IPv6 use "[X:X:...:X]:PORT"). 479 * and can have ":PORT" suffix (for IPv6 use "[X:X:...:X]:PORT").
480 * Only if there is no suffix, port argument is used */ 480 * Only if there is no suffix, port argument is used */
481/* NB: these set SO_REUSEADDR before bind */ 481/* NB: these set SO_REUSEADDR before bind */
482int create_and_bind_stream_or_die(const char *bindaddr, int port); 482int create_and_bind_stream_or_die(const char *bindaddr, int port) FAST_FUNC;
483int create_and_bind_dgram_or_die(const char *bindaddr, int port); 483int create_and_bind_dgram_or_die(const char *bindaddr, int port) FAST_FUNC;
484/* Create client TCP socket connected to peer:port. Peer cannot be NULL. 484/* Create client TCP socket connected to peer:port. Peer cannot be NULL.
485 * Peer can be numeric IP ("N.N.N.N"), numeric IPv6 address or hostname, 485 * Peer can be numeric IP ("N.N.N.N"), numeric IPv6 address or hostname,
486 * and can have ":PORT" suffix (for IPv6 use "[X:X:...:X]:PORT"). 486 * and can have ":PORT" suffix (for IPv6 use "[X:X:...:X]:PORT").
487 * If there is no suffix, port argument is used */ 487 * If there is no suffix, port argument is used */
488int create_and_connect_stream_or_die(const char *peer, int port); 488int create_and_connect_stream_or_die(const char *peer, int port) FAST_FUNC;
489/* Connect to peer identified by lsa */ 489/* Connect to peer identified by lsa */
490int xconnect_stream(const len_and_sockaddr *lsa); 490int xconnect_stream(const len_and_sockaddr *lsa) FAST_FUNC;
491/* Return malloc'ed len_and_sockaddr with socket address of host:port 491/* Return malloc'ed len_and_sockaddr with socket address of host:port
492 * Currently will return IPv4 or IPv6 sockaddrs only 492 * Currently will return IPv4 or IPv6 sockaddrs only
493 * (depending on host), but in theory nothing prevents e.g. 493 * (depending on host), but in theory nothing prevents e.g.
494 * UNIX socket address being returned, IPX sockaddr etc... 494 * UNIX socket address being returned, IPX sockaddr etc...
495 * On error does bb_error_msg and returns NULL */ 495 * On error does bb_error_msg and returns NULL */
496len_and_sockaddr* host2sockaddr(const char *host, int port); 496len_and_sockaddr* host2sockaddr(const char *host, int port) FAST_FUNC;
497/* Version which dies on error */ 497/* Version which dies on error */
498len_and_sockaddr* xhost2sockaddr(const char *host, int port); 498len_and_sockaddr* xhost2sockaddr(const char *host, int port) FAST_FUNC;
499len_and_sockaddr* xdotted2sockaddr(const char *host, int port); 499len_and_sockaddr* xdotted2sockaddr(const char *host, int port) FAST_FUNC;
500/* Same, useful if you want to force family (e.g. IPv6) */ 500/* Same, useful if you want to force family (e.g. IPv6) */
501#if !ENABLE_FEATURE_IPV6 501#if !ENABLE_FEATURE_IPV6
502#define host_and_af2sockaddr(host, port, af) host2sockaddr((host), (port)) 502#define host_and_af2sockaddr(host, port, af) host2sockaddr((host), (port))
503#define xhost_and_af2sockaddr(host, port, af) xhost2sockaddr((host), (port)) 503#define xhost_and_af2sockaddr(host, port, af) xhost2sockaddr((host), (port))
504#else 504#else
505len_and_sockaddr* host_and_af2sockaddr(const char *host, int port, sa_family_t af); 505len_and_sockaddr* host_and_af2sockaddr(const char *host, int port, sa_family_t af) FAST_FUNC;
506len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t af); 506len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t af) FAST_FUNC;
507#endif 507#endif
508/* Assign sin[6]_port member if the socket is an AF_INET[6] one, 508/* Assign sin[6]_port member if the socket is an AF_INET[6] one,
509 * otherwise no-op. Useful for ftp. 509 * otherwise no-op. Useful for ftp.
510 * NB: does NOT do htons() internally, just direct assignment. */ 510 * NB: does NOT do htons() internally, just direct assignment. */
511void set_nport(len_and_sockaddr *lsa, unsigned port); 511void set_nport(len_and_sockaddr *lsa, unsigned port) FAST_FUNC;
512/* Retrieve sin[6]_port or return -1 for non-INET[6] lsa's */ 512/* Retrieve sin[6]_port or return -1 for non-INET[6] lsa's */
513int get_nport(const struct sockaddr *sa); 513int get_nport(const struct sockaddr *sa) FAST_FUNC;
514/* Reverse DNS. Returns NULL on failure. */ 514/* Reverse DNS. Returns NULL on failure. */
515char* xmalloc_sockaddr2host(const struct sockaddr *sa); 515char* xmalloc_sockaddr2host(const struct sockaddr *sa) FAST_FUNC;
516/* This one doesn't append :PORTNUM */ 516/* This one doesn't append :PORTNUM */
517char* xmalloc_sockaddr2host_noport(const struct sockaddr *sa); 517char* xmalloc_sockaddr2host_noport(const struct sockaddr *sa) FAST_FUNC;
518/* This one also doesn't fall back to dotted IP (returns NULL) */ 518/* This one also doesn't fall back to dotted IP (returns NULL) */
519char* xmalloc_sockaddr2hostonly_noport(const struct sockaddr *sa); 519char* xmalloc_sockaddr2hostonly_noport(const struct sockaddr *sa) FAST_FUNC;
520/* inet_[ap]ton on steroids */ 520/* inet_[ap]ton on steroids */
521char* xmalloc_sockaddr2dotted(const struct sockaddr *sa); 521char* xmalloc_sockaddr2dotted(const struct sockaddr *sa) FAST_FUNC;
522char* xmalloc_sockaddr2dotted_noport(const struct sockaddr *sa); 522char* xmalloc_sockaddr2dotted_noport(const struct sockaddr *sa) FAST_FUNC;
523// "old" (ipv4 only) API 523// "old" (ipv4 only) API
524// users: traceroute.c hostname.c - use _list_ of all IPs 524// users: traceroute.c hostname.c - use _list_ of all IPs
525struct hostent *xgethostbyname(const char *name); 525struct hostent *xgethostbyname(const char *name) FAST_FUNC;
526// Also mount.c and inetd.c are using gethostbyname(), 526// Also mount.c and inetd.c are using gethostbyname(),
527// + inet_common.c has additional IPv4-only stuff 527// + inet_common.c has additional IPv4-only stuff
528 528
529 529
530void socket_want_pktinfo(int fd); 530void socket_want_pktinfo(int fd) FAST_FUNC;
531ssize_t send_to_from(int fd, void *buf, size_t len, int flags, 531ssize_t send_to_from(int fd, void *buf, size_t len, int flags,
532 const struct sockaddr *to, 532 const struct sockaddr *to,
533 const struct sockaddr *from, 533 const struct sockaddr *from,
534 socklen_t tolen); 534 socklen_t tolen) FAST_FUNC;
535ssize_t recv_from_to(int fd, void *buf, size_t len, int flags, 535ssize_t recv_from_to(int fd, void *buf, size_t len, int flags,
536 struct sockaddr *from, 536 struct sockaddr *from,
537 struct sockaddr *to, 537 struct sockaddr *to,
538 socklen_t sa_size); 538 socklen_t sa_size) FAST_FUNC;
539 539
540char *xstrdup(const char *s); 540char *xstrdup(const char *s) FAST_FUNC;
541char *xstrndup(const char *s, int n); 541char *xstrndup(const char *s, int n) FAST_FUNC;
542char *safe_strncpy(char *dst, const char *src, size_t size); 542char *safe_strncpy(char *dst, const char *src, size_t size) FAST_FUNC;
543/* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc. 543/* Guaranteed to NOT be a macro (smallest code). Saves nearly 2k on uclibc.
544 * But potentially slow, don't use in one-billion-times loops */ 544 * But potentially slow, don't use in one-billion-times loops */
545int bb_putchar(int ch); 545int bb_putchar(int ch) FAST_FUNC;
546char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); 546char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
547/* Prints unprintable chars ch as ^C or M-c to file 547/* Prints unprintable chars ch as ^C or M-c to file
548 * (M-c is used only if ch is ORed with PRINTABLE_META), 548 * (M-c is used only if ch is ORed with PRINTABLE_META),
549 * else it is printed as-is (except for ch = 0x9b) */ 549 * else it is printed as-is (except for ch = 0x9b) */
550enum { PRINTABLE_META = 0x100 }; 550enum { PRINTABLE_META = 0x100 };
551void fputc_printable(int ch, FILE *file); 551void fputc_printable(int ch, FILE *file) FAST_FUNC;
552// gcc-4.1.1 still isn't good enough at optimizing it 552// gcc-4.1.1 still isn't good enough at optimizing it
553// (+200 bytes compared to macro) 553// (+200 bytes compared to macro)
554//static ALWAYS_INLINE 554//static ALWAYS_INLINE
@@ -563,89 +563,89 @@ void fputc_printable(int ch, FILE *file);
563 563
564/* dmalloc will redefine these to it's own implementation. It is safe 564/* dmalloc will redefine these to it's own implementation. It is safe
565 * to have the prototypes here unconditionally. */ 565 * to have the prototypes here unconditionally. */
566extern void *malloc_or_warn(size_t size); 566extern void *malloc_or_warn(size_t size) FAST_FUNC;
567extern void *xmalloc(size_t size); 567extern void *xmalloc(size_t size) FAST_FUNC;
568extern void *xzalloc(size_t size); 568extern void *xzalloc(size_t size) FAST_FUNC;
569extern void *xrealloc(void *old, size_t size); 569extern void *xrealloc(void *old, size_t size) FAST_FUNC;
570 570
571extern ssize_t safe_read(int fd, void *buf, size_t count); 571extern ssize_t safe_read(int fd, void *buf, size_t count) FAST_FUNC;
572extern ssize_t nonblock_safe_read(int fd, void *buf, size_t count); 572extern ssize_t nonblock_safe_read(int fd, void *buf, size_t count) FAST_FUNC;
573// NB: will return short read on error, not -1, 573// NB: will return short read on error, not -1,
574// if some data was read before error occurred 574// if some data was read before error occurred
575extern ssize_t full_read(int fd, void *buf, size_t count); 575extern ssize_t full_read(int fd, void *buf, size_t count) FAST_FUNC;
576extern void xread(int fd, void *buf, size_t count); 576extern void xread(int fd, void *buf, size_t count) FAST_FUNC;
577extern unsigned char xread_char(int fd); 577extern unsigned char xread_char(int fd) FAST_FUNC;
578// Reads one line a-la fgets (but doesn't save terminating '\n'). 578// Reads one line a-la fgets (but doesn't save terminating '\n').
579// Uses single full_read() call, works only on seekable streams. 579// Uses single full_read() call, works only on seekable streams.
580extern char *reads(int fd, char *buf, size_t count); 580extern char *reads(int fd, char *buf, size_t count) FAST_FUNC;
581// Reads one line a-la fgets (but doesn't save terminating '\n'). 581// Reads one line a-la fgets (but doesn't save terminating '\n').
582// Reads byte-by-byte. Useful when it is important to not read ahead. 582// Reads byte-by-byte. Useful when it is important to not read ahead.
583// Bytes are appended to pfx (which must be malloced, or NULL). 583// Bytes are appended to pfx (which must be malloced, or NULL).
584extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p); 584extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC;
585extern ssize_t read_close(int fd, void *buf, size_t maxsz); 585extern ssize_t read_close(int fd, void *buf, size_t maxsz) FAST_FUNC;
586extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz); 586extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz) FAST_FUNC;
587/* Returns NULL if file can't be opened */ 587/* Returns NULL if file can't be opened */
588extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p); 588extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC;
589/* Never returns NULL */ 589/* Never returns NULL */
590extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p); 590extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC;
591 591
592extern ssize_t safe_write(int fd, const void *buf, size_t count); 592extern ssize_t safe_write(int fd, const void *buf, size_t count) FAST_FUNC;
593// NB: will return short write on error, not -1, 593// NB: will return short write on error, not -1,
594// if some data was written before error occurred 594// if some data was written before error occurred
595extern ssize_t full_write(int fd, const void *buf, size_t count); 595extern ssize_t full_write(int fd, const void *buf, size_t count) FAST_FUNC;
596extern void xwrite(int fd, const void *buf, size_t count); 596extern void xwrite(int fd, const void *buf, size_t count) FAST_FUNC;
597extern void xopen_xwrite_close(const char* file, const char *str); 597extern void xopen_xwrite_close(const char* file, const char *str) FAST_FUNC;
598 598
599/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */ 599/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */
600extern void xprint_and_close_file(FILE *file); 600extern void xprint_and_close_file(FILE *file) FAST_FUNC;
601/* Reads up to (and including) TERMINATING_STRING: */ 601/* Reads up to (and including) TERMINATING_STRING: */
602extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string); 602extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC;
603/* Chops off TERMINATING_STRING from the end: */ 603/* Chops off TERMINATING_STRING from the end: */
604extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string); 604extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string) FAST_FUNC;
605/* Reads up to (and including) "\n" or NUL byte: */ 605/* Reads up to (and including) "\n" or NUL byte: */
606extern char *xmalloc_fgets(FILE *file); 606extern char *xmalloc_fgets(FILE *file) FAST_FUNC;
607/* Chops off '\n' from the end, unlike fgets: */ 607/* Chops off '\n' from the end, unlike fgets: */
608extern char *xmalloc_fgetline(FILE *file); 608extern char *xmalloc_fgetline(FILE *file) FAST_FUNC;
609extern char *bb_get_chunk_from_file(FILE *file, int *end); 609extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC;
610extern void die_if_ferror(FILE *file, const char *msg); 610extern void die_if_ferror(FILE *file, const char *msg) FAST_FUNC;
611extern void die_if_ferror_stdout(void); 611extern void die_if_ferror_stdout(void) FAST_FUNC;
612extern void xfflush_stdout(void); 612extern void xfflush_stdout(void) FAST_FUNC;
613extern void fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN; 613extern void fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN FAST_FUNC;
614extern int fclose_if_not_stdin(FILE *file); 614extern int fclose_if_not_stdin(FILE *file) FAST_FUNC;
615extern FILE *xfopen(const char *filename, const char *mode); 615extern FILE *xfopen(const char *filename, const char *mode) FAST_FUNC;
616/* Prints warning to stderr and returns NULL on failure: */ 616/* Prints warning to stderr and returns NULL on failure: */
617extern FILE *fopen_or_warn(const char *filename, const char *mode); 617extern FILE *fopen_or_warn(const char *filename, const char *mode) FAST_FUNC;
618/* "Opens" stdin if filename is special, else just opens file: */ 618/* "Opens" stdin if filename is special, else just opens file: */
619extern FILE *xfopen_stdin(const char *filename); 619extern FILE *xfopen_stdin(const char *filename) FAST_FUNC;
620extern FILE *fopen_or_warn_stdin(const char *filename); 620extern FILE *fopen_or_warn_stdin(const char *filename) FAST_FUNC;
621 621
622int bb_pstrcmp(const void *a, const void *b); 622int bb_pstrcmp(const void *a, const void *b) /* not FAST_FUNC! */;
623void qsort_string_vector(char **sv, unsigned count); 623void qsort_string_vector(char **sv, unsigned count) FAST_FUNC;
624 624
625/* Wrapper which restarts poll on EINTR or ENOMEM. 625/* Wrapper which restarts poll on EINTR or ENOMEM.
626 * On other errors complains [perror("poll")] and returns. 626 * On other errors complains [perror("poll")] and returns.
627 * Warning! May take (much) longer than timeout_ms to return! 627 * Warning! May take (much) longer than timeout_ms to return!
628 * If this is a problem, use bare poll and open-code EINTR/ENOMEM handling */ 628 * If this is a problem, use bare poll and open-code EINTR/ENOMEM handling */
629int safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout_ms); 629int safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout_ms) FAST_FUNC;
630 630
631char *safe_gethostname(void); 631char *safe_gethostname(void) FAST_FUNC;
632 632
633/* Convert each alpha char in str to lower-case */ 633/* Convert each alpha char in str to lower-case */
634char* str_tolower(char *str); 634char* str_tolower(char *str) FAST_FUNC;
635 635
636char *utoa(unsigned n); 636char *utoa(unsigned n) FAST_FUNC;
637char *itoa(int n); 637char *itoa(int n) FAST_FUNC;
638/* Returns a pointer past the formatted number, does NOT null-terminate */ 638/* Returns a pointer past the formatted number, does NOT null-terminate */
639char *utoa_to_buf(unsigned n, char *buf, unsigned buflen); 639char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC;
640char *itoa_to_buf(int n, char *buf, unsigned buflen); 640char *itoa_to_buf(int n, char *buf, unsigned buflen) FAST_FUNC;
641/* Intelligent formatters of bignums */ 641/* Intelligent formatters of bignums */
642void smart_ulltoa4(unsigned long long ul, char buf[5], const char *scale); 642void smart_ulltoa4(unsigned long long ul, char buf[5], const char *scale) FAST_FUNC;
643void smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale); 643void smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale) FAST_FUNC;
644//TODO: provide pointer to buf (avoid statics)? 644//TODO: provide pointer to buf (avoid statics)?
645const char *make_human_readable_str(unsigned long long size, 645const char *make_human_readable_str(unsigned long long size,
646 unsigned long block_size, unsigned long display_unit); 646 unsigned long block_size, unsigned long display_unit) FAST_FUNC;
647/* Put a string of hex bytes ("1b2e66fe"...), return advanced pointer */ 647/* Put a string of hex bytes ("1b2e66fe"...), return advanced pointer */
648char *bin2hex(char *buf, const char *cp, int count); 648char *bin2hex(char *buf, const char *cp, int count) FAST_FUNC;
649 649
650/* Last element is marked by mult == 0 */ 650/* Last element is marked by mult == 0 */
651struct suffix_mult { 651struct suffix_mult {
@@ -658,56 +658,56 @@ struct suffix_mult {
658 * in many places people want *non-negative* values, but store them 658 * in many places people want *non-negative* values, but store them
659 * in signed int. Therefore we need this one: 659 * in signed int. Therefore we need this one:
660 * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc */ 660 * dies if input is not in [0, INT_MAX] range. Also will reject '-0' etc */
661int xatoi_u(const char *numstr); 661int xatoi_u(const char *numstr) FAST_FUNC;
662/* Useful for reading port numbers */ 662/* Useful for reading port numbers */
663uint16_t xatou16(const char *numstr); 663uint16_t xatou16(const char *numstr) FAST_FUNC;
664 664
665 665
666/* These parse entries in /etc/passwd and /etc/group. This is desirable 666/* These parse entries in /etc/passwd and /etc/group. This is desirable
667 * for BusyBox since we want to avoid using the glibc NSS stuff, which 667 * for BusyBox since we want to avoid using the glibc NSS stuff, which
668 * increases target size and is often not needed on embedded systems. */ 668 * increases target size and is often not needed on embedded systems. */
669long xuname2uid(const char *name); 669long xuname2uid(const char *name) FAST_FUNC;
670long xgroup2gid(const char *name); 670long xgroup2gid(const char *name) FAST_FUNC;
671/* wrapper: allows string to contain numeric uid or gid */ 671/* wrapper: allows string to contain numeric uid or gid */
672unsigned long get_ug_id(const char *s, long (*xname2id)(const char *)); 672unsigned long get_ug_id(const char *s, long FAST_FUNC (*xname2id)(const char *)) FAST_FUNC;
673/* from chpst. Does not die, returns 0 on failure */ 673/* from chpst. Does not die, returns 0 on failure */
674struct bb_uidgid_t { 674struct bb_uidgid_t {
675 uid_t uid; 675 uid_t uid;
676 gid_t gid; 676 gid_t gid;
677}; 677};
678/* always sets uid and gid */ 678/* always sets uid and gid */
679int get_uidgid(struct bb_uidgid_t*, const char*, int numeric_ok); 679int get_uidgid(struct bb_uidgid_t*, const char*, int numeric_ok) FAST_FUNC;
680/* chown-like handling of "user[:[group]" */ 680/* chown-like handling of "user[:[group]" */
681void parse_chown_usergroup_or_die(struct bb_uidgid_t *u, char *user_group); 681void parse_chown_usergroup_or_die(struct bb_uidgid_t *u, char *user_group) FAST_FUNC;
682/* bb_getpwuid, bb_getgrgid: 682/* bb_getpwuid, bb_getgrgid:
683 * bb_getXXXid(buf, bufsz, id) - copy user/group name or id 683 * bb_getXXXid(buf, bufsz, id) - copy user/group name or id
684 * as a string to buf, return user/group name or NULL 684 * as a string to buf, return user/group name or NULL
685 * bb_getXXXid(NULL, 0, id) - return user/group name or NULL 685 * bb_getXXXid(NULL, 0, id) - return user/group name or NULL
686 * bb_getXXXid(NULL, -1, id) - return user/group name or exit 686 * bb_getXXXid(NULL, -1, id) - return user/group name or exit
687*/ 687*/
688char *bb_getpwuid(char *name, int bufsize, long uid); 688char *bb_getpwuid(char *name, int bufsize, long uid) FAST_FUNC;
689char *bb_getgrgid(char *group, int bufsize, long gid); 689char *bb_getgrgid(char *group, int bufsize, long gid) FAST_FUNC;
690/* versions which cache results (useful for ps, ls etc) */ 690/* versions which cache results (useful for ps, ls etc) */
691const char* get_cached_username(uid_t uid); 691const char* get_cached_username(uid_t uid) FAST_FUNC;
692const char* get_cached_groupname(gid_t gid); 692const char* get_cached_groupname(gid_t gid) FAST_FUNC;
693void clear_username_cache(void); 693void clear_username_cache(void) FAST_FUNC;
694/* internally usernames are saved in fixed-sized char[] buffers */ 694/* internally usernames are saved in fixed-sized char[] buffers */
695enum { USERNAME_MAX_SIZE = 16 - sizeof(int) }; 695enum { USERNAME_MAX_SIZE = 16 - sizeof(int) };
696#if ENABLE_FEATURE_CHECK_NAMES 696#if ENABLE_FEATURE_CHECK_NAMES
697void die_if_bad_username(const char* name); 697void die_if_bad_username(const char* name) FAST_FUNC;
698#else 698#else
699#define die_if_bad_username(name) ((void)(name)) 699#define die_if_bad_username(name) ((void)(name))
700#endif 700#endif
701 701
702int execable_file(const char *name); 702int execable_file(const char *name) FAST_FUNC;
703char *find_execable(const char *filename, char **PATHp); 703char *find_execable(const char *filename, char **PATHp) FAST_FUNC;
704int exists_execable(const char *filename); 704int exists_execable(const char *filename) FAST_FUNC;
705 705
706/* BB_EXECxx always execs (it's not doing NOFORK/NOEXEC stuff), 706/* BB_EXECxx always execs (it's not doing NOFORK/NOEXEC stuff),
707 * but it may exec busybox and call applet instead of searching PATH. 707 * but it may exec busybox and call applet instead of searching PATH.
708 */ 708 */
709#if ENABLE_FEATURE_PREFER_APPLETS 709#if ENABLE_FEATURE_PREFER_APPLETS
710int bb_execvp(const char *file, char *const argv[]); 710int bb_execvp(const char *file, char *const argv[]) FAST_FUNC;
711#define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd) 711#define BB_EXECVP(prog,cmd) bb_execvp(prog,cmd)
712#define BB_EXECLP(prog,cmd,...) \ 712#define BB_EXECLP(prog,cmd,...) \
713 execlp((find_applet_by_name(prog) >= 0) ? CONFIG_BUSYBOX_EXEC_PATH : prog, \ 713 execlp((find_applet_by_name(prog) >= 0) ? CONFIG_BUSYBOX_EXEC_PATH : prog, \
@@ -718,10 +718,10 @@ int bb_execvp(const char *file, char *const argv[]);
718#endif 718#endif
719 719
720/* NOMMU friendy fork+exec */ 720/* NOMMU friendy fork+exec */
721pid_t spawn(char **argv); 721pid_t spawn(char **argv) FAST_FUNC;
722pid_t xspawn(char **argv); 722pid_t xspawn(char **argv) FAST_FUNC;
723 723
724int safe_waitpid(int pid, int *wstat, int options); 724int safe_waitpid(int pid, int *wstat, int options) FAST_FUNC;
725/* Unlike waitpid, waits ONLY for one process. 725/* Unlike waitpid, waits ONLY for one process.
726 * It's safe to pass negative 'pids' from failed [v]fork - 726 * It's safe to pass negative 'pids' from failed [v]fork -
727 * wait4pid will return -1 (and will not clobber [v]fork's errno). 727 * wait4pid will return -1 (and will not clobber [v]fork's errno).
@@ -729,14 +729,14 @@ int safe_waitpid(int pid, int *wstat, int options);
729 * if (rc < 0) bb_perror_msg("%s", argv[0]); 729 * if (rc < 0) bb_perror_msg("%s", argv[0]);
730 * if (rc > 0) bb_error_msg("exit code: %d", rc); 730 * if (rc > 0) bb_error_msg("exit code: %d", rc);
731 */ 731 */
732int wait4pid(int pid); 732int wait4pid(int pid) FAST_FUNC;
733int wait_any_nohang(int *wstat); 733int wait_any_nohang(int *wstat) FAST_FUNC;
734#define wait_crashed(w) ((w) & 127) 734#define wait_crashed(w) ((w) & 127)
735#define wait_exitcode(w) ((w) >> 8) 735#define wait_exitcode(w) ((w) >> 8)
736#define wait_stopsig(w) ((w) >> 8) 736#define wait_stopsig(w) ((w) >> 8)
737#define wait_stopped(w) (((w) & 127) == 127) 737#define wait_stopped(w) (((w) & 127) == 127)
738/* wait4pid(spawn(argv)) + NOFORK/NOEXEC (if configured) */ 738/* wait4pid(spawn(argv)) + NOFORK/NOEXEC (if configured) */
739int spawn_and_wait(char **argv); 739int spawn_and_wait(char **argv) FAST_FUNC;
740struct nofork_save_area { 740struct nofork_save_area {
741 jmp_buf die_jmp; 741 jmp_buf die_jmp;
742 const char *applet_name; 742 const char *applet_name;
@@ -745,11 +745,11 @@ struct nofork_save_area {
745 int die_sleep; 745 int die_sleep;
746 smallint saved; 746 smallint saved;
747}; 747};
748void save_nofork_data(struct nofork_save_area *save); 748void save_nofork_data(struct nofork_save_area *save) FAST_FUNC;
749void restore_nofork_data(struct nofork_save_area *save); 749void restore_nofork_data(struct nofork_save_area *save) FAST_FUNC;
750/* Does NOT check that applet is NOFORK, just blindly runs it */ 750/* Does NOT check that applet is NOFORK, just blindly runs it */
751int run_nofork_applet(int applet_no, char **argv); 751int run_nofork_applet(int applet_no, char **argv) FAST_FUNC;
752int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **argv); 752int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **argv) FAST_FUNC;
753 753
754/* Helpers for daemonization. 754/* Helpers for daemonization.
755 * 755 *
@@ -781,26 +781,26 @@ enum {
781 DAEMON_ONLY_SANITIZE = 8, /* internal use */ 781 DAEMON_ONLY_SANITIZE = 8, /* internal use */
782}; 782};
783#if BB_MMU 783#if BB_MMU
784 void forkexit_or_rexec(void); 784 void forkexit_or_rexec(void) FAST_FUNC;
785 enum { re_execed = 0 }; 785 enum { re_execed = 0 };
786# define forkexit_or_rexec(argv) forkexit_or_rexec() 786# define forkexit_or_rexec(argv) forkexit_or_rexec()
787# define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags) 787# define bb_daemonize_or_rexec(flags, argv) bb_daemonize_or_rexec(flags)
788# define bb_daemonize(flags) bb_daemonize_or_rexec(flags, bogus) 788# define bb_daemonize(flags) bb_daemonize_or_rexec(flags, bogus)
789#else 789#else
790 void re_exec(char **argv) ATTRIBUTE_NORETURN; 790 void re_exec(char **argv) ATTRIBUTE_NORETURN FAST_FUNC;
791 void forkexit_or_rexec(char **argv); 791 void forkexit_or_rexec(char **argv) FAST_FUNC;
792 extern bool re_execed; 792 extern bool re_execed;
793 int BUG_fork_is_unavailable_on_nommu(void); 793 int BUG_fork_is_unavailable_on_nommu(void) FAST_FUNC;
794 int BUG_daemon_is_unavailable_on_nommu(void); 794 int BUG_daemon_is_unavailable_on_nommu(void) FAST_FUNC;
795 void BUG_bb_daemonize_is_unavailable_on_nommu(void); 795 void BUG_bb_daemonize_is_unavailable_on_nommu(void) FAST_FUNC;
796# define fork() BUG_fork_is_unavailable_on_nommu() 796# define fork() BUG_fork_is_unavailable_on_nommu()
797# define daemon(a,b) BUG_daemon_is_unavailable_on_nommu() 797# define daemon(a,b) BUG_daemon_is_unavailable_on_nommu()
798# define bb_daemonize(a) BUG_bb_daemonize_is_unavailable_on_nommu() 798# define bb_daemonize(a) BUG_bb_daemonize_is_unavailable_on_nommu()
799#endif 799#endif
800void bb_daemonize_or_rexec(int flags, char **argv); 800void bb_daemonize_or_rexec(int flags, char **argv) FAST_FUNC;
801void bb_sanitize_stdio(void); 801void bb_sanitize_stdio(void) FAST_FUNC;
802/* Clear dangerous stuff, set PATH. Return 1 if was run by different user. */ 802/* Clear dangerous stuff, set PATH. Return 1 if was run by different user. */
803int sanitize_env_if_suid(void); 803int sanitize_env_if_suid(void) FAST_FUNC;
804 804
805 805
806extern const char *const bb_argv_dash[]; /* "-", NULL */ 806extern const char *const bb_argv_dash[]; /* "-", NULL */
@@ -812,19 +812,19 @@ extern const char *opt_complementary;
812extern const char *applet_long_options; 812extern const char *applet_long_options;
813#endif 813#endif
814extern uint32_t option_mask32; 814extern uint32_t option_mask32;
815extern uint32_t getopt32(char **argv, const char *applet_opts, ...); 815extern uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC;
816 816
817 817
818typedef struct llist_t { 818typedef struct llist_t {
819 char *data; 819 char *data;
820 struct llist_t *link; 820 struct llist_t *link;
821} llist_t; 821} llist_t;
822void llist_add_to(llist_t **old_head, void *data); 822void llist_add_to(llist_t **old_head, void *data) FAST_FUNC;
823void llist_add_to_end(llist_t **list_head, void *data); 823void llist_add_to_end(llist_t **list_head, void *data) FAST_FUNC;
824void *llist_pop(llist_t **elm); 824void *llist_pop(llist_t **elm) FAST_FUNC;
825void llist_unlink(llist_t **head, llist_t *elm); 825void llist_unlink(llist_t **head, llist_t *elm) FAST_FUNC;
826void llist_free(llist_t *elm, void (*freeit)(void *data)); 826void llist_free(llist_t *elm, void (*freeit)(void *data)) FAST_FUNC;
827llist_t *llist_rev(llist_t *list); 827llist_t *llist_rev(llist_t *list) FAST_FUNC;
828/* BTW, surprisingly, changing API to 828/* BTW, surprisingly, changing API to
829 * llist_t *llist_add_to(llist_t *old_head, void *data) 829 * llist_t *llist_add_to(llist_t *old_head, void *data)
830 * etc does not result in smaller code... */ 830 * etc does not result in smaller code... */
@@ -834,7 +834,7 @@ llist_t *llist_rev(llist_t *list);
834#if ENABLE_FEATURE_PIDFILE || defined(WANT_PIDFILE) 834#if ENABLE_FEATURE_PIDFILE || defined(WANT_PIDFILE)
835/* True only if we created pidfile which is *file*, not /dev/null etc */ 835/* True only if we created pidfile which is *file*, not /dev/null etc */
836extern smallint wrote_pidfile; 836extern smallint wrote_pidfile;
837void write_pidfile(const char *path); 837void write_pidfile(const char *path) FAST_FUNC;
838#define remove_pidfile(path) do { if (wrote_pidfile) unlink(path); } while (0) 838#define remove_pidfile(path) do { if (wrote_pidfile) unlink(path); } while (0)
839#else 839#else
840enum { wrote_pidfile = 0 }; 840enum { wrote_pidfile = 0 };
@@ -853,20 +853,20 @@ extern smallint logmode;
853extern int die_sleep; 853extern int die_sleep;
854extern int xfunc_error_retval; 854extern int xfunc_error_retval;
855extern jmp_buf die_jmp; 855extern jmp_buf die_jmp;
856extern void xfunc_die(void) ATTRIBUTE_NORETURN; 856extern void xfunc_die(void) ATTRIBUTE_NORETURN FAST_FUNC;
857extern void bb_show_usage(void) ATTRIBUTE_NORETURN; 857extern void bb_show_usage(void) ATTRIBUTE_NORETURN FAST_FUNC;
858extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 858extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
859extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 859extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
860extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 860extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
861extern void bb_simple_perror_msg(const char *s); 861extern void bb_simple_perror_msg(const char *s) FAST_FUNC;
862extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 862extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
863extern void bb_simple_perror_msg_and_die(const char *s) __attribute__ ((noreturn)); 863extern void bb_simple_perror_msg_and_die(const char *s) __attribute__ ((noreturn)) FAST_FUNC;
864extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 864extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
865extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); 865extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC;
866extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN; 866extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN FAST_FUNC;
867extern void bb_perror_nomsg(void); 867extern void bb_perror_nomsg(void) FAST_FUNC;
868extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); 868extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC;
869extern void bb_verror_msg(const char *s, va_list p, const char *strerr); 869extern void bb_verror_msg(const char *s, va_list p, const char *strerr) FAST_FUNC;
870 870
871/* We need to export XXX_main from libbusybox 871/* We need to export XXX_main from libbusybox
872 * only if we build "individual" binaries 872 * only if we build "individual" binaries
@@ -893,15 +893,15 @@ int bunzip2_main(int argc, char **argv) MAIN_EXTERNALLY_VISIBLE;
893int bbunpack(char **argv, 893int bbunpack(char **argv,
894 char* (*make_new_name)(char *filename), 894 char* (*make_new_name)(char *filename),
895 USE_DESKTOP(long long) int (*unpacker)(void) 895 USE_DESKTOP(long long) int (*unpacker)(void)
896); 896) FAST_FUNC;
897#if ENABLE_ROUTE 897#if ENABLE_ROUTE
898void bb_displayroutes(int noresolve, int netstatfmt); 898void bb_displayroutes(int noresolve, int netstatfmt) FAST_FUNC;
899#endif 899#endif
900 900
901 901
902/* Networking */ 902/* Networking */
903int create_icmp_socket(void); 903int create_icmp_socket(void) FAST_FUNC;
904int create_icmp6_socket(void); 904int create_icmp6_socket(void) FAST_FUNC;
905/* interface.c */ 905/* interface.c */
906/* This structure defines protocol families and their handlers. */ 906/* This structure defines protocol families and their handlers. */
907struct aftype { 907struct aftype {
@@ -909,15 +909,14 @@ struct aftype {
909 const char *title; 909 const char *title;
910 int af; 910 int af;
911 int alen; 911 int alen;
912 char *(*print) (unsigned char *); 912 char* FAST_FUNC (*print)(unsigned char *);
913 const char *(*sprint) (struct sockaddr *, int numeric); 913 const char* FAST_FUNC (*sprint)(struct sockaddr *, int numeric);
914 int (*input) (/*int type,*/ const char *bufp, struct sockaddr *); 914 int FAST_FUNC (*input)(/*int type,*/ const char *bufp, struct sockaddr *);
915 void (*herror) (char *text); 915 void FAST_FUNC (*herror)(char *text);
916 int (*rprint) (int options); 916 int FAST_FUNC (*rprint)(int options);
917 int (*rinput) (int typ, int ext, char **argv); 917 int FAST_FUNC (*rinput)(int typ, int ext, char **argv);
918
919 /* may modify src */ 918 /* may modify src */
920 int (*getmask) (char *src, struct sockaddr * mask, char *name); 919 int FAST_FUNC (*getmask)(char *src, struct sockaddr *mask, char *name);
921}; 920};
922/* This structure defines hardware protocols and their handlers. */ 921/* This structure defines hardware protocols and their handlers. */
923struct hwtype { 922struct hwtype {
@@ -925,95 +924,95 @@ struct hwtype {
925 const char *title; 924 const char *title;
926 int type; 925 int type;
927 int alen; 926 int alen;
928 char *(*print) (unsigned char *); 927 char* FAST_FUNC (*print)(unsigned char *);
929 int (*input) (const char *, struct sockaddr *); 928 int FAST_FUNC (*input)(const char *, struct sockaddr *);
930 int (*activate) (int fd); 929 int FAST_FUNC (*activate)(int fd);
931 int suppress_null_addr; 930 int suppress_null_addr;
932}; 931};
933extern smallint interface_opt_a; 932extern smallint interface_opt_a;
934int display_interfaces(char *ifname); 933int display_interfaces(char *ifname) FAST_FUNC;
935#if ENABLE_FEATURE_HWIB 934#if ENABLE_FEATURE_HWIB
936int in_ib(const char *bufp, struct sockaddr *sap); 935int in_ib(const char *bufp, struct sockaddr *sap) FAST_FUNC;
937#else 936#else
938#define in_ib(a, b) 1 /* fail */ 937#define in_ib(a, b) 1 /* fail */
939#endif 938#endif
940const struct aftype *get_aftype(const char *name); 939const struct aftype *get_aftype(const char *name) FAST_FUNC;
941const struct hwtype *get_hwtype(const char *name); 940const struct hwtype *get_hwtype(const char *name) FAST_FUNC;
942const struct hwtype *get_hwntype(int type); 941const struct hwtype *get_hwntype(int type) FAST_FUNC;
943 942
944 943
945#ifndef BUILD_INDIVIDUAL 944#ifndef BUILD_INDIVIDUAL
946extern int find_applet_by_name(const char *name); 945extern int find_applet_by_name(const char *name) FAST_FUNC;
947/* Returns only if applet is not found. */ 946/* Returns only if applet is not found. */
948extern void run_applet_and_exit(const char *name, char **argv); 947extern void run_applet_and_exit(const char *name, char **argv) FAST_FUNC;
949extern void run_applet_no_and_exit(int a, char **argv) ATTRIBUTE_NORETURN; 948extern void run_applet_no_and_exit(int a, char **argv) ATTRIBUTE_NORETURN FAST_FUNC;
950#endif 949#endif
951 950
952#ifdef HAVE_MNTENT_H 951#ifdef HAVE_MNTENT_H
953extern int match_fstype(const struct mntent *mt, const char *fstypes); 952extern int match_fstype(const struct mntent *mt, const char *fstypes) FAST_FUNC;
954extern struct mntent *find_mount_point(const char *name, const char *table); 953extern struct mntent *find_mount_point(const char *name, const char *table) FAST_FUNC;
955#endif 954#endif
956extern void erase_mtab(const char * name); 955extern void erase_mtab(const char * name) FAST_FUNC;
957extern unsigned int tty_baud_to_value(speed_t speed); 956extern unsigned int tty_baud_to_value(speed_t speed) FAST_FUNC;
958extern speed_t tty_value_to_baud(unsigned int value); 957extern speed_t tty_value_to_baud(unsigned int value) FAST_FUNC;
959extern void bb_warn_ignoring_args(int n); 958extern void bb_warn_ignoring_args(int n) FAST_FUNC;
960 959
961extern int get_linux_version_code(void); 960extern int get_linux_version_code(void) FAST_FUNC;
962 961
963extern char *query_loop(const char *device); 962extern char *query_loop(const char *device) FAST_FUNC;
964extern int del_loop(const char *device); 963extern int del_loop(const char *device) FAST_FUNC;
965/* If *devname is not NULL, use that name, otherwise try to find free one, 964/* If *devname is not NULL, use that name, otherwise try to find free one,
966 * malloc and return it in *devname. 965 * malloc and return it in *devname.
967 * return value: 1: read-only loopdev was setup, 0: rw, < 0: error */ 966 * return value: 1: read-only loopdev was setup, 0: rw, < 0: error */
968extern int set_loop(char **devname, const char *file, unsigned long long offset); 967extern int set_loop(char **devname, const char *file, unsigned long long offset) FAST_FUNC;
969 968
970 969
971//TODO: pass buf pointer or return allocated buf (avoid statics)? 970//TODO: pass buf pointer or return allocated buf (avoid statics)?
972char *bb_askpass(int timeout, const char * prompt); 971char *bb_askpass(int timeout, const char * prompt) FAST_FUNC;
973int bb_ask_confirmation(void); 972int bb_ask_confirmation(void) FAST_FUNC;
974 973
975extern int bb_parse_mode(const char* s, mode_t* theMode); 974extern int bb_parse_mode(const char* s, mode_t* theMode) FAST_FUNC;
976 975
977/* Concatenate path and filename to new allocated buffer. 976/* Concatenate path and filename to new allocated buffer.
978 * Add "/" only as needed (no duplicate "//" are produced). 977 * Add "/" only as needed (no duplicate "//" are produced).
979 * If path is NULL, it is assumed to be "/". 978 * If path is NULL, it is assumed to be "/".
980 * filename should not be NULL. */ 979 * filename should not be NULL. */
981char *concat_path_file(const char *path, const char *filename); 980char *concat_path_file(const char *path, const char *filename) FAST_FUNC;
982char *concat_subpath_file(const char *path, const char *filename); 981char *concat_subpath_file(const char *path, const char *filename) FAST_FUNC;
983const char *bb_basename(const char *name); 982const char *bb_basename(const char *name) FAST_FUNC;
984/* NB: can violate const-ness (similarly to strchr) */ 983/* NB: can violate const-ness (similarly to strchr) */
985char *last_char_is(const char *s, int c); 984char *last_char_is(const char *s, int c) FAST_FUNC;
986 985
987 986
988USE_DESKTOP(long long) int uncompress(int fd_in, int fd_out); 987USE_DESKTOP(long long) int uncompress(int fd_in, int fd_out) FAST_FUNC;
989int inflate(int in, int out); 988int inflate(int in, int out) FAST_FUNC;
990 989
991 990
992int bb_make_directory(char *path, long mode, int flags); 991int bb_make_directory(char *path, long mode, int flags) FAST_FUNC;
993 992
994int get_signum(const char *name); 993int get_signum(const char *name) FAST_FUNC;
995const char *get_signame(int number); 994const char *get_signame(int number) FAST_FUNC;
996void print_signames(void); 995void print_signames(void) FAST_FUNC;
997 996
998char *bb_simplify_path(const char *path); 997char *bb_simplify_path(const char *path) FAST_FUNC;
999 998
1000#define FAIL_DELAY 3 999#define FAIL_DELAY 3
1001extern void bb_do_delay(int seconds); 1000extern void bb_do_delay(int seconds) FAST_FUNC;
1002extern void change_identity(const struct passwd *pw); 1001extern void change_identity(const struct passwd *pw) FAST_FUNC;
1003extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) ATTRIBUTE_NORETURN; 1002extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) ATTRIBUTE_NORETURN FAST_FUNC;
1004extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args); 1003extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) FAST_FUNC;
1005#if ENABLE_SELINUX 1004#if ENABLE_SELINUX
1006extern void renew_current_security_context(void); 1005extern void renew_current_security_context(void) FAST_FUNC;
1007extern void set_current_security_context(security_context_t sid); 1006extern void set_current_security_context(security_context_t sid) FAST_FUNC;
1008extern context_t set_security_context_component(security_context_t cur_context, 1007extern context_t set_security_context_component(security_context_t cur_context,
1009 char *user, char *role, char *type, char *range); 1008 char *user, char *role, char *type, char *range) FAST_FUNC;
1010extern void setfscreatecon_or_die(security_context_t scontext); 1009extern void setfscreatecon_or_die(security_context_t scontext) FAST_FUNC;
1011extern void selinux_preserve_fcontext(int fdesc); 1010extern void selinux_preserve_fcontext(int fdesc) FAST_FUNC;
1012#else 1011#else
1013#define selinux_preserve_fcontext(fdesc) ((void)0) 1012#define selinux_preserve_fcontext(fdesc) ((void)0)
1014#endif 1013#endif
1015extern void selinux_or_die(void); 1014extern void selinux_or_die(void) FAST_FUNC;
1016extern int restricted_shell(const char *shell); 1015extern int restricted_shell(const char *shell) FAST_FUNC;
1017 1016
1018/* setup_environment: 1017/* setup_environment:
1019 * if clear_env = 1: cd(pw->pw_dir), clear environment, then set 1018 * if clear_env = 1: cd(pw->pw_dir), clear environment, then set
@@ -1029,14 +1028,14 @@ extern int restricted_shell(const char *shell);
1029 * SHELL=shell 1028 * SHELL=shell
1030 * else does nothing 1029 * else does nothing
1031 */ 1030 */
1032extern void setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw); 1031extern void setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw) FAST_FUNC;
1033extern int correct_password(const struct passwd *pw); 1032extern int correct_password(const struct passwd *pw) FAST_FUNC;
1034/* Returns a malloced string */ 1033/* Returns a malloced string */
1035#if !ENABLE_USE_BB_CRYPT 1034#if !ENABLE_USE_BB_CRYPT
1036#define pw_encrypt(clear, salt, cleanup) pw_encrypt(clear, salt) 1035#define pw_encrypt(clear, salt, cleanup) pw_encrypt(clear, salt)
1037#endif 1036#endif
1038extern char *pw_encrypt(const char *clear, const char *salt, int cleanup); 1037extern char *pw_encrypt(const char *clear, const char *salt, int cleanup) FAST_FUNC;
1039extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); 1038extern int obscure(const char *old, const char *newval, const struct passwd *pwdp) FAST_FUNC;
1040/* rnd is additional random input. New one is returned. 1039/* rnd is additional random input. New one is returned.
1041 * Useful if you call crypt_make_salt many times in a row: 1040 * Useful if you call crypt_make_salt many times in a row:
1042 * rnd = crypt_make_salt(buf1, 4, 0); 1041 * rnd = crypt_make_salt(buf1, 4, 0);
@@ -1044,44 +1043,44 @@ extern int obscure(const char *old, const char *newval, const struct passwd *pwd
1044 * rnd = crypt_make_salt(buf3, 4, rnd); 1043 * rnd = crypt_make_salt(buf3, 4, rnd);
1045 * (otherwise we risk having same salt generated) 1044 * (otherwise we risk having same salt generated)
1046 */ 1045 */
1047extern int crypt_make_salt(char *p, int cnt, int rnd); 1046extern int crypt_make_salt(char *p, int cnt, int rnd) FAST_FUNC;
1048/* Returns number of lines changed, or -1 on error */ 1047/* Returns number of lines changed, or -1 on error */
1049extern int update_passwd(const char *filename, const char *username, 1048extern int update_passwd(const char *filename, const char *username,
1050 const char *new_pw); 1049 const char *new_pw) FAST_FUNC;
1051 1050
1052int index_in_str_array(const char *const string_array[], const char *key); 1051int index_in_str_array(const char *const string_array[], const char *key) FAST_FUNC;
1053int index_in_strings(const char *strings, const char *key); 1052int index_in_strings(const char *strings, const char *key) FAST_FUNC;
1054int index_in_substr_array(const char *const string_array[], const char *key); 1053int index_in_substr_array(const char *const string_array[], const char *key) FAST_FUNC;
1055int index_in_substrings(const char *strings, const char *key); 1054int index_in_substrings(const char *strings, const char *key) FAST_FUNC;
1056const char *nth_string(const char *strings, int n); 1055const char *nth_string(const char *strings, int n) FAST_FUNC;
1057 1056
1058extern void print_login_issue(const char *issue_file, const char *tty); 1057extern void print_login_issue(const char *issue_file, const char *tty) FAST_FUNC;
1059extern void print_login_prompt(void); 1058extern void print_login_prompt(void) FAST_FUNC;
1060 1059
1061/* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */ 1060/* NB: typically you want to pass fd 0, not 1. Think 'applet | grep something' */
1062int get_terminal_width_height(int fd, unsigned *width, unsigned *height); 1061int get_terminal_width_height(int fd, unsigned *width, unsigned *height) FAST_FUNC;
1063 1062
1064/* NB: "unsigned request" is crucial! "int request" will break some arches! */ 1063/* NB: "unsigned request" is crucial! "int request" will break some arches! */
1065int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))); 1064int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))) FAST_FUNC;
1066int ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))); 1065int ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))) FAST_FUNC;
1067#if ENABLE_IOCTL_HEX2STR_ERROR 1066#if ENABLE_IOCTL_HEX2STR_ERROR
1068int bb_ioctl_or_warn(int fd, unsigned request, void *argp, const char *ioctl_name); 1067int bb_ioctl_or_warn(int fd, unsigned request, void *argp, const char *ioctl_name) FAST_FUNC;
1069int bb_xioctl(int fd, unsigned request, void *argp, const char *ioctl_name); 1068int bb_xioctl(int fd, unsigned request, void *argp, const char *ioctl_name) FAST_FUNC;
1070#define ioctl_or_warn(fd,request,argp) bb_ioctl_or_warn(fd,request,argp,#request) 1069#define ioctl_or_warn(fd,request,argp) bb_ioctl_or_warn(fd,request,argp,#request)
1071#define xioctl(fd,request,argp) bb_xioctl(fd,request,argp,#request) 1070#define xioctl(fd,request,argp) bb_xioctl(fd,request,argp,#request)
1072#else 1071#else
1073int bb_ioctl_or_warn(int fd, unsigned request, void *argp); 1072int bb_ioctl_or_warn(int fd, unsigned request, void *argp) FAST_FUNC;
1074int bb_xioctl(int fd, unsigned request, void *argp); 1073int bb_xioctl(int fd, unsigned request, void *argp) FAST_FUNC;
1075#define ioctl_or_warn(fd,request,argp) bb_ioctl_or_warn(fd,request,argp) 1074#define ioctl_or_warn(fd,request,argp) bb_ioctl_or_warn(fd,request,argp)
1076#define xioctl(fd,request,argp) bb_xioctl(fd,request,argp) 1075#define xioctl(fd,request,argp) bb_xioctl(fd,request,argp)
1077#endif 1076#endif
1078 1077
1079char *is_in_ino_dev_hashtable(const struct stat *statbuf); 1078char *is_in_ino_dev_hashtable(const struct stat *statbuf) FAST_FUNC;
1080void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); 1079void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) FAST_FUNC;
1081void reset_ino_dev_hashtable(void); 1080void reset_ino_dev_hashtable(void) FAST_FUNC;
1082#ifdef __GLIBC__ 1081#ifdef __GLIBC__
1083/* At least glibc has horrendously large inline for this, so wrap it */ 1082/* At least glibc has horrendously large inline for this, so wrap it */
1084unsigned long long bb_makedev(unsigned int major, unsigned int minor); 1083unsigned long long bb_makedev(unsigned int major, unsigned int minor) FAST_FUNC;
1085#undef makedev 1084#undef makedev
1086#define makedev(a,b) bb_makedev(a,b) 1085#define makedev(a,b) bb_makedev(a,b)
1087#endif 1086#endif
@@ -1113,15 +1112,15 @@ enum {
1113 WITH_PATH_LOOKUP = 0x20, 1112 WITH_PATH_LOOKUP = 0x20,
1114 FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION, 1113 FOR_SHELL = DO_HISTORY | SAVE_HISTORY | TAB_COMPLETION | USERNAME_COMPLETION,
1115}; 1114};
1116line_input_t *new_line_input_t(int flags); 1115line_input_t *new_line_input_t(int flags) FAST_FUNC;
1117/* Returns: 1116/* Returns:
1118 * -1 on read errors or EOF, or on bare Ctrl-D, 1117 * -1 on read errors or EOF, or on bare Ctrl-D,
1119 * 0 on ctrl-C (the line entered is still returned in 'command'), 1118 * 0 on ctrl-C (the line entered is still returned in 'command'),
1120 * >0 length of input string, including terminating '\n' 1119 * >0 length of input string, including terminating '\n'
1121 */ 1120 */
1122int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state); 1121int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state) FAST_FUNC;
1123#else 1122#else
1124int read_line_input(const char* prompt, char* command, int maxsize); 1123int read_line_input(const char* prompt, char* command, int maxsize) FAST_FUNC;
1125#define read_line_input(prompt, command, maxsize, state) \ 1124#define read_line_input(prompt, command, maxsize, state) \
1126 read_line_input(prompt, command, maxsize) 1125 read_line_input(prompt, command, maxsize)
1127#endif 1126#endif
@@ -1197,28 +1196,28 @@ enum {
1197 | PSSCAN_STIME | PSSCAN_UTIME | PSSCAN_START_TIME 1196 | PSSCAN_STIME | PSSCAN_UTIME | PSSCAN_START_TIME
1198 | PSSCAN_TTY, 1197 | PSSCAN_TTY,
1199}; 1198};
1200//procps_status_t* alloc_procps_scan(void); 1199//procps_status_t* alloc_procps_scan(void) FAST_FUNC;
1201void free_procps_scan(procps_status_t* sp); 1200void free_procps_scan(procps_status_t* sp) FAST_FUNC;
1202procps_status_t* procps_scan(procps_status_t* sp, int flags); 1201procps_status_t* procps_scan(procps_status_t* sp, int flags) FAST_FUNC;
1203/* Format cmdline (up to col chars) into char buf[col+1] */ 1202/* Format cmdline (up to col chars) into char buf[col+1] */
1204/* Puts [comm] if cmdline is empty (-> process is a kernel thread) */ 1203/* Puts [comm] if cmdline is empty (-> process is a kernel thread) */
1205void read_cmdline(char *buf, int col, unsigned pid, const char *comm); 1204void read_cmdline(char *buf, int col, unsigned pid, const char *comm) FAST_FUNC;
1206pid_t *find_pid_by_name(const char* procName); 1205pid_t *find_pid_by_name(const char* procName) FAST_FUNC;
1207pid_t *pidlist_reverse(pid_t *pidList); 1206pid_t *pidlist_reverse(pid_t *pidList) FAST_FUNC;
1208 1207
1209 1208
1210extern const char bb_uuenc_tbl_base64[]; 1209extern const char bb_uuenc_tbl_base64[];
1211extern const char bb_uuenc_tbl_std[]; 1210extern const char bb_uuenc_tbl_std[];
1212void bb_uuencode(char *store, const void *s, int length, const char *tbl); 1211void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC;
1213 1212
1214typedef struct sha1_ctx_t { 1213typedef struct sha1_ctx_t {
1215 uint32_t count[2]; 1214 uint32_t count[2];
1216 uint32_t hash[5]; 1215 uint32_t hash[5];
1217 uint32_t wbuf[16]; 1216 uint32_t wbuf[16];
1218} sha1_ctx_t; 1217} sha1_ctx_t;
1219void sha1_begin(sha1_ctx_t *ctx); 1218void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC;
1220void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx); 1219void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx) FAST_FUNC;
1221void *sha1_end(void *resbuf, sha1_ctx_t *ctx); 1220void *sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC;
1222 1221
1223typedef struct md5_ctx_t { 1222typedef struct md5_ctx_t {
1224 uint32_t A; 1223 uint32_t A;
@@ -1229,11 +1228,19 @@ typedef struct md5_ctx_t {
1229 uint32_t buflen; 1228 uint32_t buflen;
1230 char buffer[128]; 1229 char buffer[128];
1231} md5_ctx_t; 1230} md5_ctx_t;
1232void md5_begin(md5_ctx_t *ctx); 1231void md5_begin(md5_ctx_t *ctx) FAST_FUNC;
1233void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); 1232void md5_hash(const void *data, size_t length, md5_ctx_t *ctx) FAST_FUNC;
1234void *md5_end(void *resbuf, md5_ctx_t *ctx); 1233void *md5_end(void *resbuf, md5_ctx_t *ctx) FAST_FUNC;
1234
1235uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC;
1235 1236
1236uint32_t *crc32_filltable(uint32_t *tbl256, int endian); 1237typedef struct masks_labels_t {
1238 const char *labels;
1239 const int masks[];
1240} masks_labels_t;
1241int print_flags_separated(const int *masks, const char *labels,
1242 int flags, const char *separator) FAST_FUNC;
1243int print_flags(const masks_labels_t *ml, int flags) FAST_FUNC;
1237 1244
1238 1245
1239extern const char *applet_name; 1246extern const char *applet_name;
@@ -1305,15 +1312,6 @@ extern const char bb_default_login_shell[];
1305/* "sh" */ 1312/* "sh" */
1306#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+6) 1313#define DEFAULT_SHELL_SHORT_NAME (bb_default_login_shell+6)
1307 1314
1308typedef struct masks_labels_t {
1309 const char *labels;
1310 const int masks[];
1311} masks_labels_t;
1312
1313int print_flags_separated(const int *masks, const char *labels,
1314 int flags, const char *separator);
1315extern int print_flags(const masks_labels_t *ml, int flags);
1316
1317#if ENABLE_FEATURE_DEVFS 1315#if ENABLE_FEATURE_DEVFS
1318# define CURRENT_VC "/dev/vc/0" 1316# define CURRENT_VC "/dev/vc/0"
1319# define VC_1 "/dev/vc/1" 1317# define VC_1 "/dev/vc/1"
diff --git a/include/platform.h b/include/platform.h
index cdc1151ad..8d6ed9a3e 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -97,6 +97,13 @@
97# endif 97# endif
98#endif 98#endif
99 99
100#if __GNUC_PREREQ(3,0) && defined(i386)
101/* || defined(__x86_64__)? */
102# define FAST_FUNC __attribute__((regparm(3)))
103#else
104# define FAST_FUNC
105#endif
106
100/* ---- Endian Detection ------------------------------------ */ 107/* ---- Endian Detection ------------------------------------ */
101 108
102#if (defined __digital__ && defined __unix__) 109#if (defined __digital__ && defined __unix__)
diff --git a/include/rtc_.h b/include/rtc_.h
index b8e4de895..2e990581f 100644
--- a/include/rtc_.h
+++ b/include/rtc_.h
@@ -13,9 +13,9 @@
13# pragma GCC visibility push(hidden) 13# pragma GCC visibility push(hidden)
14#endif 14#endif
15 15
16extern int rtc_adjtime_is_utc(void); 16extern int rtc_adjtime_is_utc(void) FAST_FUNC;
17extern int rtc_xopen(const char **default_rtc, int flags); 17extern int rtc_xopen(const char **default_rtc, int flags) FAST_FUNC;
18extern time_t rtc_read_time(int fd, int utc); 18extern time_t rtc_read_time(int fd, int utc) FAST_FUNC;
19 19
20/* 20/*
21 * Everything below this point has been copied from linux/rtc.h 21 * Everything below this point has been copied from linux/rtc.h
diff --git a/include/unarchive.h b/include/unarchive.h
index a6b047794..721f879a4 100644
--- a/include/unarchive.h
+++ b/include/unarchive.h
@@ -31,7 +31,7 @@ typedef struct file_header_t {
31 31
32typedef struct archive_handle_t { 32typedef struct archive_handle_t {
33 /* define if the header and data component should be processed */ 33 /* define if the header and data component should be processed */
34 char (*filter)(struct archive_handle_t *); 34 char FAST_FUNC (*filter)(struct archive_handle_t *);
35 llist_t *accept; 35 llist_t *accept;
36 /* List of files that have been rejected */ 36 /* List of files that have been rejected */
37 llist_t *reject; 37 llist_t *reject;
@@ -42,13 +42,13 @@ typedef struct archive_handle_t {
42 file_header_t *file_header; 42 file_header_t *file_header;
43 43
44 /* process the header component, e.g. tar -t */ 44 /* process the header component, e.g. tar -t */
45 void (*action_header)(const file_header_t *); 45 void FAST_FUNC (*action_header)(const file_header_t *);
46 46
47 /* process the data component, e.g. extract to filesystem */ 47 /* process the data component, e.g. extract to filesystem */
48 void (*action_data)(struct archive_handle_t *); 48 void FAST_FUNC (*action_data)(struct archive_handle_t *);
49 49
50 /* How to process any sub archive, e.g. get_header_tar_gz */ 50 /* How to process any sub archive, e.g. get_header_tar_gz */
51 char (*action_data_subarchive)(struct archive_handle_t *); 51 char FAST_FUNC (*action_data_subarchive)(struct archive_handle_t *);
52 52
53 /* Contains the handle to a sub archive */ 53 /* Contains the handle to a sub archive */
54 struct archive_handle_t *sub_archive; 54 struct archive_handle_t *sub_archive;
@@ -60,7 +60,7 @@ typedef struct archive_handle_t {
60 off_t offset; 60 off_t offset;
61 61
62 /* Function that skips data: read_by_char or read_by_skip */ 62 /* Function that skips data: read_by_char or read_by_skip */
63 void (*seek)(const struct archive_handle_t *archive_handle, const unsigned amount); 63 void FAST_FUNC (*seek)(const struct archive_handle_t *archive_handle, const unsigned amount);
64 64
65 /* Temporary storage */ 65 /* Temporary storage */
66 char *buffer; 66 char *buffer;
@@ -71,62 +71,62 @@ typedef struct archive_handle_t {
71} archive_handle_t; 71} archive_handle_t;
72 72
73 73
74extern archive_handle_t *init_handle(void); 74extern archive_handle_t *init_handle(void) FAST_FUNC;
75 75
76extern char filter_accept_all(archive_handle_t *archive_handle); 76extern char filter_accept_all(archive_handle_t *archive_handle) FAST_FUNC;
77extern char filter_accept_list(archive_handle_t *archive_handle); 77extern char filter_accept_list(archive_handle_t *archive_handle) FAST_FUNC;
78extern char filter_accept_list_reassign(archive_handle_t *archive_handle); 78extern char filter_accept_list_reassign(archive_handle_t *archive_handle) FAST_FUNC;
79extern char filter_accept_reject_list(archive_handle_t *archive_handle); 79extern char filter_accept_reject_list(archive_handle_t *archive_handle) FAST_FUNC;
80 80
81extern void unpack_ar_archive(archive_handle_t *ar_archive); 81extern void unpack_ar_archive(archive_handle_t *ar_archive) FAST_FUNC;
82 82
83extern void data_skip(archive_handle_t *archive_handle); 83extern void data_skip(archive_handle_t *archive_handle) FAST_FUNC;
84extern void data_extract_all(archive_handle_t *archive_handle); 84extern void data_extract_all(archive_handle_t *archive_handle) FAST_FUNC;
85extern void data_extract_to_stdout(archive_handle_t *archive_handle); 85extern void data_extract_to_stdout(archive_handle_t *archive_handle) FAST_FUNC;
86extern void data_extract_to_buffer(archive_handle_t *archive_handle); 86extern void data_extract_to_buffer(archive_handle_t *archive_handle) FAST_FUNC;
87 87
88extern void header_skip(const file_header_t *file_header); 88extern void header_skip(const file_header_t *file_header) FAST_FUNC;
89extern void header_list(const file_header_t *file_header); 89extern void header_list(const file_header_t *file_header) FAST_FUNC;
90extern void header_verbose_list(const file_header_t *file_header); 90extern void header_verbose_list(const file_header_t *file_header) FAST_FUNC;
91 91
92extern char get_header_ar(archive_handle_t *archive_handle); 92extern char get_header_ar(archive_handle_t *archive_handle) FAST_FUNC;
93extern char get_header_cpio(archive_handle_t *archive_handle); 93extern char get_header_cpio(archive_handle_t *archive_handle) FAST_FUNC;
94extern char get_header_tar(archive_handle_t *archive_handle); 94extern char get_header_tar(archive_handle_t *archive_handle) FAST_FUNC;
95extern char get_header_tar_bz2(archive_handle_t *archive_handle); 95extern char get_header_tar_bz2(archive_handle_t *archive_handle) FAST_FUNC;
96extern char get_header_tar_lzma(archive_handle_t *archive_handle); 96extern char get_header_tar_lzma(archive_handle_t *archive_handle) FAST_FUNC;
97extern char get_header_tar_gz(archive_handle_t *archive_handle); 97extern char get_header_tar_gz(archive_handle_t *archive_handle) FAST_FUNC;
98 98
99extern void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount); 99extern void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount) FAST_FUNC;
100extern void seek_by_read(const archive_handle_t *archive_handle, unsigned amount); 100extern void seek_by_read(const archive_handle_t *archive_handle, unsigned amount) FAST_FUNC;
101 101
102extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count); 102extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count) FAST_FUNC;
103 103
104extern void data_align(archive_handle_t *archive_handle, unsigned boundary); 104extern void data_align(archive_handle_t *archive_handle, unsigned boundary) FAST_FUNC;
105extern const llist_t *find_list_entry(const llist_t *list, const char *filename); 105extern const llist_t *find_list_entry(const llist_t *list, const char *filename) FAST_FUNC;
106extern const llist_t *find_list_entry2(const llist_t *list, const char *filename); 106extern const llist_t *find_list_entry2(const llist_t *list, const char *filename) FAST_FUNC;
107 107
108/* A bit of bunzip2 internals are exposed for compressed help support: */ 108/* A bit of bunzip2 internals are exposed for compressed help support: */
109typedef struct bunzip_data bunzip_data; 109typedef struct bunzip_data bunzip_data;
110int start_bunzip(bunzip_data **bdp, int in_fd, const unsigned char *inbuf, int len); 110int start_bunzip(bunzip_data **bdp, int in_fd, const unsigned char *inbuf, int len) FAST_FUNC;
111int read_bunzip(bunzip_data *bd, char *outbuf, int len); 111int read_bunzip(bunzip_data *bd, char *outbuf, int len) FAST_FUNC;
112void dealloc_bunzip(bunzip_data *bd); 112void dealloc_bunzip(bunzip_data *bd) FAST_FUNC;
113 113
114typedef struct inflate_unzip_result { 114typedef struct inflate_unzip_result {
115 off_t bytes_out; 115 off_t bytes_out;
116 uint32_t crc; 116 uint32_t crc;
117} inflate_unzip_result; 117} inflate_unzip_result;
118 118
119extern USE_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd); 119extern USE_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd) FAST_FUNC;
120extern USE_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd); 120extern USE_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC;
121extern USE_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd); 121extern USE_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd) FAST_FUNC;
122extern USE_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd); 122extern USE_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd) FAST_FUNC;
123 123
124#if BB_MMU 124#if BB_MMU
125extern int open_transformer(int src_fd, 125extern int open_transformer(int src_fd,
126 USE_DESKTOP(long long) int (*transformer)(int src_fd, int dst_fd)); 126 USE_DESKTOP(long long) int FAST_FUNC (*transformer)(int src_fd, int dst_fd)) FAST_FUNC;
127#define open_transformer(src_fd, transformer, transform_prog) open_transformer(src_fd, transformer) 127#define open_transformer(src_fd, transformer, transform_prog) open_transformer(src_fd, transformer)
128#else 128#else
129extern int open_transformer(int src_fd, const char *transform_prog); 129extern int open_transformer(int src_fd, const char *transform_prog) FAST_FUNC;
130#define open_transformer(src_fd, transformer, transform_prog) open_transformer(src_fd, transform_prog) 130#define open_transformer(src_fd, transformer, transform_prog) open_transformer(src_fd, transform_prog)
131#endif 131#endif
132 132
diff --git a/include/xatonum.h b/include/xatonum.h
index 6cf1299b3..944ee7742 100644
--- a/include/xatonum.h
+++ b/include/xatonum.h
@@ -14,20 +14,20 @@
14/* Provides extern declarations of functions */ 14/* Provides extern declarations of functions */
15#define DECLARE_STR_CONV(type, T, UT) \ 15#define DECLARE_STR_CONV(type, T, UT) \
16\ 16\
17unsigned type xstrto##UT##_range_sfx(const char *str, int b, unsigned type l, unsigned type u, const struct suffix_mult *sfx); \ 17unsigned type xstrto##UT##_range_sfx(const char *str, int b, unsigned type l, unsigned type u, const struct suffix_mult *sfx) FAST_FUNC; \
18unsigned type xstrto##UT##_range(const char *str, int b, unsigned type l, unsigned type u); \ 18unsigned type xstrto##UT##_range(const char *str, int b, unsigned type l, unsigned type u) FAST_FUNC; \
19unsigned type xstrto##UT##_sfx(const char *str, int b, const struct suffix_mult *sfx); \ 19unsigned type xstrto##UT##_sfx(const char *str, int b, const struct suffix_mult *sfx) FAST_FUNC; \
20unsigned type xstrto##UT(const char *str, int b); \ 20unsigned type xstrto##UT(const char *str, int b) FAST_FUNC; \
21unsigned type xato##UT##_range_sfx(const char *str, unsigned type l, unsigned type u, const struct suffix_mult *sfx); \ 21unsigned type xato##UT##_range_sfx(const char *str, unsigned type l, unsigned type u, const struct suffix_mult *sfx) FAST_FUNC; \
22unsigned type xato##UT##_range(const char *str, unsigned type l, unsigned type u); \ 22unsigned type xato##UT##_range(const char *str, unsigned type l, unsigned type u) FAST_FUNC; \
23unsigned type xato##UT##_sfx(const char *str, const struct suffix_mult *sfx); \ 23unsigned type xato##UT##_sfx(const char *str, const struct suffix_mult *sfx) FAST_FUNC; \
24unsigned type xato##UT(const char *str); \ 24unsigned type xato##UT(const char *str) FAST_FUNC; \
25type xstrto##T##_range_sfx(const char *str, int b, type l, type u, const struct suffix_mult *sfx); \ 25type xstrto##T##_range_sfx(const char *str, int b, type l, type u, const struct suffix_mult *sfx) FAST_FUNC; \
26type xstrto##T##_range(const char *str, int b, type l, type u); \ 26type xstrto##T##_range(const char *str, int b, type l, type u) FAST_FUNC; \
27type xato##T##_range_sfx(const char *str, type l, type u, const struct suffix_mult *sfx); \ 27type xato##T##_range_sfx(const char *str, type l, type u, const struct suffix_mult *sfx) FAST_FUNC; \
28type xato##T##_range(const char *str, type l, type u); \ 28type xato##T##_range(const char *str, type l, type u) FAST_FUNC; \
29type xato##T##_sfx(const char *str, const struct suffix_mult *sfx); \ 29type xato##T##_sfx(const char *str, const struct suffix_mult *sfx) FAST_FUNC; \
30type xato##T(const char *str); \ 30type xato##T(const char *str) FAST_FUNC; \
31 31
32/* Unsigned long long functions always exist */ 32/* Unsigned long long functions always exist */
33DECLARE_STR_CONV(long long, ll, ull) 33DECLARE_STR_CONV(long long, ll, ull)
@@ -122,8 +122,8 @@ static ALWAYS_INLINE uint32_t xatou32(const char *numstr)
122 * return value is all-ones in this case. 122 * return value is all-ones in this case.
123 */ 123 */
124 124
125unsigned long long bb_strtoull(const char *arg, char **endp, int base); 125unsigned long long bb_strtoull(const char *arg, char **endp, int base) FAST_FUNC;
126long long bb_strtoll(const char *arg, char **endp, int base); 126long long bb_strtoll(const char *arg, char **endp, int base) FAST_FUNC;
127 127
128#if ULONG_MAX == ULLONG_MAX 128#if ULONG_MAX == ULLONG_MAX
129static ALWAYS_INLINE 129static ALWAYS_INLINE
@@ -133,8 +133,8 @@ static ALWAYS_INLINE
133long bb_strtol(const char *arg, char **endp, int base) 133long bb_strtol(const char *arg, char **endp, int base)
134{ return bb_strtoll(arg, endp, base); } 134{ return bb_strtoll(arg, endp, base); }
135#else 135#else
136unsigned long bb_strtoul(const char *arg, char **endp, int base); 136unsigned long bb_strtoul(const char *arg, char **endp, int base) FAST_FUNC;
137long bb_strtol(const char *arg, char **endp, int base); 137long bb_strtol(const char *arg, char **endp, int base) FAST_FUNC;
138#endif 138#endif
139 139
140#if UINT_MAX == ULLONG_MAX 140#if UINT_MAX == ULLONG_MAX
@@ -152,8 +152,8 @@ static ALWAYS_INLINE
152int bb_strtoi(const char *arg, char **endp, int base) 152int bb_strtoi(const char *arg, char **endp, int base)
153{ return bb_strtol(arg, endp, base); } 153{ return bb_strtol(arg, endp, base); }
154#else 154#else
155unsigned bb_strtou(const char *arg, char **endp, int base); 155unsigned bb_strtou(const char *arg, char **endp, int base) FAST_FUNC;
156int bb_strtoi(const char *arg, char **endp, int base); 156int bb_strtoi(const char *arg, char **endp, int base) FAST_FUNC;
157#endif 157#endif
158 158
159int BUG_bb_strtou32_unimplemented(void); 159int BUG_bb_strtou32_unimplemented(void);
diff --git a/include/xregex.h b/include/xregex.h
index d4bf73279..90cf124ee 100644
--- a/include/xregex.h
+++ b/include/xregex.h
@@ -17,8 +17,8 @@
17# pragma GCC visibility push(hidden) 17# pragma GCC visibility push(hidden)
18#endif 18#endif
19 19
20char* regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags); 20char* regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags) FAST_FUNC;
21void xregcomp(regex_t *preg, const char *regex, int cflags); 21void xregcomp(regex_t *preg, const char *regex, int cflags) FAST_FUNC;
22 22
23#if __GNUC_PREREQ(4,1) 23#if __GNUC_PREREQ(4,1)
24# pragma GCC visibility pop 24# pragma GCC visibility pop