summaryrefslogtreecommitdiffstats
path: root/lib/libc/stdlib
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-01-12 09:23:48 +0000
committerjasone <jasone@FreeBSD.org>2000-01-12 09:23:48 +0000
commit75903038bc52105bc7479fe5f2b75f22f10c1c50 (patch)
treec9e28eda650bbd7eaa3eb22c8d7c75d00a96a451 /lib/libc/stdlib
parent688bb99b3f790aad607b949661d0361486bbe346 (diff)
downloadFreeBSD-src-75903038bc52105bc7479fe5f2b75f22f10c1c50.zip
FreeBSD-src-75903038bc52105bc7479fe5f2b75f22f10c1c50.tar.gz
Add three-tier symbol naming in support of POSIX thread cancellation
points. For library functions, the pattern is __sleep() <-- _libc_sleep() <-- sleep(). The arrows represent weak aliases. For system calls, the pattern is _read() <-- _libc_read() <-- read().
Diffstat (limited to 'lib/libc/stdlib')
-rw-r--r--lib/libc/stdlib/malloc.c19
-rw-r--r--lib/libc/stdlib/random.c6
-rw-r--r--lib/libc/stdlib/realpath.c8
-rw-r--r--lib/libc/stdlib/system.c10
4 files changed, 25 insertions, 18 deletions
diff --git a/lib/libc/stdlib/malloc.c b/lib/libc/stdlib/malloc.c
index 02d9364..bf41790 100644
--- a/lib/libc/stdlib/malloc.c
+++ b/lib/libc/stdlib/malloc.c
@@ -72,7 +72,7 @@
static int fdzero;
# define MMAP_FD fdzero
# define INIT_MMAP() \
- { if ((fdzero=open("/dev/zero", O_RDWR, 0000)) == -1) \
+ { if ((fdzero = _libc_open("/dev/zero", O_RDWR, 0000)) == -1) \
wrterror("open of /dev/zero"); }
# define MADV_FREE MADV_DONTNEED
#endif /* __sparc__ */
@@ -275,10 +275,10 @@ static void
wrterror(char *p)
{
char *q = " error: ";
- write(STDERR_FILENO, __progname, strlen(__progname));
- write(STDERR_FILENO, malloc_func, strlen(malloc_func));
- write(STDERR_FILENO, q, strlen(q));
- write(STDERR_FILENO, p, strlen(p));
+ _libc_write(STDERR_FILENO, __progname, strlen(__progname));
+ _libc_write(STDERR_FILENO, malloc_func, strlen(malloc_func));
+ _libc_write(STDERR_FILENO, q, strlen(q));
+ _libc_write(STDERR_FILENO, p, strlen(p));
suicide = 1;
abort();
}
@@ -289,13 +289,12 @@ wrtwarning(char *p)
char *q = " warning: ";
if (malloc_abort)
wrterror(p);
- write(STDERR_FILENO, __progname, strlen(__progname));
- write(STDERR_FILENO, malloc_func, strlen(malloc_func));
- write(STDERR_FILENO, q, strlen(q));
- write(STDERR_FILENO, p, strlen(p));
+ _libc_write(STDERR_FILENO, __progname, strlen(__progname));
+ _libc_write(STDERR_FILENO, malloc_func, strlen(malloc_func));
+ _libc_write(STDERR_FILENO, q, strlen(q));
+ _libc_write(STDERR_FILENO, p, strlen(p));
}
-
/*
* Allocate a number of pages from the OS
*/
diff --git a/lib/libc/stdlib/random.c b/lib/libc/stdlib/random.c
index 8be99b4..1729589 100644
--- a/lib/libc/stdlib/random.c
+++ b/lib/libc/stdlib/random.c
@@ -298,11 +298,11 @@ srandomdev()
len = rand_deg * sizeof state[0];
done = 0;
- fd = open("/dev/urandom", O_RDONLY, 0);
+ fd = _libc_open("/dev/urandom", O_RDONLY, 0);
if (fd >= 0) {
- if (read(fd, (void *) state, len) == (ssize_t) len)
+ if (_libc_read(fd, (void *) state, len) == (ssize_t) len)
done = 1;
- close(fd);
+ _libc_close(fd);
}
if (!done) {
diff --git a/lib/libc/stdlib/realpath.c b/lib/libc/stdlib/realpath.c
index 80ed43f..b956513 100644
--- a/lib/libc/stdlib/realpath.c
+++ b/lib/libc/stdlib/realpath.c
@@ -32,6 +32,8 @@
* 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.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -65,7 +67,7 @@ realpath(path, resolved)
int symlinks = 0;
/* Save the starting point. */
- if ((fd = open(".", O_RDONLY)) < 0) {
+ if ((fd = _libc_open(".", O_RDONLY)) < 0) {
(void)strcpy(resolved, ".");
return (NULL);
}
@@ -152,12 +154,12 @@ loop:
}
/* It's okay if the close fails, what's an fd more or less? */
- (void)close(fd);
+ (void)_libc_close(fd);
return (resolved);
err1: serrno = errno;
(void)fchdir(fd);
-err2: (void)close(fd);
+err2: (void)_libc_close(fd);
errno = serrno;
return (NULL);
}
diff --git a/lib/libc/stdlib/system.c b/lib/libc/stdlib/system.c
index 00db7d6..0039c078 100644
--- a/lib/libc/stdlib/system.c
+++ b/lib/libc/stdlib/system.c
@@ -29,6 +29,8 @@
* 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.
+ *
+ * $FreeBSD$
*/
#if defined(LIBC_SCCS) && !defined(lint)
@@ -44,7 +46,8 @@ static char sccsid[] = "@(#)system.c 8.1 (Berkeley) 6/4/93";
#include <paths.h>
#include <errno.h>
-int system(command)
+int
+__system(command)
const char *command;
{
pid_t pid;
@@ -81,7 +84,7 @@ int system(command)
_exit(127);
default: /* parent */
do {
- pid = waitpid(pid, &pstat, 0);
+ pid = _libc_waitpid(pid, &pstat, 0);
} while (pid == -1 && errno == EINTR);
break;
}
@@ -90,3 +93,6 @@ int system(command)
(void)sigprocmask(SIG_SETMASK, &oldsigblock, NULL);
return(pid == -1 ? -1 : pstat);
}
+
+__weak_reference(__system, _libc_system);
+__weak_reference(_libc_system, system);
OpenPOWER on IntegriCloud