aboutsummaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/libbb.h73
1 files changed, 36 insertions, 37 deletions
diff --git a/include/libbb.h b/include/libbb.h
index 1adac8443..2593c3ad2 100644
--- a/include/libbb.h
+++ b/include/libbb.h
@@ -26,7 +26,6 @@
26#include <stdarg.h> 26#include <stdarg.h>
27#include <stddef.h> 27#include <stddef.h>
28#include <string.h> 28#include <string.h>
29/* #include <strings.h> - said to be obsolete */
30#include <sys/poll.h> 29#include <sys/poll.h>
31#include <sys/ioctl.h> 30#include <sys/ioctl.h>
32#include <sys/mman.h> 31#include <sys/mman.h>
@@ -40,6 +39,12 @@
40#include <time.h> 39#include <time.h>
41#include <unistd.h> 40#include <unistd.h>
42#include <utime.h> 41#include <utime.h>
42/* Try to pull in PATH_MAX */
43#include <limits.h>
44#include <sys/param.h>
45#ifndef PATH_MAX
46#define PATH_MAX 256
47#endif
43 48
44#if ENABLE_SELINUX 49#if ENABLE_SELINUX
45#include <selinux/selinux.h> 50#include <selinux/selinux.h>
@@ -62,14 +67,37 @@
62#include "shadow_.h" 67#include "shadow_.h"
63#endif 68#endif
64 69
65/* Try to pull in PATH_MAX */ 70#if defined(__GLIBC__) && __GLIBC__ < 2
66#include <limits.h> 71int vdprintf(int d, const char *format, va_list ap);
67#include <sys/param.h>
68#ifndef PATH_MAX
69#define PATH_MAX 256
70#endif 72#endif
73/* klogctl is in libc's klog.h, but we cheat and not #include that */
74int klogctl(int type, char *b, int len);
75/* This is declared here rather than #including <libgen.h> in order to avoid
76 * confusing the two versions of basename. See the dirname/basename man page
77 * for details. */
78char *dirname(char *path);
79/* Include our own copy of struct sysinfo to avoid binary compatibility
80 * problems with Linux 2.4, which changed things. Grumble, grumble. */
81struct sysinfo {
82 long uptime; /* Seconds since boot */
83 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
84 unsigned long totalram; /* Total usable main memory size */
85 unsigned long freeram; /* Available memory size */
86 unsigned long sharedram; /* Amount of shared memory */
87 unsigned long bufferram; /* Memory used by buffers */
88 unsigned long totalswap; /* Total swap space size */
89 unsigned long freeswap; /* swap space still available */
90 unsigned short procs; /* Number of current processes */
91 unsigned short pad; /* Padding needed for m68k */
92 unsigned long totalhigh; /* Total high memory size */
93 unsigned long freehigh; /* Available high memory size */
94 unsigned int mem_unit; /* Memory unit size in bytes */
95 char _f[20 - 2*sizeof(long) - sizeof(int)]; /* Padding: libc5 uses this.. */
96};
97int sysinfo(struct sysinfo* info);
98
71 99
72/* Tested to work correctly (IIRC :]) */ 100/* Tested to work correctly with all int types (IIRC :]) */
73#define MAXINT(T) (T)( \ 101#define MAXINT(T) (T)( \
74 ((T)-1) > 0 \ 102 ((T)-1) > 0 \
75 ? (T)-1 \ 103 ? (T)-1 \
@@ -83,7 +111,7 @@
83 ) 111 )
84 112
85/* Large file support */ 113/* Large file support */
86/* Note that CONFIG_LFS forces bbox to be built with all common ops 114/* Note that CONFIG_LFS=y forces bbox to be built with all common ops
87 * (stat, lseek etc) mapped to "largefile" variants by libc. 115 * (stat, lseek etc) mapped to "largefile" variants by libc.
88 * Practically it means that open() automatically has O_LARGEFILE added 116 * Practically it means that open() automatically has O_LARGEFILE added
89 * and all filesize/file_offset parameters and struct members are "large" 117 * and all filesize/file_offset parameters and struct members are "large"
@@ -167,7 +195,6 @@
167#endif 195#endif
168#endif 196#endif
169 197
170
171#if defined(__GLIBC__) 198#if defined(__GLIBC__)
172/* glibc uses __errno_location() to get a ptr to errno */ 199/* glibc uses __errno_location() to get a ptr to errno */
173/* We can just memorize it once - no multithreading in busybox :) */ 200/* We can just memorize it once - no multithreading in busybox :) */
@@ -176,33 +203,6 @@ extern int *const bb_errno;
176#define errno (*bb_errno) 203#define errno (*bb_errno)
177#endif 204#endif
178 205
179#if defined(__GLIBC__) && __GLIBC__ < 2
180int vdprintf(int d, const char *format, va_list ap);
181#endif
182// This is declared here rather than #including <libgen.h> in order to avoid
183// confusing the two versions of basename. See the dirname/basename man page
184// for details.
185char *dirname(char *path);
186/* Include our own copy of struct sysinfo to avoid binary compatibility
187 * problems with Linux 2.4, which changed things. Grumble, grumble. */
188struct sysinfo {
189 long uptime; /* Seconds since boot */
190 unsigned long loads[3]; /* 1, 5, and 15 minute load averages */
191 unsigned long totalram; /* Total usable main memory size */
192 unsigned long freeram; /* Available memory size */
193 unsigned long sharedram; /* Amount of shared memory */
194 unsigned long bufferram; /* Memory used by buffers */
195 unsigned long totalswap; /* Total swap space size */
196 unsigned long freeswap; /* swap space still available */
197 unsigned short procs; /* Number of current processes */
198 unsigned short pad; /* Padding needed for m68k */
199 unsigned long totalhigh; /* Total high memory size */
200 unsigned long freehigh; /* Available high memory size */
201 unsigned int mem_unit; /* Memory unit size in bytes */
202 char _f[20-2*sizeof(long)-sizeof(int)]; /* Padding: libc5 uses this.. */
203};
204int sysinfo(struct sysinfo* info);
205
206unsigned long long monotonic_us(void); 206unsigned long long monotonic_us(void);
207unsigned monotonic_sec(void); 207unsigned monotonic_sec(void);
208 208
@@ -788,7 +788,6 @@ extern int set_loop(char **devname, const char *file, unsigned long long offset)
788//TODO: pass buf pointer or return allocated buf (avoid statics)? 788//TODO: pass buf pointer or return allocated buf (avoid statics)?
789char *bb_askpass(int timeout, const char * prompt); 789char *bb_askpass(int timeout, const char * prompt);
790int bb_ask_confirmation(void); 790int bb_ask_confirmation(void);
791int klogctl(int type, char * b, int len);
792 791
793extern int bb_parse_mode(const char* s, mode_t* theMode); 792extern int bb_parse_mode(const char* s, mode_t* theMode);
794 793