[PATCH 4/6] sunrpc: Remove obsolete tst-getmyaddr and thrsvc xtests

Adhemerval Zanella adhemerval.zanella@linaro.org
Thu Jul 9 17:48:17 GMT 2026


These exercise the deprecated Sun RPC interfaces and require network
access.  Remove them along with their xtests entries.
---
 sunrpc/Makefile        |   6 ---
 sunrpc/thrsvc.c        | 109 -----------------------------------------
 sunrpc/tst-getmyaddr.c |  24 ---------
 3 files changed, 139 deletions(-)
 delete mode 100644 sunrpc/thrsvc.c
 delete mode 100644 sunrpc/tst-getmyaddr.c

diff --git a/sunrpc/Makefile b/sunrpc/Makefile
index 63c90874581..36babe303d9 100644
--- a/sunrpc/Makefile
+++ b/sunrpc/Makefile
@@ -74,10 +74,7 @@ tests = \
   tst-xdrmem2
 # tests
 
-xtests := tst-getmyaddr
-
 ifeq ($(have-thread-library),yes)
-xtests += thrsvc
 tests += tst-udp-garbage tst-svc_register
 endif
 
@@ -104,15 +101,12 @@ CFLAGS-pmap_rmt.c += -fexceptions
 CFLAGS-clnt_perr.c += -fexceptions
 CFLAGS-openchild.c += -fexceptions
 
-$(objpfx)tst-getmyaddr: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-xdrmem: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-xdrmem2: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-udp-error: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-svc_register: \
   $(common-objpfx)linkobj/libc.so $(shared-thread-library)
 
-$(objpfx)thrsvc: $(common-objpfx)linkobj/libc.so $(shared-thread-library)
-
 $(objpfx)tst-udp-timeout: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-udp-nonblocking: $(common-objpfx)linkobj/libc.so
 $(objpfx)tst-udp-garbage: \
diff --git a/sunrpc/thrsvc.c b/sunrpc/thrsvc.c
deleted file mode 100644
index 63cfbf9810d..00000000000
--- a/sunrpc/thrsvc.c
+++ /dev/null
@@ -1,109 +0,0 @@
-#include <pthread.h>
-#include <stdio.h>
-#include <string.h>
-#include <unistd.h>
-#include <rpc/rpc.h>
-#include <arpa/inet.h>
-
-#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);
-  if (request->rq_proc == PROCQUIT)
-    exit (0);
-}
-
-static void
-test_one_call (struct rpc_arg *a)
-{
-  struct timeval tout = { 60, 0 };
-  enum clnt_stat result;
-
-  printf ("test_one_call: ");
-  result = clnt_call (a->client, a->proc,
-		      (xdrproc_t) xdr_void, 0,
-		      (xdrproc_t) xdr_void, 0, tout);
-  if (result == RPC_SUCCESS)
-    puts ("success");
-  else
-    {
-      clnt_perrno (result);
-      putchar ('\n');
-      exitcode = 1;
-    }
-}
-
-static void *
-thread_wrapper (void *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;
-}
-
-int
-main (void)
-{
-  pthread_t tid;
-  pid_t pid;
-  int err;
-  SVCXPRT *svx;
-  CLIENT *clnt;
-  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);
-
-  pid = fork ();
-  if (pid == -1)
-    {
-      perror ("fork");
-      return 1;
-    }
-  if (pid == 0)
-    svc_run ();
-
-  inet_aton ("127.0.0.1", &sin.sin_addr);
-  sin.sin_port = htons (svx->xp_port);
-  sin.sin_family = AF_INET;
-
-  clnt = clntudp_create (&sin, PROGNUM, VERSNUM, wait, &sock);
-
-  a.client = clnt;
-  a.proc = PROCNUM;
-
-  /* Test in this thread */
-  test_one_call (&a);
-
-  /* Test in a child thread */
-  err = pthread_create (&tid, 0, thread_wrapper, (void *) clnt);
-  if (err)
-    fprintf (stderr, "pthread_create: %s\n", strerror (err));
-  err = pthread_join (tid, 0);
-  if (err)
-    fprintf (stderr, "pthread_join: %s\n", strerror (err));
-
-  return exitcode;
-}
diff --git a/sunrpc/tst-getmyaddr.c b/sunrpc/tst-getmyaddr.c
deleted file mode 100644
index 1eaf9b22caf..00000000000
--- a/sunrpc/tst-getmyaddr.c
+++ /dev/null
@@ -1,24 +0,0 @@
-#include <stdio.h>
-#include <string.h>
-#include <arpa/inet.h>
-#include <netinet/in.h>
-#include <rpc/clnt.h>
-
-
-static int
-do_test (void)
-{
-  struct sockaddr_in ad;
-  struct sockaddr_in ad2;
-  memset (&ad, '\0', sizeof (ad));
-  memset (&ad2, '\0', sizeof (ad2));
-
-  get_myaddress (&ad);
-
-  printf ("addr = %s:%d\n", inet_ntoa (ad.sin_addr), ad.sin_port);
-
-  return memcmp (&ad, &ad2, sizeof (ad)) == 0;
-}
-
-#define TEST_FUNCTION do_test ()
-#include "../test-skeleton.c"
-- 
2.43.0



More information about the Libc-alpha mailing list