aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2021-01-25 13:57:08 +0000
committerRon Yorston <rmy@pobox.com>2021-01-25 14:15:02 +0000
commiteb0c2bbbaf0722103124a589e3dfe952c2664cbb (patch)
tree3ae3ec89bd7a6041ed5aed1d537f6b2fb3586ed7 /include
parent6422b0ef38d0835c86b40e6e642f18cdfb933e85 (diff)
downloadbusybox-w32-eb0c2bbbaf0722103124a589e3dfe952c2664cbb.tar.gz
busybox-w32-eb0c2bbbaf0722103124a589e3dfe952c2664cbb.tar.bz2
busybox-w32-eb0c2bbbaf0722103124a589e3dfe952c2664cbb.zip
tls: avoid unnecessary changes to POSIX build, part 2
On reflection, the previous commit may have been ill-advised. There are many calls to open_read_close() and most shouldn't be able to access special devices. (Though in practice only a few are enabled in busybox-w32.) Nonetheless, I've implemented a new mechanism which uses the macro MINGW_SPECIAL() to mark calls to functions that are allowed to access special devices. An unrelated change is to avoid compiling fputs_stdout() in coreutils/printf.c for the POSIX build.
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h3
-rw-r--r--include/mingw.h4
2 files changed, 7 insertions, 0 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 3d6a6a0cf..a7f32e21e 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -202,6 +202,9 @@ int klogctl(int type, char *b, int len);
202 202
203#if ENABLE_PLATFORM_MINGW32 203#if ENABLE_PLATFORM_MINGW32
204# include "mingw.h" 204# include "mingw.h"
205# define MINGW_SPECIAL(a) mingw_ ## a
206#else
207# define MINGW_SPECIAL(a) a
205#endif 208#endif
206 209
207/* Busybox does not use threads, we can speed up stdio. */ 210/* Busybox does not use threads, we can speed up stdio. */
diff --git a/include/mingw.h b/include/mingw.h
index d1e638231..a1ba5f5af 100644
--- a/include/mingw.h
+++ b/include/mingw.h
@@ -429,7 +429,11 @@ enum {DEV_NULL, DEV_ZERO, DEV_URANDOM, NOT_DEVICE = -1};
429int get_dev_type(const char *filename); 429int get_dev_type(const char *filename);
430void update_dev_fd(int dev, int fd); 430void update_dev_fd(int dev, int fd);
431int mingw_open (const char *filename, int oflags, ...); 431int mingw_open (const char *filename, int oflags, ...);
432
433/* functions which add O_SPECIAL to open(2) to allow access to devices */
432int mingw_xopen(const char *filename, int oflags); 434int mingw_xopen(const char *filename, int oflags);
435ssize_t mingw_open_read_close(const char *fn, void *buf, size_t size) FAST_FUNC;
436
433ssize_t mingw_read(int fd, void *buf, size_t count); 437ssize_t mingw_read(int fd, void *buf, size_t count);
434int mingw_close(int fd); 438int mingw_close(int fd);
435int pipe(int filedes[2]); 439int pipe(int filedes[2]);