+1998-11-18 Ulrich Drepper <drepper@cygnus.com>
+
+ * io/Makefile (CFLAGS-ftw.c): Removed.
+
+1998-11-18 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * io/Makefile (tests): Make sure that the test program has an
+ explicit directory part.
+
+1998-11-18 Andreas Schwab <schwab@issan.cs.uni-dortmund.de>
+
+ * configure.in: Fix last change.
+
+1998-11-18 Thorsten Kukuk <kukuk@vt.uni-paderborn.de>
+
+ * sunrpc/Makefile (routines): Add create_xid.
+
+ * sunrpc/clnt_tcp.c: Use non-guessable xid.
+ * sunrpc/clnt_udp.c: Likewise.
+ * sunrpc/clnt_unix.c: Likewise.
+ * sunrpc/pmap_rmt.c: Likewise.
+ * sunrpc/create_xid.c: New, create non-guessable xid.
+
+ * sunrpc/svc_tcp.c: Remove patch from 1998-06-15, use poll instead
+ of select.
+ * sunrpc/svc_unix.c: Use poll instead of select.
+
1998-11-17 Ulrich Drepper <drepper@cygnus.com>
* sysdeps/unix/sysv/linux/sleep.c (__sleep): Make Unix98 compliant
ac_prog_version=`$MAKEINFO --version 2>&1 | sed -n 's/^.*GNU texinfo.* \([0-9][0-9.]*\).*$/\1/p'`
case $ac_prog_version in
'') ac_prog_version="v. ?.??, bad"; ac_verc_fail=yes;;
- 1.6[89] | 1.7[0-9])
+ 3.1[1-9] | 3.[2-9][0-9] | 1.6[89] | 1.7[0-9])
ac_prog_version="$ac_prog_version, ok"; ac_verc_fail=no;;
*) ac_prog_version="$ac_prog_version, bad"; ac_verc_fail=yes;;
[0.[1-9][0-9].* | [1-9].*], MSGFMT=: aux_missing=t)
AC_CHECK_PROG_VER(MAKEINFO, makeinfo, --version,
[GNU texinfo.* \([0-9][0-9.]*\)],
- [1.6[89] | 1.7[0-9]], MAKEINFO=: aux_missing=t)
+ [3.1[1-9] | 3.[2-9][0-9] | 1.6[89] | 1.7[0-9]], MAKEINFO=: aux_missing=t)
if test -n "$critic_missing"; then
AC_MSG_ERROR([
include ../Rules
CFLAGS-fts.c = -Wno-uninitialized
-CFLAGS-ftw.c = -Wno-uninitialized
ifeq ($(cross-compiling),no)
tests: $(objpfx)ftwtest
- $(SHELL) -e ftwtest-sh $(common-objpfx) $<
+ $(SHELL) -e ftwtest-sh $(common-objpfx) $(<D)/$(<F)
endif
xdr_rec xdr_ref xdr_stdio publickey xdr_sizeof \
auth_des authdes_prot des_crypt des_impl des_soft \
key_call key_prot netname openchild rtime svcauth_des xcrypt\
- clnt_unix svc_unix
+ clnt_unix svc_unix create_xid
others := rpcinfo
install-bin := rpcgen
#include <sys/socket.h>
#include <rpc/pmap_clnt.h>
+extern u_long _create_xid (void);
+
#define MCALL_MSG_SIZE 24
struct ct_data
{
CLIENT *h;
struct ct_data *ct = (struct ct_data *) mem_alloc (sizeof (*ct));
- struct timeval now;
struct rpc_msg call_msg;
h = (CLIENT *) mem_alloc (sizeof (*h));
/*
* Initialize call message
*/
- (void) __gettimeofday (&now, (struct timezone *) 0);
- call_msg.rm_xid = __getpid () ^ now.tv_sec ^ now.tv_usec;
+ call_msg.rm_xid = _create_xid ();
call_msg.rm_direction = CALL;
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
call_msg.rm_call.cb_prog = prog;
#include <rpc/pmap_clnt.h>
extern bool_t xdr_opaque_auth (XDR *, struct opaque_auth *);
+extern u_long _create_xid (void);
/*
* UDP bases client side rpc operations
* sent and received.
*/
CLIENT *
-clntudp_bufcreate (raddr, program, version, wait, sockp, sendsz, recvsz)
- struct sockaddr_in *raddr;
- u_long program;
- u_long version;
- struct timeval wait;
- int *sockp;
- u_int sendsz;
- u_int recvsz;
+clntudp_bufcreate (struct sockaddr_in *raddr, u_long program, u_long version,
+ struct timeval wait, int *sockp, u_int sendsz,
+ u_int recvsz)
{
CLIENT *cl;
struct cu_data *cu = NULL;
- struct timeval now;
struct rpc_msg call_msg;
cl = (CLIENT *) mem_alloc (sizeof (CLIENT));
}
cu->cu_outbuf = &cu->cu_inbuf[recvsz];
- (void) __gettimeofday (&now, (struct timezone *) 0);
if (raddr->sin_port == 0)
{
u_short port;
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 = _create_xid ();
call_msg.rm_direction = CALL;
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
call_msg.rm_call.cb_prog = program;
#include <sys/socket.h>
#include <rpc/pmap_clnt.h>
+extern u_long _create_xid (void);
+
#define MCALL_MSG_SIZE 24
struct ct_data
{
CLIENT *h;
struct ct_data *ct = (struct ct_data *) mem_alloc (sizeof (*ct));
- struct timeval now;
struct rpc_msg call_msg;
int len;
/*
* Initialize call message
*/
- __gettimeofday (&now, (struct timezone *) 0);
- call_msg.rm_xid = __getpid () ^ now.tv_sec ^ now.tv_usec;
+ call_msg.rm_xid = _create_xid ();
call_msg.rm_direction = CALL;
call_msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
call_msg.rm_call.cb_prog = prog;
--- /dev/null
+/* Copyright (c) 1998 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+ Contributed by Thorsten Kukuk <kukuk@vt.uni-paderborn.de>, 1998.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Library General Public License as
+ published by the Free Software Foundation; either version 2 of the
+ License, or (at your option) any later version.
+
+ The GNU C 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
+ Library General Public License for more details.
+
+ You should have received a copy of the GNU Library General Public
+ License along with the GNU C Library; see the file COPYING.LIB. If not,
+ write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
+ Boston, MA 02111-1307, USA. */
+
+#include <unistd.h>
+#include <stdlib.h>
+#include <sys/time.h>
+#include <bits/libc-lock.h>
+
+/* The RPC code is not threadsafe, but new code should be threadsafe. */
+
+__libc_lock_define_initialized (static, createxid_lock)
+
+static int is_initialized;
+static struct drand48_data __rpc_lrand48_data;
+
+unsigned long
+_create_xid (void)
+{
+ unsigned long res;
+
+ __libc_lock_lock (createxid_lock);
+
+ if (!is_initialized)
+ {
+ struct timeval now;
+
+ __gettimeofday (&now, (struct timezone *) 0);
+ srand48_r (now.tv_sec ^ now.tv_usec, &__rpc_lrand48_data);
+ is_initialized = 1;
+ }
+
+ lrand48_r (&__rpc_lrand48_data, &res);
+
+ __libc_lock_unlock (createxid_lock);
+
+ return res;
+}
#include <arpa/inet.h>
#define MAX_BROADCAST_SIZE 1400
+extern u_long _create_xid (void);
+
static struct timeval timeout = {3, 0};
/*
* written for XDR_ENCODE direction only
*/
bool_t
-xdr_rmtcall_args (xdrs, cap)
- XDR *xdrs;
- struct rmtcallargs *cap;
+xdr_rmtcall_args (XDR *xdrs, struct rmtcallargs *cap)
{
u_int lenposition, argposition, position;
AUTH *unix_auth = authunix_create_default ();
XDR xdr_stream;
XDR *xdrs = &xdr_stream;
+ struct timeval t;
int outlen, inlen, nets;
socklen_t fromlen;
int sock;
struct rmtcallargs a;
struct rmtcallres r;
struct rpc_msg msg;
- struct timeval t;
char outbuf[MAX_BROADCAST_SIZE], inbuf[UDPMSGSIZE];
/*
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;
+ msg.rm_xid = xid = _create_xid ();
t.tv_usec = 0;
msg.rm_direction = CALL;
msg.rm_call.cb_rpcvers = RPC_MSG_VERSION;
#include <string.h>
#include <rpc/rpc.h>
#include <sys/socket.h>
+#include <sys/poll.h>
#include <errno.h>
#include <stdlib.h>
mem_free ((caddr_t) xprt, sizeof (SVCXPRT));
}
-/*
- * All read operations timeout after 35 seconds.
- * A timeout is fatal for the connection.
- */
-static struct timeval wait_per_try = {35, 0};
/*
* reads data from the tcp connection.
* any error is fatal and the connection is closed.
* (And a read of zero bytes is a half closed stream => error.)
- *
- * Note: we have to be careful here not to allow ourselves to become
- * blocked too long in this routine. While we're waiting for data from one
- * client, another client may be trying to connect. To avoid this situation,
- * some code from svc_run() is transplanted here: the select() loop checks
- * all RPC descriptors including the one we want and calls svc_getreqset2()
- * to handle new requests if any are detected.
*/
static int
readtcp (char *xprtptr, char *buf, int len)
{
SVCXPRT *xprt = (SVCXPRT *)xprtptr;
int sock = xprt->xp_sock;
-#ifdef FD_SETSIZE
- fd_set readfds;
-#else
- int mask = 1 << sock;
- int readfds;
-#endif /* def FD_SETSIZE */
- while (1)
+ int milliseconds = 35 * 1000;
+ struct pollfd pollfd;
+
+ do
{
- struct timeval timeout = wait_per_try;
- readfds = svc_fdset;
-#ifdef FD_SETSIZE
- FD_SET (sock, &readfds);
-#else
- readfds |= (1 << sock);
-#endif /* def FD_SETSIZE */
- if (__select (_rpc_dtablesize (), &readfds, (fd_set *) NULL,
- (fd_set *) NULL, &timeout) <= 0)
+ pollfd.fd = sock;
+ pollfd.events = POLLIN;
+ switch (__poll (&pollfd, 1, milliseconds))
{
+ case -1:
if (errno == EINTR)
continue;
+ /*FALLTHROUGH*/
+ case 0:
goto fatal_err;
- }
-
-#ifdef FD_SETSIZE
- if (FD_ISSET (sock, &readfds))
-#else
- if (readfds == mask)
-#endif /* def FD_SETSIZE */
- break;
-
- svc_getreqset (&readfds);
+ default:
+ break;
+ }
}
+ while ((pollfd.revents & POLLIN) == 0);
if ((len = __read (sock, buf, len)) > 0)
return len;
-fatal_err:
+ fatal_err:
((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED;
return -1;
}
{
if ((i = __write (xprt->xp_sock, buf, cnt)) < 0)
{
- ((struct tcp_conn *) (xprt->xp_p1))->strm_stat =
- XPRT_DIED;
- return (-1);
+ ((struct tcp_conn *) (xprt->xp_p1))->strm_stat = XPRT_DIED;
+ return -1;
}
}
- return (len);
+ return len;
}
static enum xprt_stat
(struct tcp_conn *) (xprt->xp_p1);
if (cd->strm_stat == XPRT_DIED)
- return (XPRT_DIED);
+ return XPRT_DIED;
if (!xdrrec_eof (&(cd->xdrs)))
- return (XPRT_MOREREQS);
- return (XPRT_IDLE);
+ return XPRT_MOREREQS;
+ return XPRT_IDLE;
}
static bool_t
-svctcp_recv (xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svctcp_recv (SVCXPRT *xprt, struct rpc_msg *msg)
{
- struct tcp_conn *cd =
- (struct tcp_conn *) (xprt->xp_p1);
+ struct tcp_conn *cd = (struct tcp_conn *) (xprt->xp_p1);
XDR *xdrs = &(cd->xdrs);
xdrs->x_op = XDR_DECODE;
if (xdr_callmsg (xdrs, msg))
{
cd->x_id = msg->rm_xid;
- return (TRUE);
+ return TRUE;
}
cd->strm_stat = XPRT_DIED; /* XXXX */
- return (FALSE);
+ return FALSE;
}
static bool_t
-svctcp_getargs (xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
+svctcp_getargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
-
- return ((*xdr_args) (&(((struct tcp_conn *) (xprt->xp_p1))->xdrs), args_ptr));
+ return ((*xdr_args) (&(((struct tcp_conn *)
+ (xprt->xp_p1))->xdrs), args_ptr));
}
static bool_t
-svctcp_freeargs (xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
+svctcp_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
- XDR *xdrs =
- &(((struct tcp_conn *) (xprt->xp_p1))->xdrs);
+ XDR *xdrs = &(((struct tcp_conn *) (xprt->xp_p1))->xdrs);
xdrs->x_op = XDR_FREE;
return ((*xdr_args) (xdrs, args_ptr));
}
static bool_t
-svctcp_reply (xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svctcp_reply (SVCXPRT *xprt, struct rpc_msg *msg)
{
- struct tcp_conn *cd =
- (struct tcp_conn *) (xprt->xp_p1);
+ struct tcp_conn *cd = (struct tcp_conn *) (xprt->xp_p1);
XDR *xdrs = &(cd->xdrs);
bool_t stat;
msg->rm_xid = cd->x_id;
stat = xdr_replymsg (xdrs, msg);
(void) xdrrec_endofrecord (xdrs, TRUE);
- return (stat);
+ return stat;
}
#include <rpc/rpc.h>
#include <sys/socket.h>
#include <sys/uio.h>
+#include <sys/poll.h>
#include <errno.h>
#include <stdlib.h>
}
/*
- * All read operations timeout after 35 seconds.
- * A timeout is fatal for the connection.
- */
-static struct timeval wait_per_try = {35, 0};
-
-/*
* reads data from the unix connection.
* any error is fatal and the connection is closed.
* (And a read of zero bytes is a half closed stream => error.)
{
SVCXPRT *xprt = (SVCXPRT *) xprtptr;
int sock = xprt->xp_sock;
-#ifdef FD_SETSIZE
- fd_set readfds;
-#else
- int mask = 1 << sock;
- int readfds;
-#endif /* def FD_SETSIZE */
- while (1)
+ int milliseconds = 35 * 1000;
+ struct pollfd pollfd;
+
+ do
{
- struct timeval timeout = wait_per_try;
- readfds = svc_fdset;
-#ifdef FD_SETSIZE
- FD_SET (sock, &readfds);
-#else
- readfds |= (1 << sock);
-#endif /* def FD_SETSIZE */
- if (__select (_rpc_dtablesize (), &readfds, (fd_set *) NULL,
- (fd_set *) NULL, &timeout) <= 0)
+ pollfd.fd = sock;
+ pollfd.events = POLLIN;
+ switch (__poll (&pollfd, 1, milliseconds))
{
+ case -1:
if (errno == EINTR)
continue;
+ /*FALLTHROUGH*/
+ case 0:
goto fatal_err;
+ default:
+ break;
}
-
-#ifdef FD_SETSIZE
- if (FD_ISSET (sock, &readfds))
-#else
- if (readfds == mask)
-#endif /* def FD_SETSIZE */
- break;
-
- svc_getreqset (&readfds);
}
+ while ((pollfd.revents & POLLIN) == 0);
if ((len = __msgread (sock, buf, len)) > 0)
return len;
}
static bool_t
-svcunix_freeargs (xprt, xdr_args, args_ptr)
- SVCXPRT *xprt;
- xdrproc_t xdr_args;
- caddr_t args_ptr;
+svcunix_freeargs (SVCXPRT *xprt, xdrproc_t xdr_args, caddr_t args_ptr)
{
XDR *xdrs = &(((struct unix_conn *) (xprt->xp_p1))->xdrs);
}
static bool_t
-svcunix_reply (xprt, msg)
- SVCXPRT *xprt;
- struct rpc_msg *msg;
+svcunix_reply (SVCXPRT *xprt, struct rpc_msg *msg)
{
struct unix_conn *cd = (struct unix_conn *) (xprt->xp_p1);
XDR *xdrs = &(cd->xdrs);