+1998-06-22 17:02 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/generic/enbl-secure.c: Don't use __libc_uid.
+ * sysdeps/unix/sysv/linux/aio_sigqueue.c: Likewise.
+ * sysdeps/unix/sysv/linux/sigqueue.c: Likewise.
+ * sysdeps/unix/sysv/linux/init-first.c: Don't initialize __libc_uid.
+
+1998-06-02 Gordon Matzigkeit <gord@profitpress.com>
+
+ * mach/Makefile: Change `mv' invocations to `mv -f'.
+ * mach/Machrules: Likewise.
+
+1998-06-22 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * config.make.in (old-glibc-headers): Add it.
+
+ * configure.in: Add test for glibc 2.0.x headers.
+
+ * Makefile (headers2_0): New variable - contains so far only
+ Linux/Intel glibc 2.0.x headers.
+ (remove-old-headers): New rule to remove headers from glibc 2.0.x.
+ (install): Depend on remove-old-headers.
+
+1998-06-19 Mark Kettenis <kettenis@phys.uva.nl>
+
+ * sysdeps/generic/ftruncate.c: Define function as __ftruncate and
+ make ftruncate a weak alias.
+ * sysdeps/mach/hurd/ftruncate.c: Really define function as
+ __ftruncate.
+ * sysdeps/mach/hurd/truncate.c: Include <unistd.h>.
+ (truncate): Fix function defenition to match prototype.
+
+1998-06-20 Mark Kettenis <kettenis@phys.uva.nl>
+
+ * manual/terminal.texi: Document ttyname_r, getpt, grantpt,
+ unlockpt, ptsname, ptsname_r, openpty and forkpty.
+
+1998-06-22 Ulrich Drepper <drepper@cygnus.com>
+
+ * sysdeps/generic/glob.c: Make it possible to include glob.h
+ before loading glob.c.
+ Reported by Felix von Leitner <leitner@math.fu-berlin.de>.
+
+1998-06-22 Andreas Jaeger <aj@arthur.rhein-neckar.de>
+
+ * nscd/connections.c: Use poll() instead of select().
+
+1998-06-22 14:08 Andreas Schwab <schwab@issan.informatik.uni-dortmund.de>
+
+ * sysdeps/generic/Dist: Fix typo.
+
+1998-06-20 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ * nis/nis_add.c: Avoid unnecessary strlen () calls.
+ * nis/nis_addmember.c: Likewise.
+ * nis/nis_call.c: Likewise.
+ * nis/nis_creategroup.c: Likewise.
+ * nis/nis_destroygroup.c: Likewise.
+ * nis/nis_findserv.c: Likewise.
+ * nis/nis_ismember.c: Likewise.
+ * nis/nis_print.c: Likewise.
+ * nis/nis_print_group_entry.c: Likewise.
+ * nis/nis_removemember.c: Likewise.
+ * nis/nis_verifygroup.c: Likewise.
+ * nis/ypclnt.c: Likewise.
+
+ * nis/nis_file.c: Close file handles.
+
+ * nis/nis_callback.c: Fix typo.
+
1998-06-10 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
* nis/Makefile: Add nis-initgroups and compat-initgroups.
# need the only-MD5 based one as well.
md5-crypt/libmd5crypt:
$(MAKE) $(PARALLELMFLAGS) -C $(@D) $(@F)
+
+# glibc 2.0 contains some header files which aren't used with glibc 2.1
+# anymore.
+# These rules should remove those headers
+ifeq (,$(install_root))
+ifeq ($(old-glibc-headers),yes)
+install: remove-old-headers
+endif
+endif
+
+headers2_0 := __math.h bytesex.h confname.h direntry.h elfclass.h \
+ errnos.h fcntlbits.h huge_val.h ioctl-types.h \
+ ioctls.h iovec.h jmp_buf.h libc-lock.h local_lim.h \
+ mathcalls.h mpool.h nan.h ndbm.h posix1_lim.h \
+ posix2_lim.h posix_opt.h resourcebits.h schedbits.h \
+ selectbits.h semaphorebits.h sigaction.h sigcontext.h \
+ signum.h sigset.h sockaddrcom.h socketbits.h stab.def \
+ statbuf.h statfsbuf.h stdio-lock.h stdio_lim.h \
+ syscall-list.h termbits.h timebits.h ustatbits.h \
+ utmpbits.h utsnamelen.h waitflags.h waitstatus.h \
+ xopen_lim.h gnu/types.h sys/ipc_buf.h \
+ sys/kernel_termios.h sys/msq_buf.h sys/sem_buf.h \
+ sys/shm_buf.h sys/socketcall.h
+
+remove-old-headers:
+ rm -f $(addprefix $(inst_includedir)/, $(headers2_0))
have-initfini = @libc_cv_have_initfini@
need-nopic-initfini = @nopic_initfini@
with-cvs = @with_cvs@
+old-glibc-headers = @old_glibc_headers@
versioning = @VERSIONING@
no-whole-archive = @no_whole_archive@
esac
echo "$ac_t""$stdio" 1>&6
-echo $ac_n "checking ldap selection""... $ac_c" 1>&6
-echo "configure:2800: checking ldap selection" >&5
-
-case $add_ons in
-*ldap*)
- ldap=yes
- LDAP=ldap ;;
-*) ldap=no
- LDAP= ;;
-esac
-echo "$ac_t""$ldap" 1>&6
+# Test for old glibc 2.0.x headers so that they can be removed properly
+# Search only in includedir.
+echo $ac_n "checking for old glibc 2.0.x headers""... $ac_c" 1>&6
+echo "configure:2802: checking for old glibc 2.0.x headers" >&5
+if eval test -e "${includedir}/elfclass.h" -a -e "${includedir}/fcntlbits.h"
+then
+ old_glibc_headers=yes
+else
+ old_glibc_headers=no
+fi
+echo "$ac_t""$old_glibc_headers" 1>&6
+if test ${old_glibc_headers} = yes; then
+ echo "configure: warning: *** During \"make install\" old headers from glibc 2.0.x will" 1>&2
+ echo "configure: warning: *** be removed." 1>&2
+fi
fi
echo $ac_n "checking whether -fPIC is default""... $ac_c" 1>&6
-echo "configure:2851: checking whether -fPIC is default" >&5
+echo "configure:2855: checking whether -fPIC is default" >&5
if eval "test \"`echo '$''{'pic_default'+set}'`\" = set"; then
echo $ac_n "(cached) $ac_c" 1>&6
else
s%@uname_release@%$uname_release%g
s%@uname_version@%$uname_version%g
s%@stdio@%$stdio%g
-s%@LDAP@%$LDAP%g
s%@libc_cv_slibdir@%$libc_cv_slibdir%g
s%@libc_cv_sysconfdir@%$libc_cv_sysconfdir%g
s%@libc_cv_rootsbindir@%$libc_cv_rootsbindir%g
esac
AC_MSG_RESULT($stdio)
-AC_MSG_CHECKING(ldap selection)
-AC_SUBST(LDAP)
-case $add_ons in
-*ldap*)
- ldap=yes
- LDAP=ldap ;;
-*) ldap=no
- LDAP= ;;
-esac
-AC_MSG_RESULT($ldap)
+# Test for old glibc 2.0.x headers so that they can be removed properly
+# Search only in includedir.
+AC_MSG_CHECKING(for old glibc 2.0.x headers)
+if eval test -e "${includedir}/elfclass.h" -a -e "${includedir}/fcntlbits.h"
+then
+ old_glibc_headers=yes
+else
+ old_glibc_headers=no
+fi
+AC_MSG_RESULT($old_glibc_headers)
+if test ${old_glibc_headers} = yes; then
+ AC_MSG_WARN(*** During \"make install\" old headers from glibc 2.0.x will)
+ AC_MSG_WARN(*** be removed.)
+fi
AC_SUBST(libc_cv_slibdir)
AC_SUBST(libc_cv_sysconfdir)
{ printf \"$*-calls += %s\\n\", \$$3 }" $< ;\
echo '$$($*-calls:%=$$(objpfx)R\%C_%.c): $$(objpfx)$*.ustamp ;';\
) > $@-new
- mv $@-new $@
+ mv -f $@-new $@
vpath Machrules ../mach # Find ourselves.
ifndef transform-user-stub-output
# The last line of foo.__h is "#endif _foo_user_".
# The first two lines of foo.uh are "#ifndef _foo_user_"/"#define _foo_user_".
(sed -e '$$d' $<; sed -e '1,2d' $(word 2,$^)) > $@-new
- mv $@-new $@
+ mv -f $@-new $@
interface-routines := $(foreach if,$(user-interfaces), \
$(addprefix RPC_,$($(if)-calls))) \
sed -n -e 's/^kernel_trap(\(.*\),\([-0-9]*\),\([0-9]*\))$$/\1 \2 \3/p'\
| $(AWK) -f $< > $@-new
cat $@-dep >> $@-new; rm -f $@-dep
- mv $@-new $@
+ mv -f $@-new $@
generated += mach-syscalls.mk
ifndef mach-syscalls
(echo '#include <sysdep.h>'; \
echo 'kernel_trap(__$*,$(sysno-$*),$(nargs-$*))'; \
echo 'weak_alias (__$*, $*)') > $@-new
- mv $@-new $@
+ mv -f $@-new $@
generated += $(mach-syscalls:=.S)
endif # mach-syscalls
$(objpfx)RPC_%_rpc.c
$(AWK) -v alias=$* -v call=__$* -v rpc=__$*_rpc \
-v syscall=__syscall_$* -f $^ > $@-new
- mv $@-new $@
+ mv -f $@-new $@
generated += $(mach-shortcuts:%=%.c)
endif # mach-shortcuts
cat $^ | tr \\012 @ | sed s/@@/@%/g | tr % \\012 \
| grep '^/\* Routine [a-z0-9_]*_rpc \*/' \
| sed 's/_rpc//g' | tr @ \\012 > $@-new
- mv $@-new $@
+ mv -f $@-new $@
generated += mach-shortcuts.h
before-compile += $(objpfx)mach-shortcuts.h
$(objpfx)errsystems.c: errsystems.awk err_*.sub \
$(wildcard $(addsuffix /err_*.sub,$(+sysdep_dirs)))
$(AWK) -v subsys='$(filter-out $<,$^)' -f $^ > $@.n
- mv $@.n $@
+ mv -f $@.n $@
* Line Control:: Sending break sequences, clearing
terminal buffers @dots{}
* Noncanon Example:: How to read single characters without echo.
+* Pseudo-Terminals:: How to open a pseudo-terminal.
@end menu
@node Is It a Terminal
function.
@pindex unistd.h
-Prototypes for both @code{isatty} and @code{ttyname} are declared in
-the header file @file{unistd.h}.
+Prototypes for the functions in this section are declared in the header
+file @file{unistd.h}.
@comment unistd.h
@comment POSIX.1
@deftypefun int isatty (int @var{filedes})
This function returns @code{1} if @var{filedes} is a file descriptor
-associated with an open terminal device, and @code{0} otherwise.
+associated with an open terminal device, and @math{0} otherwise.
@end deftypefun
If a file descriptor is associated with a terminal, you can get its
isn't associated with a terminal, or the file name cannot be determined.
@end deftypefun
+@comment unistd.h
+@comment POSIX.1
+@deftypefun int ttyname_r (int @var{filedes}, char *@var{buf}, size_t @var{len})
+The @code{ttyname_r} function is similar to the @code{ttyname} function
+except that it places its result into the user-specified buffer starting
+at @var{buf} with length @var{len}.
+
+The normal return value from @code{ttyname_r} is @math{0}. Otherwise an
+error number is returned to indicate the error. The following
+@code{errno} error conditions are defined for this function:
+
+@table @code
+@item EBADF
+The @var{filedes} argument is not a valid file descriptor.
+
+@item ENOTTY
+The @var{filedes} is not associated with a terminal.
+
+@item ERANGE
+The buffer length @var{len} is too small to store the string to be
+returned.
+@end table
+@end deftypefun
+
@node I/O Queues
@section I/O Queues
device with file descriptor @var{filedes}. The attributes are returned
in the structure that @var{termios-p} points to.
-If successful, @code{tcgetattr} returns @code{0}. A return value of @code{-1}
+If successful, @code{tcgetattr} returns @math{0}. A return value of @math{-1}
indicates an error. The following @code{errno} error conditions are
defined for this function:
is ignoring or blocking @code{SIGTTOU} signals, in which case the
operation is performed and no signal is sent. @xref{Job Control}.
-If successful, @code{tcsetattr} returns @code{0}. A return value of
-@code{-1} indicates an error. The following @code{errno} error
+If successful, @code{tcsetattr} returns @math{0}. A return value of
+@math{-1} indicates an error. The following @code{errno} error
conditions are defined for this function:
@table @code
@comment POSIX.1
@deftypefun int cfsetospeed (struct termios *@var{termios-p}, speed_t @var{speed})
This function stores @var{speed} in @code{*@var{termios-p}} as the output
-speed. The normal return value is @code{0}; a value of @code{-1}
+speed. The normal return value is @math{0}; a value of @math{-1}
indicates an error. If @var{speed} is not a speed, @code{cfsetospeed}
-returns @code{-1}.
+returns @math{-1}.
@end deftypefun
@comment termios.h
@comment POSIX.1
@deftypefun int cfsetispeed (struct termios *@var{termios-p}, speed_t @var{speed})
This function stores @var{speed} in @code{*@var{termios-p}} as the input
-speed. The normal return value is @code{0}; a value of @code{-1}
+speed. The normal return value is @math{0}; a value of @math{-1}
indicates an error. If @var{speed} is not a speed, @code{cfsetospeed}
-returns @code{-1}.
+returns @math{-1}.
@end deftypefun
@comment termios.h
@comment BSD
@deftypefun int cfsetspeed (struct termios *@var{termios-p}, speed_t @var{speed})
This function stores @var{speed} in @code{*@var{termios-p}} as both the
-input and output speeds. The normal return value is @code{0}; a value
-of @code{-1} indicates an error. If @var{speed} is not a speed,
-@code{cfsetspeed} returns @code{-1}. This function is an extension in
+input and output speeds. The normal return value is @math{0}; a value
+of @math{-1} indicates an error. If @var{speed} is not a speed,
+@code{cfsetspeed} returns @math{-1}. This function is an extension in
4.4 BSD.
@end deftypefun
can actually support the specified speeds---in fact, they don't know
which device you plan to set the speed for. If you use @code{tcsetattr}
to set the speed of a particular device to a value that it cannot
-handle, @code{tcsetattr} returns @code{-1}.
+handle, @code{tcsetattr} returns @math{-1}.
@strong{Portability note:} In the GNU library, the functions above
accept speeds measured in bits per second as input, and return speed
data port.
The return value is normally zero. In the event of an error, a value
-of @code{-1} is returned. The following @code{errno} error conditions
+of @math{-1} is returned. The following @code{errno} error conditions
are defined for this function:
@table @code
@c ref pthread_cleanup_push / pthread_cleanup_pop
The return value is normally zero. In the event of an error, a value
-of @code{-1} is returned. The following @code{errno} error conditions
+of @math{-1} is returned. The following @code{errno} error conditions
are defined for this function:
@table @code
@end table
The return value is normally zero. In the event of an error, a value
-of @code{-1} is returned. The following @code{errno} error conditions
+of @math{-1} is returned. The following @code{errno} error conditions
are defined for this function:
@table @code
Characters}.
The return value is normally zero. In the event of an error, a value
-of @code{-1} is returned. The following @code{errno} error conditions
+of @math{-1} is returned. The following @code{errno} error conditions
are defined for this function:
@table @code
existing shells do not actually do this, so you may wish to establish
handlers for job control signals that reset terminal modes. The above
example does so.
+
+
+@node Pseudo-Terminals
+@section Pseudo-Terminals
+@cindex pseudo-terminals
+
+A @dfn{pseudo-terminal} is a special interprocess communication channel
+that acts like a terminal. On one end of the channel is called the
+@dfn{master} side or @dfn{master pseudo-terminal device}, the other side
+is called the @dfn{slave} side. Data written to the the master side is
+received by the slave side as if it was the result of a user typing at
+an ordinary terminal, and data written to the slave side is sent to the
+master side as if it was written on an ordinary terminal.
+
+Pseudo terminals are the way programs like @code{xterm} and @code{emacs}
+implement their terminal emulation functionality.
+
+@menu
+* Allocation:: Allocating a pseudo terminal.
+* Pseudo-Terminal Pairs:: How to open both sides of a
+ pseudo-terminal in a single operation.
+@end menu
+
+@node Allocation
+@subsection Allocating Pseudo-Terminals
+@cindex allocating pseudo-terminals
+
+@pindex stdlib.h
+This subsection describes functions for allocating a pseudo-terminals,
+and for making this pseudo-terminal available for actual use. These
+functions are declared in the header file @file{stdlib.h}.
+
+@comment stdlib.h
+@comment GNU
+@deftypefun int getpt (void)
+The @code{getpt} function returns a new file descriptor for the next
+available master pseudo-terminal. The normal return value from
+@code{getpt} is a non-negative integer file descriptor. In the case of
+an error, a value of @math{-1} is returned instead. The following
+@code{errno} conditions are defined for this function:
+
+@table @code
+@item ENFILE
+There are no master pseudo-terminals available.
+@end table
+
+This function is a GNU extension.
+@end deftypefun
+
+@comment stdlib.h
+@comment SVID, XPG4.2
+@deftypefun int grantpt (int @var{filedes})
+The @code{grantpt} function changes the ownership and access permission
+of the slave pseudo-terminal device corresponding to the master
+pseudo-terminal device associated with the file descriptor
+@var{filedes}. The owner is set from the real user ID of the calling
+process (@pxref{Process Persona}), and the group is set to a special
+group (typically @dfn{tty}) or from the real group ID of the calling
+process. The access permission is set such that the file is both
+readable and writable by the owner and only writable by the group.
+
+On some systems this function is implemented by invoking a special
+@code{setuid} root program (@pxref{How Change Persona}). As a
+consequence, installing a signal handler for the @code{SIGCHLD} signal
+(@pxref{Job Control Signals}) may interfere with a call to
+@code{grantpt}.
+
+The normal return value from @code{grantpt} is @math{0}; a value of
+@math{-1} is returned in case of failure. The following @code{errno}
+error conditions are defined for this function:
+
+@table @code
+@item EBADF
+The @var{filedes} argument is not a valid file descriptor.
+
+@item ENINVAL
+The @var{filedes} argument is not associated with a master pseudo-terminal
+device.
+
+@item EACCESS
+The slave pseudo-terminal device corresponding to the master associated
+with @var{filedes} could not be accessed.
+@end table
+
+@end deftypefun
+
+@comment stdlib.h
+@comment SVID, XPG4.2
+@deftypefun int unlockpt (int @var{filedes})
+The @code{unlockpt} function unlocks the slave pseudo-terminal device
+corresponding to the master pseudo-terminal device associated with the
+file descriptor @var{filedes}. On many systems, the slave can only be
+opened after unlocking, so portable applications should always call
+@code{unlockpt} before trying to open the slave.
+
+The normal return value from @code{unlockpt} is @math{0}; a value of
+@math{-1} is returned in case of failure. The following @code{errno}
+error conditions are defined for this function:
+
+@table @code
+@item EBADF
+The @var{filedes} argument is not a valid file descriptor.
+
+@item EINVAL
+The @var{filedes} argument is not associated with a master pseudo-terminal
+device.
+@end table
+@end deftypefun
+
+@comment stdlib.h
+@comment SVID, XPG4.2
+@deftypefun {char *} ptsname (int @var{filedes})
+If the file descriptor @var{filedes} is associated with a
+master pseudo-terminal device, the @code{ptsname} function returns a
+pointer to a statically-allocated, null-terminated string containing the
+file name of the associated slave pseudo-terminal file. This string
+might be overwritten by subsequent calls to @code{ptsname}.
+@end deftypefun
+
+@comment stdlib.h
+@comment GNU
+@deftypefun int ptsname_r (int @var{filedes}, char *@var{buf}, size_t @var{len})
+The @code{ptsname_r} function is similar to the @code{ptsname} function
+except that it places its result into the user-specified buffer starting
+at @var{buf} with length @var{len}.
+
+This function is a GNU extension.
+@end deftypefun
+
+@strong{Portability Note:} On @w{System V} derived systems, the file
+returned by the @code{ptsname} and @code{ptsname_r} functions may be
+STREAMS-based, and therefore require additional processing after opening
+before it actually behaves as a pseudo terminal.
+@c FIXME: xref STREAMS
+
+Typical usage of these functions is illustrated by the following example:
+@smallexample
+int
+open_pty_pair (int *amaster, int *aslave)
+@{
+ int master, slave;
+ char *name
+
+ master = getpt ();
+ if (master < 0)
+ return 0;
+
+ if (grantpt (master) < 0 || unlockpt (master) < 0)
+ goto close_master;
+ name = ptsname (master);
+ if (name == NULL)
+ goto close_master;
+
+ slave open (name, O_RDWR);
+ if (slave == -1)
+ goto close_master;
+
+ if (isastream (slave))
+ @{
+ if (ioctl (slave, I_PUSH, "ptem") < 0
+ || ioctl (slave, I_PUSH, "ldterm") < 0)
+ goto close_slave;
+ @}
+
+ *amaster = master;
+ *aslave = slave;
+ return 1;
+
+close_slave:
+ close (slave);
+
+close_master:
+ close (master);
+ return 0;
+@}
+@end smallexample
+
+@node Pseudo-Terminal Pairs
+@subsection Opening a Pseudo-Terminal Pair
+@cindex opening a pseudo-terminal pair
+
+These functions, derived from BSD, are available in the separate
+@file{libutil} library, and declared in @file{pty.h}.
+
+@comment pty.h
+@comment BSD
+@deftypefun int openpty (int *@var{amaster}, int *@var{aslave}, char *@var{name}, struct termios *@var{termp}, struct winsize *@var{winp})
+This function allocates and opens a pseudo-terminal pair, returning the
+file descriptor for the master in @var{*amaster}, and the file
+descriptor for the slave in @var{*aslave}. If the argument @var{name}
+is not a null pointer, the name file name of the slave pseudo-terminal
+device is stored in @code{*name}. If @var{termp} is not a null pointer,
+the terminal attributes of the slave are set to the ones specified in
+the structure that @var{termp} points to (@pxref{Terminal Modes}).
+Likewise, if the @var{winp} is not a null pointer, the screen size of
+the slave is set to the values specified in the structure that
+@var{winp} points to.
+
+The normal return value from @code{openpty} is @math{0}; a value of
+@math{-1} is returned in case of failure.
+
+@strong{Warning:} Using the @code{openpty} with @var{name} not set to
+@code{NULL} is @strong{very dangerous} because it provides no protection
+against overflowing the string @var{name}. You should use the
+@code{ttyname} function on the file descriptor returned in @var{*slave}
+to find out the file name of the slave pseudo-terminal device instead.
+@end deftypefun
+
+@comment pty.h
+@comment BSD
+@deftypefun int forkpty (int *@var{amaster}, char *@var{name}, struct termios *@var{termp}, struct winsize *@var{winp})
+This function is similar to the @code{openpty} function, but in
+addition, forks creates a new process (@pxref{Creating a Process}) and
+makes the newly opened slave pseudo-terminal device the controlling
+terminal (@pxref{Controlling Terminal}) for the child process.
+
+If the operation is successful, there are then both parent and child
+processes and both see @code{forkpty} return, but with different values:
+it returns a value of @math{0} in the child process and returns the child's
+process ID in the parent process.
+
+If the allocation of a pseudo-terminal pair or the process creation
+failed, @code{forkpty} returns a value of @math{-1} in the parent
+process.
+
+@strong{Warning:} The @code{forkpty} function has the same problems with
+respect to the @var{name} argument as @code{openpty}.
+@end deftypefun
nis_result *res;
nis_error status;
struct ns_request req;
- char buf1 [strlen (name) + 20];
- char buf4 [strlen (name) + 20];
+ size_t namelen = strlen (name);
+ char buf1 [namelen + 20];
+ char buf4 [namelen + 20];
res = calloc (1, sizeof (nis_result));
if (res == NULL)
memcpy (&obj, obj2, sizeof (nis_object));
- if (obj.zo_name == NULL || strlen (obj.zo_name) == 0)
+ if (obj.zo_name == NULL || obj.zo_name[0] == '\0')
obj.zo_name = nis_leaf_of_r (name, buf1, sizeof (buf1));
- if (obj.zo_owner == NULL || strlen (obj.zo_owner) == 0)
+ if (obj.zo_owner == NULL || obj.zo_owner[0] == '\0')
obj.zo_owner = nis_local_principal ();
- if (obj.zo_group == NULL || strlen (obj.zo_group) == 0)
+ if (obj.zo_group == NULL || obj.zo_group[0] == '\0')
obj.zo_group = nis_local_group ();
obj.zo_domain = nis_domain_of_r (name, buf4, sizeof (buf4));
}
req.ns_object.ns_object_len = 1;
- if ((status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
- NIS_ADD, (xdrproc_t) _xdr_ns_request,
- (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
- (caddr_t) res, MASTER_ONLY,
- NULL)) != RPC_SUCCESS)
+ status = __do_niscall (req.ns_object.ns_object_val[0].zo_domain,
+ NIS_ADD, (xdrproc_t) _xdr_ns_request,
+ (caddr_t) &req, (xdrproc_t) _xdr_nis_result,
+ (caddr_t) res, MASTER_ONLY, NULL);
+ if (status != RPC_SUCCESS)
NIS_RES_STATUS (res) = status;
nis_destroy_object (req.ns_object.ns_object_val);
-/* 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.
nis_error
nis_addmember (const_nis_name member, const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
+ if (group != NULL && group[0] != '\0')
{
- char buf[strlen (group) + 14 + NIS_MAXNAMELEN];
- char leafbuf[strlen (group) + 2];
- char domainbuf[strlen (group) + 2];
+ size_t grouplen = strlen (group);
+ char buf[grouplen + 14 + NIS_MAXNAMELEN];
+ char leafbuf[grouplen + 2];
+ char domainbuf[grouplen + 2];
nis_result *res, *res2;
nis_error status;
char *cp, *cp2;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
+ if (cp2 != NULL && cp2[0] != '\0')
{
*cp++ = '.';
stpcpy (cp, cp2);
case LOWER_NAME:
{
directory_obj *obj;
- char leaf [strlen (name) + 3];
- char domain [strlen (name) + 3];
- char ndomain [strlen (name) + 3];
+ size_t namelen = strlen (name);
+ char leaf [namelen + 3];
+ char domain [namelen + 3];
+ char ndomain [namelen + 3];
char *cp;
u_int run = 0;
do
{
- if (strlen (domain) == 0)
+ if (domain[0] == '\0')
{
nis_free_directory (dir);
return NULL;
#else
cb->serv->pkey.n_len =0;
cb->serv->pkey.n_bytes = NULL;
- cb->serv->key_type = NIS_PK_DH;
+ cb->serv->key_type = NIS_PK_NONE;
#endif
}
nis_error
nis_creategroup (const_nis_name group, u_long flags)
{
- if (group != NULL && strlen (group) > 0)
+ if (group != NULL && group[0] != '\0')
{
- char buf[strlen (group) + 50];
- char leafbuf[strlen (group) + 2];
- char domainbuf[strlen (group) + 2];
+ size_t grouplen = strlen (group);
+ char buf[grouplen + 50];
+ char leafbuf[grouplen + 2];
+ char domainbuf[grouplen + 2];
nis_error status;
nis_result *res;
char *cp, *cp2;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
+ if (cp2 != NULL && cp2[0] != '\0')
{
*cp++ = '.';
stpcpy (cp, cp2);
-/* 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.
nis_error
nis_destroygroup (const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
+ if (group != NULL && group[0] != '\0')
{
- char buf[strlen (group) + 50];
- char leafbuf[strlen (group) + 3];
- char domainbuf[strlen (group) + 3];
+ size_t grouplen = strlen (group);
+ char buf[grouplen + 50];
+ char leafbuf[grouplen + 3];
+ char domainbuf[grouplen + 3];
nis_error status;
nis_result *res;
char *cp, *cp2;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
+ if (cp2 != NULL && cp2[0] != '\0')
{
*cp++ = '.';
stpcpy (cp, cp2);
{
XDR xdrs;
FILE *in;
+ bool_t status;
directory_obj obj;
in = fopen (cold_start_file, "rb");
return NULL;
memset (&obj, '\0', sizeof (obj));
xdrstdio_create (&xdrs, in, XDR_DECODE);
- if (!_xdr_directory_obj (&xdrs, &obj))
- return NULL;
+ status = _xdr_directory_obj (&xdrs, &obj);
+ xdr_destroy (&xdrs);
+ fclose (in);
- return nis_clone_directory (&obj, NULL);
+ return status ? nis_clone_directory (&obj, NULL) : NULL;
}
bool_t
{
XDR xdrs;
FILE *out;
+ bool_t status;
out = fopen (cold_start_file, "wb");
if (out == NULL)
return FALSE;
xdrstdio_create (&xdrs, out, XDR_ENCODE);
- if (!_xdr_directory_obj (&xdrs, (directory_obj *) obj))
- return FALSE;
+ status = _xdr_directory_obj (&xdrs, (directory_obj *) obj);
+ xdr_destroy (&xdrs);
+ fclose (out);
- return TRUE;
+ return status;
}
nis_object *
{
XDR xdrs;
FILE *in;
+ bool_t status;
nis_object obj;
in = fopen (name, "rb");
memset (&obj, '\0', sizeof (obj));
xdrstdio_create (&xdrs, in, XDR_DECODE);
- if (!_xdr_nis_object (&xdrs, &obj))
- return NULL;
+ status =_xdr_nis_object (&xdrs, &obj);
+ xdr_destroy (&xdrs);
+ fclose (in);
- return nis_clone_object (&obj, NULL);
+ return status ? nis_clone_object (&obj, NULL) : NULL;
}
bool_t
{
XDR xdrs;
FILE *out;
+ bool_t status;
out = fopen (name, "wb");
if (out == NULL)
return FALSE;
xdrstdio_create (&xdrs, out, XDR_ENCODE);
- if (!_xdr_nis_object (&xdrs, (nis_object *) obj))
- return FALSE;
+ status = _xdr_nis_object (&xdrs, (nis_object *) obj);
+ xdr_destroy (&xdrs);
+ fclose (out);
- return TRUE;
+ return status;
}
if (strcmp (bind->server_val[i].ep.ep_val[j].family, "inet") == 0)
if ((bind->server_val[i].ep.ep_val[j].proto == NULL) ||
(strcmp (bind->server_val[i].ep.ep_val[j].proto, "-") == 0) ||
- (strlen (bind->server_val[i].ep.ep_val[j].proto) == 0))
+ (bind->server_val[i].ep.ep_val[j].proto[0] == '\0'))
{
sin.sin_addr.s_addr =
inetstr2int (bind->server_val[i].ep.ep_val[j].uaddr);
-/* 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.
static int
internal_ismember (const_nis_name principal, const_nis_name group)
{
- char buf[strlen (group) + 50];
- char leafbuf[strlen (group) + 2];
- char domainbuf[strlen (group) + 2];
+ size_t grouplen = strlen (group);
+ char buf[grouplen + 50];
+ char leafbuf[grouplen + 2];
+ char domainbuf[grouplen + 2];
nis_result *res;
char *cp, *cp2;
u_int i;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
+ if (cp2 != NULL && cp2[0] != '\0')
{
*cp++ = '.';
strcpy (cp, cp2);
bool_t
nis_ismember (const_nis_name principal, const_nis_name group)
{
- if (group != NULL && strlen (group) > 0 && principal != NULL)
+ if (group != NULL && group[0] != '\0' && principal != NULL)
return internal_ismember (principal, group) == 1 ? TRUE : FALSE;
else
return FALSE;
for (j = 0; j < sptr->ep.ep_len; j++)
{
printf ("\t[%d] - ", j + 1);
- if (ptr->proto != NULL && strlen (ptr->proto) > 0)
+ if (ptr->proto != NULL && ptr->proto[0] != '\0')
printf ("%s, ", ptr->proto);
else
printf ("-, ");
- if (ptr->family != NULL && strlen (ptr->family) > 0)
+ if (ptr->family != NULL && ptr->family[0] != '\0')
printf ("%s, ", ptr->family);
else
printf ("-, ");
- if (ptr->uaddr != NULL && strlen (ptr->uaddr) > 0)
+ if (ptr->uaddr != NULL && ptr->uaddr[0] != '\0')
printf ("%s\n", ptr->uaddr);
else
fputs ("-\n", stdout);
-/* 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.
void
nis_print_group_entry (const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
+ if (group != NULL && group[0] != '\0')
{
- char buf[strlen (group) + 50];
- char leafbuf[strlen (group) + 3];
- char domainbuf[strlen (group) + 3];
+ size_t grouplen = strlen (group);
+ char buf[grouplen + 50];
+ char leafbuf[grouplen + 3];
+ char domainbuf[grouplen + 3];
unsigned long mem_exp_cnt = 0, mem_imp_cnt = 0, mem_rec_cnt = 0;
unsigned long nomem_exp_cnt = 0, nomem_imp_cnt = 0, nomem_rec_cnt = 0;
char **mem_exp, **mem_imp, **mem_rec;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
+ if (cp2 != NULL && cp2[0] != '\0')
{
*cp++ = '.';
stpcpy (cp, cp2);
nis_error
nis_removemember (const_nis_name member, const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
+ if (group != NULL && group[0] != '\0')
{
- char buf[strlen (group) + 14 + NIS_MAXNAMELEN];
- char leafbuf[strlen (group) + 2];
- char domainbuf[strlen (group) + 2];
+ size_t grouplen = strlen (group);
+ char buf[grouplen + 14 + NIS_MAXNAMELEN];
+ char leafbuf[grouplen + 2];
+ char domainbuf[grouplen + 2];
nis_name *newmem;
nis_result *res, *res2;
nis_error status;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
+ if (cp2 != NULL && cp2[0] != '\0')
{
cp = stpcpy (cp, ".");
stpcpy (cp, cp2);
nis_error
nis_verifygroup (const_nis_name group)
{
- if (group != NULL && strlen (group) > 0)
+ if (group != NULL && group[0] != '\0')
{
- char buf[strlen (group) + 50];
- char leafbuf[strlen (group) + 2];
- char domainbuf[strlen (group) + 2];
+ size_t grouplen = strlen (group);
+ char buf[grouplen + 50];
+ char leafbuf[grouplen + 2];
+ char domainbuf[grouplen + 2];
nis_result *res;
nis_error status;
char *cp, *cp2;
cp = stpcpy (buf, nis_leaf_of_r (group, leafbuf, sizeof (leafbuf) - 1));
cp = stpcpy (cp, ".groups_dir");
cp2 = nis_domain_of_r (group, domainbuf, sizeof (domainbuf) - 1);
- if (cp2 != NULL && strlen (cp2) > 0)
+ if (cp2 != NULL && cp2[0] != '\0')
{
*cp++ = '.';
stpcpy (cp, cp2);
int is_new = 0;
int try;
- if ((domain == NULL) || (strlen (domain) == 0))
+ if ((domain == NULL) || (domain[0] == '\0'))
return YPERR_BADARGS;
if (ypdb != NULL)
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <sys/poll.h>
#include <sys/socket.h>
#include <sys/stat.h>
#include <sys/types.h>
#include "dbg_log.h"
/* Socket 0 in the array is named and exported into the file namespace
- as a connection point for clients. */
+ as a connection point for clients. There's a one to one
+ correspondence between sock[i] and read_polls[i]. */
static int sock[MAX_NUM_CONNECTIONS];
static int socks_active;
-static fd_set read_set;
+static struct pollfd read_polls[MAX_NUM_CONNECTIONS];
static pthread_mutex_t sock_lock = PTHREAD_MUTEX_INITIALIZER;
dbg_log (_("socket [%d|%d] close: %s"), strerror (errno));
sock[i] = 0;
+ read_polls[i].fd = -1;
--socks_active;
}
close (sock[conn]);
sock[conn] = 0;
+ read_polls[conn].fd = -1;
--socks_active;
pthread_mutex_unlock (&sock_lock);
}
-/* Local rountine, assigns a socket to a new connection request. */
+/* Local routine, assigns a socket to a new connection request. */
static void
handle_new_connection (void)
{
return;
}
++socks_active;
- FD_SET (sock[i], &read_set);
+ read_polls[i].fd = sock[i];
+ read_polls[i].events = POLLRDNORM;
if (debug_flag > 2)
dbg_log (_("handle_new_connection used socket %d|%d"), i,
sock[i]);
pthread_mutex_unlock (&sock_lock);
}
-/* Local routine, reads a request off a socket indicated by a selectset. */
+/* Local routine, reads a request off a socket indicated by read_polls. */
static int
-handle_new_request (fd_set read_selects, int **connp, request_header **reqp,
- char **key)
+handle_new_request (int **connp, request_header **reqp, char **key)
{
ssize_t nbytes;
int i;
/* Find the descriptor. */
for (i = 1; i < MAX_NUM_CONNECTIONS; ++i)
- if (FD_ISSET(sock[i], &read_selects))
+ if (read_polls[i].revents & (POLLRDNORM|POLLERR))
break;
if (debug_flag > 2)
dbg_log (_("Real close socket %d|%d"), i, sock[i]);
pthread_mutex_lock (&sock_lock);
- FD_CLR (sock[i], &read_set);
+ read_polls[i].fd = -1;
close (sock[i]);
sock[i] = 0;
--socks_active;
dbg_log (_("Real close socket %d|%d"), i, sock[i]);
pthread_mutex_lock (&sock_lock);
- FD_CLR (sock[i], &read_set);
+ read_polls[i].fd = -1;
close (sock[i]);
sock[i] = 0;
--socks_active;
void
get_request (int *conn, request_header *req, char **key)
{
- int i, nr, done = 0;
- fd_set read_selects;
+ int done = 0;
+ int nr;
if (debug_flag)
dbg_log ("get_request");
is read in on an existing connection. */
while (!done)
{
- /* Set up the socket descriptor mask for the select.
- copy read_set into the local copy. */
-
- FD_ZERO (&read_selects);
- pthread_mutex_lock (&sock_lock);
- for (i = 0; i < MAX_NUM_CONNECTIONS; ++i)
- {
- if (FD_ISSET (sock[i], &read_set))
- FD_SET (sock[i], &read_selects);
- }
- pthread_mutex_unlock (&sock_lock);
- /* Poll active connections using select(). */
- nr = select (FD_SETSIZE, &read_selects, NULL, NULL, NULL);
+ /* Poll active connections. */
+ nr = poll (read_polls, MAX_NUM_CONNECTIONS, -1);
if (nr <= 0)
{
- perror (_("Select new reads"));
+ perror (_("Poll new reads"));
exit (1);
}
- if (FD_ISSET (sock[0], &read_selects))
+ if (read_polls[0].revents & (POLLRDNORM|POLLERR))
/* Handle the case of a new connection request on the named socket. */
handle_new_connection ();
else
{
/* Read data from client specific descriptor. */
- if (handle_new_request (read_selects, &conn, &req, key) == 0)
- {
- FD_CLR (sock[*conn], &read_set);
- done = 1;
- }
+ if (handle_new_request (&conn, &req, key) == 0)
+ done = 1;
}
} /* While not_done. */
}
init_sockets (void)
{
struct sockaddr_un sock_addr;
+ int i;
/* Initialize the connections db. */
socks_active = 0;
- FD_ZERO (&read_set);
+
+ /* Initialize the poll array. */
+ for (i = 0; i < MAX_NUM_CONNECTIONS; i++)
+ read_polls[i].fd = -1;
/* Create the socket. */
sock[0] = socket (AF_UNIX, SOCK_STREAM, 0);
}
/* Add the socket to the server's set of active sockets. */
- FD_SET (sock[0], &read_set);
+ read_polls[0].fd = sock[0];
+ read_polls[0].events = POLLRDNORM;
++socks_active;
}
make_siglist.c signame.c signame.h
det_endian.c
entry.h
-errno-loc.c.
+errno-loc.c
getresgid.c
getresuid.c
/* Define and initialize the `__libc_enable_secure' flag. Generic 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.
The GNU C Library is free software; you can redistribute it and/or
/* Safest assumption, if somehow the initializer isn't run. */
int __libc_enable_secure = 1;
-/* We often need the UID. */
-extern uid_t __libc_uid;
-
void
__libc_init_secure (void)
{
- __libc_uid = __getuid ();
- __libc_enable_secure = (__geteuid () != __libc_uid
+ __libc_enable_secure = (__geteuid () != __getuid ()
|| __getegid () != __getgid ());
}
-/* Copyright (C) 1991, 1995, 1996, 1997 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 1995, 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
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <sys/types.h>
#include <errno.h>
+#include <sys/types.h>
#include <unistd.h>
/* Truncate the file FD refers to to LENGTH bytes. */
int
-ftruncate (fd, length)
+__ftruncate (fd, length)
int fd;
off_t length;
{
return -1;
}
+weak_alias (__ftruncate, ftruncate)
+
stub_warning (ftruncate)
#include <stub-tag.h>
/* Some system header files erroneously define these.
We want our own definitions from <glob.h> to take precedence. */
-#undef GLOB_ERR
-#undef GLOB_MARK
-#undef GLOB_NOSORT
-#undef GLOB_DOOFFS
-#undef GLOB_NOCHECK
-#undef GLOB_APPEND
-#undef GLOB_NOESCAPE
-#undef GLOB_PERIOD
+#ifndef __GNU_LIBRARY__
+# undef GLOB_ERR
+# undef GLOB_MARK
+# undef GLOB_NOSORT
+# undef GLOB_DOOFFS
+# undef GLOB_NOCHECK
+# undef GLOB_APPEND
+# undef GLOB_NOESCAPE
+# undef GLOB_PERIOD
+#endif
#include <glob.h>
\f
static
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <sys/types.h>
#include <errno.h>
+#include <sys/types.h>
#include <unistd.h>
#include <hurd.h>
#include <hurd/fd.h>
/* Truncate the file FD refers to to LENGTH bytes. */
int
-ftruncate (fd, length)
+__ftruncate (fd, length)
int fd;
__off_t length;
{
-/* Copyright (C) 1991, 92, 93, 94, 95, 97 Free Software Foundation, Inc.
+/* Copyright (C) 1991, 92, 93, 94, 95, 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
write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
Boston, MA 02111-1307, USA. */
-#include <sys/types.h>
#include <errno.h>
-#include <hurd.h>
#include <fcntl.h>
+#include <sys/types.h>
+#include <unistd.h>
+#include <hurd.h>
/* Truncate FILE_NAME to LENGTH bytes. */
int
truncate (file_name, length)
- char *file_name;
+ const char *file_name;
off_t length;
{
error_t err;
-/* Copyright (C) 1997 Free Software Foundation, Inc.
+/* Copyright (C) 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
extern int __syscall_rt_sigqueueinfo (int, int, siginfo_t *);
-/* These variables are used quite often in the libc code. */
+/* This variable is used quite often in the libc code. */
extern pid_t __libc_pid;
-extern uid_t __libc_uid;
/* Return any pending signal or wait for one for the given time. */
__libc_pid = __getpid ();
info.si_pid = __libc_pid;
- info.si_uid = __libc_uid;
+ info.si_uid = getuid ();
info.si_value = val;
/* We often need the UID and PID. Cache these values. */
pid_t __libc_pid = 0xf00baa;
-uid_t __libc_uid = 0xf00baa;
static void
/* These variables are used quite often in the libc code. */
extern pid_t __libc_pid;
-extern uid_t __libc_uid;
/* Return any pending signal or wait for one for the given time. */
info.si_errno = 0;
info.si_code = SI_QUEUE;
- if (__libc_pid ==0xf00baa)
+ if (__libc_pid == 0xf00baa)
__libc_pid = __getpid ();
info.si_pid = __libc_pid;
- if (__libc_uid ==0xf00baa)
- __libc_pid = __getuid ();
- info.si_uid = __libc_uid;
-
+ info.si_uid = __getuid ();
info.si_value = val;
return __syscall_rt_sigqueueinfo (pid, sig, &info);