diff options
author | Peter S. Mazinger <ps.m@gmx.net> | 2006-01-14 00:58:03 +0000 |
---|---|---|
committer | Peter S. Mazinger <ps.m@gmx.net> | 2006-01-14 00:58:03 +0000 |
commit | af0172162f7c653cad6a11ed1c1a5459bc154465 (patch) | |
tree | 70031dad1e7286d58762da7b9e3d3f93d043c278 /libc/unistd | |
parent | c8609543a9a8bf6559c2931dbbef6b3c41b3fbf2 (diff) |
hidden_def/hidden_proto: convert all users (I hope) termios split, add some missing headers, other jump relocs removed
Diffstat (limited to 'libc/unistd')
-rw-r--r-- | libc/unistd/confstr.c | 6 | ||||
-rw-r--r-- | libc/unistd/daemon.c | 100 | ||||
-rw-r--r-- | libc/unistd/exec.c | 50 | ||||
-rw-r--r-- | libc/unistd/fpathconf.c | 8 | ||||
-rw-r--r-- | libc/unistd/getlogin.c | 19 | ||||
-rw-r--r-- | libc/unistd/getopt-susv3.c | 2 | ||||
-rw-r--r-- | libc/unistd/getopt.c | 37 | ||||
-rw-r--r-- | libc/unistd/getpass.c | 26 | ||||
-rw-r--r-- | libc/unistd/getsubopt.c | 11 | ||||
-rw-r--r-- | libc/unistd/pathconf.c | 8 | ||||
-rw-r--r-- | libc/unistd/sleep.c | 26 | ||||
-rw-r--r-- | libc/unistd/sysconf.c | 11 | ||||
-rw-r--r-- | libc/unistd/ualarm.c | 8 | ||||
-rw-r--r-- | libc/unistd/usershell.c | 13 | ||||
-rw-r--r-- | libc/unistd/usleep.c | 8 |
15 files changed, 184 insertions, 149 deletions
diff --git a/libc/unistd/confstr.c b/libc/unistd/confstr.c index bfaecb198..8d1c8d303 100644 --- a/libc/unistd/confstr.c +++ b/libc/unistd/confstr.c @@ -21,6 +21,8 @@ #include <unistd.h> #include <string.h> +libc_hidden_proto(memcpy) + #define CS_PATH "/bin:/usr/bin" /* If BUF is not NULL and LEN > 0, fill in at most LEN - 1 bytes @@ -48,10 +50,10 @@ size_t confstr ( int name, char *buf, size_t len) if (len > 0 && buf != NULL) { if (string_len <= len) - __memcpy (buf, string, string_len); + memcpy (buf, string, string_len); else { - __memcpy (buf, string, len - 1); + memcpy (buf, string, len - 1); buf[len - 1] = '\0'; } } diff --git a/libc/unistd/daemon.c b/libc/unistd/daemon.c index 4c18e55fa..77e10dd76 100644 --- a/libc/unistd/daemon.c +++ b/libc/unistd/daemon.c @@ -1,32 +1,44 @@ /* vi: set sw=4 ts=4: */ /* daemon implementation for uClibc * - * Copyright (c) 1991, 1993 + * Copyright (c) 1990, 1993 * The Regents of the University of California. All rights reserved. * - * Modified for uClibc by Erik Andersen <andersee@debian.org> - * - * This program is free software; you can redistribute it and/or modify it - * under the terms of the GNU Library General Public License as published by - * the Free Software Foundation; either version 2 of the License, or (at your - * option) any later version. + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions + * are met: + * 1. Redistributions of source code must retain the above copyright + * notice, this list of conditions and the following disclaimer. + * 2. Redistributions in binary form must reproduce the above copyright + * notice, this list of conditions and the following disclaimer in the + * documentation and/or other materials provided with the distribution. * - * This program is distributed in the hope that it will be useful, but WITHOUT - * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or - * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Library General Public License - * for more details. + * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change + * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> * - * You should have received a copy of the GNU Library General Public License - * along with this program; if not, write to the Free Software Foundation, - * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * 4. Neither the name of the University nor the names of its contributors + * may be used to endorse or promote products derived from this software + * without specific prior written permission. * - * Original copyright notice is retained at the end of this file. + * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND + * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE + * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL + * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS + * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) + * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT + * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY + * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF + * SUCH DAMAGE. */ -#define dup2 __dup2 -#define setsid __setsid -#define chdir __chdir -#define fork __fork +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + * Modified for uClibc by Erik Andersen <andersee@debian.org> + */ #include <stdio.h> #include <features.h> @@ -35,6 +47,13 @@ #include <unistd.h> #if defined __ARCH_HAS_MMU__ +libc_hidden_proto(open) +libc_hidden_proto(close) +libc_hidden_proto(_exit) +libc_hidden_proto(dup2) +libc_hidden_proto(setsid) +libc_hidden_proto(chdir) +libc_hidden_proto(fork) int daemon( int nochdir, int noclose ) { @@ -46,7 +65,7 @@ int daemon( int nochdir, int noclose ) case 0: break; default: - _exit_internal(0); + _exit(0); } if (setsid() == -1) @@ -55,54 +74,19 @@ int daemon( int nochdir, int noclose ) /* Make certain we are not a session leader, or else we * might reacquire a controlling terminal */ if (fork()) - _exit_internal(0); + _exit(0); if (!nochdir) chdir("/"); - if (!noclose && (fd = __open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { + if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) { dup2(fd, STDIN_FILENO); dup2(fd, STDOUT_FILENO); dup2(fd, STDERR_FILENO); if (fd > 2) - __close(fd); + close(fd); } return(0); } #endif - -/*- - * Copyright (c) 1990, 1993 - * The Regents of the University of California. All rights reserved. - * - * Redistribution and use in source and binary forms, with or without - * modification, are permitted provided that the following conditions - * are met: - * 1. Redistributions of source code must retain the above copyright - * notice, this list of conditions and the following disclaimer. - * 2. Redistributions in binary form must reproduce the above copyright - * notice, this list of conditions and the following disclaimer in the - * documentation and/or other materials provided with the distribution. - * - * 3. <BSD Advertising Clause omitted per the July 22, 1999 licensing change - * ftp://ftp.cs.berkeley.edu/pub/4bsd/README.Impt.License.Change> - * - * 4. Neither the name of the University nor the names of its contributors - * may be used to endorse or promote products derived from this software - * without specific prior written permission. - * - * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND - * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE - * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE - * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE - * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL - * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS - * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) - * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT - * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY - * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF - * SUCH DAMAGE. - */ - - diff --git a/libc/unistd/exec.c b/libc/unistd/exec.c index e61ff1988..08ef742d3 100644 --- a/libc/unistd/exec.c +++ b/libc/unistd/exec.c @@ -30,10 +30,6 @@ * to free the storage allocated for the copy. Better ideas anyone? */ -#define mmap __mmap -#define munmap __munmap -#define execve __execve - #define _GNU_SOURCE #include <stdio.h> #include <stdlib.h> @@ -44,7 +40,17 @@ #include <unistd.h> #include <sys/mman.h> -extern char *__strchrnul(const char *s, int c); +libc_hidden_proto(execl) +libc_hidden_proto(execvp) + +libc_hidden_proto(memcpy) +libc_hidden_proto(strchr) +libc_hidden_proto(strlen) +libc_hidden_proto(strchrnul) +libc_hidden_proto(execve) +libc_hidden_proto(mmap) +libc_hidden_proto(munmap) +libc_hidden_proto(getenv) /**********************************************************************/ #if defined(__ARCH_HAS_MMU__) || defined(__UCLIBC_UCLINUX_BROKEN_MUNMAP__) @@ -68,12 +74,12 @@ extern char *__strchrnul(const char *s, int c); # define EXEC_ALLOC(SIZE,VAR) __exec_alloc((VAR = (SIZE))) # define EXEC_FREE(PTR,VAR) __exec_free((PTR),(VAR)) -extern void *__exec_alloc(size_t size); -extern void __exec_free(void *ptr, size_t size); +extern void *__exec_alloc(size_t size) attribute_hidden; +extern void __exec_free(void *ptr, size_t size) attribute_hidden; # ifdef L___exec_alloc -void *__exec_alloc(size_t size) +void attribute_hidden *__exec_alloc(size_t size) { void *p; @@ -82,7 +88,7 @@ void *__exec_alloc(size_t size) return (p != MAP_FAILED) ? p : NULL; } -void __exec_free(void *ptr, size_t size) +void attribute_hidden __exec_free(void *ptr, size_t size) { if (ptr) { munmap(ptr, size); @@ -95,7 +101,7 @@ void __exec_free(void *ptr, size_t size) /**********************************************************************/ #ifdef L_execl -int attribute_hidden __execl(const char *path, const char *arg, ...) +int execl(const char *path, const char *arg, ...) { EXEC_ALLOC_SIZE(size) /* Do NOT add a semicolon! */ int n; @@ -126,7 +132,7 @@ int attribute_hidden __execl(const char *path, const char *arg, ...) return n; } -strong_alias(__execl,execl) +libc_hidden_def(execl) #endif /**********************************************************************/ @@ -179,8 +185,6 @@ int execle(const char *path, const char *arg, ...) /**********************************************************************/ #ifdef L_execlp -extern int __execvp(const char *path, char *const argv[]) attribute_hidden; - int execlp(const char *file, const char *arg, ...) { EXEC_ALLOC_SIZE(size) /* Do NOT add a semicolon! */ @@ -206,7 +210,7 @@ int execlp(const char *file, const char *arg, ...) } while (--n); va_end(args); - n = __execvp(file, (char *const *) argv); + n = execvp(file, (char *const *) argv); EXEC_FREE(argv, size); @@ -222,7 +226,7 @@ int execlp(const char *file, const char *arg, ...) * /bin, and then /usr/bin. */ static const char default_path[] = ":/bin:/usr/bin"; -int attribute_hidden __execvp(const char *path, char *const argv[]) +int execvp(const char *path, char *const argv[]) { char *buf = NULL; char *p; @@ -239,7 +243,7 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) return -1; } - if (__strchr(path, '/')) { + if (strchr(path, '/')) { execve(path, argv, __environ); CHECK_ENOEXEC: if (errno == ENOEXEC) { @@ -252,12 +256,12 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) nargv = (char **) EXEC_ALLOC((n+2) * sizeof(char *), size2); nargv[0] = argv[0]; nargv[1] = (char *)path; - __memcpy(nargv+2, argv+1, n*sizeof(char *)); + memcpy(nargv+2, argv+1, n*sizeof(char *)); execve("/bin/sh", nargv, __environ); EXEC_FREE(nargv, size2); } } else { - if ((p = __getenv("PATH")) != NULL) { + if ((p = getenv("PATH")) != NULL) { if (!*p) { goto BAD; } @@ -265,7 +269,7 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) p = (char *) default_path; } - plen = __strlen(path); + plen = strlen(path); if (plen > (FILENAME_MAX - 1)) { ALL_TOO_LONG: __set_errno(ENAMETOOLONG); @@ -276,11 +280,11 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) if ((buf = EXEC_ALLOC(FILENAME_MAX, size)) != NULL) { int seen_small = 0; s0 = buf + len; - __memcpy(s0, path, plen+1); + memcpy(s0, path, plen+1); do { s = s0; - e = __strchrnul(p, ':'); + e = strchrnul(p, ':'); if (e > p) { plen = e - p; if (e[-1] != '/') { @@ -290,7 +294,7 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) goto NEXT; } s -= plen; - __memcpy(s, p, plen); + memcpy(s, p, plen); s[plen-1] = '/'; } @@ -319,7 +323,7 @@ int attribute_hidden __execvp(const char *path, char *const argv[]) return -1; } -strong_alias(__execvp,execvp) +libc_hidden_def(execvp) #endif /**********************************************************************/ diff --git a/libc/unistd/fpathconf.c b/libc/unistd/fpathconf.c index 5404e7b01..9cb66a927 100644 --- a/libc/unistd/fpathconf.c +++ b/libc/unistd/fpathconf.c @@ -32,6 +32,8 @@ //#include "linux_fsinfo.h" +libc_hidden_proto(fstat) +libc_hidden_proto(fstatfs) /* The Linux kernel headers mention this as a kind of generic value. */ #define LINUX_LINK_MAX 127 @@ -53,7 +55,7 @@ long int fpathconf(int fd, int name) struct statfs fsbuf; /* Determine the filesystem type. */ - if (__fstatfs (fd, &fsbuf) < 0) + if (fstatfs (fd, &fsbuf) < 0) { if (errno == ENOSYS) /* not possible, return the default value. */ @@ -127,7 +129,7 @@ long int fpathconf(int fd, int name) struct statfs buf; int save_errno = errno; - if (__fstatfs (fd, &buf) < 0) + if (fstatfs (fd, &buf) < 0) { if (errno == ENOSYS) { @@ -201,7 +203,7 @@ long int fpathconf(int fd, int name) /* AIO is only allowed on regular files and block devices. */ struct stat st; - if (__fstat (fd, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) + if (fstat (fd, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) return -1; else return 1; diff --git a/libc/unistd/getlogin.c b/libc/unistd/getlogin.c index 0747a49f6..f2ee1d355 100644 --- a/libc/unistd/getlogin.c +++ b/libc/unistd/getlogin.c @@ -23,35 +23,40 @@ #include <stdlib.h> #include <string.h> +libc_hidden_proto(strcpy) +libc_hidden_proto(strncpy) +libc_hidden_proto(getenv) + /* uClibc makes it policy to not mess with the utmp file whenever * possible, since I consider utmp a complete waste of time. Since * getlogin() should never be used for security purposes, we kindly let * the user specify whatever they want via the LOGNAME environment * variable, or we return NULL if getenv() fails to find anything */ -extern char attribute_hidden * __getlogin(void) +char * getlogin(void) { - return (__getenv("LOGNAME")); + return (getenv("LOGNAME")); } -strong_alias(__getlogin,getlogin) +libc_hidden_proto(getlogin) +libc_hidden_def(getlogin) int getlogin_r(char *name, size_t len) { - char * foo = __getenv("LOGNAME"); + char * foo = getenv("LOGNAME"); if (! foo) return -1; - __strncpy(name, foo, len); + strncpy(name, foo, len); name[len-1] = '\0'; return 0; } char *cuserid(char *s) { - char *name = __getlogin(); + char *name = getlogin(); if (s) { - return(__strcpy(s, name ? name : "")); + return(strcpy(s, name ? name : "")); } return name; } diff --git a/libc/unistd/getopt-susv3.c b/libc/unistd/getopt-susv3.c index d9ee18c43..a73cdbc0a 100644 --- a/libc/unistd/getopt-susv3.c +++ b/libc/unistd/getopt-susv3.c @@ -35,6 +35,8 @@ #include <string.h> #include <stdio.h> +libc_hidden_proto(fprintf) + #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Enable gettext awareness. #endif /* __UCLIBC_MJN3_ONLY__ */ diff --git a/libc/unistd/getopt.c b/libc/unistd/getopt.c index 2cf5dbb73..d9c458595 100644 --- a/libc/unistd/getopt.c +++ b/libc/unistd/getopt.c @@ -34,6 +34,13 @@ #include <libintl.h> #endif +libc_hidden_proto(strchr) +libc_hidden_proto(strcmp) +libc_hidden_proto(strlen) +libc_hidden_proto(strncmp) +libc_hidden_proto(getenv) +libc_hidden_proto(fprintf) + #ifdef __UCLIBC_MJN3_ONLY__ #warning TODO: Enable gettext awareness. #endif /* __UCLIBC_MJN3_ONLY__ */ @@ -149,7 +156,7 @@ static enum } ordering; # include <string.h> -# define my_index __strchr +# define my_index strchr /* Handle permutation of arguments. */ @@ -247,7 +254,7 @@ static const char *_getopt_initialize (attribute_unused int argc, attribute_unus ordering = REQUIRE_ORDER; ++optstring; } - else if (__getenv ("POSIXLY_CORRECT") != NULL) + else if (getenv ("POSIXLY_CORRECT") != NULL) ordering = REQUIRE_ORDER; else ordering = PERMUTE; @@ -371,7 +378,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * then exchange with previous non-options as if it were an option, then skip everything else like a non-option. */ - if (optind != argc && !__strcmp (argv[optind], "--")) + if (optind != argc && !strcmp (argv[optind], "--")) { optind++; @@ -447,10 +454,10 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!__strncmp (p->name, nextchar, nameend - nextchar)) + if (!strncmp (p->name, nextchar, nameend - nextchar)) { if ((unsigned int) (nameend - nextchar) - == (unsigned int) __strlen (p->name)) + == (unsigned int) strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -479,7 +486,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * fprintf (stderr, _("%s: option `%s' is ambiguous\n"), argv[0], argv[optind]); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); optind++; optopt = 0; return '?'; @@ -517,7 +524,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); optopt = pfound->val; return '?'; @@ -535,12 +542,12 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); optopt = pfound->val; return optstring[0] == ':' ? ':' : '?'; } } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) @@ -651,9 +658,9 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * /* Test all long options for either exact match or abbreviated matches. */ for (p = longopts, option_index = 0; p->name; p++, option_index++) - if (!__strncmp (p->name, nextchar, nameend - nextchar)) + if (!strncmp (p->name, nextchar, nameend - nextchar)) { - if ((unsigned int) (nameend - nextchar) == __strlen (p->name)) + if ((unsigned int) (nameend - nextchar) == strlen (p->name)) { /* Exact match found. */ pfound = p; @@ -678,7 +685,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * fprintf (stderr, _("%s: option `-W %s' is ambiguous\n"), argv[0], argv[optind]); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); optind++; return '?'; } @@ -700,7 +707,7 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * argv[0], pfound->name); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); return '?'; } } @@ -716,11 +723,11 @@ int attribute_hidden _getopt_internal (int argc, char *const *argv, const char * _("%s: option `%s' requires an argument\n"), argv[0], argv[optind - 1]); } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); return optstring[0] == ':' ? ':' : '?'; } } - nextchar += __strlen (nextchar); + nextchar += strlen (nextchar); if (longind != NULL) *longind = option_index; if (pfound->flag) diff --git a/libc/unistd/getpass.c b/libc/unistd/getpass.c index 834fba9d9..5833bc317 100644 --- a/libc/unistd/getpass.c +++ b/libc/unistd/getpass.c @@ -16,21 +16,25 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define setvbuf __setvbuf -#define tcsetattr __tcsetattr -#define tcgetattr __tcgetattr -#define fileno __fileno -#define fflush __fflush -#define fgets __fgets -#define fputs __fputs - #include <stdio.h> #include <string.h> #include <termios.h> #include <unistd.h> #include <string.h> -extern int __putc(int c, FILE *stream) attribute_hidden; +libc_hidden_proto(strlen) +libc_hidden_proto(tcsetattr) +libc_hidden_proto(tcgetattr) +libc_hidden_proto(setvbuf) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(fileno) +libc_hidden_proto(fflush) +libc_hidden_proto(fgets) +libc_hidden_proto(fputs) +libc_hidden_proto(fputc) +libc_hidden_proto(putc) +libc_hidden_proto(__fputc_unlocked) /* It is desirable to use this bit on systems that have it. The only bit of terminal state we want to twiddle is echoing, which is @@ -90,7 +94,7 @@ getpass (prompt) fgets (buf, PWD_BUFFER_SIZE-1, in); if (buf != NULL) { - nread = __strlen(buf); + nread = strlen(buf); if (nread < 0) buf[0] = '\0'; else if (buf[nread - 1] == '\n') @@ -99,7 +103,7 @@ getpass (prompt) buf[nread - 1] = '\0'; if (tty_changed) /* Write the newline that was not echoed. */ - __putc('\n', out); + putc('\n', out); } } diff --git a/libc/unistd/getsubopt.c b/libc/unistd/getsubopt.c index bebfbc4ed..c6c078f6f 100644 --- a/libc/unistd/getsubopt.c +++ b/libc/unistd/getsubopt.c @@ -18,12 +18,13 @@ Software Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. */ -#define memchr __memchr - +#define _GNU_SOURCE #include <stdlib.h> #include <string.h> -extern char *__strchrnul(const char *s, int c); +libc_hidden_proto(memchr) +libc_hidden_proto(memcmp) +libc_hidden_proto(strchrnul) /* Parse comma separated suboption from *OPTIONP and match against strings in TOKENS. If found return index and set *VALUEP to @@ -40,7 +41,7 @@ int getsubopt(char **optionp, char *const *tokens, char **valuep) return -1; /* Find end of next token. */ - endp = __strchrnul (*optionp, ','); + endp = strchrnul (*optionp, ','); /* Find start of value. */ vstart = memchr (*optionp, '=', endp - *optionp); @@ -50,7 +51,7 @@ int getsubopt(char **optionp, char *const *tokens, char **valuep) /* Try to match the characters between *OPTIONP and VSTART against one of the TOKENS. */ for (cnt = 0; tokens[cnt] != NULL; ++cnt) - if (__memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0 + if (memcmp (*optionp, tokens[cnt], vstart - *optionp) == 0 && tokens[cnt][vstart - *optionp] == '\0') { /* We found the current option in TOKENS. */ diff --git a/libc/unistd/pathconf.c b/libc/unistd/pathconf.c index 579b99be0..f41cf69ba 100644 --- a/libc/unistd/pathconf.c +++ b/libc/unistd/pathconf.c @@ -36,6 +36,8 @@ //#include "linux_fsinfo.h" +libc_hidden_proto(statfs) +libc_hidden_proto(stat) /* The Linux kernel headers mention this as a kind of generic value. */ #define LINUX_LINK_MAX 127 @@ -57,7 +59,7 @@ long int pathconf(const char *path, int name) struct statfs fsbuf; /* Determine the filesystem type. */ - if (__statfs (path, &fsbuf) < 0) + if (statfs (path, &fsbuf) < 0) { if (errno == ENOSYS) /* not possible, return the default value. */ @@ -131,7 +133,7 @@ long int pathconf(const char *path, int name) struct statfs buf; int save_errno = errno; - if (__statfs (path, &buf) < 0) + if (statfs (path, &buf) < 0) { if (errno == ENOSYS) { @@ -205,7 +207,7 @@ long int pathconf(const char *path, int name) /* AIO is only allowed on regular files and block devices. */ struct stat st; - if (__stat (path, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) + if (stat (path, &st) < 0 || (! S_ISREG (st.st_mode) && ! S_ISBLK (st.st_mode))) return -1; else return 1; diff --git a/libc/unistd/sleep.c b/libc/unistd/sleep.c index 3d3d516ab..92944af18 100644 --- a/libc/unistd/sleep.c +++ b/libc/unistd/sleep.c @@ -18,19 +18,25 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define sigaction __sigaction -#define nanosleep __nanosleep - #include <errno.h> #include <time.h> #include <signal.h> #include <unistd.h> +libc_hidden_proto(sleep) + +libc_hidden_proto(sigaction) +libc_hidden_proto(sigprocmask) +//libc_hidden_proto(__sigaddset) +//libc_hidden_proto(__sigemptyset) +//libc_hidden_proto(__sigismember) +libc_hidden_proto(nanosleep) + #if 0 /* This is a quick and dirty, but not 100% compliant with * the stupid SysV SIGCHLD vs. SIG_IGN behaviour. It is * fine unless you are messing with SIGCHLD... */ -unsigned int attribute_hidden __sleep (unsigned int sec) +unsigned int sleep (unsigned int sec) { unsigned int res; struct timespec ts = { .tv_sec = (long int) seconds, .tv_nsec = 0 }; @@ -44,7 +50,7 @@ unsigned int attribute_hidden __sleep (unsigned int sec) /* We are going to use the `nanosleep' syscall of the kernel. But the kernel does not implement the sstupid SysV SIGCHLD vs. SIG_IGN behaviour for this syscall. Therefore we have to emulate it here. */ -unsigned int attribute_hidden __sleep (unsigned int seconds) +unsigned int sleep (unsigned int seconds) { struct timespec ts = { .tv_sec = (long int) seconds, .tv_nsec = 0 }; sigset_t set, oset; @@ -59,7 +65,7 @@ unsigned int attribute_hidden __sleep (unsigned int seconds) in libc. We block SIGCHLD first. */ if (__sigemptyset (&set) < 0 || __sigaddset (&set, SIGCHLD) < 0 - || __sigprocmask (SIG_BLOCK, &set, &oset)) + || sigprocmask (SIG_BLOCK, &set, &oset)) return -1; /* If SIGCHLD is already blocked, we don't have to do anything. */ @@ -76,7 +82,7 @@ unsigned int attribute_hidden __sleep (unsigned int seconds) { saved_errno = errno; /* Restore the original signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); __set_errno (saved_errno); return -1; } @@ -88,13 +94,13 @@ unsigned int attribute_hidden __sleep (unsigned int seconds) saved_errno = errno; /* Restore the original signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); __set_errno (saved_errno); } else { /* We should unblock SIGCHLD. Restore the original signal mask. */ - (void) __sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); + (void) sigprocmask (SIG_SETMASK, &oset, (sigset_t *) NULL); result = nanosleep (&ts, &ts); } } @@ -108,4 +114,4 @@ unsigned int attribute_hidden __sleep (unsigned int seconds) return result; } #endif -strong_alias(__sleep,sleep) +libc_hidden_def(sleep) diff --git a/libc/unistd/sysconf.c b/libc/unistd/sysconf.c index c80a9e94e..6f362819c 100644 --- a/libc/unistd/sysconf.c +++ b/libc/unistd/sysconf.c @@ -16,9 +16,6 @@ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. */ -#define getpagesize __getpagesize_internal -#define getdtablesize __getdtablesize - #define _XOPEN_SOURCE 500 #include <features.h> #include <errno.h> @@ -36,6 +33,9 @@ #include <regex.h> #endif +libc_hidden_proto(getpagesize) +libc_hidden_proto(getdtablesize) + #ifndef __UCLIBC_CLK_TCK_CONST #error __UCLIBC_CLK_TCK_CONST not defined! #endif @@ -71,7 +71,7 @@ #endif /* _UCLIBC_GENERATE_SYSCONF_ARCH */ /* Get the value of the system variable NAME. */ -long int attribute_hidden __sysconf(int name) +long int sysconf(int name) { switch (name) { @@ -883,4 +883,5 @@ long int attribute_hidden __sysconf(int name) #endif } } -strong_alias(__sysconf,sysconf) +libc_hidden_proto(sysconf) +libc_hidden_def(sysconf) diff --git a/libc/unistd/ualarm.c b/libc/unistd/ualarm.c index 3bcb8e463..ef023e8f3 100644 --- a/libc/unistd/ualarm.c +++ b/libc/unistd/ualarm.c @@ -1,4 +1,8 @@ -#define setitimer __setitimer +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #define _GNU_SOURCE #include <time.h> @@ -6,6 +10,8 @@ #include <sys/types.h> #include <unistd.h> +libc_hidden_proto(setitimer) + useconds_t ualarm(useconds_t value, useconds_t interval) { struct itimerval otimer; diff --git a/libc/unistd/usershell.c b/libc/unistd/usershell.c index bc29cf247..51330ae78 100644 --- a/libc/unistd/usershell.c +++ b/libc/unistd/usershell.c @@ -30,10 +30,6 @@ * November 2002, Erik Andersen <andersen@codepoet.org> */ -#define __fsetlocking __fsetlocking_internal -#define fileno __fileno -#define fgets_unlocked __fgets_unlocked - #define _GNU_SOURCE #include <sys/param.h> #include <sys/file.h> @@ -45,6 +41,13 @@ #include <unistd.h> #include <paths.h> +libc_hidden_proto(fstat) +libc_hidden_proto(fopen) +libc_hidden_proto(fclose) +libc_hidden_proto(__fsetlocking) +libc_hidden_proto(fileno) +libc_hidden_proto(fgets_unlocked) + /* * Local shells should NOT be added here. They should be added in * /etc/shells. @@ -104,7 +107,7 @@ static char ** initshells(void) if ((fp = fopen(_PATH_SHELLS, "r")) == NULL) return (char **) validsh; - if (__fstat(fileno(fp), &statb) == -1) { + if (fstat(fileno(fp), &statb) == -1) { goto cleanup; } if ((strings = malloc((unsigned)statb.st_size + 1)) == NULL) { diff --git a/libc/unistd/usleep.c b/libc/unistd/usleep.c index db8b8710c..09bb09f41 100644 --- a/libc/unistd/usleep.c +++ b/libc/unistd/usleep.c @@ -1,10 +1,16 @@ -#define nanosleep __nanosleep +/* + * Copyright (C) 2000-2006 Erik Andersen <andersen@uclibc.org> + * + * Licensed under the LGPL v2.1, see the file COPYING.LIB in this tarball. + */ #include <time.h> #include <sys/time.h> #include <sys/types.h> #include <unistd.h> +libc_hidden_proto(nanosleep) + int usleep (__useconds_t usec) { const struct timespec ts = { |