diff options
author | Elliott Hughes <enh@google.com> | 2014-06-09 17:16:19 -0700 |
---|---|---|
committer | Elliott Hughes <enh@google.com> | 2014-06-09 17:42:14 -0700 |
commit | a382a792a456fe2710dd3a7be623180ed85a8dce (patch) | |
tree | e075a7c756cce6057ace7a24e46ce9226470ec0e /libc/unistd/syslog.c | |
parent | 87d4233c7224201b1199179b11c5c5f854ab36a3 (diff) | |
download | bionic-a382a792a456fe2710dd3a7be623180ed85a8dce.zip bionic-a382a792a456fe2710dd3a7be623180ed85a8dce.tar.gz bionic-a382a792a456fe2710dd3a7be623180ed85a8dce.tar.bz2 |
Hide non-standard syslog API.
The definitions are still available on LP32 for binary compatibility, but
they're gone on LP64, and the declarations are gone everywhere.
We should probably just make syslog(3) log to the regular Android log,
but that's a job for another day.
Bug: 11156955
Change-Id: I74a98c92f7922ea733549ec6d37c6fa8b7014860
Diffstat (limited to 'libc/unistd/syslog.c')
-rw-r--r-- | libc/unistd/syslog.c | 32 |
1 files changed, 28 insertions, 4 deletions
diff --git a/libc/unistd/syslog.c b/libc/unistd/syslog.c index 7878475..339df68 100644 --- a/libc/unistd/syslog.c +++ b/libc/unistd/syslog.c @@ -44,6 +44,18 @@ #include <unistd.h> #include <stdarg.h> +struct syslog_data { + int log_file; + int connected; + int opened; + int log_stat; + const char* log_tag; + int log_fac; + int log_mask; +}; + +#define SYSLOG_DATA_INIT {-1, 0, 0, 0, (const char *)0, LOG_USER, 0xff} + static struct syslog_data sdata = SYSLOG_DATA_INIT; extern const char *__progname; /* Program name, from crt0. */ @@ -51,6 +63,18 @@ extern const char *__progname; /* Program name, from crt0. */ static void disconnectlog_r(struct syslog_data *); /* disconnect from syslogd */ static void connectlog_r(struct syslog_data *); /* (re)connect to syslogd */ +#if defined(__LP64__) +#define SYSLOG_R_VISIBILITY static +#else +#define SYSLOG_R_VISIBILITY extern +#endif + +SYSLOG_R_VISIBILITY void closelog_r(struct syslog_data*); +SYSLOG_R_VISIBILITY void openlog_r(const char*, int, int, struct syslog_data*); +SYSLOG_R_VISIBILITY int setlogmask_r(int, struct syslog_data*); +SYSLOG_R_VISIBILITY void syslog_r(int, struct syslog_data*, const char*, ...) __printflike(3, 4); +SYSLOG_R_VISIBILITY void vsyslog_r(int, struct syslog_data*, const char*, va_list) __printflike(3, 0); + /* * syslog, vsyslog -- * print message on log file; output is intended for syslogd(8). @@ -157,7 +181,7 @@ vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) prlen = snprintf(p, tbuf_left, "<%d>", pri); DEC(); - /* + /* * syslogd will expand time automagically for reentrant case, and * for normal case, just do like before */ @@ -196,10 +220,10 @@ vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) ++fmt; if (data == &sdata) { prlen = snprintf(t, fmt_left, "%s", - strerror(saved_errno)); + strerror(saved_errno)); } else { prlen = snprintf(t, fmt_left, "Error %d", - saved_errno); + saved_errno); } if (prlen < 0) prlen = 0; @@ -269,7 +293,7 @@ vsyslog_r(int pri, struct syslog_data *data, const char *fmt, va_list ap) if (error == -1 && (data->log_stat & LOG_CONS) && (fd = open(_PATH_CONSOLE, O_WRONLY|O_NONBLOCK, 0)) >= 0) { struct iovec iov[2]; - + p = strchr(tbuf, '>') + 1; iov[0].iov_base = p; iov[0].iov_len = cnt - (p - tbuf); |