aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
authorRon Yorston <rmy@pobox.com>2012-03-22 15:41:00 +0000
committerRon Yorston <rmy@pobox.com>2012-03-22 15:41:00 +0000
commit1118c95535ea51961437089fc3dece5ab4ea7e1b (patch)
tree1515bd2376a6d6c5123791662307ce2ed90cdf36 /include
parent0d8b2c4a929ea9d3ac37499319fe0d8e7941a0c2 (diff)
parent066f39956641300c1e5c6bfe6c11a115cea3e2cf (diff)
downloadbusybox-w32-1118c95535ea51961437089fc3dece5ab4ea7e1b.tar.gz
busybox-w32-1118c95535ea51961437089fc3dece5ab4ea7e1b.tar.bz2
busybox-w32-1118c95535ea51961437089fc3dece5ab4ea7e1b.zip
Merge commit '066f39956641300c1e5c6bfe6c11a115cea3e2cf' into merge
Conflicts: procps/ps.c
Diffstat (limited to 'include')
-rw-r--r--include/applets.src.h2
-rw-r--r--include/libbb.h40
-rw-r--r--include/platform.h58
3 files changed, 82 insertions, 18 deletions
diff --git a/include/applets.src.h b/include/applets.src.h
index 133f376a3..2d55ffec7 100644
--- a/include/applets.src.h
+++ b/include/applets.src.h
@@ -180,7 +180,6 @@ IF_HOSTID(APPLET_NOFORK(hostid, hostid, BB_DIR_USR_BIN, BB_SUID_DROP, hostid))
180IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP)) 180IF_HOSTNAME(APPLET(hostname, BB_DIR_BIN, BB_SUID_DROP))
181IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP)) 181IF_HTTPD(APPLET(httpd, BB_DIR_USR_SBIN, BB_SUID_DROP))
182IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP)) 182IF_HWCLOCK(APPLET(hwclock, BB_DIR_SBIN, BB_SUID_DROP))
183IF_ID(APPLET_NOEXEC(id, id, BB_DIR_USR_BIN, BB_SUID_DROP, id))
184IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP)) 183IF_IFCONFIG(APPLET(ifconfig, BB_DIR_SBIN, BB_SUID_DROP))
185IF_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown)) 184IF_IFUPDOWN(APPLET_ODDNAME(ifdown, ifupdown, BB_DIR_SBIN, BB_SUID_DROP, ifdown))
186IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP)) 185IF_IFENSLAVE(APPLET(ifenslave, BB_DIR_SBIN, BB_SUID_DROP))
@@ -400,7 +399,6 @@ IF_USLEEP(APPLET_NOFORK(usleep, usleep, BB_DIR_BIN, BB_SUID_DROP, usleep))
400IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP)) 399IF_UUDECODE(APPLET(uudecode, BB_DIR_USR_BIN, BB_SUID_DROP))
401IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP)) 400IF_UUENCODE(APPLET(uuencode, BB_DIR_USR_BIN, BB_SUID_DROP))
402IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP)) 401IF_VCONFIG(APPLET(vconfig, BB_DIR_SBIN, BB_SUID_DROP))
403IF_VI(APPLET(vi, BB_DIR_BIN, BB_SUID_DROP))
404/* Needs to be run by root or be suid root - needs to change uid and gid: */ 402/* Needs to be run by root or be suid root - needs to change uid and gid: */
405IF_VLOCK(APPLET(vlock, BB_DIR_USR_BIN, BB_SUID_REQUIRE)) 403IF_VLOCK(APPLET(vlock, BB_DIR_USR_BIN, BB_SUID_REQUIRE))
406IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP)) 404IF_VOLNAME(APPLET(volname, BB_DIR_USR_BIN, BB_SUID_DROP))
diff --git a/include/libbb.h b/include/libbb.h
index ac5722c89..363fe53df 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -173,6 +173,30 @@ int sysinfo(struct sysinfo* info);
173# include "mingw.h" 173# include "mingw.h"
174#endif 174#endif
175 175
176/* Busybox does not use threads, we can speed up stdio. */
177#ifdef HAVE_UNLOCKED_STDIO
178# undef getc
179# define getc(stream) getc_unlocked(stream)
180# undef getchar
181# define getchar() getchar_unlocked()
182# undef putc
183# define putc(c, stream) putc_unlocked(c, stream)
184# undef putchar
185# define putchar(c) putchar_unlocked(c)
186# undef fgetc
187# define fgetc(stream) getc_unlocked(stream)
188# undef fputc
189# define fputc(c, stream) putc_unlocked(c, stream)
190#endif
191/* Above functions are required by POSIX.1-2008, below ones are extensions */
192#ifdef HAVE_UNLOCKED_LINE_OPS
193# undef fgets
194# define fgets(s, n, stream) fgets_unlocked(s, n, stream)
195# undef fputs
196# define fputs(s, stream) fputs_unlocked(s, stream)
197#endif
198
199
176/* Make all declarations hidden (-fvisibility flag only affects definitions) */ 200/* Make all declarations hidden (-fvisibility flag only affects definitions) */
177/* (don't include system headers after this until corresponding pop!) */ 201/* (don't include system headers after this until corresponding pop!) */
178PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN 202PUSH_AND_SET_FUNCTION_VISIBILITY_TO_HIDDEN
@@ -743,8 +767,12 @@ extern void xclose(int fd) FAST_FUNC;
743/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */ 767/* Reads and prints to stdout till eof, then closes FILE. Exits on error: */
744extern void xprint_and_close_file(FILE *file) FAST_FUNC; 768extern void xprint_and_close_file(FILE *file) FAST_FUNC;
745 769
770/* Reads a line from a text file, up to a newline or NUL byte, inclusive.
771 * Returns malloc'ed char*. If end is NULL '\n' isn't considered
772 * end of line. If end isn't NULL, length of the chunk is stored in it.
773 * Returns NULL if EOF/error.
774 */
746extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC; 775extern char *bb_get_chunk_from_file(FILE *file, int *end) FAST_FUNC;
747extern char *bb_get_chunk_with_continuation(FILE *file, int *end, int *lineno) FAST_FUNC;
748/* Reads up to (and including) TERMINATING_STRING: */ 776/* Reads up to (and including) TERMINATING_STRING: */
749extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC RETURNS_MALLOC; 777extern char *xmalloc_fgets_str(FILE *file, const char *terminating_string) FAST_FUNC RETURNS_MALLOC;
750/* Same, with limited max size, and returns the length (excluding NUL): */ 778/* Same, with limited max size, and returns the length (excluding NUL): */
@@ -1196,8 +1224,9 @@ enum {
1196}; 1224};
1197typedef struct parser_t { 1225typedef struct parser_t {
1198 FILE *fp; 1226 FILE *fp;
1199 char *line;
1200 char *data; 1227 char *data;
1228 char *line, *nline;
1229 size_t line_alloc, nline_alloc;
1201 int lineno; 1230 int lineno;
1202} parser_t; 1231} parser_t;
1203parser_t* config_open(const char *filename) FAST_FUNC; 1232parser_t* config_open(const char *filename) FAST_FUNC;
@@ -1560,13 +1589,6 @@ enum {
1560 PSSCAN_NICE = (1 << 20) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS, 1589 PSSCAN_NICE = (1 << 20) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS,
1561 PSSCAN_RUIDGID = (1 << 21) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS, 1590 PSSCAN_RUIDGID = (1 << 21) * ENABLE_FEATURE_PS_ADDITIONAL_COLUMNS,
1562 PSSCAN_TASKS = (1 << 22) * ENABLE_FEATURE_SHOW_THREADS, 1591 PSSCAN_TASKS = (1 << 22) * ENABLE_FEATURE_SHOW_THREADS,
1563 /* These are all retrieved from proc/NN/stat in one go: */
1564 PSSCAN_STAT = PSSCAN_PPID | PSSCAN_PGID | PSSCAN_SID
1565 /**/ | PSSCAN_COMM | PSSCAN_STATE
1566 /**/ | PSSCAN_VSZ | PSSCAN_RSS
1567 /**/ | PSSCAN_STIME | PSSCAN_UTIME | PSSCAN_START_TIME
1568 /**/ | PSSCAN_TTY | PSSCAN_NICE
1569 /**/ | PSSCAN_CPU
1570}; 1592};
1571//procps_status_t* alloc_procps_scan(void) FAST_FUNC; 1593//procps_status_t* alloc_procps_scan(void) FAST_FUNC;
1572void free_procps_scan(procps_status_t* sp) FAST_FUNC; 1594void free_procps_scan(procps_status_t* sp) FAST_FUNC;
diff --git a/include/platform.h b/include/platform.h
index 48e256aa0..319ef4a9e 100644
--- a/include/platform.h
+++ b/include/platform.h
@@ -349,8 +349,8 @@ typedef unsigned smalluint;
349 349
350/* ---- Who misses what? ------------------------------------ */ 350/* ---- Who misses what? ------------------------------------ */
351 351
352/* Assume all these functions exist by default. Platforms where it is not 352/* Assume all these functions and header files exist by default.
353 * true will #undef them below. 353 * Platforms where it is not true will #undef them below.
354 */ 354 */
355#define HAVE_CLEARENV 1 355#define HAVE_CLEARENV 1
356#define HAVE_FDATASYNC 1 356#define HAVE_FDATASYNC 1
@@ -365,10 +365,24 @@ typedef unsigned smalluint;
365#define HAVE_STRCHRNUL 1 365#define HAVE_STRCHRNUL 1
366#define HAVE_STRSEP 1 366#define HAVE_STRSEP 1
367#define HAVE_STRSIGNAL 1 367#define HAVE_STRSIGNAL 1
368#define HAVE_STRVERSCMP 1
368#define HAVE_VASPRINTF 1 369#define HAVE_VASPRINTF 1
370#define HAVE_UNLOCKED_STDIO 1
371#define HAVE_UNLOCKED_LINE_OPS 1
372#define HAVE_GETLINE 1
373#define HAVE_XTABS 1
369#define HAVE_MNTENT_H 1 374#define HAVE_MNTENT_H 1
375#define HAVE_NET_ETHERNET_H 1
370#define HAVE_SYS_STATFS_H 1 376#define HAVE_SYS_STATFS_H 1
371#define HAVE_XTABS 1 377
378#if defined(__UCLIBC_MAJOR__)
379# if __UCLIBC_MAJOR__ == 0 \
380 && ( __UCLIBC_MINOR__ < 9 \
381 || (__UCLIBC_MINOR__ == 9 && __UCLIBC_SUBLEVEL__ < 31) \
382 )
383# undef HAVE_STRVERSCMP
384# endif
385#endif
372 386
373#if defined(__dietlibc__) 387#if defined(__dietlibc__)
374# undef HAVE_STRCHRNUL 388# undef HAVE_STRCHRNUL
@@ -383,13 +397,17 @@ typedef unsigned smalluint;
383# undef HAVE_STRCASESTR 397# undef HAVE_STRCASESTR
384# undef HAVE_STRCHRNUL 398# undef HAVE_STRCHRNUL
385# undef HAVE_STRSIGNAL 399# undef HAVE_STRSIGNAL
400# undef HAVE_STRVERSCMP
386# undef HAVE_VASPRINTF 401# undef HAVE_VASPRINTF
402# undef HAVE_UNLOCKED_STDIO
403# undef HAVE_UNLOCKED_LINE_OPS
387# undef HAVE_MNTENT_H 404# undef HAVE_MNTENT_H
388# undef HAVE_SYS_STATFS_H 405# undef HAVE_SYS_STATFS_H
389#endif 406#endif
390 407
391#if defined(__WATCOMC__) 408#if defined(__WATCOMC__)
392# undef HAVE_DPRINTF 409# undef HAVE_DPRINTF
410# undef HAVE_GETLINE
393# undef HAVE_MEMRCHR 411# undef HAVE_MEMRCHR
394# undef HAVE_MKDTEMP 412# undef HAVE_MKDTEMP
395# undef HAVE_SETBIT 413# undef HAVE_SETBIT
@@ -398,30 +416,51 @@ typedef unsigned smalluint;
398# undef HAVE_STRCHRNUL 416# undef HAVE_STRCHRNUL
399# undef HAVE_STRSEP 417# undef HAVE_STRSEP
400# undef HAVE_STRSIGNAL 418# undef HAVE_STRSIGNAL
419# undef HAVE_STRVERSCMP
401# undef HAVE_VASPRINTF 420# undef HAVE_VASPRINTF
421# undef HAVE_UNLOCKED_STDIO
422# undef HAVE_UNLOCKED_LINE_OPS
423# undef HAVE_NET_ETHERNET_H
402#endif 424#endif
403 425
404#if defined(__FreeBSD__) 426/* These BSD-derived OSes share many similarities */
405# undef HAVE_STRCHRNUL
406#endif
407
408#if (defined __digital__ && defined __unix__) \ 427#if (defined __digital__ && defined __unix__) \
409 || defined __APPLE__ \ 428 || defined __APPLE__ \
410 || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__ 429 || defined __FreeBSD__ || defined __OpenBSD__ || defined __NetBSD__
411# undef HAVE_CLEARENV 430# undef HAVE_CLEARENV
412# undef HAVE_FDATASYNC 431# undef HAVE_FDATASYNC
432# undef HAVE_GETLINE
413# undef HAVE_MNTENT_H 433# undef HAVE_MNTENT_H
414# undef HAVE_PTSNAME_R 434# undef HAVE_PTSNAME_R
415# undef HAVE_SYS_STATFS_H 435# undef HAVE_SYS_STATFS_H
416# undef HAVE_SIGHANDLER_T 436# undef HAVE_SIGHANDLER_T
437# undef HAVE_STRVERSCMP
417# undef HAVE_XTABS 438# undef HAVE_XTABS
418# undef HAVE_DPRINTF 439# undef HAVE_DPRINTF
419#endif 440#endif
420 441
442#if defined(__FreeBSD__)
443# undef HAVE_STRCHRNUL
444#endif
445
446#if defined(__NetBSD__)
447# define HAVE_GETLINE 1 /* Recent NetBSD versions have getline() */
448#endif
449
421#if defined(__digital__) && defined(__unix__) 450#if defined(__digital__) && defined(__unix__)
422# undef HAVE_STPCPY 451# undef HAVE_STPCPY
423#endif 452#endif
424 453
454#if defined(ANDROID)
455# undef HAVE_DPRINTF
456# undef HAVE_GETLINE
457# undef HAVE_STPCPY
458# undef HAVE_STRCHRNUL
459# undef HAVE_STRVERSCMP
460# undef HAVE_UNLOCKED_LINE_OPS
461# undef HAVE_NET_ETHERNET_H
462#endif
463
425/* 464/*
426 * Now, define prototypes for all the functions defined in platform.c 465 * Now, define prototypes for all the functions defined in platform.c
427 * These must come after all the HAVE_* macros are defined (or not) 466 * These must come after all the HAVE_* macros are defined (or not)
@@ -475,4 +514,9 @@ extern char *strsep(char **stringp, const char *delim) FAST_FUNC;
475extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC; 514extern int vasprintf(char **string_ptr, const char *format, va_list p) FAST_FUNC;
476#endif 515#endif
477 516
517#ifndef HAVE_GETLINE
518#include <stdio.h> /* for FILE */
519extern ssize_t getline(char **lineptr, size_t *n, FILE *stream) FAST_FUNC;
520#endif
521
478#endif 522#endif