1998-07-16 10:23  Ulrich Drepper  <drepper@cygnus.com>

	* argp/argp-fmtstream.c: Unify names of used global functions.
	* argp/argp-help.c: Likewise.
	* assert/assert-perr.c: Likewise
	* assert/assert.c: Likewise
	* dirent/scandir.c: Likewise
	* dirent/scandir64.c: Likewise
	* dirent/versionsort.c: Likewise
	* dirent/versionsort64.c: Likewise
	* gmon/bb_exit_func.c: Likewise.
	* gmon/gmon.c: Likewise.
	* grp/initgroups.c: Likewise.
	* iconv/gconv_conf.c: Likewise.
	* inet/getnameinfo.c: Likewise.
	* inet/getnetgrent_r.c: Likewise.
	* inet/inet_ntoa.c: Likewise.
	* inet/rcmd.c: Likewise.
	* inet/rexec.c: Likewise.
	* inet/ruserpass.c: Likewise.
	* io/fts.c: Likewise.
	* io/ftw.c: Likewise.
	* io/ftw64.c: Likewise.
	* io/getdirname.c: Likewise.
	* io/getwd.c: Likewise.
	* io/lockf.c: Likewise.
	* libio/iofdopen.c: Likewise.
	* libio/iopopen.c: Likewise.
	* login/utmp_daemon.c: Likewise.
	* malloc/mtrace.c: Likewise.
	* malloc/obstack.c
	* misc/daemon.c: Likewise.
	* misc/efgcvt_r.c: Likewise.
	* misc/err.c: Likewise.
	* misc/error.c: Likewise.
	* misc/fstab.c: Likewise.
	* misc/getpass.c: Likewise.
	* misc/getttyent.c: Likewise.
	* misc/mntent_r.c: Likewise.
	* misc/search.h: Likewise.
	* misc/syslog.c: Likewise.
	* nscd/nscd_getgr_r.c: Likewise.
	* nscd/nscd_getpw_r.c: Likewise.
	* posix/getpgrp.c: Likewise.
	* posix/wordexp.c: Likewise.
	* pwd/fgetpwent_r.c: Likewise.
	* pwd/getpw.c: Likewise.
	* resolv/herror.c: Likewise.
	* resolv/res_init.c: Likewise.
	* shadow/fgetspent_r.c: Likewise.
	* shadow/lckpwdf.c: Likewise.
	* signal/sigrelse.c: Likewise.
	* stdio-common/asprintf.c: Likewise.
	* stdio-common/dprintf.c: Likewise.
	* stdio-common/getw.c: Likewise.
	* stdio-common/putw.c: Likewise.
	* stdio-common/snprintf.c: Likewise.
	* stdio-common/sprintf.c: Likewise.
	* stdio-common/sscanf.c: Likewise.
	* stdlib/lrand48_r.c: Likewise.
	* stdlib/mrand48_r.c: Likewise.
	* string/argz-replace.c: Likewise.
	* string/envz.c: Likewise.
	* sunrpc/auth_des.c: Likewise.
	* sunrpc/auth_unix.c: Likewise.
	* sunrpc/bindrsvprt.c: Likewise.
	* sunrpc/clnt_gen.c: Likewise.
	* sunrpc/clnt_perr.c: Likewise.
	* sunrpc/clnt_simp.c: Likewise.
	* sunrpc/clnt_tcp.c: Likewise.
	* sunrpc/clnt_udp.c: Likewise.
	* sunrpc/get_myaddr.c: Likewise.
	* sunrpc/key_call.c: Likewise.
	* sunrpc/netname.c: Likewise.
	* sunrpc/openchild.c: Likewise.
	* sunrpc/pmap_rmt.c: Likewise.
	* sunrpc/rpc_dtable.c: Likewise.
	* sunrpc/rtime.c: Likewise.
	* sunrpc/svc_run.c: Likewise.
	* sunrpc/svc_simple.c: Likewise.
	* sunrpc/svc_tcp.c: Likewise.
	* sunrpc/svc_udp.c: Likewise.
	* sunrpc/svcauth_des.c: Likewise.
	* sunrpc/xdr_array.c: Likewise.
	* sunrpc/xdr_rec.c: Likewise.
	* sunrpc/xdr_ref.c: Likewise.
	* sunrpc/xdr_stdio.c: Likewise.
	* sysdeps/generic/abort.c: Likewise.
	* sysdeps/generic/dl-sysdep.c: Likewise.
	* sysdeps/generic/fstatfs64.c: Likewise.
	* sysdeps/generic/ftruncate64.c: Likewise.
	* sysdeps/generic/getrlimit64.c: Likewise.
	* sysdeps/generic/glob.c: Likewise.
	* sysdeps/generic/prof-freq.c: Likewise.
	* sysdeps/generic/putenv.c: Likewise.
	* sysdeps/generic/statfs64.c: Likewise.
	* sysdeps/generic/ttyname_r.c: Likewise.
	* sysdeps/generic/utmp_file.c: Likewise.
	* sysdeps/generic/vlimit.c: Likewise.
	* sysdeps/generic/vtimes.c: Likewise.
	* sysdeps/posix/cuserid.c: Likewise.
	* sysdeps/posix/euidaccess.c: Likewise.
	* sysdeps/posix/mkstemp.c: Likewise.
	* sysdeps/posix/mktemp.c: Likewise.
	* sysdeps/posix/pread.c: Likewise.
	* sysdeps/posix/pread64.c: Likewise.
	* sysdeps/posix/profil.c: Likewise.
	* sysdeps/posix/pwrite.c: Likewise.
	* sysdeps/posix/pwrite64.c: Likewise.
	* sysdeps/posix/sigblock.c: Likewise.
	* sysdeps/posix/sigpause.c: Likewise.
	* sysdeps/posix/ttyname.c: Likewise.
	* sysdeps/posix/ttyname_r.c: Likewise.
	* sysdeps/posix/waitid.c: Likewise.
	* sysdeps/unix/getlogin_r.c: Likewise.
	* sysdeps/unix/grantpt.c: Likewise.
	* sysdeps/unix/rewinddir.c: Likewise.
	* sysdeps/unix/sysv/linux/gethostid.c: Likewise.
	* sysdeps/unix/sysv/linux/getpt.c: Likewise.
	* sysdeps/unix/sysv/linux/if_index.c: Likewise.
	* sysdeps/unix/sysv/linux/ptsname.c: Likewise.
	* sysdeps/unix/sysv/linux/sendmsg.c: Likewise.
	* sysdeps/unix/sysv/linux/statvfs.c: Likewise.
	* sysdeps/unix/sysv/linux/ttyname.c: Likewise.
	* sysdeps/unix/sysv/linux/ttyname_r.c: Likewise.
	* sysdeps/unix/sysv/linux/ulimit.c: Likewise.
	* sysdeps/unix/sysv/linux/unlockpt.c: Likewise.
	* sysvipc/sys/shm.h: Likewise.
	* time/ctime_r.c: Likewise.
	* time/strptime.c: Likewise.
	* wcsmbs/mbrlen.c: Likewise.
	* wcsmbs/wcsdup.c: Likewise.
	* wcsmbs/wcsxfrm.c: Likewise.
	* wctype/wcfuncs.c: Likewise.

	* sysdeps/unix/sysv/linux/i386/socker.S: Change to honor NO_WEAK_ALIAS.
	* sysdeps/unix/sysv/linux/accept.S: Don't generate __ name.
	* sysdeps/unix/sysv/linux/bind.S: Likewise.
	* sysdeps/unix/sysv/linux/getsockname.S: Likewise.
	* sysdeps/unix/sysv/linux/listen.S: Likewise.
	* sysdeps/unix/sysv/linux/recvfrom.S: Likewise.
	* sysdeps/unix/sysv/linux/sendto.S: Likewise.
	* sysdeps/unix/sysv/linux/setsockopt.S: Likewise.

	* grp/fgetgrent_r.c: Use explicit locking of the stream.

	* elf/Makefile (rtld-routines): Add dl-environ.
	* sysdeps/generic/dl-environ.c: New file.

	* libio/Makefile [REENTRANT] (routines): Add iofputs_u.
	* libio/Versions: Add fputs_unlocked.
	* libio/iofputs_u.c: New file.
	* libio/stdio.h: Add prototype for fputs_unlocked.

	* sunrpc/rpc/auth.h: Use __PMT instead of __P in type definitions.
	* sunrpc/rpc/clnt.h: Likewise.
	* sunrpc/rpc/pmap_clnt.h: Likewise.
	* sunrpc/rpc/svc.h: Likewise.
	* sunrpc/rpc/xdr.h: Likewise.

	* sysdeps/i386/memchr.S: Correct for more strict gas.
	* sysdeps/i386/fpu/bits/mathinline.h: Likewise.
	* sysdeps/libm-i387/i686/s_fdim.S: Likewise.
	* sysdeps/libm-i387/i686/s_fdimf.S: Likewise.
	* sysdeps/libm-i387/i686/s_fdiml.S: Likewise.

1998-07-15  Andreas Jaeger  <aj@arthur.rhein-neckar.de>

	* configure.in: Change message for binutils version from
	2.8.1.0.17->2.8.1.0.23.

1998-07-15  Ulrich Drepper  <drepper@cygnus.com>

	* sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h: Define LOC.
	Patch by John Tobey <jtobey@banta-im.com>.
This commit is contained in:
Ulrich Drepper 1998-07-16 11:44:36 +00:00
parent e31cac9420
commit 50304ef057
164 changed files with 1173 additions and 691 deletions

176
ChangeLog
View File

@ -1,3 +1,179 @@
1998-07-16 10:23 Ulrich Drepper <drepper@cygnus.com>
* argp/argp-fmtstream.c: Unify names of used global functions.
* argp/argp-help.c: Likewise.
* assert/assert-perr.c: Likewise
* assert/assert.c: Likewise
* dirent/scandir.c: Likewise
* dirent/scandir64.c: Likewise
* dirent/versionsort.c: Likewise
* dirent/versionsort64.c: Likewise
* gmon/bb_exit_func.c: Likewise.
* gmon/gmon.c: Likewise.
* grp/initgroups.c: Likewise.
* iconv/gconv_conf.c: Likewise.
* inet/getnameinfo.c: Likewise.
* inet/getnetgrent_r.c: Likewise.
* inet/inet_ntoa.c: Likewise.
* inet/rcmd.c: Likewise.
* inet/rexec.c: Likewise.
* inet/ruserpass.c: Likewise.
* io/fts.c: Likewise.
* io/ftw.c: Likewise.
* io/ftw64.c: Likewise.
* io/getdirname.c: Likewise.
* io/getwd.c: Likewise.
* io/lockf.c: Likewise.
* libio/iofdopen.c: Likewise.
* libio/iopopen.c: Likewise.
* login/utmp_daemon.c: Likewise.
* malloc/mtrace.c: Likewise.
* malloc/obstack.c
* misc/daemon.c: Likewise.
* misc/efgcvt_r.c: Likewise.
* misc/err.c: Likewise.
* misc/error.c: Likewise.
* misc/fstab.c: Likewise.
* misc/getpass.c: Likewise.
* misc/getttyent.c: Likewise.
* misc/mntent_r.c: Likewise.
* misc/search.h: Likewise.
* misc/syslog.c: Likewise.
* nscd/nscd_getgr_r.c: Likewise.
* nscd/nscd_getpw_r.c: Likewise.
* posix/getpgrp.c: Likewise.
* posix/wordexp.c: Likewise.
* pwd/fgetpwent_r.c: Likewise.
* pwd/getpw.c: Likewise.
* resolv/herror.c: Likewise.
* resolv/res_init.c: Likewise.
* shadow/fgetspent_r.c: Likewise.
* shadow/lckpwdf.c: Likewise.
* signal/sigrelse.c: Likewise.
* stdio-common/asprintf.c: Likewise.
* stdio-common/dprintf.c: Likewise.
* stdio-common/getw.c: Likewise.
* stdio-common/putw.c: Likewise.
* stdio-common/snprintf.c: Likewise.
* stdio-common/sprintf.c: Likewise.
* stdio-common/sscanf.c: Likewise.
* stdlib/lrand48_r.c: Likewise.
* stdlib/mrand48_r.c: Likewise.
* string/argz-replace.c: Likewise.
* string/envz.c: Likewise.
* sunrpc/auth_des.c: Likewise.
* sunrpc/auth_unix.c: Likewise.
* sunrpc/bindrsvprt.c: Likewise.
* sunrpc/clnt_gen.c: Likewise.
* sunrpc/clnt_perr.c: Likewise.
* sunrpc/clnt_simp.c: Likewise.
* sunrpc/clnt_tcp.c: Likewise.
* sunrpc/clnt_udp.c: Likewise.
* sunrpc/get_myaddr.c: Likewise.
* sunrpc/key_call.c: Likewise.
* sunrpc/netname.c: Likewise.
* sunrpc/openchild.c: Likewise.
* sunrpc/pmap_rmt.c: Likewise.
* sunrpc/rpc_dtable.c: Likewise.
* sunrpc/rtime.c: Likewise.
* sunrpc/svc_run.c: Likewise.
* sunrpc/svc_simple.c: Likewise.
* sunrpc/svc_tcp.c: Likewise.
* sunrpc/svc_udp.c: Likewise.
* sunrpc/svcauth_des.c: Likewise.
* sunrpc/xdr_array.c: Likewise.
* sunrpc/xdr_rec.c: Likewise.
* sunrpc/xdr_ref.c: Likewise.
* sunrpc/xdr_stdio.c: Likewise.
* sysdeps/generic/abort.c: Likewise.
* sysdeps/generic/dl-sysdep.c: Likewise.
* sysdeps/generic/fstatfs64.c: Likewise.
* sysdeps/generic/ftruncate64.c: Likewise.
* sysdeps/generic/getrlimit64.c: Likewise.
* sysdeps/generic/glob.c: Likewise.
* sysdeps/generic/prof-freq.c: Likewise.
* sysdeps/generic/putenv.c: Likewise.
* sysdeps/generic/statfs64.c: Likewise.
* sysdeps/generic/ttyname_r.c: Likewise.
* sysdeps/generic/utmp_file.c: Likewise.
* sysdeps/generic/vlimit.c: Likewise.
* sysdeps/generic/vtimes.c: Likewise.
* sysdeps/posix/cuserid.c: Likewise.
* sysdeps/posix/euidaccess.c: Likewise.
* sysdeps/posix/mkstemp.c: Likewise.
* sysdeps/posix/mktemp.c: Likewise.
* sysdeps/posix/pread.c: Likewise.
* sysdeps/posix/pread64.c: Likewise.
* sysdeps/posix/profil.c: Likewise.
* sysdeps/posix/pwrite.c: Likewise.
* sysdeps/posix/pwrite64.c: Likewise.
* sysdeps/posix/sigblock.c: Likewise.
* sysdeps/posix/sigpause.c: Likewise.
* sysdeps/posix/ttyname.c: Likewise.
* sysdeps/posix/ttyname_r.c: Likewise.
* sysdeps/posix/waitid.c: Likewise.
* sysdeps/unix/getlogin_r.c: Likewise.
* sysdeps/unix/grantpt.c: Likewise.
* sysdeps/unix/rewinddir.c: Likewise.
* sysdeps/unix/sysv/linux/gethostid.c: Likewise.
* sysdeps/unix/sysv/linux/getpt.c: Likewise.
* sysdeps/unix/sysv/linux/if_index.c: Likewise.
* sysdeps/unix/sysv/linux/ptsname.c: Likewise.
* sysdeps/unix/sysv/linux/sendmsg.c: Likewise.
* sysdeps/unix/sysv/linux/statvfs.c: Likewise.
* sysdeps/unix/sysv/linux/ttyname.c: Likewise.
* sysdeps/unix/sysv/linux/ttyname_r.c: Likewise.
* sysdeps/unix/sysv/linux/ulimit.c: Likewise.
* sysdeps/unix/sysv/linux/unlockpt.c: Likewise.
* sysvipc/sys/shm.h: Likewise.
* time/ctime_r.c: Likewise.
* time/strptime.c: Likewise.
* wcsmbs/mbrlen.c: Likewise.
* wcsmbs/wcsdup.c: Likewise.
* wcsmbs/wcsxfrm.c: Likewise.
* wctype/wcfuncs.c: Likewise.
* sysdeps/unix/sysv/linux/i386/socker.S: Change to honor NO_WEAK_ALIAS.
* sysdeps/unix/sysv/linux/accept.S: Don't generate __ name.
* sysdeps/unix/sysv/linux/bind.S: Likewise.
* sysdeps/unix/sysv/linux/getsockname.S: Likewise.
* sysdeps/unix/sysv/linux/listen.S: Likewise.
* sysdeps/unix/sysv/linux/recvfrom.S: Likewise.
* sysdeps/unix/sysv/linux/sendto.S: Likewise.
* sysdeps/unix/sysv/linux/setsockopt.S: Likewise.
* grp/fgetgrent_r.c: Use explicit locking of the stream.
* elf/Makefile (rtld-routines): Add dl-environ.
* sysdeps/generic/dl-environ.c: New file.
* libio/Makefile [REENTRANT] (routines): Add iofputs_u.
* libio/Versions: Add fputs_unlocked.
* libio/iofputs_u.c: New file.
* libio/stdio.h: Add prototype for fputs_unlocked.
* sunrpc/rpc/auth.h: Use __PMT instead of __P in type definitions.
* sunrpc/rpc/clnt.h: Likewise.
* sunrpc/rpc/pmap_clnt.h: Likewise.
* sunrpc/rpc/svc.h: Likewise.
* sunrpc/rpc/xdr.h: Likewise.
* sysdeps/i386/memchr.S: Correct for more strict gas.
* sysdeps/i386/fpu/bits/mathinline.h: Likewise.
* sysdeps/libm-i387/i686/s_fdim.S: Likewise.
* sysdeps/libm-i387/i686/s_fdimf.S: Likewise.
* sysdeps/libm-i387/i686/s_fdiml.S: Likewise.
1998-07-15 Andreas Jaeger <aj@arthur.rhein-neckar.de>
* configure.in: Change message for binutils version from
2.8.1.0.17->2.8.1.0.23.
1998-07-15 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/sysv4/solaris2/sparc/sysdep.h: Define LOC.
Patch by John Tobey <jtobey@banta-im.com>.
1998-07-14 Ulrich Drepper <drepper@cygnus.com>
* sunrpc/auth_unix.c (authunix_create_default): Use __sysconf

