summaryrefslogtreecommitdiffstats
path: root/lib/libc/rpc/clnt_unix.c
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/rpc/clnt_unix.c
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/rpc/clnt_unix.c')
-rw-r--r--lib/libc/rpc/clnt_unix.c16
1 files changed, 9 insertions, 7 deletions
diff --git a/lib/libc/rpc/clnt_unix.c b/lib/libc/rpc/clnt_unix.c
index 3b28bf8..d55859c 100644
--- a/lib/libc/rpc/clnt_unix.c
+++ b/lib/libc/rpc/clnt_unix.c
@@ -52,6 +52,7 @@ static char *rcsid = "$FreeBSD$";
* Now go hang yourself.
*/
+#include "namespace.h"
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
@@ -63,6 +64,7 @@ static char *rcsid = "$FreeBSD$";
#include <netdb.h>
#include <errno.h>
#include <rpc/pmap_clnt.h>
+#include "un-namespace.h"
#define MCALL_MSG_SIZE 24
@@ -149,12 +151,12 @@ clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
* If no socket given, open one
*/
if (*sockp < 0) {
- *sockp = socket(AF_UNIX, SOCK_STREAM, 0);
+ *sockp = _socket(AF_UNIX, SOCK_STREAM, 0);
len = strlen(raddr->sun_path) + sizeof(raddr->sun_family) +
sizeof(raddr->sun_len) + 1;
raddr->sun_len = len;
if ((*sockp < 0)
- || (connect(*sockp, (struct sockaddr *)raddr, len) < 0)) {
+ || (_connect(*sockp, (struct sockaddr *)raddr, len) < 0)) {
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
if (*sockp != -1)
@@ -441,7 +443,7 @@ clntunix_control(cl, request, info)
break;
case CLGET_LOCAL_ADDR:
len = sizeof(struct sockaddr);
- if (getsockname(ct->ct_sock, (struct sockaddr *)info, &len) <0)
+ if (_getsockname(ct->ct_sock, (struct sockaddr *)info, &len) <0)
return(FALSE);
break;
case CLGET_RETRY_TIMEOUT:
@@ -473,7 +475,7 @@ clntunix_destroy(h)
}
/*
- * read() and write() are replaced with recvmsg()/sendmsg() so that
+ * _read() and _write() are replaced with _recvmsg()/_sendmsg() so that
* we can pass ancillary control data. In this case, the data constists
* of credential information which the kernel will fill in for us.
* XXX: This code is specific to FreeBSD and will not work on other
@@ -505,7 +507,7 @@ static int __msgread(sock, buf, cnt)
msg.msg_controllen = sizeof(struct cmessage);
msg.msg_flags = 0;
- return(recvmsg(sock, &msg, 0));
+ return(_recvmsg(sock, &msg, 0));
}
static int __msgwrite(sock, buf, cnt)
@@ -533,7 +535,7 @@ static int __msgwrite(sock, buf, cnt)
msg.msg_controllen = sizeof(struct cmessage);
msg.msg_flags = 0;
- return(sendmsg(sock, &msg, 0));
+ return(_sendmsg(sock, &msg, 0));
}
/*
@@ -571,7 +573,7 @@ readunix(ct, buf, len)
/* XXX we know the other bits are still clear */
FD_SET(ct->ct_sock, fds);
tv = delta; /* in case select writes back */
- r = select(ct->ct_sock+1, fds, NULL, NULL, &tv);
+ r = _select(ct->ct_sock+1, fds, NULL, NULL, &tv);
save_errno = errno;
gettimeofday(&after, NULL);
OpenPOWER on IntegriCloud