diff options
Diffstat (limited to 'libbb/xfuncs_printf.c')
| -rw-r--r-- | libbb/xfuncs_printf.c | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c index d413c81e8..5f3de5828 100644 --- a/libbb/xfuncs_printf.c +++ b/libbb/xfuncs_printf.c | |||
| @@ -108,6 +108,7 @@ void* FAST_FUNC xmemdup(const void *s, size_t n) | |||
| 108 | return memcpy(xmalloc(n), s, n); | 108 | return memcpy(xmalloc(n), s, n); |
| 109 | } | 109 | } |
| 110 | 110 | ||
| 111 | #if !ENABLE_PLATFORM_MINGW32 | ||
| 111 | void* FAST_FUNC mmap_read(int fd, size_t size) | 112 | void* FAST_FUNC mmap_read(int fd, size_t size) |
| 112 | { | 113 | { |
| 113 | return mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); | 114 | return mmap(NULL, size, PROT_READ, MAP_PRIVATE, fd, 0); |
| @@ -128,6 +129,7 @@ void* FAST_FUNC xmmap_anon(size_t size) | |||
| 128 | bb_die_memory_exhausted(); | 129 | bb_die_memory_exhausted(); |
| 129 | return p; | 130 | return p; |
| 130 | } | 131 | } |
| 132 | #endif | ||
| 131 | 133 | ||
| 132 | // Die if we can't open a file and return a FILE* to it. | 134 | // Die if we can't open a file and return a FILE* to it. |
| 133 | // Notice we haven't got xfread(), This is for use with fscanf() and friends. | 135 | // Notice we haven't got xfread(), This is for use with fscanf() and friends. |
| @@ -334,7 +336,7 @@ void FAST_FUNC xprint_and_close_file(FILE *file) | |||
| 334 | 336 | ||
| 335 | // Die with an error message if we can't malloc() enough space and do an | 337 | // Die with an error message if we can't malloc() enough space and do an |
| 336 | // sprintf() into that space. | 338 | // sprintf() into that space. |
| 337 | char* FAST_FUNC xasprintf(const char *format, ...) | 339 | char* xasprintf(const char *format, ...) |
| 338 | { | 340 | { |
| 339 | va_list p; | 341 | va_list p; |
| 340 | int r; | 342 | int r; |
| @@ -501,6 +503,7 @@ void FAST_FUNC xlisten(int s, int backlog) | |||
| 501 | if (listen(s, backlog)) bb_simple_perror_msg_and_die("listen"); | 503 | if (listen(s, backlog)) bb_simple_perror_msg_and_die("listen"); |
| 502 | } | 504 | } |
| 503 | 505 | ||
| 506 | #if !ENABLE_PLATFORM_MINGW32 | ||
| 504 | /* Die with an error message if sendto failed. | 507 | /* Die with an error message if sendto failed. |
| 505 | * Return bytes sent otherwise */ | 508 | * Return bytes sent otherwise */ |
| 506 | ssize_t FAST_FUNC xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, | 509 | ssize_t FAST_FUNC xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, |
| @@ -514,6 +517,7 @@ ssize_t FAST_FUNC xsendto(int s, const void *buf, size_t len, const struct socka | |||
| 514 | } | 517 | } |
| 515 | return ret; | 518 | return ret; |
| 516 | } | 519 | } |
| 520 | #endif | ||
| 517 | 521 | ||
| 518 | // xstat() - a stat() which dies on failure with meaningful error message | 522 | // xstat() - a stat() which dies on failure with meaningful error message |
| 519 | void FAST_FUNC xstat(const char *name, struct stat *stat_buf) | 523 | void FAST_FUNC xstat(const char *name, struct stat *stat_buf) |
| @@ -547,7 +551,8 @@ void FAST_FUNC selinux_or_die(void) | |||
| 547 | /* not defined, other code must have no calls to it */ | 551 | /* not defined, other code must have no calls to it */ |
| 548 | #endif | 552 | #endif |
| 549 | 553 | ||
| 550 | int FAST_FUNC ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) | 554 | #if !ENABLE_PLATFORM_MINGW32 |
| 555 | int ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) | ||
| 551 | { | 556 | { |
| 552 | int ret; | 557 | int ret; |
| 553 | va_list p; | 558 | va_list p; |
| @@ -563,7 +568,7 @@ int FAST_FUNC ioctl_or_perror_and_die(int fd, unsigned request, void *argp, cons | |||
| 563 | return ret; | 568 | return ret; |
| 564 | } | 569 | } |
| 565 | 570 | ||
| 566 | int FAST_FUNC ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) | 571 | int ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) |
| 567 | { | 572 | { |
| 568 | va_list p; | 573 | va_list p; |
| 569 | int ret = ioctl(fd, request, argp); | 574 | int ret = ioctl(fd, request, argp); |
| @@ -720,6 +725,7 @@ void FAST_FUNC xvfork_parent_waits_and_exits(void) | |||
| 720 | /* Child continues */ | 725 | /* Child continues */ |
| 721 | } | 726 | } |
| 722 | #endif | 727 | #endif |
| 728 | #endif /* !ENABLE_PLATFORM_MINGW32 */ | ||
| 723 | 729 | ||
| 724 | // Useful when we do know that pid is valid, and we just want to wait | 730 | // Useful when we do know that pid is valid, and we just want to wait |
| 725 | // for it to exit. Not existing pid is fatal. waitpid() status is not returned. | 731 | // for it to exit. Not existing pid is fatal. waitpid() status is not returned. |
| @@ -733,11 +739,13 @@ int FAST_FUNC wait_for_exitstatus(pid_t pid) | |||
| 733 | return exit_status; | 739 | return exit_status; |
| 734 | } | 740 | } |
| 735 | 741 | ||
| 742 | #if !ENABLE_PLATFORM_MINGW32 | ||
| 736 | void FAST_FUNC xsettimeofday(const struct timeval *tv) | 743 | void FAST_FUNC xsettimeofday(const struct timeval *tv) |
| 737 | { | 744 | { |
| 738 | if (settimeofday(tv, NULL)) | 745 | if (settimeofday(tv, NULL)) |
| 739 | bb_simple_perror_msg_and_die("settimeofday"); | 746 | bb_simple_perror_msg_and_die("settimeofday"); |
| 740 | } | 747 | } |
| 748 | #endif | ||
| 741 | 749 | ||
| 742 | void FAST_FUNC xgettimeofday(struct timeval *tv) | 750 | void FAST_FUNC xgettimeofday(struct timeval *tv) |
| 743 | { | 751 | { |
