diff options
Diffstat (limited to 'include')
-rw-r--r-- | include/dump.h | 6 | ||||
-rw-r--r-- | include/inet_common.h | 8 | ||||
-rw-r--r-- | include/libbb.h | 634 | ||||
-rw-r--r-- | include/platform.h | 7 | ||||
-rw-r--r-- | include/rtc_.h | 6 | ||||
-rw-r--r-- | include/unarchive.h | 78 | ||||
-rw-r--r-- | include/xatonum.h | 40 | ||||
-rw-r--r-- | include/xregex.h | 4 |
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 | ||
47 | extern void bb_dump_add(const char *fmt); | 47 | extern void bb_dump_add(const char *fmt) FAST_FUNC; |
48 | extern int bb_dump_dump(char **argv); | 48 | extern int bb_dump_dump(char **argv) FAST_FUNC; |
49 | extern int bb_dump_size(FS * fs); | 49 | extern int bb_dump_size(FS * fs) FAST_FUNC; |
50 | 50 | ||
51 | extern FS *bb_dump_fshead; /* head of format strings */ | 51 | extern FS *bb_dump_fshead; /* head of format strings */ |
52 | extern int bb_dump_blocksize; /* data block size */ | 52 | extern 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 | */ |
15 | int INET_resolve(const char *name, struct sockaddr_in *s_in, int hostfirst); | 15 | int 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 | ||
22 | int INET6_resolve(const char *name, struct sockaddr_in6 *sin6); | 22 | int INET6_resolve(const char *name, struct sockaddr_in6 *sin6) FAST_FUNC; |
23 | 23 | ||
24 | /* These return malloced string */ | 24 | /* These return malloced string */ |
25 | char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask); | 25 | char *INET_rresolve(struct sockaddr_in *s_in, int numeric, uint32_t netmask) FAST_FUNC; |
26 | char *INET6_rresolve(struct sockaddr_in6 *sin6, int numeric); | 26 | char *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 | ||
240 | unsigned long long monotonic_us(void); | 240 | unsigned long long monotonic_us(void) FAST_FUNC; |
241 | unsigned monotonic_sec(void); | 241 | unsigned monotonic_sec(void) FAST_FUNC; |
242 | 242 | ||
243 | extern void chomp(char *s); | 243 | extern void chomp(char *s) FAST_FUNC; |
244 | extern void trim(char *s); | 244 | extern void trim(char *s) FAST_FUNC; |
245 | extern char *skip_whitespace(const char *); | 245 | extern char *skip_whitespace(const char *) FAST_FUNC; |
246 | extern char *skip_non_whitespace(const char *); | 246 | extern char *skip_non_whitespace(const char *) FAST_FUNC; |
247 | extern char *strrstr(const char *haystack, const char *needle); | 247 | extern 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)? |
250 | extern const char *bb_mode_string(mode_t mode); | 250 | extern const char *bb_mode_string(mode_t mode) FAST_FUNC; |
251 | extern int is_directory(const char *name, int followLinks, struct stat *statBuf); | 251 | extern int is_directory(const char *name, int followLinks, struct stat *statBuf) FAST_FUNC; |
252 | enum { /* DO NOT CHANGE THESE VALUES! cp.c, mv.c, install.c depend on them. */ | 252 | enum { /* 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") |
267 | extern int remove_file(const char *path, int flags); | 267 | extern 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. */ |
272 | extern int copy_file(const char *source, const char *dest, int flags); | 272 | extern int copy_file(const char *source, const char *dest, int flags) FAST_FUNC; |
273 | 273 | ||
274 | enum { | 274 | enum { |
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 | }; |
281 | extern int recursive_action(const char *fileName, unsigned flags, | 281 | extern 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; |
285 | extern int device_open(const char *device, int mode); | 285 | extern int device_open(const char *device, int mode) FAST_FUNC; |
286 | enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */ | 286 | enum { GETPTY_BUFSIZE = 16 }; /* more than enough for "/dev/ttyXXX" */ |
287 | extern int xgetpty(char *line); | 287 | extern int xgetpty(char *line) FAST_FUNC; |
288 | extern int get_console_fd(void); | 288 | extern int get_console_fd(void) FAST_FUNC; |
289 | extern void console_make_active(int fd, const int vt_num); | 289 | extern void console_make_active(int fd, const int vt_num) FAST_FUNC; |
290 | extern char *find_block_device(const char *path); | 290 | extern 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 */ |
292 | extern off_t bb_copyfd_eof(int fd1, int fd2); | 292 | extern off_t bb_copyfd_eof(int fd1, int fd2) FAST_FUNC; |
293 | extern off_t bb_copyfd_size(int fd1, int fd2, off_t size); | 293 | extern off_t bb_copyfd_size(int fd1, int fd2, off_t size) FAST_FUNC; |
294 | extern void bb_copyfd_exact_size(int fd1, int fd2, off_t size); | 294 | extern 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 */ |
297 | extern void complain_copyfd_and_die(off_t sz) ATTRIBUTE_NORETURN; | 297 | extern void complain_copyfd_and_die(off_t sz) ATTRIBUTE_NORETURN FAST_FUNC; |
298 | extern char bb_process_escape_sequence(const char **ptr); | 298 | extern 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 | */ |
305 | extern char *bb_get_last_path_component_strip(char *path); | 305 | extern 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' */ |
307 | extern char *bb_get_last_path_component_nostrip(const char *path); | 307 | extern char *bb_get_last_path_component_nostrip(const char *path) FAST_FUNC; |
308 | 308 | ||
309 | int ndelay_on(int fd); | 309 | int ndelay_on(int fd) FAST_FUNC; |
310 | int ndelay_off(int fd); | 310 | int ndelay_off(int fd) FAST_FUNC; |
311 | int close_on_exec_on(int fd); | 311 | int close_on_exec_on(int fd) FAST_FUNC; |
312 | void xdup2(int, int); | 312 | void xdup2(int, int) FAST_FUNC; |
313 | void xmove_fd(int, int); | 313 | void xmove_fd(int, int) FAST_FUNC; |
314 | 314 | ||
315 | 315 | ||
316 | DIR *xopendir(const char *path); | 316 | DIR *xopendir(const char *path) FAST_FUNC; |
317 | DIR *warn_opendir(const char *path); | 317 | DIR *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; */ |
320 | char *xmalloc_readlink(const char *path); | 320 | char *xmalloc_readlink(const char *path) FAST_FUNC; |
321 | char *xmalloc_readlink_or_warn(const char *path); | 321 | char *xmalloc_readlink_or_warn(const char *path) FAST_FUNC; |
322 | char *xrealloc_getcwd_or_warn(char *cwd); | 322 | char *xrealloc_getcwd_or_warn(char *cwd) FAST_FUNC; |
323 | 323 | ||
324 | char *xmalloc_follow_symlinks(const char *path); | 324 | char *xmalloc_follow_symlinks(const char *path) FAST_FUNC; |
325 | 325 | ||
326 | 326 | ||
327 | enum { | 327 | enum { |
@@ -354,43 +354,43 @@ enum { | |||
354 | + (1LL << SIGUSR2) | 354 | + (1LL << SIGUSR2) |
355 | + 0), | 355 | + 0), |
356 | }; | 356 | }; |
357 | void bb_signals(int sigs, void (*f)(int)); | 357 | void 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: */ |
361 | void bb_signals_recursive(int sigs, void (*f)(int)); | 361 | void 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: */ |
363 | void signal_no_SA_RESTART_empty_mask(int sig, void (*handler)(int)); | 363 | void 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): */ |
365 | void signal_SA_RESTART_empty_mask(int sig, void (*handler)(int)); | 365 | void signal_SA_RESTART_empty_mask(int sig, void (*handler)(int)) FAST_FUNC; |
366 | void wait_for_any_sig(void); | 366 | void wait_for_any_sig(void) FAST_FUNC; |
367 | void kill_myself_with_sig(int sig) ATTRIBUTE_NORETURN; | 367 | void kill_myself_with_sig(int sig) ATTRIBUTE_NORETURN FAST_FUNC; |
368 | void sig_block(int sig); | 368 | void sig_block(int sig) FAST_FUNC; |
369 | void sig_unblock(int sig); | 369 | void sig_unblock(int sig) FAST_FUNC; |
370 | /* Will do sigaction(signum, act, NULL): */ | 370 | /* Will do sigaction(signum, act, NULL): */ |
371 | int sigaction_set(int sig, const struct sigaction *act); | 371 | int sigaction_set(int sig, const struct sigaction *act) FAST_FUNC; |
372 | /* SIG_BLOCK/SIG_UNBLOCK all signals: */ | 372 | /* SIG_BLOCK/SIG_UNBLOCK all signals: */ |
373 | int sigprocmask_allsigs(int how); | 373 | int sigprocmask_allsigs(int how) FAST_FUNC; |
374 | 374 | ||
375 | 375 | ||
376 | void xsetgid(gid_t gid); | 376 | void xsetgid(gid_t gid) FAST_FUNC; |
377 | void xsetuid(uid_t uid); | 377 | void xsetuid(uid_t uid) FAST_FUNC; |
378 | void xchdir(const char *path); | 378 | void xchdir(const char *path) FAST_FUNC; |
379 | void xchroot(const char *path); | 379 | void xchroot(const char *path) FAST_FUNC; |
380 | void xsetenv(const char *key, const char *value); | 380 | void xsetenv(const char *key, const char *value) FAST_FUNC; |
381 | void xunlink(const char *pathname); | 381 | void xunlink(const char *pathname) FAST_FUNC; |
382 | void xstat(const char *pathname, struct stat *buf); | 382 | void xstat(const char *pathname, struct stat *buf) FAST_FUNC; |
383 | int xopen(const char *pathname, int flags); | 383 | int xopen(const char *pathname, int flags) FAST_FUNC FAST_FUNC; |
384 | int xopen3(const char *pathname, int flags, int mode); | 384 | int xopen3(const char *pathname, int flags, int mode) FAST_FUNC; |
385 | int open_or_warn(const char *pathname, int flags); | 385 | int open_or_warn(const char *pathname, int flags) FAST_FUNC; |
386 | int open3_or_warn(const char *pathname, int flags, int mode); | 386 | int open3_or_warn(const char *pathname, int flags, int mode) FAST_FUNC; |
387 | int open_or_warn_stdin(const char *pathname); | 387 | int open_or_warn_stdin(const char *pathname) FAST_FUNC; |
388 | void xrename(const char *oldpath, const char *newpath); | 388 | void xrename(const char *oldpath, const char *newpath) FAST_FUNC; |
389 | int rename_or_warn(const char *oldpath, const char *newpath); | 389 | int rename_or_warn(const char *oldpath, const char *newpath) FAST_FUNC; |
390 | off_t xlseek(int fd, off_t offset, int whence); | 390 | off_t xlseek(int fd, off_t offset, int whence) FAST_FUNC; |
391 | off_t fdlength(int fd); | 391 | off_t fdlength(int fd) FAST_FUNC; |
392 | 392 | ||
393 | void xpipe(int filedes[2]); | 393 | void 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 */ |
395 | struct fd_pair { int rd; int wr; }; | 395 | struct 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 | ||
427 | int xsocket(int domain, int type, int protocol); | 427 | int xsocket(int domain, int type, int protocol) FAST_FUNC; |
428 | void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen); | 428 | void xbind(int sockfd, struct sockaddr *my_addr, socklen_t addrlen) FAST_FUNC; |
429 | void xlisten(int s, int backlog); | 429 | void xlisten(int s, int backlog) FAST_FUNC; |
430 | void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen); | 430 | void xconnect(int s, const struct sockaddr *s_addr, socklen_t addrlen) FAST_FUNC; |
431 | ssize_t xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, | 431 | ssize_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(). */ |
439 | void setsockopt_reuseaddr(int fd); /* On Linux this never fails. */ | 439 | void setsockopt_reuseaddr(int fd) FAST_FUNC; /* On Linux this never fails. */ |
440 | int setsockopt_broadcast(int fd); | 440 | int setsockopt_broadcast(int fd) FAST_FUNC; |
441 | /* NB: returns port in host byte order */ | 441 | /* NB: returns port in host byte order */ |
442 | unsigned bb_lookup_port(const char *port, const char *protocol, unsigned default_port); | 442 | unsigned bb_lookup_port(const char *port, const char *protocol, unsigned default_port) FAST_FUNC; |
443 | typedef struct len_and_sockaddr { | 443 | typedef 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 |
471 | int xsocket_type(len_and_sockaddr **lsap, int af, int sock_type); | 471 | int xsocket_type(len_and_sockaddr **lsap, int af, int sock_type) FAST_FUNC; |
472 | #else | 472 | #else |
473 | int xsocket_type(len_and_sockaddr **lsap, int sock_type); | 473 | int 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 |
476 | int xsocket_stream(len_and_sockaddr **lsap); | 476 | int 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 */ |
482 | int create_and_bind_stream_or_die(const char *bindaddr, int port); | 482 | int create_and_bind_stream_or_die(const char *bindaddr, int port) FAST_FUNC; |
483 | int create_and_bind_dgram_or_die(const char *bindaddr, int port); | 483 | int 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 */ |
488 | int create_and_connect_stream_or_die(const char *peer, int port); | 488 | int 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 */ |
490 | int xconnect_stream(const len_and_sockaddr *lsa); | 490 | int 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 */ |
496 | len_and_sockaddr* host2sockaddr(const char *host, int port); | 496 | len_and_sockaddr* host2sockaddr(const char *host, int port) FAST_FUNC; |
497 | /* Version which dies on error */ | 497 | /* Version which dies on error */ |
498 | len_and_sockaddr* xhost2sockaddr(const char *host, int port); | 498 | len_and_sockaddr* xhost2sockaddr(const char *host, int port) FAST_FUNC; |
499 | len_and_sockaddr* xdotted2sockaddr(const char *host, int port); | 499 | len_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 |
505 | len_and_sockaddr* host_and_af2sockaddr(const char *host, int port, sa_family_t af); | 505 | len_and_sockaddr* host_and_af2sockaddr(const char *host, int port, sa_family_t af) FAST_FUNC; |
506 | len_and_sockaddr* xhost_and_af2sockaddr(const char *host, int port, sa_family_t af); | 506 | len_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. */ |
511 | void set_nport(len_and_sockaddr *lsa, unsigned port); | 511 | void 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 */ |
513 | int get_nport(const struct sockaddr *sa); | 513 | int get_nport(const struct sockaddr *sa) FAST_FUNC; |
514 | /* Reverse DNS. Returns NULL on failure. */ | 514 | /* Reverse DNS. Returns NULL on failure. */ |
515 | char* xmalloc_sockaddr2host(const struct sockaddr *sa); | 515 | char* xmalloc_sockaddr2host(const struct sockaddr *sa) FAST_FUNC; |
516 | /* This one doesn't append :PORTNUM */ | 516 | /* This one doesn't append :PORTNUM */ |
517 | char* xmalloc_sockaddr2host_noport(const struct sockaddr *sa); | 517 | char* 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) */ |
519 | char* xmalloc_sockaddr2hostonly_noport(const struct sockaddr *sa); | 519 | char* xmalloc_sockaddr2hostonly_noport(const struct sockaddr *sa) FAST_FUNC; |
520 | /* inet_[ap]ton on steroids */ | 520 | /* inet_[ap]ton on steroids */ |
521 | char* xmalloc_sockaddr2dotted(const struct sockaddr *sa); | 521 | char* xmalloc_sockaddr2dotted(const struct sockaddr *sa) FAST_FUNC; |
522 | char* xmalloc_sockaddr2dotted_noport(const struct sockaddr *sa); | 522 | char* 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 |
525 | struct hostent *xgethostbyname(const char *name); | 525 | struct 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 | ||
530 | void socket_want_pktinfo(int fd); | 530 | void socket_want_pktinfo(int fd) FAST_FUNC; |
531 | ssize_t send_to_from(int fd, void *buf, size_t len, int flags, | 531 | ssize_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; |
535 | ssize_t recv_from_to(int fd, void *buf, size_t len, int flags, | 535 | ssize_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 | ||
540 | char *xstrdup(const char *s); | 540 | char *xstrdup(const char *s) FAST_FUNC; |
541 | char *xstrndup(const char *s, int n); | 541 | char *xstrndup(const char *s, int n) FAST_FUNC; |
542 | char *safe_strncpy(char *dst, const char *src, size_t size); | 542 | char *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 */ |
545 | int bb_putchar(int ch); | 545 | int bb_putchar(int ch) FAST_FUNC; |
546 | char *xasprintf(const char *format, ...) __attribute__ ((format (printf, 1, 2))); | 546 | char *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) */ |
550 | enum { PRINTABLE_META = 0x100 }; | 550 | enum { PRINTABLE_META = 0x100 }; |
551 | void fputc_printable(int ch, FILE *file); | 551 | void 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. */ |
566 | extern void *malloc_or_warn(size_t size); | 566 | extern void *malloc_or_warn(size_t size) FAST_FUNC; |
567 | extern void *xmalloc(size_t size); | 567 | extern void *xmalloc(size_t size) FAST_FUNC; |
568 | extern void *xzalloc(size_t size); | 568 | extern void *xzalloc(size_t size) FAST_FUNC; |
569 | extern void *xrealloc(void *old, size_t size); | 569 | extern void *xrealloc(void *old, size_t size) FAST_FUNC; |
570 | 570 | ||
571 | extern ssize_t safe_read(int fd, void *buf, size_t count); | 571 | extern ssize_t safe_read(int fd, void *buf, size_t count) FAST_FUNC; |
572 | extern ssize_t nonblock_safe_read(int fd, void *buf, size_t count); | 572 | extern 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 |
575 | extern ssize_t full_read(int fd, void *buf, size_t count); | 575 | extern ssize_t full_read(int fd, void *buf, size_t count) FAST_FUNC; |
576 | extern void xread(int fd, void *buf, size_t count); | 576 | extern void xread(int fd, void *buf, size_t count) FAST_FUNC; |
577 | extern unsigned char xread_char(int fd); | 577 | extern 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. |
580 | extern char *reads(int fd, char *buf, size_t count); | 580 | extern 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). |
584 | extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p); | 584 | extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC; |
585 | extern ssize_t read_close(int fd, void *buf, size_t maxsz); | 585 | extern ssize_t read_close(int fd, void *buf, size_t maxsz) FAST_FUNC; |
586 | extern ssize_t open_read_close(const char *filename, void *buf, size_t maxsz); | 586 | extern 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 */ |
588 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p); | 588 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; |
589 | /* Never returns NULL */ | 589 | /* Never returns NULL */ |
590 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p); | 590 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC; |
591 | 591 | ||
592 | extern ssize_t safe_write(int fd, const void *buf, size_t count); | 592 | extern 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 |
595 | extern ssize_t full_write(int fd, const void *buf, size_t count); | 595 | extern ssize_t full_write(int fd, const void *buf, size_t count) FAST_FUNC; |
596 | extern void xwrite(int fd, const void *buf, size_t count); | 596 | extern void xwrite(int fd, const void *buf, size_t count) FAST_FUNC; |
597 | extern void xopen_xwrite_close(const char* file, const char *str); | 597 | extern 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: */ |
600 | extern void xprint_and_close_file(FILE *file); | 600 | extern 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: */ |
602 | extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string); | 602 | extern 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: */ |
604 | extern char *xmalloc_fgetline_str(FILE *file, const char *terminating_string); | 604 | extern 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: */ |
606 | extern char *xmalloc_fgets(FILE *file); | 606 | extern 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: */ |
608 | extern char *xmalloc_fgetline(FILE *file); | 608 | extern char *xmalloc_fgetline(FILE *file) FAST_FUNC; |
609 | extern char *bb_get_chunk_from_file(FILE *file, int *end); | 609 | extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC; |
610 | extern void die_if_ferror(FILE *file, const char *msg); | 610 | extern void die_if_ferror(FILE *file, const char *msg) FAST_FUNC; |
611 | extern void die_if_ferror_stdout(void); | 611 | extern void die_if_ferror_stdout(void) FAST_FUNC; |
612 | extern void xfflush_stdout(void); | 612 | extern void xfflush_stdout(void) FAST_FUNC; |
613 | extern void fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN; | 613 | extern void fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN FAST_FUNC; |
614 | extern int fclose_if_not_stdin(FILE *file); | 614 | extern int fclose_if_not_stdin(FILE *file) FAST_FUNC; |
615 | extern FILE *xfopen(const char *filename, const char *mode); | 615 | extern 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: */ |
617 | extern FILE *fopen_or_warn(const char *filename, const char *mode); | 617 | extern 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: */ |
619 | extern FILE *xfopen_stdin(const char *filename); | 619 | extern FILE *xfopen_stdin(const char *filename) FAST_FUNC; |
620 | extern FILE *fopen_or_warn_stdin(const char *filename); | 620 | extern FILE *fopen_or_warn_stdin(const char *filename) FAST_FUNC; |
621 | 621 | ||
622 | int bb_pstrcmp(const void *a, const void *b); | 622 | int bb_pstrcmp(const void *a, const void *b) /* not FAST_FUNC! */; |
623 | void qsort_string_vector(char **sv, unsigned count); | 623 | void 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 */ |
629 | int safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout_ms); | 629 | int safe_poll(struct pollfd *ufds, nfds_t nfds, int timeout_ms) FAST_FUNC; |
630 | 630 | ||
631 | char *safe_gethostname(void); | 631 | char *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 */ |
634 | char* str_tolower(char *str); | 634 | char* str_tolower(char *str) FAST_FUNC; |
635 | 635 | ||
636 | char *utoa(unsigned n); | 636 | char *utoa(unsigned n) FAST_FUNC; |
637 | char *itoa(int n); | 637 | char *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 */ |
639 | char *utoa_to_buf(unsigned n, char *buf, unsigned buflen); | 639 | char *utoa_to_buf(unsigned n, char *buf, unsigned buflen) FAST_FUNC; |
640 | char *itoa_to_buf(int n, char *buf, unsigned buflen); | 640 | char *itoa_to_buf(int n, char *buf, unsigned buflen) FAST_FUNC; |
641 | /* Intelligent formatters of bignums */ | 641 | /* Intelligent formatters of bignums */ |
642 | void smart_ulltoa4(unsigned long long ul, char buf[5], const char *scale); | 642 | void smart_ulltoa4(unsigned long long ul, char buf[5], const char *scale) FAST_FUNC; |
643 | void smart_ulltoa5(unsigned long long ul, char buf[5], const char *scale); | 643 | void 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)? |
645 | const char *make_human_readable_str(unsigned long long size, | 645 | const 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 */ |
648 | char *bin2hex(char *buf, const char *cp, int count); | 648 | char *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 */ |
651 | struct suffix_mult { | 651 | struct 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 */ |
661 | int xatoi_u(const char *numstr); | 661 | int xatoi_u(const char *numstr) FAST_FUNC; |
662 | /* Useful for reading port numbers */ | 662 | /* Useful for reading port numbers */ |
663 | uint16_t xatou16(const char *numstr); | 663 | uint16_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. */ |
669 | long xuname2uid(const char *name); | 669 | long xuname2uid(const char *name) FAST_FUNC; |
670 | long xgroup2gid(const char *name); | 670 | long 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 */ |
672 | unsigned long get_ug_id(const char *s, long (*xname2id)(const char *)); | 672 | unsigned 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 */ |
674 | struct bb_uidgid_t { | 674 | struct 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 */ |
679 | int get_uidgid(struct bb_uidgid_t*, const char*, int numeric_ok); | 679 | int 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]" */ |
681 | void parse_chown_usergroup_or_die(struct bb_uidgid_t *u, char *user_group); | 681 | void 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 | */ |
688 | char *bb_getpwuid(char *name, int bufsize, long uid); | 688 | char *bb_getpwuid(char *name, int bufsize, long uid) FAST_FUNC; |
689 | char *bb_getgrgid(char *group, int bufsize, long gid); | 689 | char *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) */ |
691 | const char* get_cached_username(uid_t uid); | 691 | const char* get_cached_username(uid_t uid) FAST_FUNC; |
692 | const char* get_cached_groupname(gid_t gid); | 692 | const char* get_cached_groupname(gid_t gid) FAST_FUNC; |
693 | void clear_username_cache(void); | 693 | void 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 */ |
695 | enum { USERNAME_MAX_SIZE = 16 - sizeof(int) }; | 695 | enum { USERNAME_MAX_SIZE = 16 - sizeof(int) }; |
696 | #if ENABLE_FEATURE_CHECK_NAMES | 696 | #if ENABLE_FEATURE_CHECK_NAMES |
697 | void die_if_bad_username(const char* name); | 697 | void 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 | ||
702 | int execable_file(const char *name); | 702 | int execable_file(const char *name) FAST_FUNC; |
703 | char *find_execable(const char *filename, char **PATHp); | 703 | char *find_execable(const char *filename, char **PATHp) FAST_FUNC; |
704 | int exists_execable(const char *filename); | 704 | int 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 |
710 | int bb_execvp(const char *file, char *const argv[]); | 710 | int 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 */ |
721 | pid_t spawn(char **argv); | 721 | pid_t spawn(char **argv) FAST_FUNC; |
722 | pid_t xspawn(char **argv); | 722 | pid_t xspawn(char **argv) FAST_FUNC; |
723 | 723 | ||
724 | int safe_waitpid(int pid, int *wstat, int options); | 724 | int 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 | */ |
732 | int wait4pid(int pid); | 732 | int wait4pid(int pid) FAST_FUNC; |
733 | int wait_any_nohang(int *wstat); | 733 | int 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) */ |
739 | int spawn_and_wait(char **argv); | 739 | int spawn_and_wait(char **argv) FAST_FUNC; |
740 | struct nofork_save_area { | 740 | struct 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 | }; |
748 | void save_nofork_data(struct nofork_save_area *save); | 748 | void save_nofork_data(struct nofork_save_area *save) FAST_FUNC; |
749 | void restore_nofork_data(struct nofork_save_area *save); | 749 | void 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 */ |
751 | int run_nofork_applet(int applet_no, char **argv); | 751 | int run_nofork_applet(int applet_no, char **argv) FAST_FUNC; |
752 | int run_nofork_applet_prime(struct nofork_save_area *old, int applet_no, char **argv); | 752 | int 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 |
800 | void bb_daemonize_or_rexec(int flags, char **argv); | 800 | void bb_daemonize_or_rexec(int flags, char **argv) FAST_FUNC; |
801 | void bb_sanitize_stdio(void); | 801 | void 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. */ |
803 | int sanitize_env_if_suid(void); | 803 | int sanitize_env_if_suid(void) FAST_FUNC; |
804 | 804 | ||
805 | 805 | ||
806 | extern const char *const bb_argv_dash[]; /* "-", NULL */ | 806 | extern const char *const bb_argv_dash[]; /* "-", NULL */ |
@@ -812,19 +812,19 @@ extern const char *opt_complementary; | |||
812 | extern const char *applet_long_options; | 812 | extern const char *applet_long_options; |
813 | #endif | 813 | #endif |
814 | extern uint32_t option_mask32; | 814 | extern uint32_t option_mask32; |
815 | extern uint32_t getopt32(char **argv, const char *applet_opts, ...); | 815 | extern uint32_t getopt32(char **argv, const char *applet_opts, ...) FAST_FUNC; |
816 | 816 | ||
817 | 817 | ||
818 | typedef struct llist_t { | 818 | typedef 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; |
822 | void llist_add_to(llist_t **old_head, void *data); | 822 | void llist_add_to(llist_t **old_head, void *data) FAST_FUNC; |
823 | void llist_add_to_end(llist_t **list_head, void *data); | 823 | void llist_add_to_end(llist_t **list_head, void *data) FAST_FUNC; |
824 | void *llist_pop(llist_t **elm); | 824 | void *llist_pop(llist_t **elm) FAST_FUNC; |
825 | void llist_unlink(llist_t **head, llist_t *elm); | 825 | void llist_unlink(llist_t **head, llist_t *elm) FAST_FUNC; |
826 | void llist_free(llist_t *elm, void (*freeit)(void *data)); | 826 | void llist_free(llist_t *elm, void (*freeit)(void *data)) FAST_FUNC; |
827 | llist_t *llist_rev(llist_t *list); | 827 | llist_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 */ |
836 | extern smallint wrote_pidfile; | 836 | extern smallint wrote_pidfile; |
837 | void write_pidfile(const char *path); | 837 | void 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 |
840 | enum { wrote_pidfile = 0 }; | 840 | enum { wrote_pidfile = 0 }; |
@@ -853,20 +853,20 @@ extern smallint logmode; | |||
853 | extern int die_sleep; | 853 | extern int die_sleep; |
854 | extern int xfunc_error_retval; | 854 | extern int xfunc_error_retval; |
855 | extern jmp_buf die_jmp; | 855 | extern jmp_buf die_jmp; |
856 | extern void xfunc_die(void) ATTRIBUTE_NORETURN; | 856 | extern void xfunc_die(void) ATTRIBUTE_NORETURN FAST_FUNC; |
857 | extern void bb_show_usage(void) ATTRIBUTE_NORETURN; | 857 | extern void bb_show_usage(void) ATTRIBUTE_NORETURN FAST_FUNC; |
858 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 858 | extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; |
859 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 859 | extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; |
860 | extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 860 | extern void bb_perror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; |
861 | extern void bb_simple_perror_msg(const char *s); | 861 | extern void bb_simple_perror_msg(const char *s) FAST_FUNC; |
862 | extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 862 | extern void bb_perror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; |
863 | extern void bb_simple_perror_msg_and_die(const char *s) __attribute__ ((noreturn)); | 863 | extern void bb_simple_perror_msg_and_die(const char *s) __attribute__ ((noreturn)) FAST_FUNC; |
864 | extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 864 | extern void bb_herror_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; |
865 | extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); | 865 | extern void bb_herror_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))) FAST_FUNC; |
866 | extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN; | 866 | extern void bb_perror_nomsg_and_die(void) ATTRIBUTE_NORETURN FAST_FUNC; |
867 | extern void bb_perror_nomsg(void); | 867 | extern void bb_perror_nomsg(void) FAST_FUNC; |
868 | extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); | 868 | extern void bb_info_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))) FAST_FUNC; |
869 | extern void bb_verror_msg(const char *s, va_list p, const char *strerr); | 869 | extern 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; | |||
893 | int bbunpack(char **argv, | 893 | int 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 |
898 | void bb_displayroutes(int noresolve, int netstatfmt); | 898 | void bb_displayroutes(int noresolve, int netstatfmt) FAST_FUNC; |
899 | #endif | 899 | #endif |
900 | 900 | ||
901 | 901 | ||
902 | /* Networking */ | 902 | /* Networking */ |
903 | int create_icmp_socket(void); | 903 | int create_icmp_socket(void) FAST_FUNC; |
904 | int create_icmp6_socket(void); | 904 | int 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. */ |
907 | struct aftype { | 907 | struct 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. */ |
923 | struct hwtype { | 922 | struct 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 | }; |
933 | extern smallint interface_opt_a; | 932 | extern smallint interface_opt_a; |
934 | int display_interfaces(char *ifname); | 933 | int display_interfaces(char *ifname) FAST_FUNC; |
935 | #if ENABLE_FEATURE_HWIB | 934 | #if ENABLE_FEATURE_HWIB |
936 | int in_ib(const char *bufp, struct sockaddr *sap); | 935 | int 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 |
940 | const struct aftype *get_aftype(const char *name); | 939 | const struct aftype *get_aftype(const char *name) FAST_FUNC; |
941 | const struct hwtype *get_hwtype(const char *name); | 940 | const struct hwtype *get_hwtype(const char *name) FAST_FUNC; |
942 | const struct hwtype *get_hwntype(int type); | 941 | const struct hwtype *get_hwntype(int type) FAST_FUNC; |
943 | 942 | ||
944 | 943 | ||
945 | #ifndef BUILD_INDIVIDUAL | 944 | #ifndef BUILD_INDIVIDUAL |
946 | extern int find_applet_by_name(const char *name); | 945 | extern 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. */ |
948 | extern void run_applet_and_exit(const char *name, char **argv); | 947 | extern void run_applet_and_exit(const char *name, char **argv) FAST_FUNC; |
949 | extern void run_applet_no_and_exit(int a, char **argv) ATTRIBUTE_NORETURN; | 948 | extern 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 |
953 | extern int match_fstype(const struct mntent *mt, const char *fstypes); | 952 | extern int match_fstype(const struct mntent *mt, const char *fstypes) FAST_FUNC; |
954 | extern struct mntent *find_mount_point(const char *name, const char *table); | 953 | extern struct mntent *find_mount_point(const char *name, const char *table) FAST_FUNC; |
955 | #endif | 954 | #endif |
956 | extern void erase_mtab(const char * name); | 955 | extern void erase_mtab(const char * name) FAST_FUNC; |
957 | extern unsigned int tty_baud_to_value(speed_t speed); | 956 | extern unsigned int tty_baud_to_value(speed_t speed) FAST_FUNC; |
958 | extern speed_t tty_value_to_baud(unsigned int value); | 957 | extern speed_t tty_value_to_baud(unsigned int value) FAST_FUNC; |
959 | extern void bb_warn_ignoring_args(int n); | 958 | extern void bb_warn_ignoring_args(int n) FAST_FUNC; |
960 | 959 | ||
961 | extern int get_linux_version_code(void); | 960 | extern int get_linux_version_code(void) FAST_FUNC; |
962 | 961 | ||
963 | extern char *query_loop(const char *device); | 962 | extern char *query_loop(const char *device) FAST_FUNC; |
964 | extern int del_loop(const char *device); | 963 | extern 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 */ |
968 | extern int set_loop(char **devname, const char *file, unsigned long long offset); | 967 | extern 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)? |
972 | char *bb_askpass(int timeout, const char * prompt); | 971 | char *bb_askpass(int timeout, const char * prompt) FAST_FUNC; |
973 | int bb_ask_confirmation(void); | 972 | int bb_ask_confirmation(void) FAST_FUNC; |
974 | 973 | ||
975 | extern int bb_parse_mode(const char* s, mode_t* theMode); | 974 | extern 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. */ |
981 | char *concat_path_file(const char *path, const char *filename); | 980 | char *concat_path_file(const char *path, const char *filename) FAST_FUNC; |
982 | char *concat_subpath_file(const char *path, const char *filename); | 981 | char *concat_subpath_file(const char *path, const char *filename) FAST_FUNC; |
983 | const char *bb_basename(const char *name); | 982 | const 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) */ |
985 | char *last_char_is(const char *s, int c); | 984 | char *last_char_is(const char *s, int c) FAST_FUNC; |
986 | 985 | ||
987 | 986 | ||
988 | USE_DESKTOP(long long) int uncompress(int fd_in, int fd_out); | 987 | USE_DESKTOP(long long) int uncompress(int fd_in, int fd_out) FAST_FUNC; |
989 | int inflate(int in, int out); | 988 | int inflate(int in, int out) FAST_FUNC; |
990 | 989 | ||
991 | 990 | ||
992 | int bb_make_directory(char *path, long mode, int flags); | 991 | int bb_make_directory(char *path, long mode, int flags) FAST_FUNC; |
993 | 992 | ||
994 | int get_signum(const char *name); | 993 | int get_signum(const char *name) FAST_FUNC; |
995 | const char *get_signame(int number); | 994 | const char *get_signame(int number) FAST_FUNC; |
996 | void print_signames(void); | 995 | void print_signames(void) FAST_FUNC; |
997 | 996 | ||
998 | char *bb_simplify_path(const char *path); | 997 | char *bb_simplify_path(const char *path) FAST_FUNC; |
999 | 998 | ||
1000 | #define FAIL_DELAY 3 | 999 | #define FAIL_DELAY 3 |
1001 | extern void bb_do_delay(int seconds); | 1000 | extern void bb_do_delay(int seconds) FAST_FUNC; |
1002 | extern void change_identity(const struct passwd *pw); | 1001 | extern void change_identity(const struct passwd *pw) FAST_FUNC; |
1003 | extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) ATTRIBUTE_NORETURN; | 1002 | extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args) ATTRIBUTE_NORETURN FAST_FUNC; |
1004 | extern void run_shell(const char *shell, int loginshell, const char *command, const char **additional_args); | 1003 | extern 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 |
1006 | extern void renew_current_security_context(void); | 1005 | extern void renew_current_security_context(void) FAST_FUNC; |
1007 | extern void set_current_security_context(security_context_t sid); | 1006 | extern void set_current_security_context(security_context_t sid) FAST_FUNC; |
1008 | extern context_t set_security_context_component(security_context_t cur_context, | 1007 | extern 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; |
1010 | extern void setfscreatecon_or_die(security_context_t scontext); | 1009 | extern void setfscreatecon_or_die(security_context_t scontext) FAST_FUNC; |
1011 | extern void selinux_preserve_fcontext(int fdesc); | 1010 | extern 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 |
1015 | extern void selinux_or_die(void); | 1014 | extern void selinux_or_die(void) FAST_FUNC; |
1016 | extern int restricted_shell(const char *shell); | 1015 | extern 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 | */ |
1032 | extern void setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw); | 1031 | extern void setup_environment(const char *shell, int clear_env, int change_env, const struct passwd *pw) FAST_FUNC; |
1033 | extern int correct_password(const struct passwd *pw); | 1032 | extern 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 |
1038 | extern char *pw_encrypt(const char *clear, const char *salt, int cleanup); | 1037 | extern char *pw_encrypt(const char *clear, const char *salt, int cleanup) FAST_FUNC; |
1039 | extern int obscure(const char *old, const char *newval, const struct passwd *pwdp); | 1038 | extern 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 | */ |
1047 | extern int crypt_make_salt(char *p, int cnt, int rnd); | 1046 | extern 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 */ |
1049 | extern int update_passwd(const char *filename, const char *username, | 1048 | extern int update_passwd(const char *filename, const char *username, |
1050 | const char *new_pw); | 1049 | const char *new_pw) FAST_FUNC; |
1051 | 1050 | ||
1052 | int index_in_str_array(const char *const string_array[], const char *key); | 1051 | int index_in_str_array(const char *const string_array[], const char *key) FAST_FUNC; |
1053 | int index_in_strings(const char *strings, const char *key); | 1052 | int index_in_strings(const char *strings, const char *key) FAST_FUNC; |
1054 | int index_in_substr_array(const char *const string_array[], const char *key); | 1053 | int index_in_substr_array(const char *const string_array[], const char *key) FAST_FUNC; |
1055 | int index_in_substrings(const char *strings, const char *key); | 1054 | int index_in_substrings(const char *strings, const char *key) FAST_FUNC; |
1056 | const char *nth_string(const char *strings, int n); | 1055 | const char *nth_string(const char *strings, int n) FAST_FUNC; |
1057 | 1056 | ||
1058 | extern void print_login_issue(const char *issue_file, const char *tty); | 1057 | extern void print_login_issue(const char *issue_file, const char *tty) FAST_FUNC; |
1059 | extern void print_login_prompt(void); | 1058 | extern 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' */ |
1062 | int get_terminal_width_height(int fd, unsigned *width, unsigned *height); | 1061 | int 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! */ |
1065 | int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))); | 1064 | int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))) FAST_FUNC; |
1066 | int ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) __attribute__ ((format (printf, 4, 5))); | 1065 | int 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 |
1068 | int bb_ioctl_or_warn(int fd, unsigned request, void *argp, const char *ioctl_name); | 1067 | int bb_ioctl_or_warn(int fd, unsigned request, void *argp, const char *ioctl_name) FAST_FUNC; |
1069 | int bb_xioctl(int fd, unsigned request, void *argp, const char *ioctl_name); | 1068 | int 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 |
1073 | int bb_ioctl_or_warn(int fd, unsigned request, void *argp); | 1072 | int bb_ioctl_or_warn(int fd, unsigned request, void *argp) FAST_FUNC; |
1074 | int bb_xioctl(int fd, unsigned request, void *argp); | 1073 | int 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 | ||
1079 | char *is_in_ino_dev_hashtable(const struct stat *statbuf); | 1078 | char *is_in_ino_dev_hashtable(const struct stat *statbuf) FAST_FUNC; |
1080 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name); | 1079 | void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) FAST_FUNC; |
1081 | void reset_ino_dev_hashtable(void); | 1080 | void 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 */ |
1084 | unsigned long long bb_makedev(unsigned int major, unsigned int minor); | 1083 | unsigned 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 | }; |
1116 | line_input_t *new_line_input_t(int flags); | 1115 | line_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 | */ |
1122 | int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state); | 1121 | int read_line_input(const char* prompt, char* command, int maxsize, line_input_t *state) FAST_FUNC; |
1123 | #else | 1122 | #else |
1124 | int read_line_input(const char* prompt, char* command, int maxsize); | 1123 | int 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; |
1201 | void free_procps_scan(procps_status_t* sp); | 1200 | void free_procps_scan(procps_status_t* sp) FAST_FUNC; |
1202 | procps_status_t* procps_scan(procps_status_t* sp, int flags); | 1201 | procps_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) */ |
1205 | void read_cmdline(char *buf, int col, unsigned pid, const char *comm); | 1204 | void read_cmdline(char *buf, int col, unsigned pid, const char *comm) FAST_FUNC; |
1206 | pid_t *find_pid_by_name(const char* procName); | 1205 | pid_t *find_pid_by_name(const char* procName) FAST_FUNC; |
1207 | pid_t *pidlist_reverse(pid_t *pidList); | 1206 | pid_t *pidlist_reverse(pid_t *pidList) FAST_FUNC; |
1208 | 1207 | ||
1209 | 1208 | ||
1210 | extern const char bb_uuenc_tbl_base64[]; | 1209 | extern const char bb_uuenc_tbl_base64[]; |
1211 | extern const char bb_uuenc_tbl_std[]; | 1210 | extern const char bb_uuenc_tbl_std[]; |
1212 | void bb_uuencode(char *store, const void *s, int length, const char *tbl); | 1211 | void bb_uuencode(char *store, const void *s, int length, const char *tbl) FAST_FUNC; |
1213 | 1212 | ||
1214 | typedef struct sha1_ctx_t { | 1213 | typedef 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; |
1219 | void sha1_begin(sha1_ctx_t *ctx); | 1218 | void sha1_begin(sha1_ctx_t *ctx) FAST_FUNC; |
1220 | void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx); | 1219 | void sha1_hash(const void *data, size_t length, sha1_ctx_t *ctx) FAST_FUNC; |
1221 | void *sha1_end(void *resbuf, sha1_ctx_t *ctx); | 1220 | void *sha1_end(void *resbuf, sha1_ctx_t *ctx) FAST_FUNC; |
1222 | 1221 | ||
1223 | typedef struct md5_ctx_t { | 1222 | typedef 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; |
1232 | void md5_begin(md5_ctx_t *ctx); | 1231 | void md5_begin(md5_ctx_t *ctx) FAST_FUNC; |
1233 | void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); | 1232 | void md5_hash(const void *data, size_t length, md5_ctx_t *ctx) FAST_FUNC; |
1234 | void *md5_end(void *resbuf, md5_ctx_t *ctx); | 1233 | void *md5_end(void *resbuf, md5_ctx_t *ctx) FAST_FUNC; |
1234 | |||
1235 | uint32_t *crc32_filltable(uint32_t *tbl256, int endian) FAST_FUNC; | ||
1235 | 1236 | ||
1236 | uint32_t *crc32_filltable(uint32_t *tbl256, int endian); | 1237 | typedef struct masks_labels_t { |
1238 | const char *labels; | ||
1239 | const int masks[]; | ||
1240 | } masks_labels_t; | ||
1241 | int print_flags_separated(const int *masks, const char *labels, | ||
1242 | int flags, const char *separator) FAST_FUNC; | ||
1243 | int print_flags(const masks_labels_t *ml, int flags) FAST_FUNC; | ||
1237 | 1244 | ||
1238 | 1245 | ||
1239 | extern const char *applet_name; | 1246 | extern 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 | ||
1308 | typedef struct masks_labels_t { | ||
1309 | const char *labels; | ||
1310 | const int masks[]; | ||
1311 | } masks_labels_t; | ||
1312 | |||
1313 | int print_flags_separated(const int *masks, const char *labels, | ||
1314 | int flags, const char *separator); | ||
1315 | extern 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 | ||
16 | extern int rtc_adjtime_is_utc(void); | 16 | extern int rtc_adjtime_is_utc(void) FAST_FUNC; |
17 | extern int rtc_xopen(const char **default_rtc, int flags); | 17 | extern int rtc_xopen(const char **default_rtc, int flags) FAST_FUNC; |
18 | extern time_t rtc_read_time(int fd, int utc); | 18 | extern 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 | ||
32 | typedef struct archive_handle_t { | 32 | typedef 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 | ||
74 | extern archive_handle_t *init_handle(void); | 74 | extern archive_handle_t *init_handle(void) FAST_FUNC; |
75 | 75 | ||
76 | extern char filter_accept_all(archive_handle_t *archive_handle); | 76 | extern char filter_accept_all(archive_handle_t *archive_handle) FAST_FUNC; |
77 | extern char filter_accept_list(archive_handle_t *archive_handle); | 77 | extern char filter_accept_list(archive_handle_t *archive_handle) FAST_FUNC; |
78 | extern char filter_accept_list_reassign(archive_handle_t *archive_handle); | 78 | extern char filter_accept_list_reassign(archive_handle_t *archive_handle) FAST_FUNC; |
79 | extern char filter_accept_reject_list(archive_handle_t *archive_handle); | 79 | extern char filter_accept_reject_list(archive_handle_t *archive_handle) FAST_FUNC; |
80 | 80 | ||
81 | extern void unpack_ar_archive(archive_handle_t *ar_archive); | 81 | extern void unpack_ar_archive(archive_handle_t *ar_archive) FAST_FUNC; |
82 | 82 | ||
83 | extern void data_skip(archive_handle_t *archive_handle); | 83 | extern void data_skip(archive_handle_t *archive_handle) FAST_FUNC; |
84 | extern void data_extract_all(archive_handle_t *archive_handle); | 84 | extern void data_extract_all(archive_handle_t *archive_handle) FAST_FUNC; |
85 | extern void data_extract_to_stdout(archive_handle_t *archive_handle); | 85 | extern void data_extract_to_stdout(archive_handle_t *archive_handle) FAST_FUNC; |
86 | extern void data_extract_to_buffer(archive_handle_t *archive_handle); | 86 | extern void data_extract_to_buffer(archive_handle_t *archive_handle) FAST_FUNC; |
87 | 87 | ||
88 | extern void header_skip(const file_header_t *file_header); | 88 | extern void header_skip(const file_header_t *file_header) FAST_FUNC; |
89 | extern void header_list(const file_header_t *file_header); | 89 | extern void header_list(const file_header_t *file_header) FAST_FUNC; |
90 | extern void header_verbose_list(const file_header_t *file_header); | 90 | extern void header_verbose_list(const file_header_t *file_header) FAST_FUNC; |
91 | 91 | ||
92 | extern char get_header_ar(archive_handle_t *archive_handle); | 92 | extern char get_header_ar(archive_handle_t *archive_handle) FAST_FUNC; |
93 | extern char get_header_cpio(archive_handle_t *archive_handle); | 93 | extern char get_header_cpio(archive_handle_t *archive_handle) FAST_FUNC; |
94 | extern char get_header_tar(archive_handle_t *archive_handle); | 94 | extern char get_header_tar(archive_handle_t *archive_handle) FAST_FUNC; |
95 | extern char get_header_tar_bz2(archive_handle_t *archive_handle); | 95 | extern char get_header_tar_bz2(archive_handle_t *archive_handle) FAST_FUNC; |
96 | extern char get_header_tar_lzma(archive_handle_t *archive_handle); | 96 | extern char get_header_tar_lzma(archive_handle_t *archive_handle) FAST_FUNC; |
97 | extern char get_header_tar_gz(archive_handle_t *archive_handle); | 97 | extern char get_header_tar_gz(archive_handle_t *archive_handle) FAST_FUNC; |
98 | 98 | ||
99 | extern void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount); | 99 | extern void seek_by_jump(const archive_handle_t *archive_handle, unsigned amount) FAST_FUNC; |
100 | extern void seek_by_read(const archive_handle_t *archive_handle, unsigned amount); | 100 | extern void seek_by_read(const archive_handle_t *archive_handle, unsigned amount) FAST_FUNC; |
101 | 101 | ||
102 | extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count); | 102 | extern ssize_t archive_xread_all_eof(archive_handle_t *archive_handle, unsigned char *buf, size_t count) FAST_FUNC; |
103 | 103 | ||
104 | extern void data_align(archive_handle_t *archive_handle, unsigned boundary); | 104 | extern void data_align(archive_handle_t *archive_handle, unsigned boundary) FAST_FUNC; |
105 | extern const llist_t *find_list_entry(const llist_t *list, const char *filename); | 105 | extern const llist_t *find_list_entry(const llist_t *list, const char *filename) FAST_FUNC; |
106 | extern const llist_t *find_list_entry2(const llist_t *list, const char *filename); | 106 | extern 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: */ |
109 | typedef struct bunzip_data bunzip_data; | 109 | typedef struct bunzip_data bunzip_data; |
110 | int start_bunzip(bunzip_data **bdp, int in_fd, const unsigned char *inbuf, int len); | 110 | int start_bunzip(bunzip_data **bdp, int in_fd, const unsigned char *inbuf, int len) FAST_FUNC; |
111 | int read_bunzip(bunzip_data *bd, char *outbuf, int len); | 111 | int read_bunzip(bunzip_data *bd, char *outbuf, int len) FAST_FUNC; |
112 | void dealloc_bunzip(bunzip_data *bd); | 112 | void dealloc_bunzip(bunzip_data *bd) FAST_FUNC; |
113 | 113 | ||
114 | typedef struct inflate_unzip_result { | 114 | typedef 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 | ||
119 | extern USE_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd); | 119 | extern USE_DESKTOP(long long) int unpack_bz2_stream(int src_fd, int dst_fd) FAST_FUNC; |
120 | extern USE_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd); | 120 | extern USE_DESKTOP(long long) int inflate_unzip(inflate_unzip_result *res, off_t compr_size, int src_fd, int dst_fd) FAST_FUNC; |
121 | extern USE_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd); | 121 | extern USE_DESKTOP(long long) int unpack_gz_stream(int src_fd, int dst_fd) FAST_FUNC; |
122 | extern USE_DESKTOP(long long) int unpack_lzma_stream(int src_fd, int dst_fd); | 122 | extern 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 |
125 | extern int open_transformer(int src_fd, | 125 | extern 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 |
129 | extern int open_transformer(int src_fd, const char *transform_prog); | 129 | extern 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 | \ |
17 | unsigned type xstrto##UT##_range_sfx(const char *str, int b, unsigned type l, unsigned type u, const struct suffix_mult *sfx); \ | 17 | unsigned type xstrto##UT##_range_sfx(const char *str, int b, unsigned type l, unsigned type u, const struct suffix_mult *sfx) FAST_FUNC; \ |
18 | unsigned type xstrto##UT##_range(const char *str, int b, unsigned type l, unsigned type u); \ | 18 | unsigned type xstrto##UT##_range(const char *str, int b, unsigned type l, unsigned type u) FAST_FUNC; \ |
19 | unsigned type xstrto##UT##_sfx(const char *str, int b, const struct suffix_mult *sfx); \ | 19 | unsigned type xstrto##UT##_sfx(const char *str, int b, const struct suffix_mult *sfx) FAST_FUNC; \ |
20 | unsigned type xstrto##UT(const char *str, int b); \ | 20 | unsigned type xstrto##UT(const char *str, int b) FAST_FUNC; \ |
21 | unsigned type xato##UT##_range_sfx(const char *str, unsigned type l, unsigned type u, const struct suffix_mult *sfx); \ | 21 | unsigned type xato##UT##_range_sfx(const char *str, unsigned type l, unsigned type u, const struct suffix_mult *sfx) FAST_FUNC; \ |
22 | unsigned type xato##UT##_range(const char *str, unsigned type l, unsigned type u); \ | 22 | unsigned type xato##UT##_range(const char *str, unsigned type l, unsigned type u) FAST_FUNC; \ |
23 | unsigned type xato##UT##_sfx(const char *str, const struct suffix_mult *sfx); \ | 23 | unsigned type xato##UT##_sfx(const char *str, const struct suffix_mult *sfx) FAST_FUNC; \ |
24 | unsigned type xato##UT(const char *str); \ | 24 | unsigned type xato##UT(const char *str) FAST_FUNC; \ |
25 | type xstrto##T##_range_sfx(const char *str, int b, type l, type u, const struct suffix_mult *sfx); \ | 25 | type xstrto##T##_range_sfx(const char *str, int b, type l, type u, const struct suffix_mult *sfx) FAST_FUNC; \ |
26 | type xstrto##T##_range(const char *str, int b, type l, type u); \ | 26 | type xstrto##T##_range(const char *str, int b, type l, type u) FAST_FUNC; \ |
27 | type xato##T##_range_sfx(const char *str, type l, type u, const struct suffix_mult *sfx); \ | 27 | type xato##T##_range_sfx(const char *str, type l, type u, const struct suffix_mult *sfx) FAST_FUNC; \ |
28 | type xato##T##_range(const char *str, type l, type u); \ | 28 | type xato##T##_range(const char *str, type l, type u) FAST_FUNC; \ |
29 | type xato##T##_sfx(const char *str, const struct suffix_mult *sfx); \ | 29 | type xato##T##_sfx(const char *str, const struct suffix_mult *sfx) FAST_FUNC; \ |
30 | type xato##T(const char *str); \ | 30 | type xato##T(const char *str) FAST_FUNC; \ |
31 | 31 | ||
32 | /* Unsigned long long functions always exist */ | 32 | /* Unsigned long long functions always exist */ |
33 | DECLARE_STR_CONV(long long, ll, ull) | 33 | DECLARE_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 | ||
125 | unsigned long long bb_strtoull(const char *arg, char **endp, int base); | 125 | unsigned long long bb_strtoull(const char *arg, char **endp, int base) FAST_FUNC; |
126 | long long bb_strtoll(const char *arg, char **endp, int base); | 126 | long 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 |
129 | static ALWAYS_INLINE | 129 | static ALWAYS_INLINE |
@@ -133,8 +133,8 @@ static ALWAYS_INLINE | |||
133 | long bb_strtol(const char *arg, char **endp, int base) | 133 | long 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 |
136 | unsigned long bb_strtoul(const char *arg, char **endp, int base); | 136 | unsigned long bb_strtoul(const char *arg, char **endp, int base) FAST_FUNC; |
137 | long bb_strtol(const char *arg, char **endp, int base); | 137 | long 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 | |||
152 | int bb_strtoi(const char *arg, char **endp, int base) | 152 | int 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 |
155 | unsigned bb_strtou(const char *arg, char **endp, int base); | 155 | unsigned bb_strtou(const char *arg, char **endp, int base) FAST_FUNC; |
156 | int bb_strtoi(const char *arg, char **endp, int base); | 156 | int bb_strtoi(const char *arg, char **endp, int base) FAST_FUNC; |
157 | #endif | 157 | #endif |
158 | 158 | ||
159 | int BUG_bb_strtou32_unimplemented(void); | 159 | int 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 | ||
20 | char* regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags); | 20 | char* regcomp_or_errmsg(regex_t *preg, const char *regex, int cflags) FAST_FUNC; |
21 | void xregcomp(regex_t *preg, const char *regex, int cflags); | 21 | void 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 |