summaryrefslogtreecommitdiff
path: root/libc/misc
diff options
context:
space:
mode:
authorPeter S. Mazinger <ps.m@gmx.net>2005-12-03 00:34:49 +0000
committerPeter S. Mazinger <ps.m@gmx.net>2005-12-03 00:34:49 +0000
commitc885bf5cf94a12202f849477a845d728cbd12889 (patch)
tree106e36d57ea684166ebde05a8d4be54664e0e6ce /libc/misc
parentca3067b8cec6e7ffd600c92510197df5aedd8606 (diff)
More hiding, including __mempcpy
Diffstat (limited to 'libc/misc')
-rw-r--r--libc/misc/file/lockf.c2
-rw-r--r--libc/misc/file/lockf64.c2
-rw-r--r--libc/misc/ftw/ftw.c2
-rw-r--r--libc/misc/internals/tempname.c2
-rw-r--r--libc/misc/locale/locale.c3
-rw-r--r--libc/misc/regex/regex.c4
-rw-r--r--libc/misc/search/hsearch.c4
-rw-r--r--libc/misc/search/hsearch_r.c12
-rw-r--r--libc/misc/search/tsearch.c3
-rw-r--r--libc/misc/syslog/syslog.c42
-rw-r--r--libc/misc/sysvipc/shm.c4
-rw-r--r--libc/misc/time/adjtime.c3
-rw-r--r--libc/misc/time/time.c27
-rw-r--r--libc/misc/utmp/wtent.c2
-rw-r--r--libc/misc/wordexp/wordexp.c11
15 files changed, 78 insertions, 45 deletions
diff --git a/libc/misc/file/lockf.c b/libc/misc/file/lockf.c
index 0962031da..29c91482a 100644
--- a/libc/misc/file/lockf.c
+++ b/libc/misc/file/lockf.c
@@ -43,7 +43,7 @@ int lockf (int fd, int cmd, off_t len)
fl.l_type = F_RDLCK;
if (fcntl (fd, F_GETLK, &fl) < 0)
return -1;
- if (fl.l_type == F_UNLCK || fl.l_pid == getpid ())
+ if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ())
return 0;
__set_errno(EACCES);
return -1;
diff --git a/libc/misc/file/lockf64.c b/libc/misc/file/lockf64.c
index eb70e8ddd..63c2ddfbe 100644
--- a/libc/misc/file/lockf64.c
+++ b/libc/misc/file/lockf64.c
@@ -77,7 +77,7 @@ int lockf64 (int fd, int cmd, off64_t len64)
fl.l_type = F_RDLCK;
if (fcntl (fd, F_GETLK, &fl) < 0)
return -1;
- if (fl.l_type == F_UNLCK || fl.l_pid == getpid ())
+ if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ())
return 0;
__set_errno(EACCES);
return -1;
diff --git a/libc/misc/ftw/ftw.c b/libc/misc/ftw/ftw.c
index c36ae45b6..58a9c3177 100644
--- a/libc/misc/ftw/ftw.c
+++ b/libc/misc/ftw/ftw.c
@@ -22,7 +22,9 @@
#define strlen __strlen
#define mempcpy __mempcpy
+#define stpcpy __stpcpy
#define tsearch __tsearch
+#define tdestroy __tdestroy
#define _GNU_SOURCE
#include <features.h>
diff --git a/libc/misc/internals/tempname.c b/libc/misc/internals/tempname.c
index 360c76879..99a8ac0d8 100644
--- a/libc/misc/internals/tempname.c
+++ b/libc/misc/internals/tempname.c
@@ -146,7 +146,7 @@ static void brain_damaged_fillrand(unsigned char *buf, unsigned int len)
uint32_t high, low, rh;
static uint64_t value;
gettimeofday(&tv, NULL);
- value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ getpid();
+ value += ((uint64_t) tv.tv_usec << 16) ^ tv.tv_sec ^ __getpid();
low = value & UINT32_MAX;
high = value >> 32;
for (i = 0; i < len; ++i) {
diff --git a/libc/misc/locale/locale.c b/libc/misc/locale/locale.c
index 77d3f1e5d..b73ffa3dd 100644
--- a/libc/misc/locale/locale.c
+++ b/libc/misc/locale/locale.c
@@ -46,6 +46,7 @@
* locale support had (8-bit codesets only).
*/
+#define stpcpy __stpcpy
#define strtok_r __strtok_r
#define _GNU_SOURCE
@@ -1241,7 +1242,7 @@ __locale_t __newlocale(int category_mask, const char *locale, __locale_t base)
j = 0;
do {
p = envstr[j];
- } while ((++j < 4) && (!(p = getenv(p)) || !*p));
+ } while ((++j < 4) && (!(p = __getenv(p)) || !*p));
/* The user set something... is it valid? */
diff --git a/libc/misc/regex/regex.c b/libc/misc/regex/regex.c
index d367211c5..bf8958a66 100644
--- a/libc/misc/regex/regex.c
+++ b/libc/misc/regex/regex.c
@@ -53,6 +53,10 @@ extern int __iswctype (wint_t __wc, wctype_t __desc) /*attribute_hidden*/;
#define strcmp __strcmp
#define strlen __strlen
#define strncpy __strncpy
+#define getenv __getenv
+
+extern void *__mempcpy (void *__restrict __dest,
+ __const void *__restrict __src, size_t __n) /*attribute_hidden*/;
#endif
/* Make sure noone compiles this code with a C++ compiler. */
diff --git a/libc/misc/search/hsearch.c b/libc/misc/search/hsearch.c
index 067e4973b..a9400f3ca 100644
--- a/libc/misc/search/hsearch.c
+++ b/libc/misc/search/hsearch.c
@@ -17,6 +17,10 @@
Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA
02111-1307 USA. */
+#define hdestroy_r __hdestroy_r
+#define hsearch_r __hsearch_r
+#define hcreate_r __hcreate_r
+
#ifndef _GNU_SOURCE
#define _GNU_SOURCE
#endif
diff --git a/libc/misc/search/hsearch_r.c b/libc/misc/search/hsearch_r.c
index 0f96180b1..d297b3280 100644
--- a/libc/misc/search/hsearch_r.c
+++ b/libc/misc/search/hsearch_r.c
@@ -67,7 +67,7 @@ static int isprime (unsigned int number)
indexing as explained in the comment for the hsearch function.
The contents of the table is zeroed, especially the field used
becomes zero. */
-int hcreate_r (size_t nel, struct hsearch_data *htab)
+int attribute_hidden __hcreate_r (size_t nel, struct hsearch_data *htab)
{
/* Test for correct arguments. */
if (htab == NULL)
@@ -96,13 +96,13 @@ int hcreate_r (size_t nel, struct hsearch_data *htab)
/* everything went alright */
return 1;
}
-/* libc_hidden_def (hcreate_r) */
+strong_alias(__hcreate_r,hcreate_r)
#endif
#ifdef L_hdestroy_r
/* After using the hash table it has to be destroyed. The used memory can
be freed and the local static variable can be marked as not used. */
-void hdestroy_r (struct hsearch_data *htab)
+void attribute_hidden __hdestroy_r (struct hsearch_data *htab)
{
/* Test for correct arguments. */
if (htab == NULL)
@@ -118,7 +118,7 @@ void hdestroy_r (struct hsearch_data *htab)
/* the sign for an existing table is an value != NULL in htable */
htab->table = NULL;
}
-/* libc_hidden_def (hdestroy_r) */
+strong_alias(__hdestroy_r,hdestroy_r)
#endif
#ifdef L_hsearch_r
@@ -135,7 +135,7 @@ void hdestroy_r (struct hsearch_data *htab)
means used. The used field can be used as a first fast comparison for
equality of the stored and the parameter value. This helps to prevent
unnecessary expensive calls of strcmp. */
-int hsearch_r (ENTRY item, ACTION action, ENTRY **retval,
+int attribute_hidden __hsearch_r (ENTRY item, ACTION action, ENTRY **retval,
struct hsearch_data *htab)
{
unsigned int hval;
@@ -224,5 +224,5 @@ int hsearch_r (ENTRY item, ACTION action, ENTRY **retval,
*retval = NULL;
return 0;
}
-/* libc_hidden_def (hsearch_r) */
+strong_alias(__hsearch_r,hsearch_r)
#endif
diff --git a/libc/misc/search/tsearch.c b/libc/misc/search/tsearch.c
index 1da6b571e..93a2c678f 100644
--- a/libc/misc/search/tsearch.c
+++ b/libc/misc/search/tsearch.c
@@ -205,13 +205,14 @@ tdestroy_recurse (node *root, __free_fn_t freefct)
free (root);
}
-void tdestroy (void *vroot, __free_fn_t freefct)
+void attribute_hidden __tdestroy (void *vroot, __free_fn_t freefct)
{
node *root = (node *) vroot;
if (root != NULL) {
tdestroy_recurse (root, freefct);
}
}
+strong_alias(__tdestroy,tdestroy)
#endif
/* tsearch.c ends here */
diff --git a/libc/misc/syslog/syslog.c b/libc/misc/syslog/syslog.c
index 69ff0b38b..e05297770 100644
--- a/libc/misc/syslog/syslog.c
+++ b/libc/misc/syslog/syslog.c
@@ -31,6 +31,10 @@
* SUCH DAMAGE.
*/
+#define time __time
+#define ctime __ctime
+#define sigaction __sigaction_internal
+
#define __FORCE_GLIBC
#define _GNU_SOURCE
#include <features.h>
@@ -136,18 +140,8 @@ sigpipe_handler (int sig)
* syslog, vsyslog --
* print message on log file; output is intended for syslogd(8).
*/
-void
-syslog(int pri, const char *fmt, ...)
-{
- va_list ap;
-
- va_start(ap, fmt);
- vsyslog(pri, fmt, ap);
- va_end(ap);
-}
-
-void
-vsyslog( int pri, const char *fmt, va_list ap )
+void attribute_hidden
+__vsyslog( int pri, const char *fmt, va_list ap )
{
register char *p;
char *last_chr, *head_end, *end, *stdp;
@@ -190,7 +184,7 @@ vsyslog( int pri, const char *fmt, va_list ap )
p += sprintf(p, "<BUFFER OVERRUN ATTEMPT>");
}
if (LogStat & LOG_PID)
- p += sprintf(p, "[%d]", getpid());
+ p += sprintf(p, "[%d]", __getpid());
if (LogTag) {
*p++ = ':';
*p++ = ' ';
@@ -267,12 +261,24 @@ getout:
sigaction (SIGPIPE, &oldaction,
(struct sigaction *) NULL);
}
+strong_alias(__vsyslog,vsyslog)
+
+void attribute_hidden
+__syslog(int pri, const char *fmt, ...)
+{
+ va_list ap;
+
+ va_start(ap, fmt);
+ __vsyslog(pri, fmt, ap);
+ va_end(ap);
+}
+strong_alias(__syslog,syslog)
/*
* OPENLOG -- open system log
*/
-void
-openlog( const char *ident, int logstat, int logfac )
+void attribute_hidden
+__openlog( const char *ident, int logstat, int logfac )
{
int logType = SOCK_DGRAM;
@@ -319,15 +325,17 @@ retry:
UNLOCK;
}
+strong_alias(__openlog,openlog)
/*
* CLOSELOG -- close the system log
*/
-void
-closelog( void )
+void attribute_hidden
+__closelog( void )
{
closelog_intern(1);
}
+strong_alias(__closelog,closelog)
/* setlogmask -- set the log mask level */
int setlogmask(int pmask)
diff --git a/libc/misc/sysvipc/shm.c b/libc/misc/sysvipc/shm.c
index 9c6f019bf..20e28d3b1 100644
--- a/libc/misc/sysvipc/shm.c
+++ b/libc/misc/sysvipc/shm.c
@@ -17,8 +17,8 @@
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-/* SHMLBA is using it */
-#define __getpagesize __libc_getpagesize
+/* SHMLBA uses it */
+#define __getpagesize __getpagesize_internal
#include <stdlib.h>
#include <errno.h>
diff --git a/libc/misc/time/adjtime.c b/libc/misc/time/adjtime.c
index 2049bc896..fd33ff60d 100644
--- a/libc/misc/time/adjtime.c
+++ b/libc/misc/time/adjtime.c
@@ -1,3 +1,5 @@
+#define adjtimex __adjtimex
+
#include <limits.h>
#include <sys/time.h>
#include <sys/timex.h>
@@ -49,4 +51,3 @@ adjtime(const struct timeval * itv, struct timeval * otv)
}
return 0;
}
-
diff --git a/libc/misc/time/time.c b/libc/misc/time/time.c
index 4d3c43492..3c47cb879 100644
--- a/libc/misc/time/time.c
+++ b/libc/misc/time/time.c
@@ -184,6 +184,11 @@
extern struct tm __time_tm;
+extern struct tm *__localtime_r (__const time_t *__restrict __timer,
+ struct tm *__restrict __tp) attribute_hidden;
+
+extern struct tm *__localtime (__const time_t *__timer) attribute_hidden;
+
typedef struct {
long gmt_offset;
long dst_offset;
@@ -386,6 +391,8 @@ strong_alias(__asctime_r,asctime_r)
/**********************************************************************/
#ifdef L_clock
+#define times __times
+
#include <sys/times.h>
#ifndef __BCC__
@@ -452,12 +459,12 @@ clock_t clock(void)
/**********************************************************************/
#ifdef L_ctime
-char *ctime(const time_t *clock)
+char attribute_hidden *__ctime(const time_t *clock)
{
/* ANSI/ISO/SUSv3 say that ctime is equivalent to the following. */
- return __asctime(localtime(clock));
+ return __asctime(__localtime(clock));
}
-
+strong_alias(__ctime,ctime)
#endif
/**********************************************************************/
#ifdef L_ctime_r
@@ -466,7 +473,7 @@ char *ctime_r(const time_t *clock, char *buf)
{
struct tm xtm;
- return __asctime_r(localtime_r(clock, &xtm), buf);
+ return __asctime_r(__localtime_r(clock, &xtm), buf);
}
#endif
@@ -534,22 +541,23 @@ struct tm *gmtime_r(const time_t *__restrict timer,
/**********************************************************************/
#ifdef L_localtime
-struct tm *localtime(const time_t *timer)
+struct tm attribute_hidden *__localtime(const time_t *timer)
{
register struct tm *ptm = &__time_tm;
/* In this implementation, tzset() is called by localtime_r(). */
- localtime_r(timer, ptm); /* Can return NULL... */
+ __localtime_r(timer, ptm); /* Can return NULL... */
return ptm;
}
+strong_alias(__localtime,localtime)
#endif
/**********************************************************************/
#ifdef L_localtime_r
-struct tm *localtime_r(register const time_t *__restrict timer,
+struct tm attribute_hidden *__localtime_r(register const time_t *__restrict timer,
register struct tm *__restrict result)
{
TZLOCK;
@@ -562,6 +570,7 @@ struct tm *localtime_r(register const time_t *__restrict timer,
return result;
}
+strong_alias(__localtime_r,localtime_r)
#endif
/**********************************************************************/
@@ -1542,7 +1551,7 @@ char *__XL(strptime)(const char *__restrict buf, const char *__restrict format,
buf = o;
if (!code) { /* s */
- localtime_r(&t, tm); /* TODO: check for failure? */
+ __localtime_r(&t, tm); /* TODO: check for failure? */
i = 0;
do { /* Now copy values from tm to fields. */
fields[i] = ((int *) tm)[i];
@@ -1806,7 +1815,7 @@ void tzset(void)
TZLOCK;
- e = getenv(TZ); /* TZ env var always takes precedence. */
+ e = __getenv(TZ); /* TZ env var always takes precedence. */
#if defined(__UCLIBC_HAS_TZ_FILE__) && !defined(__UCLIBC_HAS_TZ_FILE_READ_MANY__)
/* Put this inside the lock to prevent the possiblity of two different
diff --git a/libc/misc/utmp/wtent.c b/libc/misc/utmp/wtent.c
index bb5244878..0900ef379 100644
--- a/libc/misc/utmp/wtent.c
+++ b/libc/misc/utmp/wtent.c
@@ -34,7 +34,7 @@ void logwtmp (const char *line, const char *name, const char *host)
__memset (&(lutmp), 0, sizeof (struct utmp));
lutmp.ut_type = (name && *name)? USER_PROCESS : DEAD_PROCESS;
- lutmp.ut_pid = getpid();
+ lutmp.ut_pid = __getpid();
__strncpy(lutmp.ut_line, line, sizeof(lutmp.ut_line)-1);
__strncpy(lutmp.ut_name, name, sizeof(lutmp.ut_name)-1);
__strncpy(lutmp.ut_host, host, sizeof(lutmp.ut_host)-1);
diff --git a/libc/misc/wordexp/wordexp.c b/libc/misc/wordexp/wordexp.c
index 5e9133c83..ea69bc684 100644
--- a/libc/misc/wordexp/wordexp.c
+++ b/libc/misc/wordexp/wordexp.c
@@ -20,9 +20,12 @@
Boston, MA 02111-1307, USA. */
#define mempcpy __mempcpy
+#define stpcpy __stpcpy
#define strndup __strndup
#define strspn __strspn
#define unsetenv __unsetenv
+#define waitpid __waitpid
+#define kill __kill
#define _GNU_SOURCE
#include <sys/cdefs.h>
@@ -283,7 +286,7 @@ parse_tilde(char **word, size_t * word_length, size_t * max_length,
results are unspecified. We do a lookup on the uid if
HOME is unset. */
- home = getenv("HOME");
+ home = __getenv("HOME");
if (home != NULL) {
*word = w_addstr(*word, word_length, max_length, home);
if (*word == NULL)
@@ -1328,7 +1331,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
/* Is it `$$'? */
if (*env == '$') {
buffer[20] = '\0';
- value = _itoa(getpid(), &buffer[20]);
+ value = _itoa(__getpid(), &buffer[20]);
}
/* Is it `${#*}' or `${#@}'? */
else if ((*env == '*' || *env == '@') && seen_hash) {
@@ -1395,7 +1398,7 @@ parse_param(char **word, size_t * word_length, size_t * max_length,
}
}
} else
- value = getenv(env);
+ value = __getenv(env);
if (value == NULL && (flags & WRDE_UNDEF)) {
/* Variable not defined. */
@@ -2067,7 +2070,7 @@ int wordexp(const char *words, wordexp_t * we, int flags)
/* Find out what the field separators are.
* There are two types: whitespace and non-whitespace.
*/
- ifs = getenv("IFS");
+ ifs = __getenv("IFS");
if (!ifs)
/* IFS unset - use <space><tab><newline>. */