X-Git-Url: https://git.librecmc.org/?a=blobdiff_plain;f=include%2Flibbb.h;h=c031f28415af71f90f9477a550048b8dcd602671;hb=dac7ff15b7d32deeeef3d9665744fc5774c21d70;hp=0490ee35f59a3c58eb7d6079b61e72589a98cf52;hpb=1f305dc0fdb8415c9c1321e49cc194089e58c456;p=oweals%2Fbusybox.git diff --git a/include/libbb.h b/include/libbb.h index 0490ee35f..c031f2841 100644 --- a/include/libbb.h +++ b/include/libbb.h @@ -17,10 +17,11 @@ #include #include #include +#include #include -#include #include +#include #include @@ -60,6 +61,24 @@ #define MAX(a,b) (((a)>(b))?(a):(b)) #endif +/* buffer allocation schemes */ +#ifdef CONFIG_FEATURE_BUFFERS_GO_ON_STACK +#define RESERVE_CONFIG_BUFFER(buffer,len) char buffer[len] +#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char buffer[len] +#define RELEASE_CONFIG_BUFFER(buffer) ((void)0) +#else +#ifdef CONFIG_FEATURE_BUFFERS_GO_IN_BSS +#define RESERVE_CONFIG_BUFFER(buffer,len) static char buffer[len] +#define RESERVE_CONFIG_UBUFFER(buffer,len) static unsigned char buffer[len] +#define RELEASE_CONFIG_BUFFER(buffer) ((void)0) +#else +#define RESERVE_CONFIG_BUFFER(buffer,len) char *buffer=xmalloc(len) +#define RESERVE_CONFIG_UBUFFER(buffer,len) unsigned char *buffer=xmalloc(len) +#define RELEASE_CONFIG_BUFFER(buffer) free (buffer) +#endif +#endif + + extern void bb_show_usage(void) ATTRIBUTE_NORETURN ATTRIBUTE_EXTERNALLY_VISIBLE; extern void bb_error_msg(const char *s, ...) __attribute__ ((format (printf, 1, 2))); extern void bb_error_msg_and_die(const char *s, ...) __attribute__ ((noreturn, format (printf, 1, 2))); @@ -80,6 +99,8 @@ extern int bb_echo(int argc, char** argv); extern const char *bb_mode_string(int mode); extern int is_directory(const char *name, int followLinks, struct stat *statBuf); +extern DIR *bb_opendir(const char *path); +extern DIR *bb_xopendir(const char *path); extern int remove_file(const char *path, int flags); extern int copy_file(const char *source, const char *dest, int flags); @@ -123,6 +144,9 @@ extern FILE *bb_xfopen(const char *path, const char *mode); extern int bb_fclose_nonstdin(FILE *f); extern void bb_fflush_stdout_and_exit(int retval) ATTRIBUTE_NORETURN; +extern void xstat(const char *filename, struct stat *buf); +extern int bb_xsocket(int domain, int type, int protocol); + #define BB_GETOPT_ERROR 0x80000000UL extern const char *bb_opt_complementally; extern const struct option *bb_applet_long_options; @@ -217,7 +241,7 @@ extern int vdprintf(int d, const char *format, va_list ap); int nfsmount(const char *spec, const char *node, int *flags, char **mount_opts, int running_bg); -/* Include our own copy of struct sysinfo to avoid binary compatability +/* Include our own copy of struct sysinfo to avoid binary compatibility * problems with Linux 2.4, which changed things. Grumble, grumble. */ struct sysinfo { long uptime; /* Seconds since boot */ @@ -460,8 +484,11 @@ extern void llist_free(llist_t *elm); extern void print_login_issue(const char *issue_file, const char *tty); extern void print_login_prompt(void); +#if defined(__uClinux__) extern void vfork_daemon_rexec(int nochdir, int noclose, int argc, char **argv, char *foreground_opt); +#endif + extern int get_terminal_width_height(int fd, int *width, int *height); extern unsigned long get_ug_id(const char *s, long (*__bb_getxxnam)(const char *)); @@ -489,6 +516,8 @@ void md5_begin(md5_ctx_t *ctx); void md5_hash(const void *data, size_t length, md5_ctx_t *ctx); void *md5_end(void *resbuf, md5_ctx_t *ctx); +extern uint32_t *bb_crc32_filltable (int endian); + /* busybox.h will include dmalloc later for us, else include it here. */ #if !defined _BB_INTERNAL_H_ && defined DMALLOC #include