summaryrefslogtreecommitdiffstats
path: root/lib/libc/compat-43
diff options
context:
space:
mode:
authordeischen <deischen@FreeBSD.org>2001-01-24 13:01:12 +0000
committerdeischen <deischen@FreeBSD.org>2001-01-24 13:01:12 +0000
commit1635c221b7b2678beeeb2b5fa728edd7c8c3735b (patch)
treed7d4f61b9e319a781a335702fe846592726c22b9 /lib/libc/compat-43
parent08685e9e9fd9de1e8dc51cada55659344adaf0cc (diff)
downloadFreeBSD-src-1635c221b7b2678beeeb2b5fa728edd7c8c3735b.zip
FreeBSD-src-1635c221b7b2678beeeb2b5fa728edd7c8c3735b.tar.gz
Remove _THREAD_SAFE and make libc thread-safe by default by
adding (weak definitions to) stubs for some of the pthread functions. If the threads library is linked in, the real pthread functions will pulled in. Use the following convention for system calls wrapped by the threads library: __sys_foo - actual system call _foo - weak definition to __sys_foo foo - weak definition to __sys_foo Change all libc uses of system calls wrapped by the threads library from foo to _foo. In order to define the prototypes for _foo(), we introduce namespace.h and un-namespace.h (suggested by bde). All files that need to reference these system calls, should include namespace.h before any standard includes, then include un-namespace.h after the standard includes and before any local includes. <db.h> is an exception and shouldn't be included in between namespace.h and un-namespace.h namespace.h will define foo to _foo, and un-namespace.h will undefine foo. Try to eliminate some of the recursive calls to MT-safe functions in libc/stdio in preparation for adding a mutex to FILE. We have recursive mutexes, but would like to avoid using them if possible. Remove uneeded includes of <errno.h> from a few files. Add $FreeBSD$ to a few files in order to pass commitprep. Approved by: -arch
Diffstat (limited to 'lib/libc/compat-43')
-rw-r--r--lib/libc/compat-43/creat.c12
-rw-r--r--lib/libc/compat-43/sigcompat.c9
2 files changed, 9 insertions, 12 deletions
diff --git a/lib/libc/compat-43/creat.c b/lib/libc/compat-43/creat.c
index 42759e7..88a3c5f 100644
--- a/lib/libc/compat-43/creat.c
+++ b/lib/libc/compat-43/creat.c
@@ -37,20 +37,14 @@
static char sccsid[] = "@(#)creat.c 8.1 (Berkeley) 6/2/93";
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
#include <fcntl.h>
+#include "un-namespace.h"
int
-#if __STDC__
__creat(const char *path, mode_t mode)
-#else
-__creat(path, mode)
- char *path;
- mode_t mode;
-#endif
{
return(_open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
}
-
-#ifndef _THREAD_SAFE
__weak_reference(__creat, creat);
-#endif
+__weak_reference(__creat, _creat);
diff --git a/lib/libc/compat-43/sigcompat.c b/lib/libc/compat-43/sigcompat.c
index 9401e73..23f1eff 100644
--- a/lib/libc/compat-43/sigcompat.c
+++ b/lib/libc/compat-43/sigcompat.c
@@ -41,8 +41,11 @@ static const char rcsid[] =
"$FreeBSD$";
#endif /* LIBC_SCCS and not lint */
+#include "namespace.h"
#include <sys/param.h>
#include <signal.h>
+#include "un-namespace.h"
+#include "libc_private.h"
int
sigvec(signo, sv, osv)
@@ -62,7 +65,7 @@ sigvec(signo, sv, osv)
} else
sap = NULL;
osap = osv != NULL ? &osa : NULL;
- ret = sigaction(signo, sap, osap);
+ ret = _sigaction(signo, sap, osap);
if (ret == 0 && osv != NULL) {
osv->sv_handler = osa.sa_handler;
osv->sv_flags = osa.sa_flags ^ SV_INTERRUPT;
@@ -80,7 +83,7 @@ sigsetmask(mask)
sigemptyset(&set);
set.__bits[0] = mask;
- n = sigprocmask(SIG_SETMASK, &set, &oset);
+ n = _sigprocmask(SIG_SETMASK, &set, &oset);
if (n)
return (n);
return (oset.__bits[0]);
@@ -95,7 +98,7 @@ sigblock(mask)
sigemptyset(&set);
set.__bits[0] = mask;
- n = sigprocmask(SIG_BLOCK, &set, &oset);
+ n = _sigprocmask(SIG_BLOCK, &set, &oset);
if (n)
return (n);
return (oset.__bits[0]);
OpenPOWER on IntegriCloud