summaryrefslogtreecommitdiff
path: root/sunrpc/thrsvc.c
diff options
context:
space:
mode:
authorUlrich Drepper <drepper@redhat.com>2002-10-14 18:10:15 +0000
committerUlrich Drepper <drepper@redhat.com>2002-10-14 18:10:15 +0000
commit89b91a92658e1980d28c3c78582062223e134514 (patch)
treeeba69c3ef34b57cc5995cdc2cf967291dff9e548 /sunrpc/thrsvc.c
parent5e3ab761da1f32e0b1ec303a431be7d1be8a0250 (diff)
downloadglibc-89b91a92658e1980d28c3c78582062223e134514.tar.gz
Update.
2002-10-12 H.J. Lu <hjl@gnu.org> * sunrpc/thrsvc.c (PROCQUIT): New. (struct rpc_arg): New. (dispatch): Call exit (0) if request->rq_proc == PROCQUIT. (test_one_call): Take struct rpc_arg * instead of CLIENT *c. (thread_wrapper): Modified for struct rpc_arg * and call PROCQUIT. (main): Modified for struct rpc_arg *. 2002-10-14 Ulrich Drepper <drepper@redhat.com> * dirent/scandir.c: Rearrange code a bit to reduce binary size. 2002-10-14 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/x86_64/sysdep.h: Include tls.h. (SYSCALL_ERROR_HANDLER): Use RTLD_PRIVATE_ERRNO sequence in ld.so even if __thread is supported. 2002-10-13 Jakub Jelinek <jakub@redhat.com> * sysdeps/unix/sysv/linux/arm/profil-counter.h (profil_counter): Add hack to prevent the compiler from clobbering the signal context. * sysdeps/unix/sysv/linux/sh/profil-counter.h (profil_counter): Likewise. * sysdeps/unix/sysv/linux/x86_64/profil-counter.h (profil_counter): Likewise.
Diffstat (limited to 'sunrpc/thrsvc.c')
-rw-r--r--sunrpc/thrsvc.c30
1 files changed, 25 insertions, 5 deletions
diff --git a/sunrpc/thrsvc.c b/sunrpc/thrsvc.c
index ac6af09f5b..63cfbf9810 100644
--- a/sunrpc/thrsvc.c
+++ b/sunrpc/thrsvc.c
@@ -8,23 +8,32 @@
#define PROGNUM 1234
#define VERSNUM 1
#define PROCNUM 1
+#define PROCQUIT 2
static int exitcode;
+struct rpc_arg
+{
+ CLIENT *client;
+ u_long proc;
+};
+
static void
dispatch(struct svc_req *request, SVCXPRT *xprt)
{
- svc_sendreply(xprt, (xdrproc_t)xdr_void, 0);
+ svc_sendreply(xprt, (xdrproc_t)xdr_void, 0);
+ if (request->rq_proc == PROCQUIT)
+ exit (0);
}
static void
-test_one_call (CLIENT *c)
+test_one_call (struct rpc_arg *a)
{
struct timeval tout = { 60, 0 };
enum clnt_stat result;
printf ("test_one_call: ");
- result = clnt_call (c, PROCNUM,
+ result = clnt_call (a->client, a->proc,
(xdrproc_t) xdr_void, 0,
(xdrproc_t) xdr_void, 0, tout);
if (result == RPC_SUCCESS)
@@ -40,7 +49,14 @@ test_one_call (CLIENT *c)
static void *
thread_wrapper (void *arg)
{
- test_one_call ((CLIENT *)arg);
+ struct rpc_arg a;
+
+ a.client = (CLIENT *)arg;
+ a.proc = PROCNUM;
+ test_one_call (&a);
+ a.client = (CLIENT *)arg;
+ a.proc = PROCQUIT;
+ test_one_call (&a);
return 0;
}
@@ -55,6 +71,7 @@ main (void)
struct sockaddr_in sin;
struct timeval wait = { 5, 0 };
int sock = RPC_ANYSOCK;
+ struct rpc_arg a;
svx = svcudp_create (RPC_ANYSOCK);
svc_register (svx, PROGNUM, VERSNUM, dispatch, 0);
@@ -74,8 +91,11 @@ main (void)
clnt = clntudp_create (&sin, PROGNUM, VERSNUM, wait, &sock);
+ a.client = clnt;
+ a.proc = PROCNUM;
+
/* Test in this thread */
- test_one_call (clnt);
+ test_one_call (&a);
/* Test in a child thread */
err = pthread_create (&tid, 0, thread_wrapper, (void *) clnt);