View File

@ -1,5 +1,5 @@
/* Word-wrapping and line-truncating streams
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>.
@ -40,6 +40,10 @@
#define isblank(ch) ((ch)==' ' || (ch)=='\t')
#endif
#if defined _LIBC && defined USE_IN_LIBIO
# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
#endif
#define INIT_BUF_SIZE 200
#define PRINTF_SIZE_GUESS 150
@ -89,7 +93,7 @@ __argp_fmtstream_free (argp_fmtstream_t fs)
{
__argp_fmtstream_update (fs);
if (fs->p > fs->buf)
fwrite (fs->buf, 1, fs->p - fs->buf, fs->stream);
fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
free (fs->buf);
free (fs);
}
@ -129,7 +133,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
/* No buffer space for spaces. Must flush. */
size_t i;
for (i = 0; i < pad; i++)
putc (' ', fs->stream);
putc_unlocked (' ', fs->stream);
}
fs->point_col = pad;
}
@ -262,8 +266,8 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
/* Output the first line so we can use the space. */
{
if (nl > fs->buf)
fwrite (fs->buf, 1, nl - fs->buf, fs->stream);
putc ('\n', fs->stream);
fwrite_unlocked (fs->buf, 1, nl - fs->buf, fs->stream);
putc_unlocked ('\n', fs->stream);
len += buf - fs->buf;
nl = buf = fs->buf;
}
@ -279,7 +283,7 @@ __argp_fmtstream_update (argp_fmtstream_t fs)
*nl++ = ' ';
else
for (i = 0; i < fs->wmargin; ++i)
putc (' ', fs->stream);
putc_unlocked (' ', fs->stream);
/* Copy the tail of the original buffer into the current buffer
position. */
@ -316,7 +320,7 @@ __argp_fmtstream_ensure (struct argp_fmtstream *fs, size_t amount)
/* Flush FS's buffer. */
__argp_fmtstream_update (fs);
wrote = fwrite (fs->buf, 1, fs->p - fs->buf, fs->stream);
wrote = fwrite_unlocked (fs->buf, 1, fs->p - fs->buf, fs->stream);
if (wrote == fs->p - fs->buf)
{
fs->p = fs->buf;

View File

@ -32,11 +32,16 @@
#ifndef _
/* This is for other GNU distributions with internationalized messages. */
#ifdef HAVE_LIBINTL_H
# ifdef HAVE_LIBINTL_H
# include <libintl.h>
#else
# else
# define dgettext(domain, msgid) (msgid)
# endif
#endif
#ifdef USE_IN_LIBIO
# define flockfile(s) _IO_flockfile (s)
# define funlockfile(s) _IO_funlockfile (s)
#endif
#include "argp.h"
@ -1405,7 +1410,7 @@ argp_doc (const struct argp *argp, const struct argp_state *state,
{
if (inp_text_limit)
/* Copy INP_TEXT so that it's nul-terminated. */
inp_text = strndup (inp_text, inp_text_limit);
inp_text = __strndup (inp_text, inp_text_limit);
input = __argp_input (argp, state);
text =
(*argp->help_filter) (post
@ -1479,12 +1484,17 @@ _help (const struct argp *argp, const struct argp_state *state, FILE *stream,
if (! stream)
return;
flockfile (stream);
if (! uparams.valid)
fill_in_uparams (state);
fs = __argp_make_fmtstream (stream, 0, uparams.rmargin, 0);
if (! fs)
{
funlockfile (stream);
return;
}
if (flags & (ARGP_HELP_USAGE | ARGP_HELP_SHORT_USAGE | ARGP_HELP_LONG))
{
@ -1590,6 +1600,8 @@ Try `%s --help' or `%s --usage' for more information.\n"),
anything = 1;
}
funlockfile (stream);
if (hol)
hol_free (hol);
@ -1647,17 +1659,22 @@ __argp_error (const struct argp_state *state, const char *fmt, ...)
{
va_list ap;
fputs (state ? state->name : program_invocation_short_name, stream);
putc (':', stream);
putc (' ', stream);
flockfile (stream);
fputs_unlocked (state ? state->name : program_invocation_short_name,
stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
va_start (ap, fmt);
vfprintf (stream, fmt, ap);
va_end (ap);
putc ('\n', stream);
putc_unlocked ('\n', stream);
__argp_state_help (state, stream, ARGP_HELP_STD_ERR);
funlockfile (stream);
}
}
}
@ -1683,14 +1700,17 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
if (stream)
{
fputs (state ? state->name : program_invocation_short_name, stream);
flockfile (stream);
fputs_unlocked (state ? state->name : program_invocation_short_name,
stream);
if (fmt)
{
va_list ap;
putc (':', stream);
putc (' ', stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
va_start (ap, fmt);
vfprintf (stream, fmt, ap);
@ -1699,12 +1719,14 @@ __argp_failure (const struct argp_state *state, int status, int errnum,
if (errnum)
{
putc (':', stream);
putc (' ', stream);
putc_unlocked (':', stream);
putc_unlocked (' ', stream);
fputs (strerror (errnum), stream);
}
putc ('\n', stream);
putc_unlocked ('\n', stream);
funlockfile (stream);
if (status && (!state || !(state->flags & ARGP_NO_EXIT)))
exit (status);

View File

@ -24,13 +24,17 @@
extern const char *__assert_program_name; /* In assert.c. */
#ifdef USE_IN_LIBIO
# define fflush(s) _IO_fflush (s)
#endif
/* This function, when passed an error number, a filename, and a line
number, prints a message on the standard error stream of the form:
a.c:10: foobar: Unexpected error: Computer bought the farm
It then aborts program execution via a call to `abort'. */
#ifdef FATAL_PREPARE_INCLUDE
#include FATAL_PREPARE_INCLUDE
# include FATAL_PREPARE_INCLUDE
#endif
void

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1994, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1994, 1995, 1996, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -24,6 +24,10 @@
const char *__assert_program_name;
#ifdef USE_IN_LIBIO
# define fflush(s) _IO_fflush (s)
#endif
/* This function, when passed a string containing an asserted
expression, a filename, and a line number, prints a message
on the standard error stream of the form:
@ -31,7 +35,7 @@ const char *__assert_program_name;
It then aborts program execution via a call to `abort'. */
#ifdef FATAL_PREPARE_INCLUDE
#include FATAL_PREPARE_INCLUDE
# include FATAL_PREPARE_INCLUDE
#endif
void

View File

@ -731,7 +731,7 @@ if test $VERSIONING = no; then
*** WARNING: You should not compile GNU libc without versioning. Not using
*** versioning will introduce incompatibilities so that old binaries
*** will not run anymore.
*** For versioning you need recent binutils (binutils-2.8.1.0.17 or newer)."
*** For versioning you need recent binutils (binutils-2.8.1.0.23 or newer)."
fi
if test $elf = yes; then
AC_CACHE_CHECK(for .previous assembler directive,

View File

@ -28,7 +28,7 @@ scandir (dir, namelist, select, cmp)
int (*select) __P ((const struct dirent *));
int (*cmp) __P ((const void *, const void *));
{
DIR *dp = opendir (dir);
DIR *dp = __opendir (dir);
struct dirent **v = NULL;
size_t vsize = 0, i;
struct dirent *d;
@ -74,7 +74,7 @@ scandir (dir, namelist, select, cmp)
if (errno != 0)
{
save = errno;
(void) closedir (dp);
(void) __closedir (dp);
while (i > 0)
free (v[--i]);
free (v);
@ -82,7 +82,7 @@ scandir (dir, namelist, select, cmp)
return -1;
}
(void) closedir (dp);
(void) __closedir (dp);
__set_errno (save);
/* Sort the list if we have a comparison function to sort with. */

View File

@ -28,7 +28,7 @@ scandir64 (dir, namelist, select, cmp)
int (*select) __P ((const struct dirent64 *));
int (*cmp) __P ((const void *, const void *));
{
DIR *dp = opendir (dir);
DIR *dp = __opendir (dir);
struct dirent64 **v = NULL;
size_t vsize = 0, i;
struct dirent64 *d;
@ -74,7 +74,7 @@ scandir64 (dir, namelist, select, cmp)
if (errno != 0)
{
save = errno;
(void) closedir (dp);
(void) __closedir (dp);
while (i > 0)
free (v[--i]);
free (v);
@ -82,7 +82,7 @@ scandir64 (dir, namelist, select, cmp)
return -1;
}
(void) closedir (dp);
(void) __closedir (dp);
__set_errno (save);
/* Sort the list if we have a comparison function to sort with. */

View File

@ -22,6 +22,6 @@
int
versionsort (const void *a, const void *b)
{
return strverscmp ((*(const struct dirent **) a)->d_name,
return __strverscmp ((*(const struct dirent **) a)->d_name,
(*(const struct dirent **) b)->d_name);
}

View File

@ -22,6 +22,6 @@
int
versionsort64 (const void *a, const void *b)
{
return strverscmp ((*(const struct dirent64 **) a)->d_name,
return __strverscmp ((*(const struct dirent64 **) a)->d_name,
(*(const struct dirent64 **) b)->d_name);
}

View File

@ -34,7 +34,7 @@ elide-routines.os = $(dl-routines) dl-support enbl-secure
# ld.so uses those routines, plus some special stuff for being the program
# interpreter and operating independent of libc.
rtld-routines := rtld $(dl-routines) dl-sysdep dl-minimal
rtld-routines := rtld $(dl-routines) dl-sysdep dl-environ dl-minimal
ld-map = $(common-objpfx)libc.map
distribute = $(rtld-routines:=.c) dynamic-link.h do-rel.h dl-machine.h \
dl-hash.h soinit.c sofini.c ldd.sh.in ldd.bash.in eval.c \

View File

@ -57,7 +57,7 @@ __bb_exit_func (void)
}
memcpy (&ghdr.cookie[0], GMON_MAGIC, 4);
memcpy (&ghdr.version, &version, sizeof (version));
fwrite (&ghdr, sizeof (ghdr), 1, fp);
fwrite_unlocked (&ghdr, sizeof (ghdr), 1, fp);
for (ptr = __bb_head; ptr != 0; ptr = ptr->next)
{
@ -66,13 +66,14 @@ __bb_exit_func (void)
u_int i;
tag = GMON_TAG_BB_COUNT;
fwrite (&tag, sizeof (tag), 1, fp);
fwrite (&ncounts, sizeof (ncounts), 1, fp);
fwrite_unlocked (&tag, sizeof (tag), 1, fp);
fwrite_unlocked (&ncounts, sizeof (ncounts), 1, fp);
for (i = 0; i < ncounts; ++i)
{
fwrite (&ptr->addresses[i], sizeof (ptr->addresses[0]), 1, fp);
fwrite (&ptr->counts[i], sizeof (ptr->counts[0]), 1, fp);
fwrite_unlocked (&ptr->addresses[i], sizeof (ptr->addresses[0]), 1,
fp);
fwrite_unlocked (&ptr->counts[i], sizeof (ptr->counts[0]), 1, fp);
}
}
fclose (fp);

View File

@ -58,7 +58,7 @@ struct gmonparam _gmonparam = { GMON_PROF_OFF };
static int s_scale;
#define SCALE_1_TO_1 0x10000L
#define ERR(s) write(2, s, sizeof(s) - 1)
#define ERR(s) __write(2, s, sizeof(s) - 1)
void moncontrol __P ((int mode));
void __moncontrol __P ((int mode));

View File

@ -21,6 +21,12 @@
#include <grp.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define flockfile(s) _IO_flockfile (s)
# define funlockfile(s) _IO_funlockfile (s)
#endif
/* Define a line parsing function using the common code
used in the nss_files module. */
@ -59,17 +65,20 @@ __fgetgrent_r (FILE *stream, struct group *resbuf, char *buffer, size_t buflen,
char *p;
int parse_result;
flockfile (stream);
do
{
buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, stream);
if (p == NULL && feof (stream))
p = fgets_unlocked (buffer, buflen, stream);
if (p == NULL && feof_unlocked (stream))
{
funlockfile (stream);
*result = NULL;
return errno;
}
if (p == NULL || buffer[buflen - 1] != '\xff')
{
funlockfile (stream);
*result = NULL;
return errno = ERANGE;
}
@ -84,6 +93,8 @@ __fgetgrent_r (FILE *stream, struct group *resbuf, char *buffer, size_t buflen,
(void *) buffer, buflen,
&errno)));
funlockfile (stream);
if (parse_result == -1)
{
/* The parser ran out of space. */

View File

@ -52,7 +52,7 @@ compat_call (service_user *nip, const char *user, gid_t group, long int *start,
long int *size, gid_t *groups, long int limit, int *errnop)
{
struct group grpbuf, *g;
size_t buflen = sysconf (_SC_GETPW_R_SIZE_MAX);
size_t buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
char *tmpbuf;
enum nss_status status;
set_function setgrent_fct;
@ -155,7 +155,7 @@ initgroups (user, group)
size = limit;
#else
long int limit = sysconf (_SC_NGROUPS_MAX);
long int limit = __sysconf (_SC_NGROUPS_MAX);
if (limit > 0)
size = limit;

View File

@ -77,6 +77,10 @@ builtin_aliases[] =
#include "gconv_builtin.h"
};
#ifdef USE_IN_LIBIO
# define __getdelim(line, len, c, fp) _IO_getdelim (line, len, c, fp)
#endif
/* Function for searching module. */
static int

View File

@ -102,7 +102,7 @@ nrl_domainname (void)
{
/* The name contains no domain information. Use the name
now to get more information. */
while (gethostname (tmpbuf, tmpbuflen))
while (__gethostname (tmpbuf, tmpbuflen))
{
tmpbuflen *= 2;
tmpbuf = alloca (tmpbuflen);
@ -337,7 +337,7 @@ getnameinfo (const struct sockaddr *sa, socklen_t addrlen, char *host,
break;
}
}
snprintf (serv, servlen, "%d",
__snprintf (serv, servlen, "%d",
ntohs (((struct sockaddr_in *) sa)->sin_port));
break;

View File

@ -319,7 +319,7 @@ innetgr (const char *netgroup, const char *host, const char *user,
struct __netgrent entry;
/* Clear the space for the netgroup data. */
bzero (&entry, sizeof (entry));
__bzero (&entry, sizeof (entry));
/* Open netgroup. */
status = (*setfct) (current_group, &entry);

View File

@ -70,7 +70,8 @@ inet_ntoa (struct in_addr in)
}
bytes = (unsigned char *) &in;
snprintf (buffer, 18, "%d.%d.%d.%d", bytes[0], bytes[1], bytes[2], bytes[3]);
__snprintf (buffer, 18, "%d.%d.%d.%d",
bytes[0], bytes[1], bytes[2], bytes[3]);
return buffer;
}

View File

@ -76,7 +76,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
char c;
int herr;
pid = getpid();
pid = __getpid();
hstbuflen = 1024;
tmphstbuf = __alloca (hstbuflen);
@ -99,7 +99,7 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
pfd[1].events = POLLIN;
*ahost = hp->h_name;
oldmask = sigblock(sigmask(SIGURG));
oldmask = __sigblock(sigmask(SIGURG));
for (timo = 1, lport = IPPORT_RESERVED - 1;;) {
s = rresvport(&lport);
if (s < 0) {
@ -108,23 +108,23 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
_("rcmd: socket: All ports in use\n"));
else
(void)fprintf(stderr, "rcmd: socket: %m\n");
sigsetmask(oldmask);
__sigsetmask(oldmask);
return -1;
}
fcntl(s, F_SETOWN, pid);
__fcntl(s, F_SETOWN, pid);
sin.sin_family = hp->h_addrtype;
bcopy(hp->h_addr_list[0], &sin.sin_addr,
MIN (sizeof (sin.sin_addr), hp->h_length));
sin.sin_port = rport;
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
if (__connect(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
break;
(void)close(s);
(void)__close(s);
if (errno == EADDRINUSE) {
lport--;
continue;
}
if (errno == ECONNREFUSED && timo <= 16) {
(void)sleep(timo);
(void)__sleep(timo);
timo *= 2;
continue;
}
@ -143,12 +143,12 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
continue;
}
(void)fprintf(stderr, "%s: %m\n", hp->h_name);
sigsetmask(oldmask);
__sigsetmask(oldmask);
return -1;
}
lport--;
if (fd2p == 0) {
write(s, "", 1);
__write(s, "", 1);
lport = 0;
} else {
char num[8];
@ -158,11 +158,11 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
if (s2 < 0)
goto bad;
listen(s2, 1);
(void)snprintf(num, sizeof(num), "%d", lport);
if (write(s, num, strlen(num)+1) != strlen(num)+1) {
(void)__snprintf(num, sizeof(num), "%d", lport);
if (__write(s, num, strlen(num)+1) != strlen(num)+1) {
(void)fprintf(stderr,
_("rcmd: write (setting up stderr): %m\n"));
(void)close(s2);
(void)__close(s2);
goto bad;
}
pfd[0].fd = s;
@ -175,11 +175,11 @@ rcmd(ahost, rport, locuser, remuser, cmd, fd2p)
else
(void)fprintf(stderr,
_("poll: protocol failure in circuit setup\n"));
(void)close(s2);
(void)__close(s2);
goto bad;
}
s3 = accept(s2, (struct sockaddr *)&from, &len);
(void)close(s2);
(void)__close(s2);
if (s3 < 0) {
(void)fprintf(stderr,
"rcmd: accept: %m\n");
@ -196,30 +196,30 @@ 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)__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)fprintf(stderr,
"rcmd: %s: %m\n", *ahost);
goto bad2;
}
if (c != 0) {
while (read(s, &c, 1) == 1) {
(void)write(STDERR_FILENO, &c, 1);
while (__read(s, &c, 1) == 1) {
(void)__write(STDERR_FILENO, &c, 1);
if (c == '\n')
break;
}
goto bad2;
}
sigsetmask(oldmask);
__sigsetmask(oldmask);
return s;
bad2:
if (lport)
(void)close(*fd2p);
(void)__close(*fd2p);
bad:
(void)close(s);
sigsetmask(oldmask);
(void)__close(s);
__sigsetmask(oldmask);
return -1;
}
@ -232,7 +232,7 @@ rresvport(alport)
sin.sin_family = AF_INET;
sin.sin_addr.s_addr = INADDR_ANY;
s = socket(AF_INET, SOCK_STREAM, 0);
s = __socket(AF_INET, SOCK_STREAM, 0);
if (s < 0)
return -1;
for (;;) {
@ -240,12 +240,12 @@ rresvport(alport)
if (bind(s, (struct sockaddr *)&sin, sizeof(sin)) >= 0)
return s;
if (errno != EADDRINUSE) {
(void)close(s);
(void)__close(s);
return -1;
}
(*alport)--;
if (*alport == IPPORT_RESERVED/2) {
(void)close(s);
(void)__close(s);
__set_errno (EAGAIN); /* close */
return -1;
}
@ -382,7 +382,7 @@ iruserok (raddr, superuser, ruser, luser)
/* Change effective uid while reading .rhosts. If root and
reading an NFS mounted file system, can't read files that
are protected read/write owner only. */
uid = geteuid ();
uid = __geteuid ();
seteuid (pwd->pw_uid);
hostf = iruserfopen (pbuf, pwd->pw_uid);
@ -481,7 +481,7 @@ __icheckhost(raddr, lhost)
/* Spin through ip addresses. */
for (pp = hp->h_addr_list; *pp; ++pp)
if (!bcmp(&raddr, *pp, sizeof(u_int32_t)))
if (!memcmp(&raddr, *pp, sizeof(u_int32_t)))
return 1;
/* No match. */

View File

@ -85,7 +85,7 @@ rexec(ahost, rport, name, pass, cmd, fd2p)
*ahost = hp->h_name;
ruserpass(hp->h_name, &name, &pass);
retry:
s = socket(AF_INET, SOCK_STREAM, 0);
s = __socket(AF_INET, SOCK_STREAM, 0);
if (s < 0) {
perror("rexec: socket");
return (-1);
@ -93,10 +93,10 @@ retry:
sin.sin_family = hp->h_addrtype;
sin.sin_port = rport;
bcopy(hp->h_addr, (caddr_t)&sin.sin_addr, hp->h_length);
if (connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
if (__connect(s, (struct sockaddr *)&sin, sizeof(sin)) < 0) {
if (errno == ECONNREFUSED && timo <= 16) {
(void) close(s);
sleep(timo);
(void) __close(s);
__sleep(timo);
timo *= 2;
goto retry;
}
@ -104,15 +104,15 @@ retry:
return (-1);
}
if (fd2p == 0) {
(void) write(s, "", 1);
(void) __write(s, "", 1);
port = 0;
} else {
char num[32];
int s2, sin2len;
s2 = socket(AF_INET, SOCK_STREAM, 0);
s2 = __socket(AF_INET, SOCK_STREAM, 0);
if (s2 < 0) {
(void) close(s);
(void) __close(s);
return (-1);
}
listen(s2, 1);
@ -120,15 +120,15 @@ retry:
if (getsockname(s2, (struct sockaddr *)&sin2, &sin2len) < 0 ||
sin2len != sizeof (sin2)) {
perror("getsockname");
(void) close(s2);
(void) __close(s2);
goto bad;
}
port = ntohs((u_short)sin2.sin_port);
(void) sprintf(num, "%u", port);
(void) write(s, num, strlen(num)+1);
(void) __write(s, num, strlen(num)+1);
{ int len = sizeof (from);
s3 = accept(s2, (struct sockaddr *)&from, &len);
close(s2);
__close(s2);
if (s3 < 0) {
perror("accept");
port = 0;
@ -137,17 +137,17 @@ retry:
}
*fd2p = s3;
}
(void) write(s, name, strlen(name) + 1);
(void) __write(s, name, strlen(name) + 1);
/* should public key encypt the password here */
(void) write(s, pass, strlen(pass) + 1);
(void) write(s, cmd, strlen(cmd) + 1);
if (read(s, &c, 1) != 1) {
(void) __write(s, pass, strlen(pass) + 1);
(void) __write(s, cmd, strlen(cmd) + 1);
if (__read(s, &c, 1) != 1) {
perror(*ahost);
goto bad;
}
if (c != 0) {
while (read(s, &c, 1) == 1) {
(void) write(2, &c, 1);
while (__read(s, &c, 1) == 1) {
(void) __write(2, &c, 1);
if (c == '\n')
break;
}
@ -156,7 +156,7 @@ retry:
return (s);
bad:
if (port)
(void) close(*fd2p);
(void) close(s);
(void) __close(*fd2p);
(void) __close(s);
return (-1);
}

View File

@ -105,7 +105,7 @@ ruserpass(host, aname, apass)
warn("%s", buf);
return (0);
}
if (gethostname(myname, sizeof(myname)) < 0)
if (__gethostname(myname, sizeof(myname)) < 0)
myname[0] = '\0';
if ((mydomain = strchr(myname, '.')) == NULL)
mydomain = "";
@ -125,18 +125,18 @@ next:
* or official hostname. Also allow match of
* incompletely-specified host in local domain.
*/
if (strcasecmp(host, tokval) == 0)
if (__strcasecmp(host, tokval) == 0)
goto match;
/* if (strcasecmp(hostname, tokval) == 0)
/* if (__strcasecmp(hostname, tokval) == 0)
goto match;
if ((tmp = strchr(hostname, '.')) != NULL &&
strcasecmp(tmp, mydomain) == 0 &&
strncasecmp(hostname, tokval, tmp-hostname) == 0 &&
__strcasecmp(tmp, mydomain) == 0 &&
__strncasecmp(hostname, tokval, tmp-hostname) == 0 &&
tokval[tmp - hostname] == '\0')
goto match; */
if ((tmp = strchr(host, '.')) != NULL &&
strcasecmp(tmp, mydomain) == 0 &&
strncasecmp(host, tokval, tmp - host) == 0 &&
__strcasecmp(tmp, mydomain) == 0 &&
__strncasecmp(host, tokval, tmp - host) == 0 &&
tokval[tmp - host] == '\0')
goto match;
continue;

View File

@ -79,8 +79,8 @@ static u_short fts_stat __P((FTS *, struct dirent *, FTSENT *, int))
#define ISSET(opt) (sp->fts_options & opt)
#define SET(opt) (sp->fts_options |= opt)
#define CHDIR(sp, path) (!ISSET(FTS_NOCHDIR) && chdir(path))
#define FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && fchdir(fd))
#define CHDIR(sp, path) (!ISSET(FTS_NOCHDIR) && __chdir(path))
#define FCHDIR(sp, fd) (!ISSET(FTS_NOCHDIR) && __fchdir(fd))
/* fts_build flags */
#define BCHILD 1 /* fts_children */
@ -108,7 +108,7 @@ fts_open(argv, options, compar)
/* Allocate/initialize the stream */
if ((sp = malloc((u_int)sizeof(FTS))) == NULL)
return (NULL);
bzero(sp, sizeof(FTS));
__bzero(sp, sizeof(FTS));
sp->fts_compar = (int (*) __P((const void *, const void *))) compar;
sp->fts_options = options;
@ -186,7 +186,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 = __open(".", O_RDONLY, 0)) < 0)
SET(FTS_NOCHDIR);
return (sp);
@ -254,8 +255,8 @@ 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);
saved_errno = __fchdir(sp->fts_rfd) ? errno : 0;
(void)__close(sp->fts_rfd);
}
/* Free up the stream pointer. */
@ -313,7 +314,7 @@ fts_read(sp)
(p->fts_info == FTS_SL || p->fts_info == FTS_SLNONE)) {
p->fts_info = fts_stat(sp, NULL, p, 1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
if ((p->fts_symfd = open(".", O_RDONLY, 0)) < 0) {
if ((p->fts_symfd = __open(".", O_RDONLY, 0)) < 0) {
p->fts_errno = errno;
p->fts_info = FTS_ERR;
} else
@ -327,7 +328,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)__close(p->fts_symfd);
if (sp->fts_child) {
fts_lfree(sp->fts_child);
sp->fts_child = NULL;
@ -402,7 +403,7 @@ next: tmp = p;
p->fts_info = fts_stat(sp, NULL, p, 1);
if (p->fts_info == FTS_D && !ISSET(FTS_NOCHDIR))
if ((p->fts_symfd =
open(".", O_RDONLY, 0)) < 0) {
__open(".", O_RDONLY, 0)) < 0) {
p->fts_errno = errno;
p->fts_info = FTS_ERR;
} else
@ -446,12 +447,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)__close(p->fts_symfd);
__set_errno (saved_errno);
SET(FTS_STOP);
return (NULL);
}
(void)close(p->fts_symfd);
(void)__close(p->fts_symfd);
} else if (!(p->fts_flags & FTS_DONTCHDIR)) {
if (CHDIR(sp, "..")) {
SET(FTS_STOP);
@ -543,12 +544,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 = __open(".", O_RDONLY, 0)) < 0)
return (NULL);
sp->fts_child = fts_build(sp, instr);
if (fchdir(fd))
if (__fchdir(fd))
return (NULL);
(void)close(fd);
(void)__close(fd);
return (sp->fts_child);
}
@ -597,7 +598,7 @@ fts_build(sp, type)
else
oflag = DTF_HIDEW|DTF_NODUP|DTF_REWIND;
#else
# define __opendir2(path, flag) opendir(path)
# define __opendir2(path, flag) __opendir(path)
#endif
if ((dirp = __opendir2 (cur->fts_accpath, oflag)) == NULL) {
if (type == BREAD) {
@ -673,7 +674,7 @@ fts_build(sp, type)
/* Read the directory, attaching each entry to the `link' pointer. */
adjaddr = NULL;
for (head = tail = NULL, nitems = 0; dp = readdir(dirp);) {
for (head = tail = NULL, nitems = 0; dp = __readdir(dirp);) {
int namlen;
if (!ISSET(FTS_SEEDOT) && ISDOT(dp->d_name))
@ -693,7 +694,7 @@ mem1: saved_errno = errno;
if (p)
free(p);
fts_lfree(head);
(void)closedir(dirp);
(void)__closedir(dirp);
__set_errno (saved_errno);
cur->fts_info = FTS_ERR;
SET(FTS_STOP);
@ -749,7 +750,7 @@ mem1: saved_errno = errno;
}
++nitems;
}
(void)closedir(dirp);
(void)__closedir(dirp);
/*
* If had to realloc the path, adjust the addresses for the rest
@ -843,7 +844,7 @@ fts_stat(sp, dp, p, follow)
}
} else if (lstat(p->fts_accpath, sbp)) {
p->fts_errno = errno;
err: bzero(sbp, sizeof(struct stat));
err: __bzero(sbp, sizeof(struct stat));
return (FTS_NS);
}

View File

@ -1,5 +1,5 @@
/* File tree walker functions.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -38,7 +38,7 @@
# define INO_T ino_t
# define STAT stat
# define DIRENT dirent
# define READDIR readdir
# define READDIR __readdir
# define LXSTAT __lxstat
# define XSTAT __xstat
# define FTW_FUNC_T __ftw_func_t
@ -205,7 +205,7 @@ open_dir_stream (struct ftw_data *data, struct dir_data *dirp)
}
else
{
closedir (st);
__closedir (st);
data->dirstreams[data->actdir]->stream = NULL;
data->dirstreams[data->actdir] = NULL;
}
@ -217,7 +217,7 @@ open_dir_stream (struct ftw_data *data, struct dir_data *dirp)
{
assert (data->dirstreams[data->actdir] == NULL);
dirp->stream = opendir (data->dirbuf);
dirp->stream = __opendir (data->dirbuf);
if (dirp->stream == NULL)
result = -1;
else
@ -309,7 +309,7 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
{
if (data->ftw.base == 1)
{
if (chdir ("/") < 0)
if (__chdir ("/") < 0)
result = -1;
}
else
@ -317,7 +317,7 @@ process_entry (struct ftw_data *data, struct dir_data *dir, const char *name,
/* Please note that we overwrite a slash. */
data->dirbuf[data->ftw.base - 1] = '\0';
if (chdir (data->dirbuf) < 0)
if (__chdir (data->dirbuf) < 0)
result = -1;
data->dirbuf[data->ftw.base - 1] = '/';
@ -372,7 +372,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st)
{
if (errno == ENOSYS)
{
if (chdir (data->dirbuf) < 0)
if (__chdir (data->dirbuf) < 0)
result = -1;
}
else
@ -382,7 +382,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st)
if (result != 0)
{
int save_err = errno;
closedir (dir.stream);
__closedir (dir.stream);
__set_errno (save_err);
if (data->actdir-- == 0)
@ -414,7 +414,7 @@ ftw_dir (struct ftw_data *data, struct STAT *st)
assert (dir.content == NULL);
closedir (dir.stream);
__closedir (dir.stream);
__set_errno (save_err);
if (data->actdir-- == 0)
@ -524,7 +524,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
if ((flags & FTW_CHDIR) && data.ftw.base > 0)
{
/* GNU extension ahead. */
cwd = getcwd (NULL, 0);
cwd = __getcwd (NULL, 0);
if (cwd == NULL)
result = -1;
else
@ -534,12 +534,12 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
terminate it for now and change the directory. */
if (data.ftw.base == 1)
/* I.e., the file is in the root directory. */
result = chdir ("/");
result = __chdir ("/");
else
{
char ch = data.dirbuf[data.ftw.base - 1];
data.dirbuf[data.ftw.base - 1] = '\0';
result = chdir (data.dirbuf);
result = __chdir (data.dirbuf);
data.dirbuf[data.ftw.base - 1] = ch;
}
}
@ -592,7 +592,7 @@ ftw_startup (const char *dir, int is_nftw, void *func, int descriptors,
if (cwd != NULL)
{
int save_err = errno;
chdir (cwd);
__chdir (cwd);
free (cwd);
__set_errno (save_err);
}

View File

@ -1,5 +1,5 @@
/* File tree walker functions. LFS version.
Copyright (C) 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -23,7 +23,7 @@
#define INO_T ino64_t
#define STAT stat64
#define DIRENT dirent64
#define READDIR readdir64
#define READDIR __readdir64
#define LXSTAT __lxstat64
#define XSTAT __xstat64
#define FTW_FUNC_T __ftw64_func_t

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1992, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -38,7 +38,7 @@ get_current_dir_name (void)
pwdstat.st_dev == dotstat.st_dev &&
pwdstat.st_ino == dotstat.st_ino)
/* The PWD value is correct. Use it. */
return strdup (pwd);
return __strdup (pwd);
return getcwd ((char *) NULL, 0);
return __getcwd ((char *) NULL, 0);
}

View File

@ -1,5 +1,5 @@
/* Obsolete function to get current working directory.
Copyright (C) 1991, 1992, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1991, 1992, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -38,7 +38,7 @@ getwd (buf)
return NULL;
}
if (getcwd (tmpbuf, PATH_MAX) == NULL)
if (__getcwd (tmpbuf, PATH_MAX) == NULL)
{
/* We use 1024 here since it should really be enough and because
this is a safe value. */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1994, 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1994, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -36,9 +36,9 @@ lockf (int fd, int cmd, off_t len)
case F_TEST:
/* Test the lock: return 0 if FD is unlocked or locked by this process;
return -1, set errno to EACCES, if another process holds the lock. */
if (fcntl (fd, F_GETLK, &fl) < 0)
if (__fcntl (fd, F_GETLK, &fl) < 0)
return -1;
if (fl.l_type == F_UNLCK || fl.l_pid == getpid ())
if (fl.l_type == F_UNLCK || fl.l_pid == __getpid ())
return 0;
__set_errno (EACCES);
return -1;
@ -67,5 +67,5 @@ lockf (int fd, int cmd, off_t len)
fl.l_len = len;
return fcntl (fd, cmd, &fl);
return __fcntl (fd, cmd, &fl);
}

View File

@ -50,7 +50,8 @@ CPPFLAGS-.o += -DIO_DEBUG
ifneq (,$(filter %REENTRANT, $(defines)))
routines += clearerr_u feof_u ferror_u fputc_u getc_u getchar_u \
iofflush_u putc_u putchar_u peekc iofread_u iofwrite_u iofgets_u
iofflush_u putc_u putchar_u peekc iofread_u iofwrite_u iofgets_u \
iofputs_u
CPPFLAGS += -D_IO_MTSAFE_IO
endif

View File

@ -89,6 +89,6 @@ libc {
# f*
fgetpos64; fopen64; freopen64; fseeko; fseeko64; fsetpos64; ftello;
ftello64; fopen; fclose; fdopen; fread_unlocked; fwrite_unlocked;
fgets_unlocked;
fgets_unlocked; fputs_unlocked;
}
}

View File

@ -30,8 +30,12 @@
#include <fcntl.h>
#ifndef _IO_fcntl
#ifdef _LIBC
#define _IO_fcntl __fcntl
#else
#define _IO_fcntl fcntl
#endif
#endif
_IO_FILE *
_IO_new_fdopen (fd, mode)

42
libio/iofputs_u.c Normal file
View File

@ -0,0 +1,42 @@
/* Copyright (C) 1993, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License as
published by the Free Software Foundation; either version 2, or (at
your option) any later version.
This library is distributed in the hope that it will be useful, but
WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
General Public License for more details.
You should have received a copy of the GNU General Public License
along with this library; see the file COPYING. If not, write to
the Free Software Foundation, 59 Temple Place - Suite 330, Boston,
MA 02111-1307, USA.
As a special exception, if you link this library with files
compiled with a GNU compiler to produce an executable, this does
not cause the resulting executable to be covered by the GNU General
Public License. This exception does not however invalidate any
other reasons why the executable file might be covered by the GNU
General Public License. */
#include "libioP.h"
#include <string.h>
int
fputs_unlocked (str, fp)
const char *str;
_IO_FILE *fp;
{
_IO_size_t len = strlen (str);
int result;
CHECK_FILE (fp, EOF);
if (_IO_sputn (fp, str, len) != len)
result = EOF;
else
result = 1;
return result;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1993, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1993, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU IO Library.
Written by Per Bothner <bothner@cygnus.com>.
@ -41,25 +41,41 @@
#include <sys/wait.h>
#ifndef _IO_fork
#ifdef _LIBC
#define _IO_fork __vfork
#else
#define _IO_fork vfork /* defined in libiberty, if needed */
#endif
extern _IO_pid_t _IO_fork __P ((void));
#endif
#endif /* _IO_HAVE_SYS_WAIT */
#ifndef _IO_pipe
#ifdef _LIBC
#define _IO_pipe __pipe
#else
#define _IO_pipe pipe
#endif
extern int _IO_pipe __P ((int des[2]));
#endif
#ifndef _IO_dup2
#ifdef _LIBC
#define _IO_dup2 __dup2
#else
#define _IO_dup2 dup2
#endif
extern int _IO_dup2 __P ((int fd, int fd2));
#endif
#ifndef _IO_waitpid
#ifdef _LIBC
#define _IO_waitpid __waitpid
#else
#define _IO_waitpid waitpid
#endif
#endif
#ifndef _IO_execl
#define _IO_execl execl
@ -69,8 +85,12 @@ extern int _IO_dup2 __P ((int fd, int fd2));
#endif
#ifndef _IO_close
#ifdef _LIBC
#define _IO_close __close
#else
#define _IO_close close
#endif
#endif
struct _IO_proc_file
{

View File

@ -516,6 +516,12 @@ getline (char **__lineptr, size_t *__n, FILE *__stream)
/* Write a string to STREAM. */
extern int fputs __P ((__const char *__restrict __s,
FILE *__restrict __stream));
#ifdef __USE_GNU
/* This function does the same as `fgets' but does not lock the stream. */
extern int fputs_unlocked __P ((__const char *__restrict __s,
FILE *__restrict __stream));
#endif
/* Write a string, followed by a newline, to stdout. */
extern int puts __P ((__const char *__s));

View File

@ -1,3 +1,17 @@
1998-07-16 10:52 Ulrich Drepper <drepper@cygnus.com>
* manager.c (pthread_handle_create): Check whether sched_setscheduler
call can succeed here.
* mutex.c: Define __pthread_mutexattr_settype and make
__pthread_mutexattr_setkind_np an alias.
Likewise for __pthread_mutexattr_gettype.
1998-07-15 11:00 -0400 Zack Weinberg <zack@rabi.phys.columbia.edu>
* attr.c (pthread_attr_setschedpolicy): Don't check whether caller
is root.
1998-07-14 19:38 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/pthread/bits/libc-lock.h: Define __libc_cleanup_end.

View File

@ -96,8 +96,6 @@ int pthread_attr_setschedpolicy(pthread_attr_t *attr, int policy)
{
if (policy != SCHED_OTHER && policy != SCHED_FIFO && policy != SCHED_RR)
return EINVAL;
if (policy != SCHED_OTHER && geteuid() != 0)
return ENOTSUP;
attr->schedpolicy = policy;
return 0;
}

View File

@ -217,6 +217,12 @@ static int pthread_handle_create(pthread_t *thread, const pthread_attr_t *attr,
void *guardaddr = NULL;
size_t guardsize = 0;
/* First check whether we have to change the policy and if yes, whether
we can do this. Normally this should be done by examining the
return value of the __sched_setscheduler call in pthread_start_thread
but this is hard to implement. FIXME */
if (attr != NULL && attr->schedpolicy != SCHED_OTHER && geteuid () != 0)
return EPERM;
/* Find a free stack segment for the current stack */
for (sseg = 1; ; sseg++)
{

View File

@ -144,7 +144,7 @@ int __pthread_mutexattr_destroy(pthread_mutexattr_t *attr)
}
weak_alias (__pthread_mutexattr_destroy, pthread_mutexattr_destroy)
int __pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
int __pthread_mutexattr_settype(pthread_mutexattr_t *attr, int kind)
{
if (kind != PTHREAD_MUTEX_FAST_NP
&& kind != PTHREAD_MUTEX_RECURSIVE_NP
@ -153,18 +153,18 @@ int __pthread_mutexattr_setkind_np(pthread_mutexattr_t *attr, int kind)
attr->mutexkind = kind;
return 0;
}
weak_alias (__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np)
strong_alias (__pthread_mutexattr_setkind_np, __pthread_mutexattr_settype)
weak_alias (__pthread_mutexattr_settype, pthread_mutexattr_settype)
strong_alias ( __pthread_mutexattr_settype, __pthread_mutexattr_setkind_np)
weak_alias (__pthread_mutexattr_setkind_np, pthread_mutexattr_setkind_np)
int __pthread_mutexattr_getkind_np(const pthread_mutexattr_t *attr, int *kind)
int __pthread_mutexattr_gettype(const pthread_mutexattr_t *attr, int *kind)
{
*kind = attr->mutexkind;
return 0;
}
weak_alias (__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np)
strong_alias (__pthread_mutexattr_getkind_np, __pthread_mutexattr_gettype)
weak_alias (__pthread_mutexattr_gettype, pthread_mutexattr_gettype)
strong_alias (__pthread_mutexattr_gettype, __pthread_mutexattr_getkind_np)
weak_alias (__pthread_mutexattr_getkind_np, pthread_mutexattr_getkind_np)
/* Once-only execution */

View File

@ -77,8 +77,8 @@ static int send_request (int sock, const request_header *request,
static int
setutent_daemon (void)
{
if (access (_PATH_UTMPD_RW, F_OK) == -1
&& access (_PATH_UTMPD_RO, F_OK) == -1)
if (__access (_PATH_UTMPD_RW, F_OK) == -1
&& __access (_PATH_UTMPD_RO, F_OK) == -1)
return 0;
if (daemon_sock < 0)
@ -175,7 +175,7 @@ endutent_daemon (void)
/* Send request to the daemon. */
do_endutent (daemon_sock);
close (daemon_sock);
__close (daemon_sock);
daemon_sock = -1;
}
@ -193,11 +193,11 @@ updwtmp_daemon (const char *file, const struct utmp *utmp)
/* Send request to the daemon. */
if (do_updwtmp (sock, file, utmp) < 0)
{
close (sock);
__close (sock);
return -1;
}
close (sock);
__close (sock);
return 0;
}
@ -417,7 +417,7 @@ open_socket (const char *name)
strcpy (addr.sun_path, name);
if (__connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
{
close (sock);
__close (sock);
return -1;
}
@ -433,11 +433,11 @@ send_request (int sock, const request_header *request,
reply_header header;
ssize_t nbytes;
nbytes = write (sock, request, request->size);
nbytes = __write (sock, request, request->size);
if (nbytes != (ssize_t) request->size)
return -1;
nbytes = read (sock, &header, sizeof (reply_header));
nbytes = __read (sock, &header, sizeof (reply_header));
if (nbytes != sizeof (reply_header))
return -1;
@ -446,7 +446,7 @@ send_request (int sock, const request_header *request,
|| reply->type != header.type)
return -1;
nbytes = read (sock, reply + 1, reply->size - sizeof (reply_header));
nbytes = __read (sock, reply + 1, reply->size - sizeof (reply_header));
if (nbytes != (ssize_t) (reply->size - sizeof (reply_header)))
return -1;

View File

@ -40,6 +40,10 @@ extern char *getenv ();
#include <stdlib.h>
#endif
#if defined _LIBC && defined USE_IN_LIBIO
# define setvbuf(s, b, f, l) _IO_setvbuf (s, b, f, l)
#endif
#define TRACE_BUFFER_SIZE 512
static FILE *mallstream;

View File

@ -1,5 +1,5 @@
/* obstack.c - subroutines used implicitly by object stack macros
Copyright (C) 1988,89,90,91,92,93,94,96,97 Free Software Foundation, Inc.
Copyright (C) 1988,89,90,91,92,93,94,96,97,98 Free Software Foundation, Inc.
This file is part of the GNU C Library. Its master source is NOT part of
the C library, however. The master source lives in /gd/gnu/lib.
@ -459,6 +459,9 @@ _obstack_memory_used (h)
# define _(Str) (Str)
# endif
#endif
#if defined _LIBC && defined USE_IN_LIBIO
# define fputs(s, f) _IO_fputs (s, f)
#endif
static void
print_and_abort ()

View File

@ -45,7 +45,7 @@ daemon(nochdir, noclose)
{
int fd;
switch (fork()) {
switch (__fork()) {
case -1:
return (-1);
case 0:
@ -54,18 +54,18 @@ daemon(nochdir, noclose)
_exit(0);
}
if (setsid() == -1)
if (__setsid() == -1)
return (-1);
if (!nochdir)
(void)chdir("/");
(void)__chdir("/");
if (!noclose && (fd = open(_PATH_DEVNULL, O_RDWR, 0)) != -1) {
(void)dup2(fd, STDIN_FILENO);
(void)dup2(fd, STDOUT_FILENO);
(void)dup2(fd, STDERR_FILENO);
if (!noclose && (fd = __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)__close (fd);
}
return (0);
}

View File

@ -87,7 +87,7 @@ APPEND (FUNC_PREFIX, fcvt_r) (value, ndigit, decpt, sign, buf, len)
/* Value is Inf or NaN. */
*sign = 0;
n = snprintf (buf, len, "%.*" FLOAT_FMT_FLAG "f", ndigit, value);
n = __snprintf (buf, len, "%.*" FLOAT_FMT_FLAG "f", ndigit, value);
if (n < 0)
return -1;

View File

@ -1,5 +1,5 @@
/* err.c --- 4.4BSD utility functions for error messages.
Copyright (C) 1995, 1996 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -24,6 +24,11 @@
#include <string.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define flockfile(s) _IO_flockfile (s)
# define funlockfile(s) _IO_funlockfile (s)
#endif
extern char *__progname;
#define VA(call) \
@ -37,11 +42,13 @@ extern char *__progname;
void
vwarnx (const char *format, __gnuc_va_list ap)
{
flockfile (stderr);
if (__progname)
fprintf (stderr, "%s: ", __progname);
if (format)
vfprintf (stderr, format, ap);
putc ('\n', stderr);
putc_unlocked ('\n', stderr);
funlockfile (stderr);
}
void
@ -49,15 +56,17 @@ vwarn (const char *format, __gnuc_va_list ap)
{
int error = errno;
flockfile (stderr);
if (__progname)
fprintf (stderr, "%s: ", __progname);
if (format)
{
vfprintf (stderr, format, ap);
fputs (": ", stderr);
fputs_unlocked (": ", stderr);
}
__set_errno (error);
fprintf (stderr, "%m\n");
funlockfile (stderr);
}

View File

@ -76,6 +76,10 @@ unsigned int error_message_count;
# define error __error
# define error_at_line __error_at_line
# ifdef USE_IN_LIBIO
# define fflush(s) _IO_fflush (s)
# endif
#else /* not _LIBC */
/* The calling program should define program_name and set it to the

View File

@ -102,7 +102,7 @@ endfsent ()
state = &fstab_state;
if (state->fs_fp != NULL)
{
(void) endmntent (state->fs_fp);
(void) __endmntent (state->fs_fp);
state->fs_fp = NULL;
}
}
@ -134,7 +134,7 @@ fstab_init (int opt_rewind)
}
else
{
fp = setmntent (_PATH_FSTAB, "r");
fp = __setmntent (_PATH_FSTAB, "r");
if (fp == NULL)
return NULL;
state->fs_fp = fp;
@ -165,11 +165,11 @@ fstab_convert (struct fstab_state *state)
f->fs_file = m->mnt_dir;
f->fs_vfstype = m->mnt_type;
f->fs_mntops = m->mnt_opts;
f->fs_type = (hasmntopt (m, FSTAB_RW) ? FSTAB_RW :
hasmntopt (m, FSTAB_RQ) ? FSTAB_RQ :
hasmntopt (m, FSTAB_RO) ? FSTAB_RO :
hasmntopt (m, FSTAB_SW) ? FSTAB_SW :
hasmntopt (m, FSTAB_XX) ? FSTAB_XX :
f->fs_type = (__hasmntopt (m, FSTAB_RW) ? FSTAB_RW :
__hasmntopt (m, FSTAB_RQ) ? FSTAB_RQ :
__hasmntopt (m, FSTAB_RO) ? FSTAB_RO :
__hasmntopt (m, FSTAB_SW) ? FSTAB_SW :
__hasmntopt (m, FSTAB_XX) ? FSTAB_XX :
"??");
f->fs_freq = m->mnt_freq;
f->fs_passno = m->mnt_passno;

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1992, 93, 94, 95, 96, 97 Free Software Foundation, Inc.
/* Copyright (C) 1992, 93, 94, 95, 96, 97, 98 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -20,6 +20,11 @@
#include <termios.h>
#include <unistd.h>
#ifdef USE_IN_LIBIO
# define flockfile(s) _IO_flockfile (s)
# define funlockfile(s) _IO_funlockfile (s)
#endif
/* It is desirable to use this bit on systems that have it.
The only bit of terminal state we want to twiddle is echoing, which is
done in software; there is no need to change the state of the terminal
@ -52,9 +57,11 @@ getpass (prompt)
else
out = in;
flockfile (out);
/* Turn echoing off if it is on now. */
if (tcgetattr (fileno (in), &t) == 0)
if (__tcgetattr (fileno (in), &t) == 0)
{
/* Save the old one. */
s = t;
@ -66,8 +73,8 @@ getpass (prompt)
tty_changed = 0;
/* Write the prompt. */
fputs (prompt, out);
fflush (out);
fputs_unlocked (prompt, out);
fflush_unlocked (out);
/* Read the password. */
nread = __getline (&buf, &bufsize, in);
@ -80,13 +87,15 @@ getpass (prompt)
buf[nread - 1] = '\0';
if (tty_changed)
/* Write the newline that was not echoed. */
putc ('\n', out);
putc_unlocked ('\n', out);
}
/* Restore the original setting. */
if (tty_changed)
(void) tcsetattr (fileno (in), TCSAFLUSH|TCSASOFT, &s);
funlockfile (out);
if (in != stdin)
/* We opened the terminal; now close it. */
fclose (in);

View File

@ -40,6 +40,11 @@ static char sccsid[] = "@(#)getttyent.c 8.1 (Berkeley) 6/4/93";
#include <ctype.h>
#include <string.h>
#ifdef USE_IN_LIBIO
# define flockfile(s) _IO_flockfile (s)
# define funlockfile(s) _IO_funlockfile (s)
#endif
static char zapchar;
static FILE *tf;

View File

@ -22,6 +22,11 @@
#include <string.h>
#include <sys/types.h>
#ifdef USE_IN_LIBIO
# define flockfile(s) _IO_flockfile (s)
# define funlockfile(s) _IO_funlockfile (s)
#endif
/* Prepare to begin reading and/or writing mount table entries from the
beginning of FILE. MODE is as for `fopen'. */
FILE *

View File

@ -160,7 +160,7 @@ extern void twalk __PMT ((__const void *__root, __action_fn_t action));
#ifdef __USE_GNU
/* Callback type for function to free a tree node. If the keys are atomic
data this function should do nothing. */
typedef void (*__free_fn_t) __P ((void *__nodep));
typedef void (*__free_fn_t) __PMT ((void *__nodep));
/* Destroy the whole tree, call FREEFCT for each node or leaf. */
extern void __tdestroy __PMT ((void *__root, __free_fn_t freefct));

View File

@ -58,6 +58,10 @@ static char sccsid[] = "@(#)syslog.c 8.4 (Berkeley) 3/18/94";
#include <varargs.h>
#endif
#ifdef USE_IN_LIBIO
# define ftell(s) _IO_ftell (s)
#endif
static int LogType = SOCK_DGRAM; /* type of socket connection */
static int LogFile = -1; /* fd for log */
static int connected; /* have done connect */
@ -152,11 +156,11 @@ vsyslog(pri, fmt, ap)
if (LogTag == NULL)
LogTag = __progname;
if (LogTag != NULL)
fputs (LogTag, f);
fputs_unlocked (LogTag, f);
if (LogStat & LOG_PID)
fprintf (f, "[%d]", getpid ());
fprintf (f, "[%d]", __getpid ());
if (LogTag != NULL)
putc (':', f), putc (' ', f);
putc_unlocked (':', f), putc_unlocked (' ', f);
/* We have the header. Print the user's format into the buffer. */
vfprintf (f, fmt, ap);
@ -175,7 +179,7 @@ vsyslog(pri, fmt, ap)
++v;
v->iov_base = (char *) "\n";
v->iov_len = 1;
(void)writev(STDERR_FILENO, iov, 2);
(void)__writev(STDERR_FILENO, iov, 2);
}
/* Prepare for multiple users. We have to take care: open and
@ -188,7 +192,7 @@ vsyslog(pri, fmt, ap)
memset (&action, 0, sizeof (action));
action.sa_handler = sigpipe_handler;
sigemptyset (&action.sa_mask);
sigpipe = sigaction (SIGPIPE, &action, &oldaction);
sigpipe = __sigaction (SIGPIPE, &action, &oldaction);
if (sigpipe == 0)
oldaction_ptr = &oldaction;
@ -210,15 +214,15 @@ vsyslog(pri, fmt, ap)
* is the one from the syslogd failure.
*/
if (LogStat & LOG_CONS &&
(fd = open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
(fd = __open(_PATH_CONSOLE, O_WRONLY|O_NOCTTY, 0)) >= 0)
{
dprintf (fd, "%s\r\n", buf + msgoff);
(void)close(fd);
(void)__close(fd);
}
}
if (sigpipe == 0)
sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
__sigaction (SIGPIPE, &oldaction, (struct sigaction *) NULL);
/* End of critical section. */
__libc_cleanup_region_end (0);
@ -248,7 +252,7 @@ openlog_internal(const char *ident, int logstat, int logfac)
if ((LogFile = __socket(AF_UNIX, LogType, 0))
== -1)
return;
(void)fcntl(LogFile, F_SETFD, 1);
(void)__fcntl(LogFile, F_SETFD, 1);
}
}
if (LogFile != -1 && !connected)
@ -258,7 +262,7 @@ openlog_internal(const char *ident, int logstat, int logfac)
== -1)
{
int saved_errno = errno;
(void)close(LogFile);
(void)__close(LogFile);
LogFile = -1;
if (LogType == SOCK_DGRAM
&& saved_errno == EPROTOTYPE)
@ -301,7 +305,7 @@ closelog_internal()
if (!connected)
return;
close (LogFile);
__close (LogFile);
LogFile = -1;
connected = 0;
LogTag = NULL;
@ -329,7 +333,7 @@ cancel_handler (void *ptr)
struct sigaction *oldaction = *((struct sigaction **) ptr);
if (oldaction != (struct sigaction *) NULL)
sigaction (SIGPIPE, oldaction, (struct sigaction *) NULL);
__sigaction (SIGPIPE, oldaction, (struct sigaction *) NULL);
/* Free the lock. */
__libc_lock_unlock (syslog_lock);

View File

@ -82,7 +82,7 @@ nscd_open_socket (void)
strcpy (addr.sun_path, _PATH_NSCDSOCKET);
if (__connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
{
close (sock);
__close (sock);
__set_errno (saved_errno);
return -1;
}
@ -108,31 +108,31 @@ __nscd_getgr_r (const char *key, request_type type, struct group *resultbuf,
req.version = NSCD_VERSION;
req.type = type;
req.key_len = strlen (key);
nbytes = write (sock, &req, sizeof (request_header));
nbytes = __write (sock, &req, sizeof (request_header));
if (nbytes != sizeof (request_header))
{
close (sock);
__close (sock);
return 1;
}
nbytes = write (sock, key, req.key_len);
nbytes = __write (sock, key, req.key_len);
if (nbytes != req.key_len)
{
close (sock);
__close (sock);
return 1;
}
nbytes = read (sock, &gr_resp, sizeof (gr_response_header));
nbytes = __read (sock, &gr_resp, sizeof (gr_response_header));
if (nbytes != sizeof (gr_response_header))
{
close (sock);
__close (sock);
return 1;
}
if (gr_resp.found == -1)
{
/* The daemon does not cache this database. */
close (sock);
__close (sock);
__nss_not_use_nscd_group = 1;
return 1;
}
@ -145,16 +145,16 @@ __nscd_getgr_r (const char *key, request_type type, struct group *resultbuf,
if (buflen < gr_resp.gr_name_len + 1)
{
__set_errno (ERANGE);
close (sock);
__close (sock);
return -1;
}
resultbuf->gr_name = p;
p += gr_resp.gr_name_len + 1;
buflen -= (gr_resp.gr_name_len + 1);
nbytes = read (sock, resultbuf->gr_name, gr_resp.gr_name_len);
nbytes = __read (sock, resultbuf->gr_name, gr_resp.gr_name_len);
if (nbytes != gr_resp.gr_name_len)
{
close (sock);
__close (sock);
return 1;
}
resultbuf->gr_name[gr_resp.gr_name_len] = '\0';
@ -162,16 +162,16 @@ __nscd_getgr_r (const char *key, request_type type, struct group *resultbuf,
if (buflen < gr_resp.gr_passwd_len + 1)
{
__set_errno (ERANGE);
close (sock);
__close (sock);
return -1;
}
resultbuf->gr_passwd = p;
p += gr_resp.gr_passwd_len + 1;
buflen -= (gr_resp.gr_passwd_len + 1);
nbytes = read (sock, resultbuf->gr_passwd, gr_resp.gr_passwd_len);
nbytes = __read (sock, resultbuf->gr_passwd, gr_resp.gr_passwd_len);
if (nbytes != gr_resp.gr_passwd_len)
{
close (sock);
__close (sock);
return 1;
}
resultbuf->gr_passwd[gr_resp.gr_passwd_len] = '\0';
@ -181,7 +181,7 @@ __nscd_getgr_r (const char *key, request_type type, struct group *resultbuf,
if (buflen < ((gr_resp.gr_mem_len + 1) * sizeof (char *)))
{
__set_errno (ERANGE);
close (sock);
__close (sock);
return -1;
}
resultbuf->gr_mem = (char **)p;
@ -193,36 +193,36 @@ __nscd_getgr_r (const char *key, request_type type, struct group *resultbuf,
for (i = 0; i < gr_resp.gr_mem_len; ++i)
{
size_t len;
nbytes = read (sock, &len, sizeof (len));
nbytes = __read (sock, &len, sizeof (len));
if (nbytes != sizeof (len))
{
close (sock);
__close (sock);
return 1;
}
if (buflen < (len + 1))
{
__set_errno (ERANGE);
close (sock);
__close (sock);
return -1;
}
resultbuf->gr_mem[i] = p;
p += len + 1;
buflen -= (len + 1);
nbytes = read (sock, resultbuf->gr_mem[i], len);
nbytes = __read (sock, resultbuf->gr_mem[i], len);
resultbuf->gr_mem[i][len] = '\0';
if (nbytes != len)
{
close (sock);
__close (sock);
return 1;
}
}
close (sock);
__close (sock);
return 0;
}
else
{
close (sock);
__close (sock);
return -1;
}
}

View File

@ -82,7 +82,7 @@ nscd_open_socket (void)
strcpy (addr.sun_path, _PATH_NSCDSOCKET);
if (__connect (sock, (struct sockaddr *) &addr, sizeof (addr)) < 0)
{
close (sock);
__close (sock);
__set_errno (saved_errno);
return -1;
}
@ -108,31 +108,31 @@ __nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
req.version = NSCD_VERSION;
req.type = type;
req.key_len = strlen (key);
nbytes = write (sock, &req, sizeof (request_header));
nbytes = __write (sock, &req, sizeof (request_header));
if (nbytes != sizeof (request_header))
{
close (sock);
__close (sock);
return 1;
}
nbytes = write (sock, key, req.key_len);
nbytes = __write (sock, key, req.key_len);
if (nbytes != req.key_len)
{
close (sock);
__close (sock);
return 1;
}
nbytes = read (sock, &pw_resp, sizeof (pw_response_header));
nbytes = __read (sock, &pw_resp, sizeof (pw_response_header));
if (nbytes != sizeof (pw_response_header))
{
close (sock);
__close (sock);
return 1;
}
if (pw_resp.found == -1)
{
/* The daemon does not cache this database. */
close (sock);
__close (sock);
__nss_not_use_nscd_passwd = 1;
return 1;
}
@ -147,7 +147,7 @@ __nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
+ pw_resp.pw_shell_len + 1))
{
__set_errno (ERANGE);
close (sock);
__close (sock);
return -1;
}
@ -182,7 +182,7 @@ __nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
+ pw_resp.pw_gecos_len + pw_resp.pw_dir_len
+ pw_resp.pw_shell_len))
{
close (sock);
__close (sock);
return 1;
}
@ -199,12 +199,12 @@ __nscd_getpw_r (const char *key, request_type type, struct passwd *resultbuf,
resultbuf->pw_shell = vec[4].iov_base;
resultbuf->pw_shell[pw_resp.pw_shell_len] = '\0';
close (sock);
__close (sock);
return 0;
}
else
{
close (sock);
__close (sock);
return -1;
}
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1996, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -21,5 +21,5 @@
int
setpgrp ()
{
return setpgid (0, 0);
return __setpgid (0, 0);
}

View File

@ -291,7 +291,7 @@ parse_tilde (char **word, size_t *word_length, size_t *max_length,
char* buffer = __alloca (buflen);
int result;
uid = getuid ();
uid = __getuid ();
while ((result = __getpwuid_r (uid, &pwd, buffer, buflen, &tpwd)) != 0
&& errno == ERANGE)
@ -801,11 +801,11 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
if (!comm || !*comm)
return 0;
if (pipe (fildes))
if (__pipe (fildes))
/* Bad */
return WRDE_NOSPACE;
if ((pid = fork ()) < 0)
if ((pid = __fork ()) < 0)
{
/* Bad */
return WRDE_NOSPACE;
@ -817,23 +817,23 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
const char *args[4] = { _PATH_BSHELL, "-c", comm, NULL };
/* Redirect output. */
dup2 (fildes[1], 1);
close (fildes[1]);
__dup2 (fildes[1], 1);
__close (fildes[1]);
/* Redirect stderr to /dev/null if we have to. */
if ((flags & WRDE_SHOWERR) == 0)
{
int fd;
close (2);
fd = open (_PATH_DEVNULL, O_WRONLY);
__close (2);
fd = __open (_PATH_DEVNULL, O_WRONLY);
if (fd >= 0 && fd != 2)
{
dup2 (fd, 2);
close (fd);
__dup2 (fd, 2);
__close (fd);
}
}
close (fildes[0]);
__close (fildes[0]);
__execve (_PATH_BSHELL, (char *const *) args, __environ);
/* Bad. What now? */
@ -842,7 +842,7 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
/* Parent */
close (fildes[1]);
__close (fildes[1]);
buffer = __alloca (bufsize);
if (!pwordexp)
@ -850,20 +850,20 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
while (1)
{
if ((buflen = read (fildes[0], buffer, bufsize)) < 1)
if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
{
if (__waitpid (pid, NULL, WNOHANG) == 0)
continue;
if ((buflen = read (fildes[0], buffer, bufsize)) < 1)
if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
break;
}
*word = w_addmem (*word, word_length, max_length, buffer, buflen);
if (*word == NULL)
{
kill (pid, SIGKILL);
__kill (pid, SIGKILL);
__waitpid (pid, NULL, 0);
close (fildes[0]);
__close (fildes[0]);
return WRDE_NOSPACE;
}
}
@ -880,11 +880,11 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
while (1)
{
if ((buflen = read (fildes[0], buffer, bufsize)) < 1)
if ((buflen = __read (fildes[0], buffer, bufsize)) < 1)
{
if (__waitpid (pid, NULL, WNOHANG) == 0)
continue;
if ((read (fildes[0], buffer, bufsize)) < 1)
if ((__read (fildes[0], buffer, bufsize)) < 1)
break;
}
@ -932,18 +932,18 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
*word = w_addchar (*word, word_length, max_length, 0);
if (*word == NULL)
{
kill (pid, SIGKILL);
__kill (pid, SIGKILL);
__waitpid (pid, NULL, 0);
close (fildes[0]);
__close (fildes[0]);
return WRDE_NOSPACE;
}
}
if (w_addword (pwordexp, *word) == WRDE_NOSPACE)
{
kill (pid, SIGKILL);
__kill (pid, SIGKILL);
__waitpid (pid, NULL, 0);
close (fildes[0]);
__close (fildes[0]);
return WRDE_NOSPACE;
}
@ -958,9 +958,9 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
buffer[i]);
if (*word == NULL)
{
kill (pid, SIGKILL);
__kill (pid, SIGKILL);
__waitpid (pid, NULL, 0);
close (fildes[0]);
__close (fildes[0]);
return WRDE_NOSPACE;
}
}
@ -972,7 +972,7 @@ exec_comm (char *comm, char **word, size_t *word_length, size_t *max_length,
while (*word_length > 0 && (*word)[*word_length - 1] == '\n')
(*word)[--*word_length] = '\0';
close (fildes[0]);
__close (fildes[0]);
return 0;
}
@ -1280,7 +1280,7 @@ envsubst:
if (*env == '$')
{
buffer[20] = '\0';
value = _itoa_word (getpid (), &buffer[20], 10, 0);
value = _itoa_word (__getpid (), &buffer[20], 10, 0);
}
/* Is it `${#*}' or `${#@}'? */
else if ((*env == '*' || *env == '@') && seen_hash)

View File

@ -21,6 +21,10 @@
#include <stdio.h>
#include <pwd.h>
#ifdef USE_IN_LIBIO
# define flockfile(s) _IO_flockfile (s)
#endif
/* Define a line parsing function using the common code
used in the nss_files module. */
@ -72,17 +76,20 @@ __fgetpwent_r (FILE *stream, struct passwd *resbuf, char *buffer,
{
char *p;
flockfile (stream);
do
{
buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, stream);
if (p == NULL && feof (stream))
p = fgets_unlocked (buffer, buflen, stream);
if (p == NULL && feof_unlocked (stream))
{
funlockfile (stream);
*result = NULL;
return errno;
}
if (p == NULL || buffer[buflen - 1] != '\xff')
{
funlockfile (stream);
*result = NULL;
return errno = ERANGE;
}
@ -95,6 +102,8 @@ __fgetpwent_r (FILE *stream, struct passwd *resbuf, char *buffer,
get the next line of the file to parse. */
! parse_line (p, resbuf, (void *) buffer, buflen, &errno));
funlockfile (stream);
*result = resbuf;
return 0;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1992, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1992, 1996, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -47,7 +47,7 @@ __getpw (uid, buf)
buflen = __sysconf (_SC_GETPW_R_SIZE_MAX);
tmpbuf = alloca (buflen);
if (getpwuid_r (uid, &resbuf, tmpbuf, buflen, &p) < 0)
if (__getpwuid_r (uid, &resbuf, tmpbuf, buflen, &p) < 0)
return -1;
if (sprintf (buf, "%s:%s:%u:%u:%s:%s:%s", p->pw_name, p->pw_passwd,

View File

@ -106,7 +106,7 @@ herror(s)
v++;
v->iov_base = "\n";
v->iov_len = 1;
writev(STDERR_FILENO, iov, (v - iov) + 1);
__writev(STDERR_FILENO, iov, (v - iov) + 1);
}
const char *

View File

@ -386,7 +386,7 @@ res_init()
(void) fclose(fp);
}
if (_res.defdname[0] == 0 &&
gethostname(buf, sizeof(_res.defdname) - 1) == 0 &&
__gethostname(buf, sizeof(_res.defdname) - 1) == 0 &&
(cp = strchr(buf, '.')) != NULL)
strcpy(_res.defdname, cp + 1);
@ -651,6 +651,6 @@ res_randomid()
{
struct timeval now;
gettimeofday(&now, NULL);
return (0xffff & (now.tv_sec ^ now.tv_usec ^ getpid()));
__gettimeofday(&now, NULL);
return (0xffff & (now.tv_sec ^ now.tv_usec ^ __getpid()));
}

View File

@ -21,6 +21,10 @@
#include <shadow.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define flockfile(s) _IO_flockfile (s)
#endif
/* Define a line parsing function using the common code
used in the nss_files module. */
@ -39,17 +43,20 @@ __fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen,
{
char *p;
flockfile (stream);
do
{
buffer[buflen - 1] = '\xff';
p = fgets (buffer, buflen, stream);
if (p == NULL && feof (stream))
p = fgets_unlocked (buffer, buflen, stream);
if (p == NULL && feof_unlocked (stream))
{
funlockfile (stream);
*result = NULL;
return errno;
}
if (p == NULL || buffer[buflen - 1] != '\xff')
{
funlockfile (stream);
*result = NULL;
return errno = ERANGE;
}
@ -62,6 +69,8 @@ __fgetspent_r (FILE *stream, struct spwd *resbuf, char *buffer, size_t buflen,
get the next line of the file to parse. */
! parse_line (buffer, (void *) resbuf, NULL, 0, &errno));
funlockfile (stream);
*result = resbuf;
return 0;
}

View File

@ -1,5 +1,5 @@
/* Handle locking of password file.
Copyright (C) 1996 Free Software Foundation, Inc.
Copyright (C) 1996, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Ulrich Drepper <drepper@cygnus.com>, 1996.
@ -52,7 +52,7 @@ static void noop_handler __P ((int __sig));
do { \
if ((code) < 0 && lock_fd >= 0) \
{ \
close (lock_fd); \
__close (lock_fd); \
lock_fd = -1; \
} \
__libc_lock_unlock (lock); \
@ -63,7 +63,7 @@ static void noop_handler __P ((int __sig));
do { \
/* Restore old action handler for alarm. We don't need to know \
about the current one. */ \
sigaction (SIGALRM, &saved_act, NULL); \
__sigaction (SIGALRM, &saved_act, NULL); \
RETURN_CLOSE_FD (code); \
} while (0)
@ -73,7 +73,7 @@ static void noop_handler __P ((int __sig));
alarm (0); \
/* Restore old set of handled signals. We don't need to know \
about the current one.*/ \
sigprocmask (SIG_SETMASK, &saved_set, NULL); \
__sigprocmask (SIG_SETMASK, &saved_set, NULL); \
RETURN_RESTORE_HANDLER (code); \
} while (0)
@ -96,18 +96,18 @@ __lckpwdf ()
/* Prevent problems caused by multiple threads. */
__libc_lock_lock (lock);
lock_fd = open (PWD_LOCKFILE, O_WRONLY | O_CREAT, 0600);
lock_fd = __open (PWD_LOCKFILE, O_WRONLY | O_CREAT, 0600);
if (lock_fd == -1)
/* Cannot create lock file. */
RETURN_CLOSE_FD (-1);
/* Make sure file gets correctly closed when process finished. */
flags = fcntl (lock_fd, F_GETFD, 0);
flags = __fcntl (lock_fd, F_GETFD, 0);
if (flags == -1)
/* Cannot get file flags. */
RETURN_CLOSE_FD (-1);
flags |= FD_CLOEXEC; /* Close on exit. */
if (fcntl (lock_fd, F_SETFD, flags) < 0)
if (__fcntl (lock_fd, F_SETFD, flags) < 0)
/* Cannot set new flags. */
RETURN_CLOSE_FD (-1);
@ -125,14 +125,14 @@ __lckpwdf ()
new_act.sa_flags = 0ul;
/* Install new action handler for alarm and save old. */
if (sigaction (SIGALRM, &new_act, &saved_act) < 0)
if (__sigaction (SIGALRM, &new_act, &saved_act) < 0)
/* Cannot install signal handler. */
RETURN_CLOSE_FD (-1);
/* Now make sure the alarm signal is not blocked. */
sigemptyset (&new_set);
sigaddset (&new_set, SIGALRM);
if (sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0)
if (__sigprocmask (SIG_UNBLOCK, &new_set, &saved_set) < 0)
RETURN_RESTORE_HANDLER (-1);
/* Start timer. If we cannot get the lock in the specified time we
@ -143,7 +143,7 @@ __lckpwdf ()
memset (&fl, '\0', sizeof (struct flock));
fl.l_type = F_WRLCK;
fl.l_whence = SEEK_SET;
result = fcntl (lock_fd, F_SETLKW, &fl);
result = __fcntl (lock_fd, F_SETLKW, &fl);
RETURN_CLEAR_ALARM (result);
}
@ -163,7 +163,7 @@ __ulckpwdf ()
/* Prevent problems caused by multiple threads. */
__libc_lock_lock (lock);
result = close (lock_fd);
result = __close (lock_fd);
/* Mark descriptor as unused. */
lock_fd = -1;

View File

@ -29,7 +29,7 @@ sigrelse (sig)
sigset_t set;
/* Retrieve current signal set. */
if (sigprocmask (SIG_SETMASK, NULL, &set) < 0)
if (__sigprocmask (SIG_SETMASK, NULL, &set) < 0)
return -1;
/* Remove the specified signal. */
@ -37,5 +37,5 @@ sigrelse (sig)
return -1;
/* Set the new mask. */
return sigprocmask (SIG_SETMASK, &set, NULL);
return __sigprocmask (SIG_SETMASK, &set, NULL);
}

View File

@ -19,6 +19,10 @@
#include <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define vasprintf(s, f, a) _IO_vasprintf (s, f, a)
#endif
/* Write formatted output from FORMAT to a string which is
allocated with malloc and stored in *STRING_PTR. */
/* VARARGS2 */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1995, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -19,6 +19,10 @@
#include <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define vdprintf(d, f, a) _IO_vdprintf (d, f, a)
#endif
/* Write formatted output to D, according to the format string FORMAT. */
/* VARARGS2 */
int

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -18,6 +18,9 @@
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define fread(p, m, n, s) _IO_fread (p, m, n, s)
#endif
/* Read a word (int) from STREAM. */
int

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -18,6 +18,9 @@
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define fwrite(p, n, m, s) _IO_fwrite (p, n, m, s)
#endif
/* Write the word (int) W to STREAM. */
int

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1995, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -19,6 +19,10 @@
#include <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define __vsnprintf(s, l, f, a) _IO_vsnprintf (s, l, f, a)
#endif
/* Write formatted output into S, according to the format
string FORMAT, writing no more than MAXLEN characters. */
/* VARARGS3 */

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1995, 1997 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -19,6 +19,10 @@
#include <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define vsprintf(s, f, a) _IO_vsprintf (s, f, a)
#endif
/* Write formatted output into S, according to the format string FORMAT. */
/* VARARGS2 */
int

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1991, 1995, 1996 Free Software Foundation, Inc.
/* Copyright (C) 1991, 1995, 1996, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@ -19,6 +19,10 @@
#include <stdarg.h>
#include <stdio.h>
#ifdef USE_IN_LIBIO
# define __vsscanf(s, f, a) _IO_vsscanf (s, f, a)
#endif
/* Read formatted input from S, according to the format string FORMAT. */
/* VARARGS2 */
int

View File

@ -28,5 +28,5 @@ lrand48_r (buffer, result)
if (buffer == NULL)
return -1;
return nrand48_r (buffer->x, buffer, result);
return __nrand48_r (buffer->x, buffer, result);
}

View File

@ -28,5 +28,5 @@ mrand48_r (buffer, result)
if (buffer == NULL)
return -1;
return jrand48_r (buffer->x, buffer, result);
return __jrand48_r (buffer->x, buffer, result);
}

View File

@ -1,5 +1,5 @@
/* String replacement in an argz vector
Copyright (C) 1997 Free Software Foundation, Inc.
Copyright (C) 1997, 1998 Free Software Foundation, Inc.
Written by Miles Bader <miles@gnu.ai.mit.edu>
The GNU C Library is free software; you can redistribute it and/or
@ -69,7 +69,7 @@ __argz_replace (char **argz, size_t *argz_len, const char *str, const char *with
{
char *from = match + str_len;
size_t to_len = match - arg;
char *to = strndup (arg, to_len);
char *to = __strndup (arg, to_len);
while (to && from)
{
@ -98,11 +98,11 @@ __argz_replace (char **argz, size_t *argz_len, const char *str, const char *with
of SRC. */
{
if (arg > src)
err = argz_append (&dst, &dst_len, src, (arg - src));
err = __argz_append (&dst, &dst_len, src, (arg - src));
delayed_copy = 0;
}
if (! err)
err = argz_add (&dst, &dst_len, to);
err = __argz_add (&dst, &dst_len, to);
free (to);
}
else
@ -112,7 +112,7 @@ __argz_replace (char **argz, size_t *argz_len, const char *str, const char *with
(*replace_count)++;
}
else if (! delayed_copy)
err = argz_add (&dst, &dst_len, arg);
err = __argz_add (&dst, &dst_len, arg);
}
if (! err)

View File

@ -1,5 +1,5 @@
/* Routines for dealing with '\0' separated environment vectors
Copyright (C) 1995, 1996, 1997 Free Software Foundation, Inc.
Copyright (C) 1995, 1996, 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader <miles@gnu.ai.mit.edu>
@ -119,7 +119,7 @@ envz_add (char **envz, size_t *envz_len, const char *name, const char *value)
}
else
/* Add a null entry. */
return argz_add (envz, envz_len, name);
return __argz_add (envz, envz_len, name);
}
/* Adds each entry in ENVZ2 to ENVZ & ENVZ_LEN, as if with envz_add(). If
@ -137,11 +137,11 @@ envz_merge (char **envz, size_t *envz_len, const char *envz2,
size_t new_len = strlen (envz2) + 1;
if (! old)
err = argz_append (envz, envz_len, envz2, new_len);
err = __argz_append (envz, envz_len, envz2, new_len);
else if (override)
{
argz_delete (envz, envz_len, old);
err = argz_append (envz, envz_len, envz2, new_len);
err = __argz_append (envz, envz_len, envz2, new_len);
}
envz2 += new_len;

View File

@ -243,7 +243,7 @@ authdes_marshal (AUTH * auth, XDR * xdrs)
* Figure out the "time", accounting for any time difference
* with the server if necessary.
*/
gettimeofday (&ad->ad_timestamp, (struct timezone *) NULL);
__gettimeofday (&ad->ad_timestamp, (struct timezone *) NULL);
ad->ad_timestamp.tv_sec += ad->ad_timediff.tv_sec;
ad->ad_timestamp.tv_usec += ad->ad_timediff.tv_usec;
if (ad->ad_timestamp.tv_usec >= MILLION)
@ -371,7 +371,7 @@ authdes_validate (AUTH * auth, struct opaque_auth *rverf)
/*
* validate
*/
if (bcmp ((char *) &ad->ad_timestamp, (char *) &verf.adv_timestamp,
if (memcmp ((char *) &ad->ad_timestamp, (char *) &verf.adv_timestamp,
sizeof (struct timeval)) != 0)
{
debug ("authdes_validate: verifier mismatch\n");
@ -449,7 +449,7 @@ synchronize (struct sockaddr *syncaddr, struct timeval *timep)
if (rtime ((struct sockaddr_in *) syncaddr, timep, &timeout) < 0)
return (FALSE);
gettimeofday (&mytime, (struct timezone *) NULL);
__gettimeofday (&mytime, (struct timezone *) NULL);
timep->tv_sec -= mytime.tv_sec;
if (mytime.tv_usec > timep->tv_usec)
{

View File

@ -130,7 +130,7 @@ authunix_create (machname, uid, gid, len, aup_gids)
/*
* fill in param struct from the given params
*/
(void) gettimeofday (&now, (struct timezone *) 0);
(void) __gettimeofday (&now, (struct timezone *) 0);
aup.aup_time = now.tv_sec;
aup.aup_machname = machname;
aup.aup_uid = uid;
@ -175,13 +175,13 @@ authunix_create_default (void)
int max_nr_groups = __sysconf (_SC_NGROUPS_MAX);
gid_t gids[max_nr_groups];
if (gethostname (machname, MAX_MACHINE_NAME) == -1)
if (__gethostname (machname, MAX_MACHINE_NAME) == -1)
abort ();
machname[MAX_MACHINE_NAME] = 0;
uid = geteuid ();
gid = getegid ();
uid = __geteuid ();
gid = __getegid ();
if ((len = getgroups (max_nr_groups, gids)) < 0)
if ((len = __getgroups (max_nr_groups, gids)) < 0)
abort ();
/* This braindamaged Sun code forces us here to truncate the
list of groups to NGRPS members since the code in
@ -267,7 +267,7 @@ authunix_refresh (AUTH *auth)
goto done;
/* update the time and serialize in place */
(void) gettimeofday (&now, (struct timezone *) 0);
(void) __gettimeofday (&now, (struct timezone *) 0);
aup.aup_time = now.tv_sec;
xdrs.x_op = XDR_ENCODE;
XDR_SETPOS (&xdrs, 0);

View File

@ -61,7 +61,7 @@ bindresvport (int sd, struct sockaddr_in *sin)
if (sin == (struct sockaddr_in *) 0)
{
sin = &myaddr;
bzero (sin, sizeof (*sin));
__bzero (sin, sizeof (*sin));
sin->sin_family = AF_INET;
}
else if (sin->sin_family != AF_INET)
@ -71,7 +71,7 @@ bindresvport (int sd, struct sockaddr_in *sin)
}
if (port == 0)
{
port = (getpid () % NPORTS) + STARTPORT;
port = (__getpid () % NPORTS) + STARTPORT;
}
res = -1;
__set_errno (EADDRINUSE);

View File

@ -89,7 +89,7 @@ clnt_create (const char *hostname, u_long prog, u_long vers,
}
sin.sin_family = h->h_addrtype;
sin.sin_port = 0;
bzero (sin.sin_zero, sizeof (sin.sin_zero));
__bzero (sin.sin_zero, sizeof (sin.sin_zero));
bcopy (h->h_addr, (char *) &sin.sin_addr, h->h_length);
prtbuflen = 1024;

View File

@ -43,6 +43,11 @@ static char sccsid[] = "@(#)clnt_perror.c 1.15 87/10/07 Copyr 1984 Sun Micro";
#include <rpc/auth.h>
#include <rpc/clnt.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
static char *auth_errmsg (enum auth_stat stat) internal_function;
static char *buf;
@ -96,7 +101,7 @@ clnt_sperror (CLIENT * rpch, const char *msg)
case RPC_CANTSEND:
case RPC_CANTRECV:
len = sprintf (str, "; errno = %s", strerror_r (e.re_errno,
len = sprintf (str, "; errno = %s", __strerror_r (e.re_errno,
buf, sizeof buf));
str += len;
break;
@ -233,21 +238,14 @@ clnt_spcreateerror (const char *msg)
switch (rpc_createerr.cf_stat)
{
case RPC_PMAPFAILURE:
cp = stpcpy (cp, " - ");
cp = stpcpy (cp, clnt_sperrno (rpc_createerr.cf_error.re_status));
cp = stpcpy (stpcpy (cp, " - "),
clnt_sperrno (rpc_createerr.cf_error.re_status));
break;
case RPC_SYSTEMERROR:
cp = stpcpy (str, " - ");
if (rpc_createerr.cf_error.re_errno > 0
&& rpc_createerr.cf_error.re_errno < sys_nerr)
cp = stpcpy (str, strerror_r (rpc_createerr.cf_error.re_errno,
cp = stpcpy (stpcpy (cp, " - "),
__strerror_r (rpc_createerr.cf_error.re_errno,
buf, sizeof buf));
else
{
len = sprintf (cp, _("Error %d"), rpc_createerr.cf_error.re_errno);
cp += len;
}
break;
default:
break;

View File

@ -93,7 +93,7 @@ callrpc (const char *host, u_long prognum, u_long versnum, u_long procnum,
crp->valid = 0;
if (crp->socket != RPC_ANYSOCK)
{
(void) close (crp->socket);
(void) __close (crp->socket);
crp->socket = RPC_ANYSOCK;
}
if (crp->client)

View File

@ -155,16 +155,16 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
*/
if (*sockp < 0)
{
*sockp = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
*sockp = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP);
(void) bindresvport (*sockp, (struct sockaddr_in *) 0);
if ((*sockp < 0)
|| (connect (*sockp, (struct sockaddr *) raddr,
|| (__connect (*sockp, (struct sockaddr *) raddr,
sizeof (*raddr)) < 0))
{
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
rpc_createerr.cf_error.re_errno = errno;
if (*sockp >= 0)
(void) close (*sockp);
(void) __close (*sockp);
goto fooy;
}
ct->ct_closeit = TRUE;
@ -185,8 +185,8 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
/*
* Initialize call message
*/
(void) gettimeofday (&now, (struct timezone *) 0);
call_msg.rm_xid = getpid () ^ now.tv_sec ^ now.tv_usec;
(void) __gettimeofday (&now, (struct timezone *) 0);
call_msg.rm_xid = __getpid () ^ now.tv_sec ^ now.tv_usec;
call_msg.rm_direction = CALL;
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
call_msg.rm_call.cb_prog = prog;
@ -201,7 +201,7 @@ clnttcp_create (struct sockaddr_in *raddr, u_long prog, u_long vers,
{
if (ct->ct_closeit)
{
(void) close (*sockp);
(void) __close (*sockp);
}
goto fooy;
}
@ -454,7 +454,7 @@ clnttcp_destroy (CLIENT *h)
if (ct->ct_closeit)
{
(void) close (ct->ct_sock);
(void) __close (ct->ct_sock);
}
XDR_DESTROY (&(ct->ct_xdrs));
mem_free ((caddr_t) ct, sizeof (struct ct_data));
@ -496,7 +496,7 @@ readtcp (char *ctptr, char *buf, int len)
}
break;
}
switch (len = read (ct->ct_sock, buf, len))
switch (len = __read (ct->ct_sock, buf, len))
{
case 0:
@ -522,7 +522,7 @@ writetcp (char *ctptr, char *buf, int len)
for (cnt = len; cnt > 0; cnt -= i, buf += i)
{
if ((i = write (ct->ct_sock, buf, cnt)) == -1)
if ((i = __write (ct->ct_sock, buf, cnt)) == -1)
{
ct->ct_error.re_errno = errno;
ct->ct_error.re_status = RPC_CANTSEND;

View File

@ -143,7 +143,7 @@ clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
}
cu->cu_outbuf = &cu->cu_inbuf[recvsz];
(void) gettimeofday (&now, (struct timezone *) 0);
(void) __gettimeofday (&now, (struct timezone *) 0);
if (raddr->sin_port == 0)
{
u_short port;
@ -163,7 +163,7 @@ clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
cu->cu_total.tv_usec = -1;
cu->cu_sendsz = sendsz;
cu->cu_recvsz = recvsz;
call_msg.rm_xid = getpid () ^ now.tv_sec ^ now.tv_usec;
call_msg.rm_xid = __getpid () ^ now.tv_sec ^ now.tv_usec;
call_msg.rm_direction = CALL;
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
call_msg.rm_call.cb_prog = program;
@ -179,7 +179,7 @@ clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
{
int dontblock = 1;
*sockp = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
*sockp = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP);
if (*sockp < 0)
{
rpc_createerr.cf_stat = RPC_SYSTEMERROR;
@ -189,7 +189,7 @@ clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
/* attempt to bind to prov port */
(void) bindresvport (*sockp, (struct sockaddr_in *) 0);
/* the sockets rpc controls are non-blocking */
(void) ioctl (*sockp, FIONBIO, (char *) &dontblock);
(void) __ioctl (*sockp, FIONBIO, (char *) &dontblock);
cu->cu_closeit = TRUE;
}
else
@ -511,7 +511,7 @@ clntudp_destroy (CLIENT *cl)
if (cu->cu_closeit)
{
(void) close (cu->cu_sock);
(void) __close (cu->cu_sock);
}
XDR_DESTROY (&(cu->cu_outxdrs));
mem_free ((caddr_t) cu, (sizeof (*cu) + cu->cu_sendsz + cu->cu_recvsz));

View File

@ -65,14 +65,14 @@ get_myaddress (struct sockaddr_in *addr)
struct ifreq ifreq, *ifr;
int len, loopback = 0;
if ((s = socket (AF_INET, SOCK_DGRAM, 0)) < 0)
if ((s = __socket (AF_INET, SOCK_DGRAM, 0)) < 0)
{
perror ("get_myaddress: socket");
exit (1);
}
ifc.ifc_len = sizeof (buf);
ifc.ifc_buf = buf;
if (ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0)
if (__ioctl (s, SIOCGIFCONF, (char *) &ifc) < 0)
{
perror (_("get_myaddress: ioctl (get interface configuration)"));
exit (1);
@ -83,7 +83,7 @@ get_myaddress (struct sockaddr_in *addr)
for (len = ifc.ifc_len; len; len -= sizeof ifreq)
{
ifreq = *ifr;
if (ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0)
if (__ioctl (s, SIOCGIFFLAGS, (char *) &ifreq) < 0)
{
perror ("get_myaddress: ioctl");
exit (1);
@ -94,7 +94,7 @@ get_myaddress (struct sockaddr_in *addr)
{
*addr = *((struct sockaddr_in *) &ifr->ifr_addr);
addr->sin_port = htons (PMAPPORT);
close (s);
__close (s);
return;
}
ifr++;
@ -104,5 +104,5 @@ get_myaddress (struct sockaddr_in *addr)
loopback = 1;
goto again;
}
close (s);
__close (s);
}

View File

@ -200,7 +200,7 @@ key_gendes (des_block *key)
sin.sin_family = AF_INET;
sin.sin_port = 0;
sin.sin_addr.s_addr = htonl (INADDR_LOOPBACK);
bzero (sin.sin_zero, sizeof (sin.sin_zero));
__bzero (sin.sin_zero, sizeof (sin.sin_zero));
socket = RPC_ANYSOCK;
client = clntudp_bufcreate (&sin, (u_long) KEY_PROG, (u_long) KEY_VERS,
trytimeout, &socket, RPCSMALLMSGSIZE,
@ -211,7 +211,7 @@ key_gendes (des_block *key)
stat = clnt_call (client, KEY_GEN, (xdrproc_t) xdr_void, NULL,
(xdrproc_t) xdr_des_block, (caddr_t) key, tottimeout);
clnt_destroy (client);
close (socket);
__close (socket);
if (stat != RPC_SUCCESS)
return -1;
@ -286,21 +286,21 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
if (proc == KEY_ENCRYPT_PK && __key_encryptsession_pk_LOCAL)
{
cryptkeyres *res;
res = (*__key_encryptsession_pk_LOCAL) (geteuid (), arg);
res = (*__key_encryptsession_pk_LOCAL) (__geteuid (), arg);
*(cryptkeyres *) rslt = *res;
return 1;
}
else if (proc == KEY_DECRYPT_PK && __key_decryptsession_pk_LOCAL)
{
cryptkeyres *res;
res = (*__key_decryptsession_pk_LOCAL) (geteuid (), arg);
res = (*__key_decryptsession_pk_LOCAL) (__geteuid (), arg);
*(cryptkeyres *) rslt = *res;
return 1;
}
else if (proc == KEY_GEN && __key_gendes_LOCAL)
{
des_block *res;
res = (*__key_gendes_LOCAL) (geteuid (), 0);
res = (*__key_gendes_LOCAL) (__geteuid (), 0);
*(des_block *) rslt = *res;
return 1;
}
@ -308,7 +308,7 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
success = 1;
sigemptyset (&mask);
sigaddset (&mask, SIGCHLD);
sigprocmask (SIG_BLOCK, &mask, &oldmask);
__sigprocmask (SIG_BLOCK, &mask, &oldmask);
/*
* We are going to exec a set-uid program which makes our effective uid
@ -316,15 +316,15 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
* effective uid be the real uid for the setuid program, and
* the real uid be the effective uid so that we can change things back.
*/
euid = geteuid ();
ruid = getuid ();
setreuid (euid, ruid);
euid = __geteuid ();
ruid = __getuid ();
__setreuid (euid, ruid);
pid = _openchild (MESSENGER, &fargs, &frslt);
setreuid (ruid, euid);
__setreuid (ruid, euid);
if (pid < 0)
{
debug ("open_streams");
sigprocmask(SIG_SETMASK, &oldmask, NULL);
__sigprocmask (SIG_SETMASK, &oldmask, NULL);
return (0);
}
xdrstdio_create (&xdrargs, fargs, XDR_ENCODE);
@ -345,23 +345,23 @@ key_call (u_long proc, xdrproc_t xdr_arg, char *arg,
fclose(frslt);
wait_again:
if (wait4(pid, &status, 0, NULL) < 0)
if (__wait4 (pid, &status, 0, NULL) < 0)
{
if (errno == EINTR)
goto wait_again;
debug("wait4");
debug ("wait4");
if (errno == ECHILD || errno == ESRCH)
perror("wait");
perror ("wait");
else
success = 0;
}
else
if (status.w_retcode)
{
debug("wait4 1");
debug ("wait4 1");
success = 0;
}
sigprocmask(SIG_SETMASK, &oldmask, NULL);
__sigprocmask (SIG_SETMASK, &oldmask, NULL);
return (success);
return success;
}

View File

@ -1,4 +1,4 @@
/* Copyright (C) 1997 Free Software Foundation, Inc.
/* Copyright (C) 1997, 1998 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1997.
@ -69,7 +69,7 @@ host2netname (char netname[MAXNETNAMELEN + 1], const char *host,
netname[0] = '\0'; /* make null first (no need for memset) */
if (host == NULL)
gethostname (hostname, MAXHOSTNAMELEN);
__gethostname (hostname, MAXHOSTNAMELEN);
else
{
strncpy (hostname, host, MAXHOSTNAMELEN);
@ -122,7 +122,7 @@ getnetname (char name[MAXNETNAMELEN + 1])
uid_t uid;
int dummy;
uid = geteuid ();
uid = __geteuid ();
if (uid == 0)
dummy = host2netname (name, NULL, NULL);
else

View File

@ -43,6 +43,11 @@
#include <rpc/rpc.h>
#include <rpc/clnt.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define fflush(s) _IO_fflush (s)
#endif
/*
* returns pid, or -1 for failure
*/
@ -54,11 +59,11 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
int pdto[2];
int pdfrom[2];
if (pipe (pdto) < 0)
if (__pipe (pdto) < 0)
goto error1;
if (pipe (pdfrom) < 0)
if (__pipe (pdfrom) < 0)
goto error2;
switch (pid = fork ())
switch (pid = __fork ())
{
case -1:
goto error3;
@ -67,13 +72,13 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
/*
* child: read from pdto[0], write into pdfrom[1]
*/
close (0);
dup (pdto[0]);
close (1);
dup (pdfrom[1]);
__close (0);
__dup (pdto[0]);
__close (1);
__dup (pdfrom[1]);
fflush (stderr);
for (i = _rpc_dtablesize () - 1; i >= 3; i--)
close (i);
__close (i);
fflush (stderr);
execlp (command, command, 0);
perror ("exec");
@ -84,9 +89,9 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
* parent: write into pdto[1], read from pdfrom[0]
*/
*fto = fdopen (pdto[1], "w");
close (pdto[0]);
__close (pdto[0]);
*ffrom = fdopen (pdfrom[0], "r");
close (pdfrom[1]);
__close (pdfrom[1]);
break;
}
return pid;
@ -95,11 +100,11 @@ _openchild (char *command, FILE ** fto, FILE ** ffrom)
* error cleanup and return
*/
error3:
close (pdfrom[0]);
close (pdfrom[1]);
__close (pdfrom[0]);
__close (pdfrom[1]);
error2:
close (pdto[0]);
close (pdto[1]);
__close (pdto[0]);
__close (pdto[1]);
error1:
return -1;
}

View File

@ -101,7 +101,7 @@ pmap_rmtcall (addr, prog, vers, proc, xdrargs, argsp, xdrres, resp, tout, port_p
{
stat = RPC_FAILED;
}
/* (void)close(socket); CLNT_DESTROY already closed it */
/* (void)__close(socket); CLNT_DESTROY already closed it */
addr->sin_port = 0;
return stat;
}
@ -180,7 +180,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf)
ifc.ifc_len = UDPMSGSIZE;
ifc.ifc_buf = buf;
if (ioctl (sock, SIOCGIFCONF, (char *) &ifc) < 0)
if (__ioctl (sock, SIOCGIFCONF, (char *) &ifc) < 0)
{
perror (_("broadcast: ioctl (get interface configuration)"));
return (0);
@ -189,7 +189,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf)
for (i = 0, n = ifc.ifc_len / sizeof (struct ifreq); n > 0; n--, ifr++)
{
ifreq = *ifr;
if (ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0)
if (__ioctl (sock, SIOCGIFFLAGS, (char *) &ifreq) < 0)
{
perror (_("broadcast: ioctl (get interface flags)"));
continue;
@ -200,7 +200,7 @@ getbroadcastnets (struct in_addr *addrs, int sock, char *buf)
{
sin = (struct sockaddr_in *) &ifr->ifr_addr;
#ifdef SIOCGIFBRDADDR /* 4.3BSD */
if (ioctl (sock, SIOCGIFBRDADDR, (char *) &ifreq) < 0)
if (__ioctl (sock, SIOCGIFBRDADDR, (char *) &ifreq) < 0)
{
addrs[i++] = inet_makeaddr (inet_netof
/* Changed to pass struct instead of s_addr member
@ -259,7 +259,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
* initialization: create a socket, a broadcast address, and
* preserialize the arguments into a send buffer.
*/
if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
{
perror (_("Cannot create socket for broadcast rpc"));
stat = RPC_CANTSEND;
@ -276,13 +276,13 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
fd.fd = sock;
fd.events = POLLIN;
nets = getbroadcastnets (addrs, sock, inbuf);
bzero ((char *) &baddr, sizeof (baddr));
__bzero ((char *) &baddr, sizeof (baddr));
baddr.sin_family = AF_INET;
baddr.sin_port = htons (PMAPPORT);
baddr.sin_addr.s_addr = htonl (INADDR_ANY);
/* baddr.sin_addr.S_un.S_addr = htonl(INADDR_ANY); */
(void) gettimeofday (&t, (struct timezone *) 0);
msg.rm_xid = xid = getpid () ^ t.tv_sec ^ t.tv_usec;
(void) __gettimeofday (&t, (struct timezone *) 0);
msg.rm_xid = xid = __getpid () ^ t.tv_sec ^ t.tv_usec;
t.tv_usec = 0;
msg.rm_direction = CALL;
msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
@ -405,7 +405,7 @@ clnt_broadcast (prog, vers, proc, xargs, argsp, xresults, resultsp, eachresult)
}
}
done_broad:
(void) close (sock);
(void) __close (sock);
AUTH_DESTROY (unix_auth);
return stat;
}

View File

@ -97,12 +97,12 @@ struct AUTH {
struct opaque_auth ah_verf;
union des_block ah_key;
struct auth_ops {
void (*ah_nextverf) __P ((AUTH *));
int (*ah_marshal) __P ((AUTH *, XDR *)); /* nextverf & serialize */
int (*ah_validate) __P ((AUTH *, struct opaque_auth *));
void (*ah_nextverf) __PMT ((AUTH *));
int (*ah_marshal) __PMT ((AUTH *, XDR *)); /* nextverf & serialize */
int (*ah_validate) __PMT ((AUTH *, struct opaque_auth *));
/* validate verifier */
int (*ah_refresh) __P ((AUTH *)); /* refresh credentials */
void (*ah_destroy) __P ((AUTH *)); /* destroy this structure */
int (*ah_refresh) __PMT ((AUTH *)); /* refresh credentials */
void (*ah_destroy) __PMT ((AUTH *)); /* destroy this structure */
} *ah_ops;
caddr_t ah_private;
};

View File

@ -132,17 +132,17 @@ typedef struct CLIENT CLIENT;
struct CLIENT {
AUTH *cl_auth; /* authenticator */
struct clnt_ops {
enum clnt_stat (*cl_call) __P ((CLIENT *, u_long, xdrproc_t,
enum clnt_stat (*cl_call) __PMT ((CLIENT *, u_long, xdrproc_t,
caddr_t, xdrproc_t,
caddr_t, struct timeval));
/* call remote procedure */
void (*cl_abort) __P ((void)); /* abort a call */
void (*cl_geterr) __P ((CLIENT *, struct rpc_err *));
void (*cl_abort) __PMT ((void)); /* abort a call */
void (*cl_geterr) __PMT ((CLIENT *, struct rpc_err *));
/* get specific error code */
bool_t (*cl_freeres) __P ((CLIENT *, xdrproc_t, caddr_t));
bool_t (*cl_freeres) __PMT ((CLIENT *, xdrproc_t, caddr_t));
/* frees results */
void (*cl_destroy) __P ((CLIENT *)); /* destroy this structure */
bool_t (*cl_control) __P ((CLIENT *, int, char *));
void (*cl_destroy) __PMT ((CLIENT *)); /* destroy this structure */
bool_t (*cl_control) __PMT ((CLIENT *, int, char *));
/* the ioctl() of rpc */
} *cl_ops;
caddr_t cl_private; /* private stuff */

View File

@ -45,7 +45,8 @@
__BEGIN_DECLS
typedef bool_t (*resultproc_t) __P ((caddr_t resp, struct sockaddr_in *raddr));
typedef bool_t (*resultproc_t) __PMT ((caddr_t resp,
struct sockaddr_in *raddr));
/*
* Usage:

View File

@ -78,18 +78,18 @@ struct SVCXPRT {
int xp_sock;
u_short xp_port; /* associated port number */
const struct xp_ops {
bool_t (*xp_recv) __P ((SVCXPRT *__xprt, struct rpc_msg *__msg));
bool_t (*xp_recv) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
/* receive incoming requests */
enum xprt_stat (*xp_stat) __P ((SVCXPRT *__xprt));
enum xprt_stat (*xp_stat) __PMT ((SVCXPRT *__xprt));
/* get transport status */
bool_t (*xp_getargs) __P ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
bool_t (*xp_getargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
caddr_t args_ptr)); /* get arguments */
bool_t (*xp_reply) __P ((SVCXPRT *__xprt, struct rpc_msg *__msg));
bool_t (*xp_reply) __PMT ((SVCXPRT *__xprt, struct rpc_msg *__msg));
/* send reply */
bool_t (*xp_freeargs) __P ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
bool_t (*xp_freeargs) __PMT ((SVCXPRT *__xprt, xdrproc_t __xdr_args,
caddr_t args_ptr));
/* free mem allocated for args */
void (*xp_destroy) __P ((SVCXPRT *__xprt));
void (*xp_destroy) __PMT ((SVCXPRT *__xprt));
/* destroy this struct */
} *xp_ops;
int xp_addrlen; /* length of remote address */
@ -157,7 +157,7 @@ struct svc_req {
#ifndef __DISPATCH_FN_T
#define __DISPATCH_FN_T
typedef void (*__dispatch_fn_t) __P((struct svc_req*, SVCXPRT*));
typedef void (*__dispatch_fn_t) __PMT ((struct svc_req*, SVCXPRT*));
#endif
/*

View File

@ -117,22 +117,23 @@ struct XDR
enum xdr_op x_op; /* operation; fast additional param */
struct xdr_ops
{
bool_t (*x_getlong) __P ((XDR * __xdrs, long *__lp));
bool_t (*x_getlong) __PMT ((XDR * __xdrs, long *__lp));
/* get a long from underlying stream */
bool_t (*x_putlong) __P ((XDR * __xdrs, __const long *__lp));
bool_t (*x_putlong) __PMT ((XDR * __xdrs, __const long *__lp));
/* put a long to " */
bool_t (*x_getbytes) __P ((XDR * __xdrs, caddr_t __addr, u_int __len));
bool_t (*x_getbytes) __PMT ((XDR * __xdrs, caddr_t __addr,
u_int __len));
/* get some bytes from " */
bool_t (*x_putbytes) __P ((XDR * __xdrs, __const char *__addr,
bool_t (*x_putbytes) __PMT ((XDR * __xdrs, __const char *__addr,
u_int __len));
/* put some bytes to " */
u_int (*x_getpostn) __P ((__const XDR * __xdrs));
u_int (*x_getpostn) __PMT ((__const XDR * __xdrs));
/* returns bytes off from beginning */
bool_t (*x_setpostn) __P ((XDR * __xdrs, u_int pos));
bool_t (*x_setpostn) __PMT ((XDR * __xdrs, u_int pos));
/* lets you reposition the stream */
long *(*x_inline) __P ((XDR * __xdrs, int len));
long *(*x_inline) __PMT ((XDR * __xdrs, int len));
/* buf quick ptr to buffered data */
void (*x_destroy) __P ((XDR * __xdrs));
void (*x_destroy) __PMT ((XDR * __xdrs));
/* free privates of this xdr_stream */
}
*x_ops;
@ -151,8 +152,7 @@ struct XDR
* allocate dynamic storage of the appropriate size and return it.
* bool_t (*xdrproc_t)(XDR *, caddr_t *);
*/
typedef
bool_t (*xdrproc_t) __P ((XDR *, void *,...));
typedef bool_t (*xdrproc_t) __PMT ((XDR *, void *,...));
/*
* Operations defined on a XDR handle

View File

@ -43,7 +43,7 @@ _rpc_dtablesize (void)
static int size;
if (size == 0)
size = getdtablesize ();
size = __getdtablesize ();
return size;
}

View File

@ -65,7 +65,7 @@ do_close (int s)
int save;
save = errno;
close (s);
__close (s);
__set_errno (save);
}
@ -87,7 +87,7 @@ rtime (struct sockaddr_in *addrp, struct timeval *timep,
else
type = SOCK_DGRAM;
s = socket (AF_INET, type, 0);
s = __socket (AF_INET, type, 0);
if (s < 0)
return (-1);
@ -124,12 +124,12 @@ rtime (struct sockaddr_in *addrp, struct timeval *timep,
}
else
{
if (connect (s, (struct sockaddr *) addrp, sizeof (*addrp)) < 0)
if (__connect (s, (struct sockaddr *) addrp, sizeof (*addrp)) < 0)
{
do_close (s);
return -1;
}
res = read (s, (char *) &thetime, sizeof (thetime));
res = __read (s, (char *) &thetime, sizeof (thetime));
do_close (s);
if (res < 0)
return (-1);

View File

@ -70,7 +70,7 @@ svc_run (void)
#else
readfds = svc_fds;
#endif /* def FD_SETSIZE */
switch (select (_rpc_dtablesize (), &readfds, (fd_set *)NULL,
switch (__select (_rpc_dtablesize (), &readfds, (fd_set *)NULL,
(fd_set *)NULL, (struct timeval *) 0))
{
case -1:

View File

@ -45,6 +45,10 @@ static char sccsid[] = "@(#)svc_simple.c 1.18 87/08/11 Copyr 1984 Sun Micro";
#include <sys/socket.h>
#include <netdb.h>
#ifdef USE_IN_LIBIO
# define fputs(s, f) _IO_fputs (s, f)
#endif
static struct proglst
{
char *(*p_progname) (char *);
@ -129,7 +133,7 @@ universal (struct svc_req *rqstp, SVCXPRT *transp)
if (pl->p_prognum == prog && pl->p_procnum == proc)
{
/* decode arguments into a CLEAN buffer */
bzero (xdrbuf, sizeof (xdrbuf)); /* required ! */
__bzero (xdrbuf, sizeof (xdrbuf)); /* required ! */
if (!svc_getargs (transp, pl->p_inproc, xdrbuf))
{
svcerr_decode (transp);

View File

@ -49,6 +49,11 @@ static char sccsid[] = "@(#)svc_tcp.c 1.21 87/08/11 Copyr 1984 Sun Micro";
#include <errno.h>
#include <stdlib.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
/*
* Ops vector for TCP/IP based rpc service handle
*/
@ -134,14 +139,14 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
if (sock == RPC_ANYSOCK)
{
if ((sock = socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
if ((sock = __socket (AF_INET, SOCK_STREAM, IPPROTO_TCP)) < 0)
{
perror (_("svctcp_.c - udp socket creation problem"));
return (SVCXPRT *) NULL;
}
madesock = TRUE;
}
bzero ((char *) &addr, sizeof (addr));
__bzero ((char *) &addr, sizeof (addr));
addr.sin_family = AF_INET;
if (bindresvport (sock, &addr))
{
@ -153,7 +158,7 @@ svctcp_create (int sock, u_int sendsize, u_int recvsize)
{
perror (_("svctcp_.c - cannot getsockname or listen"));
if (madesock)
(void) close (sock);
(void) __close (sock);
return (SVCXPRT *) NULL;
}
r = (struct tcp_rendezvous *) mem_alloc (sizeof (*r));
@ -237,8 +242,7 @@ rendezvous_request (SVCXPRT *xprt, struct rpc_msg *errmsg)
r = (struct tcp_rendezvous *) xprt->xp_p1;
again:
len = sizeof (struct sockaddr_in);
if ((sock = accept (xprt->xp_sock, (struct sockaddr *) &addr,
&len)) < 0)
if ((sock = accept (xprt->xp_sock, (struct sockaddr *) &addr, &len)) < 0)
{
if (errno == EINTR)
goto again;
@ -265,7 +269,7 @@ svctcp_destroy (SVCXPRT *xprt)
struct tcp_conn *cd = (struct tcp_conn *) xprt->xp_p1;
xprt_unregister (xprt);
(void) close (xprt->xp_sock);
(void) __close (xprt->xp_sock);
if (xprt->xp_port != 0)
{
/* a rendezvouser socket */
@ -318,7 +322,7 @@ readtcp (char *xprtptr, char *buf, int len)
#else
readfds |= (1 << sock);
#endif /* def FD_SETSIZE */
if (select (_rpc_dtablesize (), &readfds, (fd_set *) NULL,
if (__select (_rpc_dtablesize (), &readfds, (fd_set *) NULL,
(fd_set *) NULL, &timeout) <= 0)
{
if (errno == EINTR)
@ -336,7 +340,7 @@ readtcp (char *xprtptr, char *buf, int len)
svc_getreqset (&readfds);
}
if ((len = read (sock, buf, len)) > 0)
if ((len = __read (sock, buf, len)) > 0)
return len;
fatal_err:
@ -356,7 +360,7 @@ writetcp (char *xprtptr, char * buf, int len)
for (cnt = len; cnt > 0; cnt -= i, buf += i)
{
if ((i = write (xprt->xp_sock, buf, cnt)) < 0)
if ((i = __write (xprt->xp_sock, buf, cnt)) < 0)
{
((struct tcp_conn *) (xprt->xp_p1))->strm_stat =
XPRT_DIED;

View File

@ -46,6 +46,10 @@ static char sccsid[] = "@(#)svc_udp.c 1.24 87/08/11 Copyr 1984 Sun Micro";
#include <sys/socket.h>
#include <errno.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
#define rpc_buffer(xprt) ((xprt)->xp_p1)
#ifndef MAX
@ -112,14 +116,14 @@ svcudp_bufcreate (sock, sendsz, recvsz)
if (sock == RPC_ANYSOCK)
{
if ((sock = socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
if ((sock = __socket (AF_INET, SOCK_DGRAM, IPPROTO_UDP)) < 0)
{
perror (_("svcudp_create: socket creation problem"));
return (SVCXPRT *) NULL;
}
madesock = TRUE;
}
bzero ((char *) &addr, sizeof (addr));
__bzero ((char *) &addr, sizeof (addr));
addr.sin_family = AF_INET;
if (bindresvport (sock, &addr))
{
@ -130,7 +134,7 @@ svcudp_bufcreate (sock, sendsz, recvsz)
{
perror (_("svcudp_create - cannot getsockname"));
if (madesock)
(void) close (sock);
(void) __close (sock);
return (SVCXPRT *) NULL;
}
xprt = (SVCXPRT *) mem_alloc (sizeof (SVCXPRT));
@ -276,7 +280,7 @@ svcudp_destroy (xprt)
struct svcudp_data *su = su_data (xprt);
xprt_unregister (xprt);
(void) close (xprt->xp_sock);
(void) __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));
@ -301,7 +305,7 @@ svcudp_destroy (xprt)
(type *) mem_alloc((unsigned) (sizeof(type) * (size)))
#define BZERO(addr, type, size) \
bzero((char *) addr, sizeof(type) * (int) (size))
__bzero((char *) addr, sizeof(type) * (int) (size))
/*
* An entry in the cache
@ -479,7 +483,7 @@ cache_get (xprt, msg, replyp, replylenp)
struct svcudp_data *su = su_data (xprt);
struct udp_cache *uc = (struct udp_cache *) su->su_cache;
#define EQADDR(a1, a2) (bcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
#define EQADDR(a1, a2) (memcmp((char*)&a1, (char*)&a2, sizeof(a1)) == 0)
loc = CACHE_LOC (xprt, su->su_xid);
for (ent = uc->uc_entries[loc]; ent != NULL; ent = ent->cache_next)

View File

@ -282,7 +282,7 @@ _svcauth_des (register struct svc_req *rqst, register struct rpc_msg *msg)
debug ("timestamp before last seen");
return (AUTH_REJECTEDVERF); /* replay */
}
gettimeofday (&current, (struct timezone *) NULL);
__gettimeofday (&current, (struct timezone *) NULL);
current.tv_sec -= window; /* allow for expiration */
if (!BEFORE (&current, &timestamp))
{
@ -385,7 +385,7 @@ cache_init (void)
authdes_cache = (struct cache_entry *)
mem_alloc (sizeof (struct cache_entry) * AUTHDES_CACHESZ);
bzero ((char *) authdes_cache,
__bzero ((char *) authdes_cache,
sizeof (struct cache_entry) * AUTHDES_CACHESZ);
authdes_lru = (short *) mem_alloc (sizeof (short) * AUTHDES_CACHESZ);
@ -449,7 +449,7 @@ cache_spot (register des_block * key, char *name, struct timeval *timestamp)
if (cp->key.key.high == hi &&
cp->key.key.low == key->key.low &&
cp->rname != NULL &&
bcmp (cp->rname, name, strlen (name) + 1) == 0)
memcmp (cp->rname, name, strlen (name) + 1) == 0)
{
if (BEFORE (timestamp, &cp->laststamp))
{

View File

@ -99,7 +99,7 @@ xdr_array (xdrs, addrp, sizep, maxsize, elsize, elproc)
"xdr_array: out of memory\n");
return FALSE;
}
bzero (target, nodesize);
__bzero (target, nodesize);
break;
case XDR_FREE:

View File

@ -53,6 +53,11 @@ static char sccsid[] = "@(#)xdr_rec.c 1.21 87/08/11 Copyr 1984 Sun Micro";
#include <unistd.h>
#include <rpc/rpc.h>
#ifdef USE_IN_LIBIO
# include <libio/iolibio.h>
# define fputs(s, f) _IO_fputs (s, f)
#endif
static bool_t xdrrec_getlong (XDR *, long *);
static bool_t xdrrec_putlong (XDR *, const long *);
static bool_t xdrrec_getbytes (XDR *, caddr_t, u_int);
@ -309,7 +314,7 @@ xdrrec_getpos (const XDR *xdrs)
RECSTREAM *rstrm = (RECSTREAM *) xdrs->x_private;
long pos;
pos = lseek ((int) rstrm->tcp_handle, (long) 0, 1);
pos = __lseek ((int) rstrm->tcp_handle, (long) 0, 1);
if (pos != -1)
switch (xdrs->x_op)
{

Some files were not shown because too many files have changed in this diff Show More