diff options
author | Ron Yorston <rmy@pobox.com> | 2012-03-21 20:53:50 +0000 |
---|---|---|
committer | Ron Yorston <rmy@pobox.com> | 2012-03-21 20:53:50 +0000 |
commit | f6bad5ef766b0447158e3de2f55c35f1f6cecb58 (patch) | |
tree | f5ec7ac45234c25794c97f87e9a6daa8a551e57c /include/libbb.h | |
parent | 72394258b6509b40e0fa08594ac86215a558dfd8 (diff) | |
parent | 8d0e0cdadf726beab28ccdc7d69738c1534e1f74 (diff) | |
download | busybox-w32-f6bad5ef766b0447158e3de2f55c35f1f6cecb58.tar.gz busybox-w32-f6bad5ef766b0447158e3de2f55c35f1f6cecb58.tar.bz2 busybox-w32-f6bad5ef766b0447158e3de2f55c35f1f6cecb58.zip |
Merge commit '8d0e0cdadf726beab28ccdc7d69738c1534e1f74' into merge
Conflicts:
include/platform.h
libbb/Kbuild.src
libbb/messages.c
Diffstat (limited to 'include/libbb.h')
-rw-r--r-- | include/libbb.h | 51 |
1 files changed, 41 insertions, 10 deletions
diff --git a/include/libbb.h b/include/libbb.h index 5fa62da3a..7efa32349 100644 --- a/include/libbb.h +++ b/include/libbb.h | |||
@@ -50,6 +50,9 @@ | |||
50 | # include <selinux/flask.h> | 50 | # include <selinux/flask.h> |
51 | # include <selinux/av_permissions.h> | 51 | # include <selinux/av_permissions.h> |
52 | #endif | 52 | #endif |
53 | #if ENABLE_FEATURE_UTMP | ||
54 | # include <utmp.h> | ||
55 | #endif | ||
53 | #if ENABLE_LOCALE_SUPPORT | 56 | #if ENABLE_LOCALE_SUPPORT |
54 | # include <locale.h> | 57 | # include <locale.h> |
55 | #else | 58 | #else |
@@ -68,6 +71,19 @@ | |||
68 | # include <shadow.h> | 71 | # include <shadow.h> |
69 | # endif | 72 | # endif |
70 | #endif | 73 | #endif |
74 | /* Just in case libc doesn't define some of these... */ | ||
75 | #ifndef _PATH_PASSWD | ||
76 | #define _PATH_PASSWD "/etc/passwd" | ||
77 | #endif | ||
78 | #ifndef _PATH_GROUP | ||
79 | #define _PATH_GROUP "/etc/group" | ||
80 | #endif | ||
81 | #ifndef _PATH_SHADOW | ||
82 | #define _PATH_SHADOW "/etc/shadow" | ||
83 | #endif | ||
84 | #ifndef _PATH_GSHADOW | ||
85 | #define _PATH_GSHADOW "/etc/gshadow" | ||
86 | #endif | ||
71 | #if defined __FreeBSD__ || defined __OpenBSD__ | 87 | #if defined __FreeBSD__ || defined __OpenBSD__ |
72 | # include <netinet/in.h> | 88 | # include <netinet/in.h> |
73 | # include <arpa/inet.h> | 89 | # include <arpa/inet.h> |
@@ -91,6 +107,15 @@ | |||
91 | typedef unsigned socklen_t; | 107 | typedef unsigned socklen_t; |
92 | # endif | 108 | # endif |
93 | #endif | 109 | #endif |
110 | #ifndef HAVE_CLEARENV | ||
111 | # define clearenv() do { if (environ) environ[0] = NULL; } while (0) | ||
112 | #endif | ||
113 | #ifndef HAVE_FDATASYNC | ||
114 | # define fdatasync fsync | ||
115 | #endif | ||
116 | #ifndef HAVE_XTABS | ||
117 | # define XTABS TAB3 | ||
118 | #endif | ||
94 | 119 | ||
95 | 120 | ||
96 | /* Some libc's forget to declare these, do it ourself */ | 121 | /* Some libc's forget to declare these, do it ourself */ |
@@ -348,9 +373,9 @@ extern char *bb_get_last_path_component_strip(char *path) FAST_FUNC; | |||
348 | /* "abc/def/" -> "" and it never modifies 'path' */ | 373 | /* "abc/def/" -> "" and it never modifies 'path' */ |
349 | extern char *bb_get_last_path_component_nostrip(const char *path) FAST_FUNC; | 374 | extern char *bb_get_last_path_component_nostrip(const char *path) FAST_FUNC; |
350 | 375 | ||
351 | int ndelay_on(int fd) FAST_FUNC; | 376 | void ndelay_on(int fd) FAST_FUNC; |
352 | int ndelay_off(int fd) FAST_FUNC; | 377 | void ndelay_off(int fd) FAST_FUNC; |
353 | int close_on_exec_on(int fd) FAST_FUNC; | 378 | void close_on_exec_on(int fd) FAST_FUNC; |
354 | void xdup2(int, int) FAST_FUNC; | 379 | void xdup2(int, int) FAST_FUNC; |
355 | void xmove_fd(int, int) FAST_FUNC; | 380 | void xmove_fd(int, int) FAST_FUNC; |
356 | 381 | ||
@@ -674,6 +699,8 @@ extern char *xmalloc_reads(int fd, char *pfx, size_t *maxsz_p) FAST_FUNC; | |||
674 | extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | 699 | extern void *xmalloc_read(int fd, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; |
675 | /* Returns NULL if file can't be opened (default max size: INT_MAX - 4095) */ | 700 | /* Returns NULL if file can't be opened (default max size: INT_MAX - 4095) */ |
676 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | 701 | extern void *xmalloc_open_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; |
702 | /* Never returns NULL */ | ||
703 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | ||
677 | /* Autodetects gzip/bzip2 formats. fd may be in the middle of the file! */ | 704 | /* Autodetects gzip/bzip2 formats. fd may be in the middle of the file! */ |
678 | #if ENABLE_FEATURE_SEAMLESS_LZMA \ | 705 | #if ENABLE_FEATURE_SEAMLESS_LZMA \ |
679 | || ENABLE_FEATURE_SEAMLESS_BZ2 \ | 706 | || ENABLE_FEATURE_SEAMLESS_BZ2 \ |
@@ -686,8 +713,6 @@ extern void setup_unzip_on_fd(int fd /*, int fail_if_not_detected*/) FAST_FUNC; | |||
686 | /* Autodetects .gz etc */ | 713 | /* Autodetects .gz etc */ |
687 | extern int open_zipped(const char *fname) FAST_FUNC; | 714 | extern int open_zipped(const char *fname) FAST_FUNC; |
688 | extern void *xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | 715 | extern void *xmalloc_open_zipped_read_close(const char *fname, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; |
689 | /* Never returns NULL */ | ||
690 | extern void *xmalloc_xopen_read_close(const char *filename, size_t *maxsz_p) FAST_FUNC RETURNS_MALLOC; | ||
691 | 716 | ||
692 | extern ssize_t safe_write(int fd, const void *buf, size_t count) FAST_FUNC; | 717 | extern ssize_t safe_write(int fd, const void *buf, size_t count) FAST_FUNC; |
693 | // NB: will return short write on error, not -1, | 718 | // NB: will return short write on error, not -1, |
@@ -1211,6 +1236,12 @@ extern void selinux_preserve_fcontext(int fdesc) FAST_FUNC; | |||
1211 | #endif | 1236 | #endif |
1212 | extern void selinux_or_die(void) FAST_FUNC; | 1237 | extern void selinux_or_die(void) FAST_FUNC; |
1213 | 1238 | ||
1239 | |||
1240 | /* systemd support */ | ||
1241 | #define SD_LISTEN_FDS_START 3 | ||
1242 | int sd_listen_fds(void); | ||
1243 | |||
1244 | |||
1214 | /* setup_environment: | 1245 | /* setup_environment: |
1215 | * if chdir pw->pw_dir: ok: else if to_tmp == 1: goto /tmp else: goto / or die | 1246 | * if chdir pw->pw_dir: ok: else if to_tmp == 1: goto /tmp else: goto / or die |
1216 | * if clear_env = 1: cd(pw->pw_dir), clear environment, then set | 1247 | * if clear_env = 1: cd(pw->pw_dir), clear environment, then set |
@@ -1291,7 +1322,7 @@ void add_to_ino_dev_hashtable(const struct stat *statbuf, const char *name) FAST | |||
1291 | void reset_ino_dev_hashtable(void) FAST_FUNC; | 1322 | void reset_ino_dev_hashtable(void) FAST_FUNC; |
1292 | #ifdef __GLIBC__ | 1323 | #ifdef __GLIBC__ |
1293 | /* At least glibc has horrendously large inline for this, so wrap it */ | 1324 | /* At least glibc has horrendously large inline for this, so wrap it */ |
1294 | unsigned long long bb_makedev(unsigned int major, unsigned int minor) FAST_FUNC; | 1325 | unsigned long long bb_makedev(unsigned major, unsigned minor) FAST_FUNC; |
1295 | #undef makedev | 1326 | #undef makedev |
1296 | #define makedev(a,b) bb_makedev(a,b) | 1327 | #define makedev(a,b) bb_makedev(a,b) |
1297 | #endif | 1328 | #endif |
@@ -1628,10 +1659,10 @@ extern const char bb_busybox_exec_path[]; | |||
1628 | * get the list of currently mounted filesystems */ | 1659 | * get the list of currently mounted filesystems */ |
1629 | #define bb_path_mtab_file IF_FEATURE_MTAB_SUPPORT("/etc/mtab")IF_NOT_FEATURE_MTAB_SUPPORT("/proc/mounts") | 1660 | #define bb_path_mtab_file IF_FEATURE_MTAB_SUPPORT("/etc/mtab")IF_NOT_FEATURE_MTAB_SUPPORT("/proc/mounts") |
1630 | 1661 | ||
1631 | #define bb_path_passwd_file "/etc/passwd" | 1662 | #define bb_path_passwd_file _PATH_PASSWD |
1632 | #define bb_path_shadow_file "/etc/shadow" | 1663 | #define bb_path_group_file _PATH_GROUP |
1633 | #define bb_path_gshadow_file "/etc/gshadow" | 1664 | #define bb_path_shadow_file _PATH_SHADOW |
1634 | #define bb_path_group_file "/etc/group" | 1665 | #define bb_path_gshadow_file _PATH_GSHADOW |
1635 | 1666 | ||
1636 | #define bb_path_motd_file "/etc/motd" | 1667 | #define bb_path_motd_file "/etc/motd" |
1637 | 1668 | ||