Add errno.h
[oweals/busybox.git] / busybox.h
index 41421ae56d80cb8b44bdb9462ac2f1ab07b3a437..be6c6f305e50d194b9230af4d9b8a6b3f795a1c4 100644 (file)
--- a/busybox.h
+++ b/busybox.h
 
 #include "Config.h"
 
-#ifdef DMALLOC
-#include "dmalloc.h"
-#endif
-
 #include <stdlib.h>
 #include <stdarg.h>
 #include <string.h>
 #include <errno.h>
 #include <sys/stat.h>
 #include <sys/param.h>
+#include <sys/types.h>
 #include <mntent.h>
 #include <regex.h>
 /* for the _syscall() macros */
 #include <sys/syscall.h>
 #include <linux/unistd.h>
 
+#ifdef DMALLOC
+#include "dmalloc.h"
+#endif
 
 /* Some useful definitions */
 #define FALSE   ((int) 0)
 #define TRUE    ((int) 1)
+#define SKIP   ((int) 2)
 
 /* for mtab.c */
 #define MTAB_GETMOUNTPT '1'
@@ -147,6 +148,7 @@ int makeString(int argc, const char **argv, char *buf, int bufLen);
 char *getChunk(int size);
 char *chunkstrdup(const char *str);
 void freeChunks(void);
+ssize_t safe_read(int fd, void *buf, size_t count);
 int full_write(int fd, const char *buf, int len);
 int full_read(int fd, char *buf, int len);
 int recursive_action(const char *fileName, int recurse, int followLinks, int depthFirst,
@@ -181,7 +183,7 @@ extern void xregcomp(regex_t *preg, const char *regex, int cflags);
 extern FILE *wfopen(const char *path, const char *mode);
 extern FILE *xfopen(const char *path, const char *mode);
 
-#ifndef DMALLOC 
+#ifndef DMALLOC
 extern void *xmalloc (size_t size);
 extern void *xrealloc(void *old, size_t size);
 extern void *xcalloc(size_t nmemb, size_t size);
@@ -189,6 +191,13 @@ extern char *xstrdup (const char *s);
 #endif
 extern char *xstrndup (const char *s, int n);
 
+struct suffix_mult {
+       char *suffix;
+       int mult;
+};
+
+extern unsigned long parse_number(const char *numstr, struct suffix_mult *suffixes);
+
 
 /* These parse entries in /etc/passwd and /etc/group.  This is desirable
  * for BusyBox since we want to avoid using the glibc NSS stuff, which
@@ -250,4 +259,19 @@ extern int sysinfo (struct sysinfo* info);
 #define isclr(a,i)      (((a)[(i)/NBBY] & (1<<((i)%NBBY))) == 0)
 #endif
 
+#ifdef BB_FEATURE_HUMAN_READABLE
+char *format(unsigned long val, unsigned long hr);
+#define KILOBYTE 1024
+#define MEGABYTE (KILOBYTE*1024)
+#define GIGABYTE (MEGABYTE*1024)
+#endif
+
+#ifdef BB_FEATURE_BUFFERS_GO_ON_STACK
+#define RESERVE_BB_BUFFER(buffer,len)           char buffer[len]
+#define RESERVE_BB_UBUFFER(buffer,len) unsigned char buffer[len]
+#else
+#define RESERVE_BB_BUFFER(buffer,len)           char *buffer=xmalloc(len)
+#define RESERVE_BB_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len)
+#endif
+
 #endif /* _BB_INTERNAL_H_ */