summaryrefslogtreecommitdiffstats
path: root/lib/libc/yp/yplib.c
diff options
context:
space:
mode:
authorjasone <jasone@FreeBSD.org>2000-01-27 23:07:25 +0000
committerjasone <jasone@FreeBSD.org>2000-01-27 23:07:25 +0000
commit8abe2a2d86ee5f72093b3feeabf05c9f6f963576 (patch)
tree2ebe01199c17764ebcd26435b5ce1c06ebb67ad5 /lib/libc/yp/yplib.c
parent1731b249ccd9d7586d511eda8756f5c6b57b871c (diff)
downloadFreeBSD-src-8abe2a2d86ee5f72093b3feeabf05c9f6f963576.zip
FreeBSD-src-8abe2a2d86ee5f72093b3feeabf05c9f6f963576.tar.gz
Simplify sytem call renaming. Instead of _foo() <-- _libc_foo <-- foo(),
just use _foo() <-- foo(). In the case of a libpthread that doesn't do call conversion (such as linuxthreads and our upcoming libpthread), this is adequate. In the case of libc_r, we still need three names, which are now _thread_sys_foo() <-- _foo() <-- foo(). Convert all internal libc usage of: aio_suspend(), close(), fsync(), msync(), nanosleep(), open(), fcntl(), read(), and write() to _foo() instead of foo(). Remove all internal libc usage of: creat(), pause(), sleep(), system(), tcdrain(), wait(), and waitpid(). Make thread cancellation fully POSIX-compliant. Suggested by: deischen
Diffstat (limited to 'lib/libc/yp/yplib.c')
-rw-r--r--lib/libc/yp/yplib.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/lib/libc/yp/yplib.c b/lib/libc/yp/yplib.c
index 8fc1d56..5c72573 100644
--- a/lib/libc/yp/yplib.c
+++ b/lib/libc/yp/yplib.c
@@ -350,7 +350,7 @@ _yp_dobind(dom, ypdb)
ysd->dom_vers = 0;
ysd->dom_client = NULL;
sock = dup2(save, sock);
- _libc_close(save);
+ _close(save);
}
}
@@ -373,10 +373,10 @@ again:
ysd->dom_socket = -1;
}
snprintf(path, sizeof(path), "%s/%s.%d", BINDINGDIR, dom, 2);
- if((fd = _libc_open(path, O_RDONLY)) == -1) {
+ if((fd = _open(path, O_RDONLY)) == -1) {
/* no binding file, YP is dead. */
/* Try to bring it back to life. */
- _libc_close(fd);
+ _close(fd);
goto skipit;
}
if( flock(fd, LOCK_EX|LOCK_NB) == -1 && errno==EWOULDBLOCK) {
@@ -391,7 +391,7 @@ again:
r = readv(fd, iov, 2);
if(r != iov[0].iov_len + iov[1].iov_len) {
- _libc_close(fd);
+ _close(fd);
ysd->dom_vers = -1;
goto again;
}
@@ -405,12 +405,12 @@ again:
*(u_short *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port;
ysd->dom_server_port = ysd->dom_server_addr.sin_port;
- _libc_close(fd);
+ _close(fd);
goto gotit;
} else {
/* no lock on binding file, YP is dead. */
/* Try to bring it back to life. */
- _libc_close(fd);
+ _close(fd);
goto skipit;
}
}
@@ -478,9 +478,15 @@ skipit:
goto again;
} else {
if (ypbr.ypbind_status != YPBIND_SUCC_VAL) {
+ struct timespec time_to_sleep, time_remaining;
+
clnt_destroy(client);
ysd->dom_vers = -1;
- _libc_sleep(_yplib_timeout/2);
+
+ time_to_sleep.tv_sec = _yplib_timeout/2;
+ time_to_sleep.tv_nsec = 0;
+ _nanosleep(&time_to_sleep,
+ &time_remaining);
goto again;
}
}
@@ -518,7 +524,7 @@ gotit:
ysd->dom_vers = -1;
goto again;
}
- if(_libc_fcntl(ysd->dom_socket, F_SETFD, 1) == -1)
+ if(_fcntl(ysd->dom_socket, F_SETFD, 1) == -1)
perror("fcntl: F_SETFD");
/*
* We want a port number associated with this socket
@@ -567,7 +573,7 @@ _yp_unbind(ypb)
save = dup(ypb->dom_socket);
clnt_destroy(ypb->dom_client);
sock = dup2(save, sock);
- _libc_close(save);
+ _close(save);
} else
clnt_destroy(ypb->dom_client);
}
OpenPOWER on IntegriCloud