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().
This commit is contained in:
parent
f3d5d34b45
commit
929273386f
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=55837
@ -25,6 +25,8 @@
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
@ -42,7 +44,9 @@
|
||||
|
||||
.set noreorder
|
||||
|
||||
LEAF(_setjmp, 1)
|
||||
XLEAF(_setjmp, 1)
|
||||
XLEAF(_libc__setjmp, 1)
|
||||
LEAF(___setjmp, 1)
|
||||
LDGP(pv)
|
||||
stq ra, (2 * 8)(a0) /* sc_pc = return address */
|
||||
stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */
|
||||
@ -83,9 +87,11 @@ LEAF(_setjmp, 1)
|
||||
|
||||
mov zero, v0 /* return zero */
|
||||
RET
|
||||
END(_setjmp)
|
||||
END(___setjmp)
|
||||
|
||||
LEAF(_longjmp, 2)
|
||||
XLEAF(_longjmp, 2)
|
||||
XLEAF(_libc__longjmp, 2)
|
||||
LEAF(___longjmp, 2)
|
||||
LDGP(pv)
|
||||
ldq t0, ((31 + 4) * 8)(a0) /* magic in sc_regs[31] */
|
||||
ldiq t1, 0xacedbadd
|
||||
@ -120,4 +126,4 @@ botch:
|
||||
CALL(longjmperror)
|
||||
CALL(abort)
|
||||
RET /* "can't" get here... */
|
||||
END(_longjmp)
|
||||
END(___longjmp)
|
||||
|
@ -44,7 +44,9 @@
|
||||
|
||||
.set noreorder
|
||||
|
||||
LEAF(setjmp, 1)
|
||||
XLEAF(setjmp, 1)
|
||||
XLEAF(_libc_setjmp, 1)
|
||||
LEAF(__setjmp, 1)
|
||||
LDGP(pv)
|
||||
stq ra, (2 * 8)(a0) /* sc_pc = return address */
|
||||
stq s0, (( 9 + 4) * 8)(a0) /* saved bits of sc_regs */
|
||||
@ -113,9 +115,11 @@ LEAF(setjmp, 1)
|
||||
|
||||
mov zero, v0 /* return zero */
|
||||
RET
|
||||
END(setjmp)
|
||||
END(__setjmp)
|
||||
|
||||
LEAF(longjmp, 2)
|
||||
XLEAF(longjmp, 2)
|
||||
XLEAF(_libc_longjmp, 2)
|
||||
LEAF(__longjmp, 2)
|
||||
LDGP(pv)
|
||||
stq a1, (( 0 + 4) * 8)(a0) /* save return value */
|
||||
PCALL(sigreturn) /* use sigreturn to return */
|
||||
@ -124,4 +128,4 @@ botch:
|
||||
CALL(longjmperror)
|
||||
CALL(abort)
|
||||
RET /* "can't" get here... */
|
||||
END(longjmp)
|
||||
END(__longjmp)
|
||||
|
@ -25,6 +25,8 @@
|
||||
*
|
||||
* any improvements or extensions that they make and grant Carnegie the
|
||||
* rights to redistribute these changes.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
@ -43,20 +45,24 @@
|
||||
|
||||
.set noreorder
|
||||
|
||||
LEAF(sigsetjmp, 2)
|
||||
XLEAF(sigsetjmp, 2)
|
||||
XLEAF(_libc_sigsetjmp, 2)
|
||||
LEAF(__sigsetjmp, 2)
|
||||
LDGP(pv)
|
||||
stq a1, (81 * 8)(a0) /* save the mask */
|
||||
bne a1, Lsavesig /* if !zero, save signals */
|
||||
jmp zero, _setjmp /* else don't. */
|
||||
Lsavesig:
|
||||
jmp zero, setjmp
|
||||
END(sigsetjmp)
|
||||
END(__sigsetjmp)
|
||||
|
||||
LEAF(siglongjmp, 2)
|
||||
XLEAF(siglongjmp, 2)
|
||||
XLEAF(_libc_siglongjmp, 2)
|
||||
LEAF(__siglongjmp, 2)
|
||||
LDGP(pv)
|
||||
ldq t0, (81 * 8)(a0) /* get the mask */
|
||||
bne t0, Lrestoresig /* if !zero, restore signals */
|
||||
jmp zero, _longjmp
|
||||
Lrestoresig:
|
||||
jmp zero, longjmp
|
||||
END(siglongjmp)
|
||||
END(__siglongjmp)
|
||||
|
@ -43,15 +43,20 @@
|
||||
|
||||
#define SYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \
|
||||
ENTRY(__CONCAT(_,x)); \
|
||||
.weak CNAME(__CONCAT(_libc_,x)); \
|
||||
.set CNAME(__CONCAT(_libc_,x)),CNAME(__CONCAT(_,x)); \
|
||||
.weak CNAME(x); \
|
||||
.set CNAME(x),CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(x),CNAME(__CONCAT(_libc_,x)); \
|
||||
lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
|
||||
#define RSYSCALL(x) SYSCALL(x); ret
|
||||
|
||||
#define PSEUDO(x,y) ENTRY(__CONCAT(_,x)); \
|
||||
.weak CNAME(__CONCAT(_libc_,x)); \
|
||||
.set CNAME(__CONCAT(_libc_,x)),CNAME(__CONCAT(_,x)); \
|
||||
.weak CNAME(x); \
|
||||
.set CNAME(x),CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(x),CNAME(__CONCAT(_libc_,x)); \
|
||||
lea __CONCAT(SYS_,y), %eax; KERNCALL; ret
|
||||
|
||||
/* gas messes up offset -- although we don't currently need it, do for BCS */
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
|
||||
|
||||
|
@ -53,7 +53,9 @@
|
||||
|
||||
#include "DEFS.h"
|
||||
|
||||
ENTRY(_setjmp)
|
||||
ALTENTRY(_setjmp)
|
||||
ALTENTRY(_libc__setjmp)
|
||||
ENTRY(___setjmp)
|
||||
movl 4(%esp),%eax
|
||||
movl 0(%esp),%edx
|
||||
movl %edx, 0(%eax) /* rta */
|
||||
@ -66,7 +68,9 @@ ENTRY(_setjmp)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
ENTRY(_longjmp)
|
||||
ALTENTRY(_longjmp)
|
||||
ALTENTRY(_libc__longjmp)
|
||||
ENTRY(___longjmp)
|
||||
movl 4(%esp),%edx
|
||||
movl 8(%esp),%eax
|
||||
movl 0(%edx),%ecx
|
||||
|
@ -54,8 +54,9 @@
|
||||
#include "DEFS.h"
|
||||
#include "SYS.h"
|
||||
|
||||
.globl CNAME(__setjmp); CNAME(__setjmp):
|
||||
ENTRY(setjmp)
|
||||
ALTENTRY(setjmp)
|
||||
ALTENTRY(_libc_setjmp)
|
||||
ENTRY(__setjmp)
|
||||
movl 4(%esp),%ecx
|
||||
PIC_PROLOGUE
|
||||
leal 28(%ecx), %eax
|
||||
@ -81,8 +82,9 @@ ENTRY(setjmp)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
.globl CNAME(__longjmp); CNAME(__longjmp):
|
||||
ENTRY(longjmp)
|
||||
ALTENTRY(longjmp)
|
||||
ALTENTRY(_libc_longjmp)
|
||||
ENTRY(__longjmp)
|
||||
movl 4(%esp),%edx
|
||||
PIC_PROLOGUE
|
||||
pushl $0 /* (sigset_t*)oset */
|
||||
|
@ -59,8 +59,9 @@
|
||||
* use sigreturn() if sigreturn() works.
|
||||
*/
|
||||
|
||||
.globl CNAME(__sigsetjmp); CNAME(__sigsetjmp):
|
||||
ENTRY(sigsetjmp)
|
||||
ALTENTRY(sigsetjmp)
|
||||
ALTENTRY(_libc_sigsetjmp)
|
||||
ENTRY(__sigsetjmp)
|
||||
movl 8(%esp),%eax
|
||||
movl 4(%esp),%ecx
|
||||
movl %eax,44(%ecx)
|
||||
@ -90,8 +91,9 @@ ENTRY(sigsetjmp)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
.globl CNAME(__siglongjmp); CNAME(__siglongjmp):
|
||||
ENTRY(siglongjmp)
|
||||
ALTENTRY(siglongjmp)
|
||||
ALTENTRY(_libc_siglongjmp)
|
||||
ENTRY(__siglongjmp)
|
||||
movl 4(%esp),%edx
|
||||
cmpl $0,44(%edx)
|
||||
jz 2f
|
||||
|
@ -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)
|
||||
@ -39,12 +41,15 @@ static char sccsid[] = "@(#)creat.c 8.1 (Berkeley) 6/2/93";
|
||||
|
||||
int
|
||||
#if __STDC__
|
||||
creat(const char *path, mode_t mode)
|
||||
__creat(const char *path, mode_t mode)
|
||||
#else
|
||||
creat(path, mode)
|
||||
__creat(path, mode)
|
||||
char *path;
|
||||
mode_t mode;
|
||||
#endif
|
||||
{
|
||||
return(open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
|
||||
return(_libc_open(path, O_WRONLY|O_CREAT|O_TRUNC, mode));
|
||||
}
|
||||
|
||||
__weak_reference(__creat, _libc_creat);
|
||||
__weak_reference(_libc_creat, creat);
|
||||
|
@ -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)
|
||||
@ -107,5 +109,5 @@ sigpause(mask)
|
||||
|
||||
sigemptyset(&set);
|
||||
set.__bits[0] = mask;
|
||||
return (sigsuspend(&set));
|
||||
return (_libc_sigsuspend(&set));
|
||||
}
|
||||
|
@ -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)
|
||||
@ -103,7 +105,7 @@ __bt_close(dbp)
|
||||
fd = t->bt_fd;
|
||||
free(t);
|
||||
free(dbp);
|
||||
return (close(fd) ? RET_ERROR : RET_SUCCESS);
|
||||
return (_libc_close(fd) ? RET_ERROR : RET_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -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)
|
||||
@ -201,7 +203,7 @@ __bt_open(fname, flags, mode, openinfo, dflags)
|
||||
goto einval;
|
||||
}
|
||||
|
||||
if ((t->bt_fd = open(fname, flags, mode)) < 0)
|
||||
if ((t->bt_fd = _libc_open(fname, flags, mode)) < 0)
|
||||
goto err;
|
||||
|
||||
} else {
|
||||
@ -212,13 +214,13 @@ __bt_open(fname, flags, mode, openinfo, dflags)
|
||||
F_SET(t, B_INMEM);
|
||||
}
|
||||
|
||||
if (fcntl(t->bt_fd, F_SETFD, 1) == -1)
|
||||
if (_libc_fcntl(t->bt_fd, F_SETFD, 1) == -1)
|
||||
goto err;
|
||||
|
||||
if (fstat(t->bt_fd, &sb))
|
||||
goto err;
|
||||
if (sb.st_size) {
|
||||
if ((nr = read(t->bt_fd, &m, sizeof(BTMETA))) < 0)
|
||||
if ((nr = _libc_read(t->bt_fd, &m, sizeof(BTMETA))) < 0)
|
||||
goto err;
|
||||
if (nr != sizeof(BTMETA))
|
||||
goto eftype;
|
||||
@ -334,7 +336,7 @@ err: if (t) {
|
||||
if (t->bt_dbp)
|
||||
free(t->bt_dbp);
|
||||
if (t->bt_fd != -1)
|
||||
(void)close(t->bt_fd);
|
||||
(void)_libc_close(t->bt_fd);
|
||||
free(t);
|
||||
}
|
||||
return (NULL);
|
||||
|
@ -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)
|
||||
@ -128,7 +130,7 @@ __hash_open(file, flags, mode, info, dflags)
|
||||
new_table = 1;
|
||||
}
|
||||
if (file) {
|
||||
if ((hashp->fp = open(file, flags, mode)) == -1)
|
||||
if ((hashp->fp = _libc_open(file, flags, mode)) == -1)
|
||||
RETURN_ERROR(errno, error0);
|
||||
|
||||
/* if the .db file is empty, and we had permission to create
|
||||
@ -137,7 +139,7 @@ __hash_open(file, flags, mode, info, dflags)
|
||||
fstat(hashp->fp, &statbuf) == 0 && statbuf.st_size == 0)
|
||||
new_table = 1;
|
||||
|
||||
(void)fcntl(hashp->fp, F_SETFD, 1);
|
||||
(void)_libc_fcntl(hashp->fp, F_SETFD, 1);
|
||||
}
|
||||
if (new_table) {
|
||||
if (!(hashp = init_hash(hashp, file, (HASHINFO *)info)))
|
||||
@ -149,7 +151,7 @@ __hash_open(file, flags, mode, info, dflags)
|
||||
else
|
||||
hashp->hash = __default_hash;
|
||||
|
||||
hdrsize = read(hashp->fp, &hashp->hdr, sizeof(HASHHDR));
|
||||
hdrsize = _libc_read(hashp->fp, &hashp->hdr, sizeof(HASHHDR));
|
||||
#if BYTE_ORDER == LITTLE_ENDIAN
|
||||
swap_header(hashp);
|
||||
#endif
|
||||
@ -240,7 +242,7 @@ __hash_open(file, flags, mode, info, dflags)
|
||||
|
||||
error1:
|
||||
if (hashp != NULL)
|
||||
(void)close(hashp->fp);
|
||||
(void)_libc_close(hashp->fp);
|
||||
|
||||
error0:
|
||||
free(hashp);
|
||||
@ -438,7 +440,7 @@ hdestroy(hashp)
|
||||
free(hashp->mapp[i]);
|
||||
|
||||
if (hashp->fp != -1)
|
||||
(void)close(hashp->fp);
|
||||
(void)_libc_close(hashp->fp);
|
||||
|
||||
free(hashp);
|
||||
|
||||
@ -507,7 +509,7 @@ flush_meta(hashp)
|
||||
swap_header_copy(&hashp->hdr, whdrp);
|
||||
#endif
|
||||
if ((lseek(fp, (off_t)0, SEEK_SET) == -1) ||
|
||||
((wsize = write(fp, whdrp, sizeof(HASHHDR))) == -1))
|
||||
((wsize = _libc_write(fp, whdrp, sizeof(HASHHDR))) == -1))
|
||||
return (-1);
|
||||
else
|
||||
if (wsize != sizeof(HASHHDR)) {
|
||||
|
@ -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)
|
||||
@ -537,7 +539,7 @@ __get_page(hashp, p, bucket, is_bucket, is_disk, is_bitmap)
|
||||
else
|
||||
page = OADDR_TO_PAGE(bucket);
|
||||
if ((lseek(fd, (off_t)page << hashp->BSHIFT, SEEK_SET) == -1) ||
|
||||
((rsize = read(fd, p, size)) == -1))
|
||||
((rsize = _libc_read(fd, p, size)) == -1))
|
||||
return (-1);
|
||||
bp = (u_int16_t *)p;
|
||||
if (!rsize)
|
||||
@ -608,7 +610,7 @@ __put_page(hashp, p, bucket, is_bucket, is_bitmap)
|
||||
else
|
||||
page = OADDR_TO_PAGE(bucket);
|
||||
if ((lseek(fd, (off_t)page << hashp->BSHIFT, SEEK_SET) == -1) ||
|
||||
((wsize = write(fd, p, size)) == -1))
|
||||
((wsize = _libc_write(fd, p, size)) == -1))
|
||||
/* Errno is set */
|
||||
return (-1);
|
||||
if (wsize != size) {
|
||||
@ -712,7 +714,8 @@ overflow_page(hashp)
|
||||
#define OVMSG "HASH: Out of overflow pages. Increase page size\n"
|
||||
if (offset > SPLITMASK) {
|
||||
if (++splitnum >= NCACHED) {
|
||||
(void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
|
||||
(void)_libc_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) -
|
||||
1);
|
||||
return (0);
|
||||
}
|
||||
hashp->OVFL_POINT = splitnum;
|
||||
@ -725,7 +728,8 @@ overflow_page(hashp)
|
||||
if (free_bit == (hashp->BSIZE << BYTE_SHIFT) - 1) {
|
||||
free_page++;
|
||||
if (free_page >= NCACHED) {
|
||||
(void)write(STDERR_FILENO, OVMSG, sizeof(OVMSG) - 1);
|
||||
(void)_libc_write(STDERR_FILENO, OVMSG, sizeof(OVMSG) -
|
||||
1);
|
||||
return (0);
|
||||
}
|
||||
/*
|
||||
@ -749,7 +753,7 @@ overflow_page(hashp)
|
||||
offset++;
|
||||
if (offset > SPLITMASK) {
|
||||
if (++splitnum >= NCACHED) {
|
||||
(void)write(STDERR_FILENO, OVMSG,
|
||||
(void)_libc_write(STDERR_FILENO, OVMSG,
|
||||
sizeof(OVMSG) - 1);
|
||||
return (0);
|
||||
}
|
||||
@ -867,7 +871,7 @@ open_temp(hashp)
|
||||
(void)sigprocmask(SIG_BLOCK, &set, &oset);
|
||||
if ((hashp->fp = mkstemp(namestr)) != -1) {
|
||||
(void)unlink(namestr);
|
||||
(void)fcntl(hashp->fp, F_SETFD, 1);
|
||||
(void)_libc_fcntl(hashp->fp, F_SETFD, 1);
|
||||
}
|
||||
(void)sigprocmask(SIG_SETMASK, &oset, (sigset_t *)NULL);
|
||||
return (hashp->fp != -1 ? 0 : -1);
|
||||
|
@ -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)
|
||||
@ -205,7 +207,7 @@ mpool_get(mp, pgno, flags)
|
||||
off = mp->pagesize * pgno;
|
||||
if (lseek(mp->fd, off, SEEK_SET) != off)
|
||||
return (NULL);
|
||||
if ((nr = read(mp->fd, bp->page, mp->pagesize)) != mp->pagesize) {
|
||||
if ((nr = _libc_read(mp->fd, bp->page, mp->pagesize)) != mp->pagesize) {
|
||||
if (nr >= 0)
|
||||
errno = EFTYPE;
|
||||
return (NULL);
|
||||
@ -297,7 +299,7 @@ mpool_sync(mp)
|
||||
return (RET_ERROR);
|
||||
|
||||
/* Sync the file descriptor. */
|
||||
return (fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
|
||||
return (_libc_fsync(mp->fd) ? RET_ERROR : RET_SUCCESS);
|
||||
}
|
||||
|
||||
/*
|
||||
@ -380,7 +382,7 @@ mpool_write(mp, bp)
|
||||
off = mp->pagesize * bp->pgno;
|
||||
if (lseek(mp->fd, off, SEEK_SET) != off)
|
||||
return (RET_ERROR);
|
||||
if (write(mp->fd, bp->page, mp->pagesize) != mp->pagesize)
|
||||
if (_libc_write(mp->fd, bp->page, mp->pagesize) != mp->pagesize)
|
||||
return (RET_ERROR);
|
||||
|
||||
bp->flags &= ~MPOOL_DIRTY;
|
||||
|
@ -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)
|
||||
@ -84,7 +86,7 @@ __rec_close(dbp)
|
||||
if (fclose(t->bt_rfp))
|
||||
status = RET_ERROR;
|
||||
} else
|
||||
if (close(t->bt_rfd))
|
||||
if (_libc_close(t->bt_rfd))
|
||||
status = RET_ERROR;
|
||||
|
||||
if (__bt_close(dbp) == RET_ERROR)
|
||||
@ -150,7 +152,8 @@ __rec_sync(dbp, flags)
|
||||
*/
|
||||
status = (dbp->seq)(dbp, &key, &data, R_FIRST);
|
||||
while (status == RET_SUCCESS) {
|
||||
if (write(t->bt_rfd, data.data, data.size) != data.size)
|
||||
if (_libc_write(t->bt_rfd, data.data, data.size) !=
|
||||
data.size)
|
||||
return (RET_ERROR);
|
||||
status = (dbp->seq)(dbp, &key, &data, R_NEXT);
|
||||
}
|
||||
|
@ -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)
|
||||
@ -66,7 +68,7 @@ __rec_open(fname, flags, mode, openinfo, dflags)
|
||||
int rfd, sverrno;
|
||||
|
||||
/* Open the user's file -- if this fails, we're done. */
|
||||
if (fname != NULL && (rfd = open(fname, flags, mode)) < 0)
|
||||
if (fname != NULL && (rfd = _libc_open(fname, flags, mode)) < 0)
|
||||
return (NULL);
|
||||
|
||||
/* Create a btree in memory (backed by disk). */
|
||||
@ -213,7 +215,7 @@ err: sverrno = errno;
|
||||
if (dbp != NULL)
|
||||
(void)__bt_close(dbp);
|
||||
if (fname != NULL)
|
||||
(void)close(rfd);
|
||||
(void)_libc_close(rfd);
|
||||
errno = sverrno;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -84,10 +84,10 @@ arc4_stir(as)
|
||||
|
||||
gettimeofday(&rdat.tv, NULL);
|
||||
rdat.pid = getpid();
|
||||
fd = open("/dev/urandom", O_RDONLY, 0);
|
||||
fd = _libc_open("/dev/urandom", O_RDONLY, 0);
|
||||
if (fd >= 0) {
|
||||
(void) read(fd, rdat.rnd, sizeof(rdat.rnd));
|
||||
close(fd);
|
||||
(void) _libc_read(fd, rdat.rnd, sizeof(rdat.rnd));
|
||||
_libc_close(fd);
|
||||
}
|
||||
/* fd < 0? Ah, what the heck. We'll just take whatever was on the
|
||||
* stack... */
|
||||
|
@ -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)
|
||||
@ -58,5 +60,5 @@ closedir(dirp)
|
||||
free((void *)dirp->dd_buf);
|
||||
free((void *)dirp);
|
||||
_reclaim_telldir(dirp);
|
||||
return(close(fd));
|
||||
return(_libc_close(fd));
|
||||
}
|
||||
|
@ -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)
|
||||
@ -60,12 +62,12 @@ daemon(nochdir, noclose)
|
||||
if (!nochdir)
|
||||
(void)chdir("/");
|
||||
|
||||
if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
|
||||
if (!noclose && (fd = _libc_open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
|
||||
(void)dup2(fd, STDIN_FILENO);
|
||||
(void)dup2(fd, STDOUT_FILENO);
|
||||
(void)dup2(fd, STDERR_FILENO);
|
||||
if (fd > 2)
|
||||
(void)close (fd);
|
||||
(void)_libc_close(fd);
|
||||
}
|
||||
return (0);
|
||||
}
|
||||
|
@ -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)
|
||||
@ -247,9 +249,10 @@ execvp(name, argv)
|
||||
* the user may execute the wrong program.
|
||||
*/
|
||||
if (lp + ln + 2 > sizeof(buf)) {
|
||||
(void)write(STDERR_FILENO, "execvp: ", 8);
|
||||
(void)write(STDERR_FILENO, p, lp);
|
||||
(void)write(STDERR_FILENO, ": path too long\n", 16);
|
||||
(void)_libc_write(STDERR_FILENO, "execvp: ", 8);
|
||||
(void)_libc_write(STDERR_FILENO, p, lp);
|
||||
(void)_libc_write(STDERR_FILENO, ": path too long\n",
|
||||
16);
|
||||
continue;
|
||||
}
|
||||
bcopy(p, buf, lp);
|
||||
|
@ -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)
|
||||
@ -251,12 +253,12 @@ error(err)
|
||||
char *p;
|
||||
char num[30];
|
||||
|
||||
(void)write(STDERR_FILENO, "fstab: ", 7);
|
||||
(void)write(STDERR_FILENO, _PATH_FSTAB, sizeof(_PATH_FSTAB) - 1);
|
||||
(void)write(STDERR_FILENO, ":", 1);
|
||||
(void)_libc_write(STDERR_FILENO, "fstab: ", 7);
|
||||
(void)_libc_write(STDERR_FILENO, _PATH_FSTAB, sizeof(_PATH_FSTAB) - 1);
|
||||
(void)_libc_write(STDERR_FILENO, ":", 1);
|
||||
sprintf(num, "%d: ", LineNo);
|
||||
(void)write(STDERR_FILENO, num, strlen(num));
|
||||
(void)_libc_write(STDERR_FILENO, num, strlen(num));
|
||||
p = strerror(err);
|
||||
(void)write(STDERR_FILENO, p, strlen(p));
|
||||
(void)write(STDERR_FILENO, "\n", 1);
|
||||
(void)_libc_write(STDERR_FILENO, p, strlen(p));
|
||||
(void)_libc_write(STDERR_FILENO, "\n", 1);
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
@ -176,7 +178,8 @@ fts_open(argv, options, compar)
|
||||
* and ".." are all fairly nasty problems. Note, if we can't get the
|
||||
* descriptor we run anyway, just more slowly.
|
||||
*/
|
||||
if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
|
||||
if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = _libc_open(".", O_RDONLY, 0))
|
||||
< 0)
|
||||
SET(FTS_NOCHDIR);
|
||||
|
||||
return (sp);
|
||||
@ -245,7 +248,7 @@ fts_close(sp)
|
||||
/* Return to original directory, save errno if necessary. */
|
||||
if (!ISSET(FTS_NOCHDIR)) {
|
||||
saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
|
||||
(void)close(sp->fts_rfd);
|
||||
(void)_libc_close(sp->fts_rfd);
|
||||
|
||||
/* Set errno and return. */
|
||||
if (saved_errno != 0) {
|
||||
@ -305,7 +308,7 @@ fts_read(sp)
|
||||
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
|
||||
p->fts_info = fts_stat(sp, p, 1);
|
||||
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
|
||||
if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
|
||||
if ((p->fts_symfd = _libc_open(".", O_RDONLY, 0)) < 0) {
|
||||
p->fts_errno = errno;
|
||||
p->fts_info = FTS_ERR;
|
||||
} else
|
||||
@ -320,7 +323,7 @@ fts_read(sp)
|
||||
if (instr == FTS_SKIP ||
|
||||
(ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
|
||||
if (p->fts_flags & FTS_SYMFOLLOW)
|
||||
(void)close(p->fts_symfd);
|
||||
(void)_libc_close(p->fts_symfd);
|
||||
if (sp->fts_child) {
|
||||
fts_lfree(sp->fts_child);
|
||||
sp->fts_child = NULL;
|
||||
@ -395,7 +398,7 @@ next: tmp = p;
|
||||
p->fts_info = fts_stat(sp, p, 1);
|
||||
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
|
||||
if ((p->fts_symfd =
|
||||
open(".", O_RDONLY, 0)) < 0) {
|
||||
_libc_open(".", O_RDONLY, 0)) < 0) {
|
||||
p->fts_errno = errno;
|
||||
p->fts_info = FTS_ERR;
|
||||
} else
|
||||
@ -440,12 +443,12 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
|
||||
} else if (p->fts_flags & FTS_SYMFOLLOW) {
|
||||
if (FCHDIR(sp, p->fts_symfd)) {
|
||||
saved_errno = errno;
|
||||
(void)close(p->fts_symfd);
|
||||
(void)_libc_close(p->fts_symfd);
|
||||
errno = saved_errno;
|
||||
SET(FTS_STOP);
|
||||
return (NULL);
|
||||
}
|
||||
(void)close(p->fts_symfd);
|
||||
(void)_libc_close(p->fts_symfd);
|
||||
} else if (!(p->fts_flags & FTS_DONTCHDIR)) {
|
||||
if (CHDIR(sp, "..")) {
|
||||
SET(FTS_STOP);
|
||||
@ -537,12 +540,12 @@ fts_children(sp, instr)
|
||||
ISSET(FTS_NOCHDIR))
|
||||
return (sp->fts_child = fts_build(sp, instr));
|
||||
|
||||
if ((fd = open(".", O_RDONLY, 0)) < 0)
|
||||
if ((fd = _libc_open(".", O_RDONLY, 0)) < 0)
|
||||
return (NULL);
|
||||
sp->fts_child = fts_build(sp, instr);
|
||||
if (fchdir(fd))
|
||||
return (NULL);
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
return (sp->fts_child);
|
||||
}
|
||||
|
||||
@ -1091,7 +1094,7 @@ fts_safe_changedir(sp, p, fd)
|
||||
newfd = fd;
|
||||
if (ISSET(FTS_NOCHDIR))
|
||||
return (0);
|
||||
if (fd < 0 && (newfd = open(p->fts_accpath, O_RDONLY, 0)) < 0)
|
||||
if (fd < 0 && (newfd = _libc_open(p->fts_accpath, O_RDONLY, 0)) < 0)
|
||||
return (-1);
|
||||
if (fstat(newfd, &sb)) {
|
||||
ret = -1;
|
||||
@ -1106,7 +1109,7 @@ fts_safe_changedir(sp, p, fd)
|
||||
bail:
|
||||
oerrno = errno;
|
||||
if (fd < 0)
|
||||
(void)close(newfd);
|
||||
(void)_libc_close(newfd);
|
||||
errno = oerrno;
|
||||
return (ret);
|
||||
}
|
||||
|
@ -31,6 +31,8 @@
|
||||
* SUCH DAMAGE.
|
||||
*
|
||||
* $OpenBSD: fts.c,v 1.22 1999/10/03 19:22:22 millert Exp $
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
@ -176,7 +178,8 @@ fts_open(argv, options, compar)
|
||||
* and ".." are all fairly nasty problems. Note, if we can't get the
|
||||
* descriptor we run anyway, just more slowly.
|
||||
*/
|
||||
if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = open(".", O_RDONLY, 0)) < 0)
|
||||
if (!ISSET(FTS_NOCHDIR) && (sp->fts_rfd = _libc_open(".", O_RDONLY, 0))
|
||||
< 0)
|
||||
SET(FTS_NOCHDIR);
|
||||
|
||||
return (sp);
|
||||
@ -245,7 +248,7 @@ fts_close(sp)
|
||||
/* Return to original directory, save errno if necessary. */
|
||||
if (!ISSET(FTS_NOCHDIR)) {
|
||||
saved_errno = fchdir(sp->fts_rfd) ? errno : 0;
|
||||
(void)close(sp->fts_rfd);
|
||||
(void)_libc_close(sp->fts_rfd);
|
||||
|
||||
/* Set errno and return. */
|
||||
if (saved_errno != 0) {
|
||||
@ -305,7 +308,7 @@ fts_read(sp)
|
||||
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
|
||||
p->fts_info = fts_stat(sp, p, 1);
|
||||
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
|
||||
if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
|
||||
if ((p->fts_symfd = _libc_open(".", O_RDONLY, 0)) < 0) {
|
||||
p->fts_errno = errno;
|
||||
p->fts_info = FTS_ERR;
|
||||
} else
|
||||
@ -320,7 +323,7 @@ fts_read(sp)
|
||||
if (instr == FTS_SKIP ||
|
||||
(ISSET(FTS_XDEV) && p->fts_dev != sp->fts_dev)) {
|
||||
if (p->fts_flags & FTS_SYMFOLLOW)
|
||||
(void)close(p->fts_symfd);
|
||||
(void)_libc_close(p->fts_symfd);
|
||||
if (sp->fts_child) {
|
||||
fts_lfree(sp->fts_child);
|
||||
sp->fts_child = NULL;
|
||||
@ -395,7 +398,7 @@ next: tmp = p;
|
||||
p->fts_info = fts_stat(sp, p, 1);
|
||||
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR)) {
|
||||
if ((p->fts_symfd =
|
||||
open(".", O_RDONLY, 0)) < 0) {
|
||||
_libc_open(".", O_RDONLY, 0)) < 0) {
|
||||
p->fts_errno = errno;
|
||||
p->fts_info = FTS_ERR;
|
||||
} else
|
||||
@ -440,12 +443,12 @@ name: t = sp->fts_path + NAPPEND(p->fts_parent);
|
||||
} else if (p->fts_flags & FTS_SYMFOLLOW) {
|
||||
if (FCHDIR(sp, p->fts_symfd)) {
|
||||
saved_errno = errno;
|
||||
(void)close(p->fts_symfd);
|
||||
(void)_libc_close(p->fts_symfd);
|
||||
errno = saved_errno;
|
||||
SET(FTS_STOP);
|
||||
return (NULL);
|
||||
}
|
||||
(void)close(p->fts_symfd);
|
||||
(void)_libc_close(p->fts_symfd);
|
||||
} else if (!(p->fts_flags & FTS_DONTCHDIR)) {
|
||||
if (CHDIR(sp, "..")) {
|
||||
SET(FTS_STOP);
|
||||
@ -537,12 +540,12 @@ fts_children(sp, instr)
|
||||
ISSET(FTS_NOCHDIR))
|
||||
return (sp->fts_child = fts_build(sp, instr));
|
||||
|
||||
if ((fd = open(".", O_RDONLY, 0)) < 0)
|
||||
if ((fd = _libc_open(".", O_RDONLY, 0)) < 0)
|
||||
return (NULL);
|
||||
sp->fts_child = fts_build(sp, instr);
|
||||
if (fchdir(fd))
|
||||
return (NULL);
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
return (sp->fts_child);
|
||||
}
|
||||
|
||||
@ -1091,7 +1094,7 @@ fts_safe_changedir(sp, p, fd)
|
||||
newfd = fd;
|
||||
if (ISSET(FTS_NOCHDIR))
|
||||
return (0);
|
||||
if (fd < 0 && (newfd = open(p->fts_accpath, O_RDONLY, 0)) < 0)
|
||||
if (fd < 0 && (newfd = _libc_open(p->fts_accpath, O_RDONLY, 0)) < 0)
|
||||
return (-1);
|
||||
if (fstat(newfd, &sb)) {
|
||||
ret = -1;
|
||||
@ -1106,7 +1109,7 @@ fts_safe_changedir(sp, p, fd)
|
||||
bail:
|
||||
oerrno = errno;
|
||||
if (fd < 0)
|
||||
(void)close(newfd);
|
||||
(void)_libc_close(newfd);
|
||||
errno = oerrno;
|
||||
return (ret);
|
||||
}
|
||||
|
@ -268,7 +268,7 @@ getent(cap, len, db_array, fd, name, depth, nfield)
|
||||
*cap = cbuf;
|
||||
return (retval);
|
||||
} else {
|
||||
fd = open(*db_p, O_RDONLY, 0);
|
||||
fd = _libc_open(*db_p, O_RDONLY, 0);
|
||||
if (fd < 0)
|
||||
continue;
|
||||
myfd = 1;
|
||||
@ -303,10 +303,10 @@ getent(cap, len, db_array, fd, name, depth, nfield)
|
||||
if (bp >= b_end) {
|
||||
int n;
|
||||
|
||||
n = read(fd, buf, sizeof(buf));
|
||||
n = _libc_read(fd, buf, sizeof(buf));
|
||||
if (n <= 0) {
|
||||
if (myfd)
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
if (n < 0) {
|
||||
free(record);
|
||||
return (-2);
|
||||
@ -345,7 +345,7 @@ getent(cap, len, db_array, fd, name, depth, nfield)
|
||||
if (record == NULL) {
|
||||
errno = ENOMEM;
|
||||
if (myfd)
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
return (-2);
|
||||
}
|
||||
r_end = record + newsize;
|
||||
@ -435,7 +435,7 @@ tc_exp: {
|
||||
/* an error */
|
||||
if (iret < -1) {
|
||||
if (myfd)
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
free(record);
|
||||
return (iret);
|
||||
}
|
||||
@ -485,7 +485,7 @@ tc_exp: {
|
||||
if (record == NULL) {
|
||||
errno = ENOMEM;
|
||||
if (myfd)
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
free(icap);
|
||||
return (-2);
|
||||
}
|
||||
@ -517,7 +517,7 @@ tc_exp: {
|
||||
* return capability, length and success.
|
||||
*/
|
||||
if (myfd)
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
*len = rp - record - 1; /* don't count NUL */
|
||||
if (r_end > rp)
|
||||
if ((record =
|
||||
|
@ -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)
|
||||
@ -84,7 +86,7 @@ getpass(prompt)
|
||||
if (p < buf + _PASSWORD_LEN)
|
||||
*p++ = ch;
|
||||
*p = '\0';
|
||||
(void)write(fileno(outfp), "\n", 1);
|
||||
(void)_libc_write(fileno(outfp), "\n", 1);
|
||||
(void)tcsetattr(fileno(fp), TCSAFLUSH|TCSASOFT, &oterm);
|
||||
|
||||
(void)sigprocmask(SIG_SETMASK, &oset, NULL);
|
||||
|
@ -34,6 +34,8 @@
|
||||
* 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.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#if defined(LIBC_SCCS) && !defined(lint)
|
||||
@ -73,7 +75,7 @@ lockf(filedes, function, size)
|
||||
break;
|
||||
case F_TEST:
|
||||
fl.l_type = F_WRLCK;
|
||||
if (fcntl(filedes, F_GETLK, &fl) == -1)
|
||||
if (_libc_fcntl(filedes, F_GETLK, &fl) == -1)
|
||||
return (-1);
|
||||
if (fl.l_type == F_UNLCK || fl.l_pid == getpid())
|
||||
return (0);
|
||||
@ -86,5 +88,5 @@ lockf(filedes, function, size)
|
||||
/* NOTREACHED */
|
||||
}
|
||||
|
||||
return (fcntl(filedes, cmd, &fl));
|
||||
return (_libc_fcntl(filedes, cmd, &fl));
|
||||
}
|
||||
|
@ -66,11 +66,11 @@ nlist(name, list)
|
||||
{
|
||||
int fd, n;
|
||||
|
||||
fd = open(name, O_RDONLY, 0);
|
||||
fd = _libc_open(name, O_RDONLY, 0);
|
||||
if (fd < 0)
|
||||
return (-1);
|
||||
n = __fdnlist(fd, list);
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
return (n);
|
||||
}
|
||||
|
||||
@ -255,7 +255,7 @@ __elf_fdnlist(fd, list)
|
||||
|
||||
/* Make sure obj is OK */
|
||||
if (lseek(fd, (off_t)0, SEEK_SET) == -1 ||
|
||||
read(fd, &ehdr, sizeof(Elf_Ehdr)) != sizeof(Elf_Ehdr) ||
|
||||
_libc_read(fd, &ehdr, sizeof(Elf_Ehdr)) != sizeof(Elf_Ehdr) ||
|
||||
!__elf_is_okay__(&ehdr) ||
|
||||
fstat(fd, &st) < 0)
|
||||
return (-1);
|
||||
@ -339,7 +339,7 @@ __elf_fdnlist(fd, list)
|
||||
|
||||
while (symsize > 0 && nent > 0) {
|
||||
cc = MIN(symsize, sizeof(sbuf));
|
||||
if (read(fd, sbuf, cc) != cc)
|
||||
if (_libc_read(fd, sbuf, cc) != cc)
|
||||
break;
|
||||
symsize -= cc;
|
||||
for (s = sbuf; cc > 0 && nent > 0; ++s, cc -= sizeof(*s)) {
|
||||
|
@ -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)
|
||||
@ -78,7 +80,7 @@ __opendir2(name, flags)
|
||||
errno = ENOTDIR;
|
||||
return (NULL);
|
||||
}
|
||||
if ((fd = open(name, O_RDONLY | O_NONBLOCK)) == -1)
|
||||
if ((fd = _libc_open(name, O_RDONLY | O_NONBLOCK)) == -1)
|
||||
return (NULL);
|
||||
dirp = NULL;
|
||||
if (fstat(fd, &statb) != 0)
|
||||
@ -87,7 +89,7 @@ __opendir2(name, flags)
|
||||
errno = ENOTDIR;
|
||||
goto fail;
|
||||
}
|
||||
if (fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 ||
|
||||
if (_libc_fcntl(fd, F_SETFD, FD_CLOEXEC) == -1 ||
|
||||
(dirp = malloc(sizeof(DIR))) == NULL)
|
||||
goto fail;
|
||||
|
||||
@ -161,8 +163,8 @@ __opendir2(name, flags)
|
||||
* which has also been read -- see fts.c.
|
||||
*/
|
||||
if (flags & DTF_REWIND) {
|
||||
(void) close(fd);
|
||||
if ((fd = open(name, O_RDONLY)) == -1) {
|
||||
(void)_libc_close(fd);
|
||||
if ((fd = _libc_open(name, O_RDONLY)) == -1) {
|
||||
saved_errno = errno;
|
||||
free(buf);
|
||||
free(dirp);
|
||||
@ -268,7 +270,7 @@ __opendir2(name, flags)
|
||||
fail:
|
||||
saved_errno = errno;
|
||||
free(dirp);
|
||||
(void) close(fd);
|
||||
(void)_libc_close(fd);
|
||||
errno = saved_errno;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -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)
|
||||
@ -42,8 +44,10 @@ static char sccsid[] = "@(#)pause.c 8.1 (Berkeley) 6/4/93";
|
||||
* Backwards compatible pause.
|
||||
*/
|
||||
int
|
||||
pause()
|
||||
__pause()
|
||||
{
|
||||
|
||||
return sigpause(sigblock(0L));
|
||||
}
|
||||
|
||||
__weak_reference(__pause, _libc_pause);
|
||||
__weak_reference(_libc_pause, pause);
|
||||
|
@ -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)
|
||||
@ -83,8 +85,8 @@ popen(command, type)
|
||||
return (NULL);
|
||||
|
||||
if ((cur = malloc(sizeof(struct pid))) == NULL) {
|
||||
(void)close(pdes[0]);
|
||||
(void)close(pdes[1]);
|
||||
(void)_libc_close(pdes[0]);
|
||||
(void)_libc_close(pdes[1]);
|
||||
return (NULL);
|
||||
}
|
||||
|
||||
@ -95,8 +97,8 @@ popen(command, type)
|
||||
|
||||
switch (pid = vfork()) {
|
||||
case -1: /* Error. */
|
||||
(void)close(pdes[0]);
|
||||
(void)close(pdes[1]);
|
||||
(void)_libc_close(pdes[0]);
|
||||
(void)_libc_close(pdes[1]);
|
||||
free(cur);
|
||||
return (NULL);
|
||||
/* NOTREACHED */
|
||||
@ -110,10 +112,10 @@ popen(command, type)
|
||||
* the compiler is free to corrupt all the local
|
||||
* variables.
|
||||
*/
|
||||
(void) close(pdes[0]);
|
||||
(void)_libc_close(pdes[0]);
|
||||
if (pdes[1] != STDOUT_FILENO) {
|
||||
(void)dup2(pdes[1], STDOUT_FILENO);
|
||||
(void)close(pdes[1]);
|
||||
(void)_libc_close(pdes[1]);
|
||||
if (twoway)
|
||||
(void)dup2(STDOUT_FILENO, STDIN_FILENO);
|
||||
} else if (twoway && (pdes[1] != STDIN_FILENO))
|
||||
@ -121,12 +123,12 @@ popen(command, type)
|
||||
} else {
|
||||
if (pdes[0] != STDIN_FILENO) {
|
||||
(void)dup2(pdes[0], STDIN_FILENO);
|
||||
(void)close(pdes[0]);
|
||||
(void)_libc_close(pdes[0]);
|
||||
}
|
||||
(void)close(pdes[1]);
|
||||
(void)_libc_close(pdes[1]);
|
||||
}
|
||||
for (p = pidlist; p; p = p->next) {
|
||||
(void)close(fileno(p->fp));
|
||||
(void)_libc_close(fileno(p->fp));
|
||||
}
|
||||
execve(_PATH_BSHELL, argv, environ);
|
||||
_exit(127);
|
||||
@ -136,10 +138,10 @@ popen(command, type)
|
||||
/* Parent; assume fdopen can't fail. */
|
||||
if (*type == 'r') {
|
||||
iop = fdopen(pdes[0], type);
|
||||
(void)close(pdes[1]);
|
||||
(void)_libc_close(pdes[1]);
|
||||
} else {
|
||||
iop = fdopen(pdes[1], type);
|
||||
(void)close(pdes[0]);
|
||||
(void)_libc_close(pdes[0]);
|
||||
}
|
||||
|
||||
/* Link into list of file descriptors. */
|
||||
@ -175,7 +177,7 @@ pclose(iop)
|
||||
(void)fclose(iop);
|
||||
|
||||
do {
|
||||
pid = waitpid(cur->pid, &pstat, 0);
|
||||
pid = _libc_waitpid(cur->pid, &pstat, 0);
|
||||
} while (pid == -1 && errno == EINTR);
|
||||
|
||||
/* Remove the entry from the linked list. */
|
||||
|
@ -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)
|
||||
@ -55,9 +57,9 @@ psignal(sig, s)
|
||||
else
|
||||
c = "Unknown signal";
|
||||
if (s != NULL && *s != '\0') {
|
||||
(void)write(STDERR_FILENO, s, strlen(s));
|
||||
(void)write(STDERR_FILENO, ": ", 2);
|
||||
(void)_libc_write(STDERR_FILENO, s, strlen(s));
|
||||
(void)_libc_write(STDERR_FILENO, ": ", 2);
|
||||
}
|
||||
(void)write(STDERR_FILENO, c, strlen(c));
|
||||
(void)write(STDERR_FILENO, "\n", 1);
|
||||
(void)_libc_write(STDERR_FILENO, c, strlen(c));
|
||||
(void)_libc_write(STDERR_FILENO, "\n", 1);
|
||||
}
|
||||
|
@ -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)
|
||||
@ -49,5 +51,5 @@ void
|
||||
longjmperror()
|
||||
{
|
||||
#define ERRMSG "longjmp botch.\n"
|
||||
(void)write(STDERR_FILENO, ERRMSG, sizeof(ERRMSG) - 1);
|
||||
(void)_libc_write(STDERR_FILENO, ERRMSG, sizeof(ERRMSG) - 1);
|
||||
}
|
||||
|
@ -45,7 +45,7 @@ static char rcsid[] =
|
||||
#include <unistd.h>
|
||||
|
||||
unsigned int
|
||||
sleep(seconds)
|
||||
__sleep(seconds)
|
||||
unsigned int seconds;
|
||||
{
|
||||
struct timespec time_to_sleep;
|
||||
@ -56,14 +56,17 @@ sleep(seconds)
|
||||
* the maximum value for a time_t is >= INT_MAX.
|
||||
*/
|
||||
if (seconds > INT_MAX)
|
||||
return (seconds - INT_MAX + sleep(INT_MAX));
|
||||
return (seconds - INT_MAX + __sleep(INT_MAX));
|
||||
|
||||
time_to_sleep.tv_sec = seconds;
|
||||
time_to_sleep.tv_nsec = 0;
|
||||
if (nanosleep(&time_to_sleep, &time_remaining) != -1)
|
||||
if (_libc_nanosleep(&time_to_sleep, &time_remaining) != -1)
|
||||
return (0);
|
||||
if (errno != EINTR)
|
||||
return (seconds); /* best guess */
|
||||
return (time_remaining.tv_sec +
|
||||
(time_remaining.tv_nsec != 0)); /* round up */
|
||||
}
|
||||
|
||||
__weak_reference(__sleep, _libc_sleep);
|
||||
__weak_reference(_libc_sleep, sleep);
|
||||
|
@ -260,7 +260,7 @@ vsyslog(pri, fmt, ap)
|
||||
* is the one from the syslogd failure.
|
||||
*/
|
||||
if (LogStat & LOG_CONS &&
|
||||
(fd = open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) {
|
||||
(fd = _libc_open(_PATH_CONSOLE, O_WRONLY, 0)) >= 0) {
|
||||
struct iovec iov[2];
|
||||
register struct iovec *v = iov;
|
||||
|
||||
@ -271,7 +271,7 @@ vsyslog(pri, fmt, ap)
|
||||
v->iov_base = "\r\n";
|
||||
v->iov_len = 2;
|
||||
(void)writev(fd, iov, 2);
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
}
|
||||
}
|
||||
static void
|
||||
@ -283,7 +283,7 @@ disconnectlog()
|
||||
* system services.
|
||||
*/
|
||||
if (LogFile != -1) {
|
||||
close(LogFile);
|
||||
_libc_close(LogFile);
|
||||
LogFile = -1;
|
||||
}
|
||||
connected = 0; /* retry connect */
|
||||
@ -297,7 +297,7 @@ connectlog()
|
||||
if (LogFile == -1) {
|
||||
if ((LogFile = socket(AF_UNIX, SOCK_DGRAM, 0)) == -1)
|
||||
return;
|
||||
(void)fcntl(LogFile, F_SETFD, 1);
|
||||
(void)_libc_fcntl(LogFile, F_SETFD, 1);
|
||||
}
|
||||
if (LogFile != -1 && !connected) {
|
||||
SyslogAddr.sun_len = sizeof(SyslogAddr);
|
||||
@ -320,7 +320,7 @@ connectlog()
|
||||
}
|
||||
|
||||
if (!connected) {
|
||||
(void)close(LogFile);
|
||||
(void)_libc_close(LogFile);
|
||||
LogFile = -1;
|
||||
}
|
||||
}
|
||||
@ -346,7 +346,7 @@ openlog(ident, logstat, logfac)
|
||||
void
|
||||
closelog()
|
||||
{
|
||||
(void)close(LogFile);
|
||||
(void)_libc_close(LogFile);
|
||||
LogFile = -1;
|
||||
connected = 0;
|
||||
}
|
||||
|
@ -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)
|
||||
@ -187,13 +189,15 @@ tcsendbreak(fd, len)
|
||||
}
|
||||
|
||||
int
|
||||
tcdrain(fd)
|
||||
__tcdrain(fd)
|
||||
int fd;
|
||||
{
|
||||
|
||||
return (ioctl(fd, TIOCDRAIN, 0));
|
||||
}
|
||||
|
||||
__weak_reference(__tcdrain, _libc_tcdrain);
|
||||
__weak_reference(_libc_tcdrain, tcdrain);
|
||||
|
||||
int
|
||||
tcflush(fd, which)
|
||||
int fd, which;
|
||||
@ -234,7 +238,8 @@ tcflow(fd, action)
|
||||
if (tcgetattr(fd, &term) == -1)
|
||||
return (-1);
|
||||
c = term.c_cc[action == TCIOFF ? VSTOP : VSTART];
|
||||
if (c != _POSIX_VDISABLE && write(fd, &c, sizeof(c)) == -1)
|
||||
if (c != _POSIX_VDISABLE && _libc_write(fd, &c, sizeof(c)) ==
|
||||
-1)
|
||||
return (-1);
|
||||
return (0);
|
||||
default:
|
||||
|
@ -50,5 +50,5 @@ usleep(useconds)
|
||||
|
||||
time_to_sleep.tv_nsec = (useconds % 1000000) * 1000;
|
||||
time_to_sleep.tv_sec = useconds / 1000000;
|
||||
return (nanosleep(&time_to_sleep, NULL));
|
||||
return (_libc_nanosleep(&time_to_sleep, NULL));
|
||||
}
|
||||
|
@ -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)
|
||||
@ -41,8 +43,11 @@ static char sccsid[] = "@(#)wait.c 8.1 (Berkeley) 6/4/93";
|
||||
#include <sys/resource.h>
|
||||
|
||||
pid_t
|
||||
wait(istat)
|
||||
__wait(istat)
|
||||
int *istat;
|
||||
{
|
||||
return (wait4(WAIT_ANY, istat, 0, (struct rusage *)0));
|
||||
}
|
||||
|
||||
__weak_reference(__wait, _libc_wait);
|
||||
__weak_reference(_libc_wait, wait);
|
||||
|
@ -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)
|
||||
@ -42,9 +44,9 @@ static char sccsid[] = "@(#)waitpid.c 8.1 (Berkeley) 6/4/93";
|
||||
|
||||
pid_t
|
||||
#if __STDC__
|
||||
waitpid(pid_t pid, int *istat, int options)
|
||||
__waitpid(pid_t pid, int *istat, int options)
|
||||
#else
|
||||
waitpid(pid, istat, options)
|
||||
__waitpid(pid, istat, options)
|
||||
pid_t pid;
|
||||
int *istat;
|
||||
int options;
|
||||
@ -52,3 +54,6 @@ waitpid(pid, istat, options)
|
||||
{
|
||||
return (wait4(pid, istat, options, (struct rusage *)0));
|
||||
}
|
||||
|
||||
__weak_reference(__waitpid, _libc_waitpid);
|
||||
__weak_reference(_libc_waitpid, waitpid);
|
||||
|
@ -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(lint) && defined(LIBC_SCCS)
|
||||
@ -60,7 +62,7 @@ static int s_scale;
|
||||
/* see profil(2) where this is describe (incorrectly) */
|
||||
#define SCALE_1_TO_1 0x10000L
|
||||
|
||||
#define ERR(s) write(2, s, sizeof(s))
|
||||
#define ERR(s) _libc_write(2, s, sizeof(s))
|
||||
|
||||
void moncontrol __P((int));
|
||||
static int hertz __P((void));
|
||||
@ -170,20 +172,20 @@ _mcleanup()
|
||||
|
||||
moncontrol(0);
|
||||
snprintf(outname,sizeof(outname),"%s.gmon",__progname);
|
||||
fd = open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
||||
fd = _libc_open(outname, O_CREAT|O_TRUNC|O_WRONLY, 0666);
|
||||
if (fd < 0) {
|
||||
warnx("_mcleanup: %s - %s",outname,strerror(errno));
|
||||
return;
|
||||
}
|
||||
#ifdef DEBUG
|
||||
log = open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
|
||||
log = _libc_open("gmon.log", O_CREAT|O_TRUNC|O_WRONLY, 0664);
|
||||
if (log < 0) {
|
||||
perror("_mcleanup: gmon.log");
|
||||
return;
|
||||
}
|
||||
len = sprintf(buf, "[mcleanup1] kcount 0x%x ssiz %d\n",
|
||||
p->kcount, p->kcountsize);
|
||||
write(log, buf, len);
|
||||
_libc_write(log, buf, len);
|
||||
#endif
|
||||
hdr = (struct gmonhdr *)&gmonhdr;
|
||||
hdr->lpc = p->lowpc;
|
||||
@ -191,8 +193,8 @@ _mcleanup()
|
||||
hdr->ncnt = p->kcountsize + sizeof(gmonhdr);
|
||||
hdr->version = GMONVERSION;
|
||||
hdr->profrate = clockinfo.profhz;
|
||||
write(fd, (char *)hdr, sizeof *hdr);
|
||||
write(fd, p->kcount, p->kcountsize);
|
||||
_libc_write(fd, (char *)hdr, sizeof *hdr);
|
||||
_libc_write(fd, p->kcount, p->kcountsize);
|
||||
endfrom = p->fromssize / sizeof(*p->froms);
|
||||
for (fromindex = 0; fromindex < endfrom; fromindex++) {
|
||||
if (p->froms[fromindex] == 0)
|
||||
@ -207,15 +209,15 @@ _mcleanup()
|
||||
"[mcleanup2] frompc 0x%x selfpc 0x%x count %d\n" ,
|
||||
frompc, p->tos[toindex].selfpc,
|
||||
p->tos[toindex].count);
|
||||
write(log, buf, len);
|
||||
_libc_write(log, buf, len);
|
||||
#endif
|
||||
rawarc.raw_frompc = frompc;
|
||||
rawarc.raw_selfpc = p->tos[toindex].selfpc;
|
||||
rawarc.raw_count = p->tos[toindex].count;
|
||||
write(fd, &rawarc, sizeof rawarc);
|
||||
_libc_write(fd, &rawarc, sizeof rawarc);
|
||||
}
|
||||
}
|
||||
close(fd);
|
||||
_libc_close(fd);
|
||||
}
|
||||
|
||||
/*
|
||||
|
@ -39,3 +39,26 @@
|
||||
*/
|
||||
|
||||
#include <machine/asm.h>
|
||||
|
||||
/* Already defined in machine/asm.h. */
|
||||
#undef ENTRY
|
||||
|
||||
#define MCOUNT call PIC_PLT(HIDENAME(mcount))
|
||||
#define MEXITCOUNT call PIC_PLT(HIDENAME(mexitcount))
|
||||
|
||||
#ifdef PROF
|
||||
/*
|
||||
* XXX Looks good to me, but it sure looks different than the original...
|
||||
* (jasone)
|
||||
*/
|
||||
#define ENTRY(name) _ENTRY(name) ; 9: ; MCOUNT
|
||||
/* #define ENTRY(name) _ENTRY(name) ; 9: \ */
|
||||
/* pushl %ebp; movl %esp,%ebp; \ */
|
||||
/* call PIC_PLT(HIDENAME(mcount)); \ */
|
||||
/* popl %ebp */
|
||||
|
||||
#define ALTENTRY(name) _ENTRY(name) ; MCOUNT ; MEXITCOUNT ; jmp 9f
|
||||
#else
|
||||
#define ENTRY(name) _ENTRY(name)
|
||||
#define ALTENTRY(name) _ENTRY(name)
|
||||
#endif
|
||||
|
@ -43,15 +43,20 @@
|
||||
|
||||
#define SYSCALL(x) 2: PIC_PROLOGUE; jmp PIC_PLT(HIDENAME(cerror)); \
|
||||
ENTRY(__CONCAT(_,x)); \
|
||||
.weak CNAME(__CONCAT(_libc_,x)); \
|
||||
.set CNAME(__CONCAT(_libc_,x)),CNAME(__CONCAT(_,x)); \
|
||||
.weak CNAME(x); \
|
||||
.set CNAME(x),CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(x),CNAME(__CONCAT(_libc_,x)); \
|
||||
lea __CONCAT(SYS_,x),%eax; KERNCALL; jb 2b
|
||||
#define RSYSCALL(x) SYSCALL(x); ret
|
||||
|
||||
#define PSEUDO(x,y) ENTRY(__CONCAT(_,x)); \
|
||||
.weak CNAME(__CONCAT(_libc_,x)); \
|
||||
.set CNAME(__CONCAT(_libc_,x)),CNAME(__CONCAT(_,x)); \
|
||||
.weak CNAME(x); \
|
||||
.set CNAME(x),CNAME(__CONCAT(_,x)); \
|
||||
.set CNAME(x),CNAME(__CONCAT(_libc_,x)); \
|
||||
lea __CONCAT(SYS_,y), %eax; KERNCALL; ret
|
||||
|
||||
/* gas messes up offset -- although we don't currently need it, do for BCS */
|
||||
#define LCALL(x,y) .byte 0x9a ; .long y; .word x
|
||||
|
||||
|
@ -53,7 +53,9 @@
|
||||
|
||||
#include "DEFS.h"
|
||||
|
||||
ENTRY(_setjmp)
|
||||
ALTENTRY(_setjmp)
|
||||
ALTENTRY(_libc__setjmp)
|
||||
ENTRY(___setjmp)
|
||||
movl 4(%esp),%eax
|
||||
movl 0(%esp),%edx
|
||||
movl %edx, 0(%eax) /* rta */
|
||||
@ -66,7 +68,9 @@ ENTRY(_setjmp)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
ENTRY(_longjmp)
|
||||
ALTENTRY(_longjmp)
|
||||
ALTENTRY(_libc__longjmp)
|
||||
ENTRY(___longjmp)
|
||||
movl 4(%esp),%edx
|
||||
movl 8(%esp),%eax
|
||||
movl 0(%edx),%ecx
|
||||
|
@ -54,8 +54,9 @@
|
||||
#include "DEFS.h"
|
||||
#include "SYS.h"
|
||||
|
||||
.globl CNAME(__setjmp); CNAME(__setjmp):
|
||||
ENTRY(setjmp)
|
||||
ALTENTRY(setjmp)
|
||||
ALTENTRY(_libc_setjmp)
|
||||
ENTRY(__setjmp)
|
||||
movl 4(%esp),%ecx
|
||||
PIC_PROLOGUE
|
||||
leal 28(%ecx), %eax
|
||||
@ -81,8 +82,9 @@ ENTRY(setjmp)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
.globl CNAME(__longjmp); CNAME(__longjmp):
|
||||
ENTRY(longjmp)
|
||||
ALTENTRY(longjmp)
|
||||
ALTENTRY(_libc_longjmp)
|
||||
ENTRY(__longjmp)
|
||||
movl 4(%esp),%edx
|
||||
PIC_PROLOGUE
|
||||
pushl $0 /* (sigset_t*)oset */
|
||||
|
@ -59,8 +59,9 @@
|
||||
* use sigreturn() if sigreturn() works.
|
||||
*/
|
||||
|
||||
.globl CNAME(__sigsetjmp); CNAME(__sigsetjmp):
|
||||
ENTRY(sigsetjmp)
|
||||
ALTENTRY(sigsetjmp)
|
||||
ALTENTRY(_libc_sigsetjmp)
|
||||
ENTRY(__sigsetjmp)
|
||||
movl 8(%esp),%eax
|
||||
movl 4(%esp),%ecx
|
||||
movl %eax,44(%ecx)
|
||||
@ -90,8 +91,9 @@ ENTRY(sigsetjmp)
|
||||
xorl %eax,%eax
|
||||
ret
|
||||
|
||||
.globl CNAME(__siglongjmp); CNAME(__siglongjmp):
|
||||
ENTRY(siglongjmp)
|
||||
ALTENTRY(siglongjmp)
|
||||
ALTENTRY(_libc_siglongjmp)
|
||||
ENTRY(__siglongjmp)
|
||||
movl 4(%esp),%edx
|
||||
cmpl $0,44(%edx)
|
||||
jz 2f
|
||||
|
@ -177,14 +177,14 @@ __collate_err(int ex, const char *f)
|
||||
int serrno = errno;
|
||||
|
||||
s = __progname;
|
||||
write(STDERR_FILENO, s, strlen(s));
|
||||
write(STDERR_FILENO, ": ", 2);
|
||||
_libc_write(STDERR_FILENO, s, strlen(s));
|
||||
_libc_write(STDERR_FILENO, ": ", 2);
|
||||
s = f;
|
||||
write(STDERR_FILENO, s, strlen(s));
|
||||
write(STDERR_FILENO, ": ", 2);
|
||||
_libc_write(STDERR_FILENO, s, strlen(s));
|
||||
_libc_write(STDERR_FILENO, ": ", 2);
|
||||
s = strerror(serrno);
|
||||
write(STDERR_FILENO, s, strlen(s));
|
||||
write(STDERR_FILENO, "\n", 1);
|
||||
_libc_write(STDERR_FILENO, s, strlen(s));
|
||||
_libc_write(STDERR_FILENO, "\n", 1);
|
||||
exit(ex);
|
||||
}
|
||||
|
||||
|
@ -482,7 +482,7 @@ explore_fqdn(pai, hostname, servname, res)
|
||||
s = socket(pai->ai_family, SOCK_DGRAM, 0);
|
||||
if (s < 0)
|
||||
return 0;
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
|
||||
/*
|
||||
* if the servname does not match socktype/protocol, ignore it.
|
||||
@ -590,7 +590,7 @@ explore_null(pai, hostname, servname, res)
|
||||
s = socket(pai->ai_family, SOCK_DGRAM, 0);
|
||||
if (s < 0)
|
||||
return 0;
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
afd = find_afd(pai->ai_family);
|
||||
if (afd == NULL)
|
||||
return 0;
|
||||
|
@ -257,7 +257,7 @@ _ghbyname(const char *name, int af, int flags, int *errp)
|
||||
* (or apropriate interval),
|
||||
* because addresses will be dynamically assigned or deleted.
|
||||
*/
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
}
|
||||
|
||||
for (i = 0; i < MAXHOSTCONF; i++) {
|
||||
@ -1182,21 +1182,21 @@ _icmp_fqdn_query(const struct in6_addr *addr, int ifindex)
|
||||
(char *)&filter, sizeof(filter));
|
||||
cc = sendmsg(s, &msg, 0);
|
||||
if (cc < 0) {
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
return NULL;
|
||||
}
|
||||
FD_SET(s, &s_fds);
|
||||
for (;;) {
|
||||
fds = s_fds;
|
||||
if (select(s + 1, &fds, NULL, NULL, &tout) <= 0) {
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
return NULL;
|
||||
}
|
||||
len = sizeof(sin6);
|
||||
cc = recvfrom(s, buf, sizeof(buf), 0,
|
||||
(struct sockaddr *)&sin6, &len);
|
||||
if (cc <= 0) {
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
return NULL;
|
||||
}
|
||||
if (cc < sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr))
|
||||
@ -1207,7 +1207,7 @@ _icmp_fqdn_query(const struct in6_addr *addr, int ifindex)
|
||||
if (fr->icmp6_fqdn_type == ICMP6_FQDN_REPLY)
|
||||
break;
|
||||
}
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
if (fr->icmp6_fqdn_cookie[1] != 0) {
|
||||
/* rfc1788 type */
|
||||
name = buf + sizeof(struct ip6_hdr) + sizeof(struct icmp6_hdr) + 4;
|
||||
|
@ -101,7 +101,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
sigsetmask(oldmask);
|
||||
return (-1);
|
||||
}
|
||||
fcntl(s, F_SETOWN, pid);
|
||||
_libc_fcntl(s, F_SETOWN, pid);
|
||||
bzero(&sin, sizeof sin);
|
||||
sin.sin_len = sizeof(struct sockaddr_in);
|
||||
sin.sin_family = hp->h_addrtype;
|
||||
@ -109,13 +109,13 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
bcopy(hp->h_addr_list[0], &sin.sin_addr, MIN(hp->h_length, sizeof sin.sin_addr));
|
||||
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
|
||||
break;
|
||||
(void)close(s);
|
||||
(void)_libc_close(s);
|
||||
if (errno == EADDRINUSE) {
|
||||
lport--;
|
||||
continue;
|
||||
}
|
||||
if (errno == ECONNREFUSED && timo <= 16) {
|
||||
(void)sleep(timo);
|
||||
(void)_libc_sleep(timo);
|
||||
timo *= 2;
|
||||
continue;
|
||||
}
|
||||
@ -138,7 +138,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
}
|
||||
lport--;
|
||||
if (fd2p == 0) {
|
||||
write(s, "", 1);
|
||||
_libc_write(s, "", 1);
|
||||
lport = 0;
|
||||
} else {
|
||||
char num[8];
|
||||
@ -150,17 +150,17 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
goto bad;
|
||||
listen(s2, 1);
|
||||
(void)snprintf(num, sizeof(num), "%d", lport);
|
||||
if (write(s, num, strlen(num)+1) != strlen(num)+1) {
|
||||
if (_libc_write(s, num, strlen(num)+1) != strlen(num)+1) {
|
||||
(void)fprintf(stderr,
|
||||
"rcmd: write (setting up stderr): %s\n",
|
||||
strerror(errno));
|
||||
(void)close(s2);
|
||||
(void)_libc_close(s2);
|
||||
goto bad;
|
||||
}
|
||||
nfds = max(s, s2)+1;
|
||||
if(nfds > FD_SETSIZE) {
|
||||
fprintf(stderr, "rcmd: too many files\n");
|
||||
(void)close(s2);
|
||||
(void)_libc_close(s2);
|
||||
goto bad;
|
||||
}
|
||||
again:
|
||||
@ -176,7 +176,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
else
|
||||
(void)fprintf(stderr,
|
||||
"select: protocol failure in circuit setup\n");
|
||||
(void)close(s2);
|
||||
(void)_libc_close(s2);
|
||||
goto bad;
|
||||
}
|
||||
s3 = accept(s2, (struct sockaddr *)&from, &len);
|
||||
@ -185,10 +185,10 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
* down and check for the real auxiliary channel to connect.
|
||||
*/
|
||||
if (from.sin_family == AF_INET && from.sin_port == htons(20)) {
|
||||
close(s3);
|
||||
_libc_close(s3);
|
||||
goto again;
|
||||
}
|
||||
(void)close(s2);
|
||||
(void)_libc_close(s2);
|
||||
if (s3 < 0) {
|
||||
(void)fprintf(stderr,
|
||||
"rcmd: accept: %s\n", strerror(errno));
|
||||
@ -205,17 +205,17 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
goto bad2;
|
||||
}
|
||||
}
|
||||
(void)write(s, locuser, strlen(locuser)+1);
|
||||
(void)write(s, remuser, strlen(remuser)+1);
|
||||
(void)write(s, cmd, strlen(cmd)+1);
|
||||
if (read(s, &c, 1) != 1) {
|
||||
(void)_libc_write(s, locuser, strlen(locuser)+1);
|
||||
(void)_libc_write(s, remuser, strlen(remuser)+1);
|
||||
(void)_libc_write(s, cmd, strlen(cmd)+1);
|
||||
if (_libc_read(s, &c, 1) != 1) {
|
||||
(void)fprintf(stderr,
|
||||
"rcmd: %s: %s\n", *ahost, strerror(errno));
|
||||
goto bad2;
|
||||
}
|
||||
if (c != 0) {
|
||||
while (read(s, &c, 1) == 1) {
|
||||
(void)write(STDERR_FILENO, &c, 1);
|
||||
while (_libc_read(s, &c, 1) == 1) {
|
||||
(void)_libc_write(STDERR_FILENO, &c, 1);
|
||||
if (c == '\n')
|
||||
break;
|
||||
}
|
||||
@ -225,9 +225,9 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
|
||||
return (s);
|
||||
bad2:
|
||||
if (lport)
|
||||
(void)close(*fd2p);
|
||||
(void)_libc_close(*fd2p);
|
||||
bad:
|
||||
(void)close(s);
|
||||
(void)_libc_close(s);
|
||||
sigsetmask(oldmask);
|
||||
return (-1);
|
||||
}
|
||||
@ -251,13 +251,13 @@ rresvport(alport)
|
||||
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
|
||||
return (s);
|
||||
if (errno != EADDRINUSE) {
|
||||
(void)close(s);
|
||||
(void)_libc_close(s);
|
||||
return (-1);
|
||||
}
|
||||
#endif
|
||||
sin.sin_port = 0;
|
||||
if (bindresvport(s, &sin) == -1) {
|
||||
(void)close(s);
|
||||
(void)_libc_close(s);
|
||||
return (-1);
|
||||
}
|
||||
*alport = (int)ntohs(sin.sin_port);
|
||||
|
@ -428,7 +428,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
read_len:
|
||||
cp = ans;
|
||||
len = INT16SZ;
|
||||
while ((n = read(s, (char *)cp, (int)len)) > 0) {
|
||||
while ((n = _libc_read(s, (char *)cp, (int)len)) > 0) {
|
||||
cp += n;
|
||||
if ((len -= n) <= 0)
|
||||
break;
|
||||
@ -476,7 +476,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
}
|
||||
cp = ans;
|
||||
while (len != 0 &&
|
||||
(n = read(s, (char *)cp, (int)len)) > 0) {
|
||||
(n = _libc_read(s, (char *)cp, (int)len)) > 0) {
|
||||
cp += n;
|
||||
len -= n;
|
||||
}
|
||||
@ -499,7 +499,7 @@ res_send(buf, buflen, ans, anssiz)
|
||||
n = (len > sizeof(junk)
|
||||
? sizeof(junk)
|
||||
: len);
|
||||
if ((n = read(s, junk, n)) > 0)
|
||||
if ((n = _libc_read(s, junk, n)) > 0)
|
||||
len -= n;
|
||||
else
|
||||
break;
|
||||
@ -607,8 +607,8 @@ res_send(buf, buflen, ans, anssiz)
|
||||
int s1 = socket(PF_INET, SOCK_DGRAM,0);
|
||||
if (s1 < 0)
|
||||
goto bad_dg_sock;
|
||||
(void) dup2(s1, s);
|
||||
(void) close(s1);
|
||||
(void)dup2(s1, s);
|
||||
(void)_libc_close(s1);
|
||||
Dprint(_res.options & RES_DEBUG,
|
||||
(stdout, ";; new DG socket\n"))
|
||||
#endif /* CAN_RECONNECT */
|
||||
@ -893,7 +893,7 @@ void
|
||||
res_close()
|
||||
{
|
||||
if (s >= 0) {
|
||||
(void) close(s);
|
||||
(void)_libc_close(s);
|
||||
s = -1;
|
||||
connected = 0;
|
||||
vc = 0;
|
||||
|
@ -285,7 +285,7 @@ nl_catd catd;
|
||||
return -1;
|
||||
}
|
||||
|
||||
if (cat->loadType != MCLoadAll) close(cat->fd);
|
||||
if (cat->loadType != MCLoadAll) _libc_close(cat->fd);
|
||||
for (i = 0; i < cat->numSets; ++i) {
|
||||
set = cat->sets + i;
|
||||
if (!set->invalid) {
|
||||
@ -321,14 +321,15 @@ __const char *catpath;
|
||||
if (!cat) return(NLERR);
|
||||
cat->loadType = MCLoadBySet;
|
||||
|
||||
if ((cat->fd = open(catpath, O_RDONLY)) < 0) {
|
||||
if ((cat->fd = _libc_open(catpath, O_RDONLY)) < 0) {
|
||||
free(cat);
|
||||
return(NLERR);
|
||||
}
|
||||
|
||||
(void)fcntl(cat->fd, F_SETFD, FD_CLOEXEC);
|
||||
(void)_libc_fcntl(cat->fd, F_SETFD, FD_CLOEXEC);
|
||||
|
||||
if (read(cat->fd, &header, sizeof(header)) != sizeof(header)) CORRUPT();
|
||||
if (_libc_read(cat->fd, &header, sizeof(header)) != sizeof(header))
|
||||
CORRUPT();
|
||||
|
||||
if (strncmp(header.magic, MCMagic, MCMagicLen) != 0) CORRUPT();
|
||||
|
||||
@ -368,7 +369,7 @@ __const char *catpath;
|
||||
|
||||
/* read in the set header */
|
||||
set = cat->sets + i;
|
||||
if (read(cat->fd, set, sizeof(*set)) != sizeof(*set)) {
|
||||
if (_libc_read(cat->fd, set, sizeof(*set)) != sizeof(*set)) {
|
||||
for (j = 0; j < i; j++) {
|
||||
set = cat->sets + j;
|
||||
if (!set->invalid) {
|
||||
@ -407,7 +408,7 @@ __const char *catpath;
|
||||
nextSet = set->nextSet;
|
||||
}
|
||||
if (cat->loadType == MCLoadAll) {
|
||||
close(cat->fd);
|
||||
_libc_close(cat->fd);
|
||||
cat->fd = -1;
|
||||
}
|
||||
return((nl_catd) cat);
|
||||
@ -423,7 +424,7 @@ MCSetT *set;
|
||||
/* Get the data */
|
||||
if (lseek(cat->fd, set->data.off, 0) == -1) return(0);
|
||||
if ((set->data.str = malloc(set->dataLen)) == NULL) return(-1);
|
||||
if (read(cat->fd, set->data.str, set->dataLen) != set->dataLen) {
|
||||
if (_libc_read(cat->fd, set->data.str, set->dataLen) != set->dataLen) {
|
||||
free(set->data.str); return(0);
|
||||
}
|
||||
|
||||
@ -437,7 +438,7 @@ MCSetT *set;
|
||||
|
||||
for (i = 0; i < set->numMsgs; ++i) {
|
||||
msg = set->u.msgs + i;
|
||||
if (read(cat->fd, msg, sizeof(*msg)) != sizeof(*msg)) {
|
||||
if (_libc_read(cat->fd, msg, sizeof(*msg)) != sizeof(*msg)) {
|
||||
free(set->u.msgs); free(set->data.str); return(0);
|
||||
}
|
||||
if (msg->invalid) {
|
||||
|
@ -28,6 +28,8 @@
|
||||
*
|
||||
* NOTE: This code has had the crap beaten out it in order to convert
|
||||
* it from TI-RPC back to TD-RPC for use on FreeBSD.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
#include <stdio.h>
|
||||
#include <syslog.h>
|
||||
@ -435,7 +437,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
|
||||
msg("alarm caught it, must be unreachable.");
|
||||
goto error;
|
||||
}
|
||||
res = read(s, (char *)&thetime, sizeof(thetime));
|
||||
res = _libc_read(s, (char *)&thetime, sizeof(thetime));
|
||||
if (res != sizeof(thetime)) {
|
||||
if (saw_alarm)
|
||||
msg("timed out TCP call.");
|
||||
@ -447,7 +449,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
|
||||
time_valid = 1;
|
||||
}
|
||||
save = errno;
|
||||
(void) close(s);
|
||||
(void)_libc_close(s);
|
||||
errno = save;
|
||||
s = RPC_ANYSOCK;
|
||||
|
||||
@ -466,7 +468,7 @@ __rpc_get_time_offset(td, srv, thost, uaddr, netid)
|
||||
*/
|
||||
|
||||
if (s != RPC_ANYSOCK)
|
||||
(void) close(s);
|
||||
(void)_libc_close(s);
|
||||
|
||||
if (clnt != NULL)
|
||||
clnt_destroy(clnt);
|
||||
|
@ -86,7 +86,7 @@ callrpc(host, prognum, versnum, procnum, inproc, in, outproc, out)
|
||||
} else {
|
||||
crp->valid = 0;
|
||||
if (crp->socket != -1)
|
||||
(void)close(crp->socket);
|
||||
(void)_libc_close(crp->socket);
|
||||
crp->socket = RPC_ANYSOCK;
|
||||
if (crp->client) {
|
||||
clnt_destroy(crp->client);
|
||||
|
@ -167,7 +167,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
|
||||
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
||||
rpc_createerr.cf_error.re_errno = errno;
|
||||
if (*sockp != -1)
|
||||
(void)close(*sockp);
|
||||
(void)_libc_close(*sockp);
|
||||
goto fooy;
|
||||
}
|
||||
ct->ct_closeit = TRUE;
|
||||
@ -200,7 +200,7 @@ clnttcp_create(raddr, prog, vers, sockp, sendsz, recvsz)
|
||||
XDR_ENCODE);
|
||||
if (! xdr_callhdr(&(ct->ct_xdrs), &call_msg)) {
|
||||
if (ct->ct_closeit) {
|
||||
(void)close(*sockp);
|
||||
(void)_libc_close(*sockp);
|
||||
}
|
||||
goto fooy;
|
||||
}
|
||||
@ -474,7 +474,7 @@ clnttcp_destroy(h)
|
||||
(struct ct_data *) h->cl_private;
|
||||
|
||||
if (ct->ct_closeit) {
|
||||
(void)close(ct->ct_sock);
|
||||
(void)_libc_close(ct->ct_sock);
|
||||
}
|
||||
XDR_DESTROY(&(ct->ct_xdrs));
|
||||
mem_free((caddr_t)ct, sizeof(struct ct_data));
|
||||
@ -544,7 +544,7 @@ readtcp(ct, buf, len)
|
||||
}
|
||||
break;
|
||||
}
|
||||
switch (len = read(ct->ct_sock, buf, len)) {
|
||||
switch (len = _libc_read(ct->ct_sock, buf, len)) {
|
||||
|
||||
case 0:
|
||||
/* premature eof */
|
||||
@ -570,7 +570,7 @@ writetcp(ct, buf, len)
|
||||
register int i, cnt;
|
||||
|
||||
for (cnt = len; cnt > 0; cnt -= i, buf += i) {
|
||||
if ((i = write(ct->ct_sock, buf, cnt)) == -1) {
|
||||
if ((i = _libc_write(ct->ct_sock, buf, cnt)) == -1) {
|
||||
ct->ct_error.re_errno = errno;
|
||||
ct->ct_error.re_status = RPC_CANTSEND;
|
||||
return (-1);
|
||||
|
@ -559,7 +559,7 @@ clntudp_destroy(cl)
|
||||
register struct cu_data *cu = (struct cu_data *)cl->cl_private;
|
||||
|
||||
if (cu->cu_closeit) {
|
||||
(void)close(cu->cu_sock);
|
||||
(void)_libc_close(cu->cu_sock);
|
||||
}
|
||||
XDR_DESTROY(&(cu->cu_outxdrs));
|
||||
mem_free((caddr_t)cu, (sizeof(*cu) + cu->cu_sendsz + cu->cu_recvsz));
|
||||
|
@ -158,7 +158,7 @@ clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
|
||||
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
|
||||
rpc_createerr.cf_error.re_errno = errno;
|
||||
if (*sockp != -1)
|
||||
(void)close(*sockp);
|
||||
(void)_libc_close(*sockp);
|
||||
goto fooy;
|
||||
}
|
||||
ct->ct_closeit = TRUE;
|
||||
@ -191,7 +191,7 @@ clntunix_create(raddr, prog, vers, sockp, sendsz, recvsz)
|
||||
XDR_ENCODE);
|
||||
if (! xdr_callhdr(&(ct->ct_xdrs), &call_msg)) {
|
||||
if (ct->ct_closeit) {
|
||||
(void)close(*sockp);
|
||||
(void)_libc_close(*sockp);
|
||||
}
|
||||
goto fooy;
|
||||
}
|
||||
@ -465,7 +465,7 @@ clntunix_destroy(h)
|
||||
(struct ct_data *) h->cl_private;
|
||||
|
||||
if (ct->ct_closeit) {
|
||||
(void)close(ct->ct_sock);
|
||||
(void)_libc_close(ct->ct_sock);
|
||||
}
|
||||
XDR_DESTROY(&(ct->ct_xdrs));
|
||||
mem_free((caddr_t)ct, sizeof(struct ct_data));
|
||||
|
@ -73,7 +73,7 @@ get_myaddress(addr)
|
||||
ifc.ifc_len = sizeof (buf);
|
||||
ifc.ifc_buf = buf;
|
||||
if (ioctl(s, SIOCGIFCONF, (char *)&ifc) < 0) {
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
return(-1);
|
||||
}
|
||||
again:
|
||||
@ -83,7 +83,7 @@ get_myaddress(addr)
|
||||
while (ifr < end) {
|
||||
ifreq = *ifr;
|
||||
if (ioctl(s, SIOCGIFFLAGS, (char *)&ifreq) < 0) {
|
||||
close(s);
|
||||
_libc_close(s);
|
||||
return(-1);
|
||||
}
|
||||
if (((ifreq.ifr_flags & IFF_UP) &&
|
||||
@ -107,6 +107,6 @@ get_myaddress(addr)
|
||||
loopback = 1;
|
||||
goto again;
|
||||
}
|
||||
(void) close(s);
|
||||
(void)_libc_close(s);
|
||||
return (gotit ? 0 : -1);
|
||||
}
|
||||
|
@ -28,6 +28,8 @@
|
||||
*/
|
||||
/*
|
||||
* Copyright (c) 1986-1991 by Sun Microsystems Inc.
|
||||
*
|
||||
* $FreeBSD$
|
||||
*/
|
||||
|
||||
#ident "@(#)key_call.c 1.25 94/04/24 SMI"
|
||||
@ -367,7 +369,7 @@ int vers;
|
||||
(void) clnt_control(kcp->client, CLSET_RETRY_TIMEOUT,
|
||||
(char *)&wait_time);
|
||||
if (clnt_control(kcp->client, CLGET_FD, (char *)&fd))
|
||||
fcntl(fd, F_SETFD, 1); /* make it "close on exec" */
|
||||
_libc_fcntl(fd, F_SETFD, 1); /* make it "close on exec" */
|
||||
|
||||
return (kcp->client);
|
||||
}
|
||||
|
@ -102,7 +102,7 @@ pmap_set(program, version, protocol, port)
|
||||
}
|
||||
CLNT_DESTROY(client);
|
||||
if (socket != -1)
|
||||
(void)close(socket);
|
||||
(void)_libc_close(socket);
|
||||
return (rslt);
|
||||
}
|
||||
|
||||
@ -144,6 +144,6 @@ pmap_unset(program, version)
|
||||
tottimeout);
|
||||
CLNT_DESTROY(client);
|
||||
if (socket != -1)
|
||||
(void)close(socket);
|
||||
(void)_libc_close(socket);
|
||||
return (rslt);
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ pmap_getmaps(address)
|
||||
CLNT_DESTROY(client);
|
||||
}
|
||||
if (socket != -1)
|
||||
(void)close(socket);
|
||||
(void)_libc_close(socket);
|
||||
address->sin_port = 0;
|
||||
return (head);
|
||||
}
|
||||
|
@ -85,7 +85,7 @@ pmap_getport(address, program, version, protocol)
|
||||
CLNT_DESTROY(client);
|
||||
}
|
||||
if (socket != -1)
|
||||
(void)close(socket);
|
||||
(void)_libc_close(socket);
|
||||
address->sin_port = 0;
|
||||
return (port);
|
||||
}
|
||||
|
@ -98,7 +98,7 @@ pmap_rmtcall(addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_pt
|
||||
stat = RPC_FAILED;
|
||||
}
|
||||
if (socket != -1)
|
||||
(void)close(socket);
|
||||
(void)_libc_close(socket);
|
||||
addr->sin_port = 0;
|
||||
return (stat);
|
||||
}
|
||||
@ -408,7 +408,7 @@ clnt_broadcast(prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
|
||||
if (fds != &readfds)
|
||||
free(fds);
|
||||
if (sock >= 0)
|
||||
(void)close(sock);
|
||||
(void)_libc_close(sock);
|
||||
AUTH_DESTROY(unix_auth);
|
||||
return (stat);
|
||||
}
|
||||
|
@ -129,7 +129,7 @@ rtime(addrp, timep, timeout)
|
||||
do_close(s);
|
||||
return(-1);
|
||||
}
|
||||
res = read(s, (char *)&thetime, sizeof(thetime));
|
||||
res = _libc_read(s, (char *)&thetime, sizeof(thetime));
|
||||
do_close(s);
|
||||
if (res < 0) {
|
||||
return(-1);
|
||||
@ -152,6 +152,6 @@ do_close(s)
|
||||
int save;
|
||||
|
||||
save = errno;
|
||||
(void) close(s);
|
||||
(void)_libc_close(s);
|
||||
errno = save;
|
||||
}
|
||||
|
@ -145,7 +145,7 @@ svctcp_create(sock, sendsize, recvsize)
|
||||
if (ioctl(sock, FIONBIO, &on) < 0) {
|
||||
perror("svc_tcp.c - cannot turn on non-blocking mode");
|
||||
if (madesock)
|
||||
(void)close(sock);
|
||||
(void)_libc_close(sock);
|
||||
return ((SVCXPRT *)NULL);
|
||||
}
|
||||
memset(&addr, 0, sizeof (addr));
|
||||
@ -159,7 +159,7 @@ svctcp_create(sock, sendsize, recvsize)
|
||||
(listen(sock, 2) != 0)) {
|
||||
perror("svctcp_.c - cannot getsockname or listen");
|
||||
if (madesock)
|
||||
(void)close(sock);
|
||||
(void)_libc_close(sock);
|
||||
return ((SVCXPRT *)NULL);
|
||||
}
|
||||
r = (struct tcp_rendezvous *)mem_alloc(sizeof(*r));
|
||||
@ -257,7 +257,7 @@ rendezvous_request(xprt)
|
||||
* Guard against FTP bounce attacks.
|
||||
*/
|
||||
if (addr.sin_port == htons(20)) {
|
||||
close(sock);
|
||||
_libc_close(sock);
|
||||
return (FALSE);
|
||||
}
|
||||
/*
|
||||
@ -265,7 +265,7 @@ rendezvous_request(xprt)
|
||||
*/
|
||||
off = 0;
|
||||
if (ioctl(sock, FIONBIO, &off) < 0) {
|
||||
close(sock);
|
||||
_libc_close(sock);
|
||||
return (FALSE);
|
||||
}
|
||||
/*
|
||||
@ -291,7 +291,7 @@ svctcp_destroy(xprt)
|
||||
register struct tcp_conn *cd = (struct tcp_conn *)xprt->xp_p1;
|
||||
|
||||
xprt_unregister(xprt);
|
||||
(void)close(xprt->xp_sock);
|
||||
(void)_libc_close(xprt->xp_sock);
|
||||
if (xprt->xp_port != 0) {
|
||||
/* a rendezvouser socket */
|
||||
xprt->xp_port = 0;
|
||||
@ -376,7 +376,7 @@ readtcp(xprt, buf, len)
|
||||
}
|
||||
}
|
||||
} while (!FD_ISSET(sock, fds));
|
||||
if ((len = read(sock, buf, len)) > 0) {
|
||||
if ((len = _libc_read(sock, buf, len)) > 0) {
|
||||
if (fds != NULL)
|
||||
free(fds);
|
||||
return (len);
|
||||
@ -401,7 +401,7 @@ writetcp(xprt, buf, len)
|
||||
register int i, cnt;
|
||||
|
||||
for (cnt = len; cnt > 0; cnt -= i, buf += i) {
|
||||
if ((i = write(xprt->xp_sock, buf, cnt)) < 0) {
|
||||
if ((i = _libc_write(xprt->xp_sock, buf, cnt)) < 0) {
|
||||
((struct tcp_conn *)(xprt->xp_p1))->strm_stat =
|
||||
XPRT_DIED;
|
||||
return (-1);
|
||||
|
@ -123,7 +123,7 @@ svcudp_bufcreate(sock, sendsz, recvsz)
|
||||
if (getsockname(sock, (struct sockaddr *)&addr, &len) != 0) {
|
||||
perror("svcudp_create - cannot getsockname");
|
||||
if (madesock)
|
||||
(void)close(sock);
|
||||
(void)_libc_close(sock);
|
||||
return ((SVCXPRT *)NULL);
|
||||
}
|
||||
xprt = (SVCXPRT *)mem_alloc(sizeof(SVCXPRT));
|
||||
@ -259,7 +259,7 @@ svcudp_destroy(xprt)
|
||||
register struct svcudp_data *su = su_data(xprt);
|
||||
|
||||
xprt_unregister(xprt);
|
||||
(void)close(xprt->xp_sock);
|
||||
(void)_libc_close(xprt->xp_sock);
|
||||
XDR_DESTROY(&(su->su_xdrs));
|
||||
mem_free(rpc_buffer(xprt), su->su_iosz);
|
||||
mem_free((caddr_t)su, sizeof(struct svcudp_data));
|
||||
|
@ -213,7 +213,7 @@ svcunix_create(sock, sendsize, recvsize, path)
|
||||
(listen(sock, 2) != 0)) {
|
||||
perror("svc_unix.c - cannot getsockname or listen");
|
||||
if (madesock)
|
||||
(void)close(sock);
|
||||
(void)_libc_close(sock);
|
||||
return ((SVCXPRT *)NULL);
|
||||
}
|
||||
r = (struct unix_rendezvous *)mem_alloc(sizeof(*r));
|
||||
@ -333,7 +333,7 @@ svcunix_destroy(xprt)
|
||||
register struct unix_conn *cd = (struct unix_conn *)xprt->xp_p1;
|
||||
|
||||
xprt_unregister(xprt);
|
||||
(void)close(xprt->xp_sock);
|
||||
(void)_libc_close(xprt->xp_sock);
|
||||
if (xprt->xp_port != 0) {
|
||||
/* a rendezvouser socket */
|
||||
xprt->xp_port = 0;
|
||||
|
@ -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)
|
||||
@ -61,7 +63,7 @@ fdopen(fd, mode)
|
||||
return (NULL);
|
||||
|
||||
/* Make sure the mode the user wants is a subset of the actual mode. */
|
||||
if ((fdflags = fcntl(fd, F_GETFL, 0)) < 0)
|
||||
if ((fdflags = _libc_fcntl(fd, F_GETFL, 0)) < 0)
|
||||
return (NULL);
|
||||
tmp = fdflags & O_ACCMODE;
|
||||
if (tmp != O_RDWR && (tmp != (oflags & O_ACCMODE))) {
|
||||
|
@ -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)
|
||||
@ -58,7 +60,7 @@ fopen(file, mode)
|
||||
return (NULL);
|
||||
if ((fp = __sfp()) == NULL)
|
||||
return (NULL);
|
||||
if ((f = open(file, oflags, DEFFILEMODE)) < 0) {
|
||||
if ((f = _libc_open(file, oflags, DEFFILEMODE)) < 0) {
|
||||
fp->_flags = 0; /* release */
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -100,13 +100,13 @@ freopen(file, mode, fp)
|
||||
}
|
||||
|
||||
/* Get a new descriptor to refer to the new file. */
|
||||
f = open(file, oflags, DEFFILEMODE);
|
||||
f = _libc_open(file, oflags, DEFFILEMODE);
|
||||
if (f < 0 && isopen) {
|
||||
/* If out of fd's close the old one and try again. */
|
||||
if (errno == ENFILE || errno == EMFILE) {
|
||||
(void) (*fp->_close)(fp->_cookie);
|
||||
isopen = 0;
|
||||
f = open(file, oflags, DEFFILEMODE);
|
||||
f = _libc_open(file, oflags, DEFFILEMODE);
|
||||
}
|
||||
}
|
||||
sverrno = errno;
|
||||
@ -147,7 +147,7 @@ freopen(file, mode, fp)
|
||||
*/
|
||||
if (wantfd >= 0 && f != wantfd) {
|
||||
if (dup2(f, wantfd) >= 0) {
|
||||
(void) close(f);
|
||||
(void)_libc_close(f);
|
||||
f = wantfd;
|
||||
}
|
||||
}
|
||||
|
@ -59,7 +59,7 @@ gets(buf)
|
||||
"warning: this program uses gets(), which is unsafe.\n";
|
||||
|
||||
if (!warned) {
|
||||
(void) write(STDERR_FILENO, w, sizeof(w) - 1);
|
||||
(void) _libc_write(STDERR_FILENO, w, sizeof(w) - 1);
|
||||
warned = 1;
|
||||
}
|
||||
for (s = buf; (c = getchar()) != '\n';)
|
||||
|
@ -163,7 +163,7 @@ _gettemp(path, doopen, domkdir, slen)
|
||||
for (;;) {
|
||||
if (doopen) {
|
||||
if ((*doopen =
|
||||
open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0)
|
||||
_libc_open(path, O_CREAT|O_EXCL|O_RDWR, 0600)) >= 0)
|
||||
return(1);
|
||||
if (errno != EEXIST)
|
||||
return(0);
|
||||
|
@ -60,7 +60,7 @@ __sread(cookie, buf, n)
|
||||
register FILE *fp = cookie;
|
||||
register int ret;
|
||||
|
||||
ret = read(fp->_file, buf, (size_t)n);
|
||||
ret = _libc_read(fp->_file, buf, (size_t)n);
|
||||
/* if the read succeeded, update the current offset */
|
||||
if (ret >= 0)
|
||||
fp->_offset += ret;
|
||||
@ -80,7 +80,7 @@ __swrite(cookie, buf, n)
|
||||
if (fp->_flags & __SAPP)
|
||||
(void) lseek(fp->_file, (off_t)0, SEEK_END);
|
||||
fp->_flags &= ~__SOFF; /* in case FAPPEND mode is set */
|
||||
return (write(fp->_file, buf, (size_t)n));
|
||||
return (_libc_write(fp->_file, buf, (size_t)n));
|
||||
}
|
||||
|
||||
fpos_t
|
||||
@ -107,5 +107,5 @@ __sclose(cookie)
|
||||
void *cookie;
|
||||
{
|
||||
|
||||
return (close(((FILE *)cookie)->_file));
|
||||
return (_libc_close(((FILE *)cookie)->_file));
|
||||
}
|
||||
|
@ -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)
|
||||
@ -72,7 +74,7 @@ tmpfile()
|
||||
|
||||
if ((fp = fdopen(fd, "w+")) == NULL) {
|
||||
sverrno = errno;
|
||||
(void)close(fd);
|
||||
(void)_libc_close(fd);
|
||||
errno = sverrno;
|
||||
return (NULL);
|
||||
}
|
||||
|
@ -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
|
||||
*/
|
||||
|
@ -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) {
|
||||
|
@ -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 @@ realpath(path, resolved)
|
||||
}
|
||||
|
||||
/* 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);
|
||||
}
|
||||
|
@ -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);
|
||||
|
@ -1,6 +1,8 @@
|
||||
/*
|
||||
** This file is in the public domain, so clarified as of
|
||||
** June 5, 1996 by Arthur David Olson (arthur_david_olson@nih.gov).
|
||||
**
|
||||
** $FreeBSD$
|
||||
*/
|
||||
|
||||
#ifndef lint
|
||||
@ -312,7 +314,7 @@ register struct state * const sp;
|
||||
}
|
||||
if (doaccess && access(name, R_OK) != 0)
|
||||
return -1;
|
||||
if ((fid = open(name, OPEN_MODE)) == -1)
|
||||
if ((fid = _libc_open(name, OPEN_MODE)) == -1)
|
||||
return -1;
|
||||
if ((fstat(fid, &stab) < 0) || !S_ISREG(stab.st_mode))
|
||||
return -1;
|
||||
@ -323,8 +325,8 @@ register struct state * const sp;
|
||||
int ttisstdcnt;
|
||||
int ttisgmtcnt;
|
||||
|
||||
i = read(fid, buf, sizeof buf);
|
||||
if (close(fid) != 0)
|
||||
i = _libc_read(fid, buf, sizeof buf);
|
||||
if (_libc_close(fid) != 0)
|
||||
return -1;
|
||||
p = buf;
|
||||
p += (sizeof tzhp->tzh_magic) + (sizeof tzhp->tzh_reserved);
|
||||
|
@ -157,7 +157,7 @@ __time_load_locale(const char *name)
|
||||
strcat(filename, "/");
|
||||
strcat(filename, name);
|
||||
strcat(filename, "/LC_TIME");
|
||||
fd = open(filename, O_RDONLY);
|
||||
fd = _libc_open(filename, O_RDONLY);
|
||||
if (fd < 0)
|
||||
goto no_locale;
|
||||
if (fstat(fd, &st) != 0)
|
||||
@ -173,9 +173,9 @@ __time_load_locale(const char *name)
|
||||
(void) strcpy(lbuf, name);
|
||||
p = lbuf + namesize;
|
||||
plim = p + st.st_size;
|
||||
if (read(fd, p, (size_t) st.st_size) != st.st_size)
|
||||
if (_libc_read(fd, p, (size_t) st.st_size) != st.st_size)
|
||||
goto bad_lbuf;
|
||||
if (close(fd) != 0)
|
||||
if (_libc_close(fd) != 0)
|
||||
goto bad_lbuf;
|
||||
/*
|
||||
** Parse the locale file into localebuf.
|
||||
@ -211,7 +211,7 @@ __time_load_locale(const char *name)
|
||||
bad_lbuf:
|
||||
free(lbuf);
|
||||
bad_locale:
|
||||
(void) close(fd);
|
||||
(void)_libc_close(fd);
|
||||
no_locale:
|
||||
_time_using_locale = save_using_locale;
|
||||
return -1;
|
||||
|
@ -350,7 +350,7 @@ _yp_dobind(dom, ypdb)
|
||||
ysd->dom_vers = 0;
|
||||
ysd->dom_client = NULL;
|
||||
sock = dup2(save, sock);
|
||||
close(save);
|
||||
_libc_close(save);
|
||||
}
|
||||
}
|
||||
|
||||
@ -373,10 +373,10 @@ _yp_dobind(dom, ypdb)
|
||||
ysd->dom_socket = -1;
|
||||
}
|
||||
snprintf(path, sizeof(path), "%s/%s.%d", BINDINGDIR, dom, 2);
|
||||
if( (fd=open(path, O_RDONLY)) == -1) {
|
||||
if((fd = _libc_open(path, O_RDONLY)) == -1) {
|
||||
/* no binding file, YP is dead. */
|
||||
/* Try to bring it back to life. */
|
||||
close(fd);
|
||||
_libc_close(fd);
|
||||
goto skipit;
|
||||
}
|
||||
if( flock(fd, LOCK_EX|LOCK_NB) == -1 && errno==EWOULDBLOCK) {
|
||||
@ -391,7 +391,7 @@ _yp_dobind(dom, ypdb)
|
||||
|
||||
r = readv(fd, iov, 2);
|
||||
if(r != iov[0].iov_len + iov[1].iov_len) {
|
||||
close(fd);
|
||||
_libc_close(fd);
|
||||
ysd->dom_vers = -1;
|
||||
goto again;
|
||||
}
|
||||
@ -405,12 +405,12 @@ _yp_dobind(dom, ypdb)
|
||||
*(u_short *)&ybr.ypbind_resp_u.ypbind_bindinfo.ypbind_binding_port;
|
||||
|
||||
ysd->dom_server_port = ysd->dom_server_addr.sin_port;
|
||||
close(fd);
|
||||
_libc_close(fd);
|
||||
goto gotit;
|
||||
} else {
|
||||
/* no lock on binding file, YP is dead. */
|
||||
/* Try to bring it back to life. */
|
||||
close(fd);
|
||||
_libc_close(fd);
|
||||
goto skipit;
|
||||
}
|
||||
}
|
||||
@ -480,7 +480,7 @@ _yp_dobind(dom, ypdb)
|
||||
if (ypbr.ypbind_status != YPBIND_SUCC_VAL) {
|
||||
clnt_destroy(client);
|
||||
ysd->dom_vers = -1;
|
||||
sleep(_yplib_timeout/2);
|
||||
_libc_sleep(_yplib_timeout/2);
|
||||
goto again;
|
||||
}
|
||||
}
|
||||
@ -518,7 +518,7 @@ _yp_dobind(dom, ypdb)
|
||||
ysd->dom_vers = -1;
|
||||
goto again;
|
||||
}
|
||||
if( fcntl(ysd->dom_socket, F_SETFD, 1) == -1)
|
||||
if(_libc_fcntl(ysd->dom_socket, F_SETFD, 1) == -1)
|
||||
perror("fcntl: F_SETFD");
|
||||
/*
|
||||
* We want a port number associated with this socket
|
||||
@ -567,7 +567,7 @@ _yp_unbind(ypb)
|
||||
save = dup(ypb->dom_socket);
|
||||
clnt_destroy(ypb->dom_client);
|
||||
sock = dup2(save, sock);
|
||||
close(save);
|
||||
_libc_close(save);
|
||||
} else
|
||||
clnt_destroy(ypb->dom_client);
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user