aboutsummaryrefslogtreecommitdiff
path: root/libbb/xfuncs_printf.c
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--libbb/xfuncs_printf.c14
1 files changed, 11 insertions, 3 deletions
diff --git a/libbb/xfuncs_printf.c b/libbb/xfuncs_printf.c
index 842d10cd2..0ead3b2eb 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
111void* FAST_FUNC mmap_read(int fd, size_t size) 112void* 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.
337char* FAST_FUNC xasprintf(const char *format, ...) 339char* 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 */
506ssize_t FAST_FUNC xsendto(int s, const void *buf, size_t len, const struct sockaddr *to, 509ssize_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
519void FAST_FUNC xstat(const char *name, struct stat *stat_buf) 523void 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
550int FAST_FUNC ioctl_or_perror_and_die(int fd, unsigned request, void *argp, const char *fmt,...) 554#if !ENABLE_PLATFORM_MINGW32
555int 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
566int FAST_FUNC ioctl_or_perror(int fd, unsigned request, void *argp, const char *fmt,...) 571int 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);
@@ -711,6 +716,7 @@ void FAST_FUNC xvfork_parent_waits_and_exits(void)
711 } 716 }
712 /* Child continues */ 717 /* Child continues */
713} 718}
719#endif /* !ENABLE_PLATFORM_MINGW32 */
714 720
715// Useful when we do know that pid is valid, and we just want to wait 721// Useful when we do know that pid is valid, and we just want to wait
716// for it to exit. Not existing pid is fatal. waitpid() status is not returned. 722// for it to exit. Not existing pid is fatal. waitpid() status is not returned.
@@ -724,11 +730,13 @@ int FAST_FUNC wait_for_exitstatus(pid_t pid)
724 return exit_status; 730 return exit_status;
725} 731}
726 732
733#if !ENABLE_PLATFORM_MINGW32
727void FAST_FUNC xsettimeofday(const struct timeval *tv) 734void FAST_FUNC xsettimeofday(const struct timeval *tv)
728{ 735{
729 if (settimeofday(tv, NULL)) 736 if (settimeofday(tv, NULL))
730 bb_simple_perror_msg_and_die("settimeofday"); 737 bb_simple_perror_msg_and_die("settimeofday");
731} 738}
739#endif
732 740
733void FAST_FUNC xgettimeofday(struct timeval *tv) 741void FAST_FUNC xgettimeofday(struct timeval *tv)
734{ 742{