From: Simon Wilkinson Date: Wed, 1 Sep 2010 10:09:46 +0000 (+0100) Subject: RX: Make the sample client and server build X-Git-Tag: openafs-devel-1_5_78~151 X-Git-Url: https://git.michaelhowe.org/gitweb/?a=commitdiff_plain;h=3eb62601471b44ebb6ed5e06945681c2eb320736;p=packages%2Fo%2Fopenafs.git RX: Make the sample client and server build Make the RX sample client and server build again Change-Id: I81ce12eadcb4150dd503e41f9a7fd1a850d31a11 Reviewed-on: http://gerrit.openafs.org/2737 Reviewed-by: Derrick Brashear Tested-by: Derrick Brashear (cherry picked from commit 71171262602d7f261adbffd5047266e94c4a6f92) Reviewed-on: http://gerrit.openafs.org/2791 --- diff --git a/src/rx/simple.example/.gitignore b/src/rx/simple.example/.gitignore new file mode 100644 index 000000000..28a575e60 --- /dev/null +++ b/src/rx/simple.example/.gitignore @@ -0,0 +1,3 @@ +/sample.h +/sample_client +/sample_server diff --git a/src/rx/simple.example/Makefile.in b/src/rx/simple.example/Makefile.in index c62ee8a3a..2575c50ba 100644 --- a/src/rx/simple.example/Makefile.in +++ b/src/rx/simple.example/Makefile.in @@ -7,18 +7,15 @@ srcdir=@srcdir@ include @TOP_OBJDIR@/src/config/Makefile.config -INSTALL = @INSTALL@ -INSTALL_DATA = @INSTALL_DATA@ -INSTALL_PROGRAM = @INSTALL_PROGRAM@ -INSTALL_SCRIPT = @INSTALL_SCRIPT@ +# This set of definitions tests the lwp RX library +#CFLAGS=$(COMMON_CFLAGS) $(XCFLAGS) $(ARCHFLAGS) +#LIBS=${TOP_LIBDIR}/librx.a ${TOP_LIBDIR}/liblwp.a -SRCDIR=/usr/andy/ -LIBRX=${SRCDIR}/lib/librx.a -DESTDIR=/usr/andy/ -INSTALL=${SRCDIR}/bin/install -LIBS=${LIBRX} ${SRCDIR}/lib/liblwp.a -CFLAGS=${DBG} -I. -I${SRCDIR}/include -DDEBUG ${XCFLAGS} ${ARCHFLAGS} +# This set of definitions tests the pthread one +CFLAGS=$(COMMON_CFLAGS) $(MT_CFLAGS) +LIBS=$(TOP_LIBDIR)/libafsauthent.a $(TOP_LIBDIR)/libafsrpc.a \ + $(TOP_LIBDIR)/util.a all: sample_client sample_server @@ -30,5 +27,12 @@ sample_server: sample_server.o sample.ss.o ${LIBS} sample_client.o: sample.h sample_server.o: sample.h -sample.cs.c sample.ss.c sample.er.c sample.h: sample.xg - rxgen sample.xg +sample.cs.c: sample.xg + $(RXGEN) -A -x -C -o $@ sample.xg +sample.ss.c: sample.xg + $(RXGEN) -A -x -S -o $@ sample.xg +sample.h: sample.xg + $(RXGEN) -A -x -h -o $@ sample.xg + +clean: + rm -f *.o sample.cs.c sample.ss.c sample_client sample_server diff --git a/src/rx/simple.example/sample.xg b/src/rx/simple.example/sample.xg index 2ca282630..63e048fd3 100644 --- a/src/rx/simple.example/sample.xg +++ b/src/rx/simple.example/sample.xg @@ -8,6 +8,7 @@ */ package TEST_ +prefix S %#include %#include diff --git a/src/rx/simple.example/sample_client.c b/src/rx/simple.example/sample_client.c index 38a1595a0..819153cc8 100644 --- a/src/rx/simple.example/sample_client.c +++ b/src/rx/simple.example/sample_client.c @@ -17,18 +17,17 @@ #include "sample.h" /* Bogus procedure to get internet address of host */ -static u_long -GetIpAddress(hostname) - char *hostname; +static unsigned int +GetIpAddress(char *hostname) { struct hostent *hostent; - u_long host; + unsigned int host; hostent = gethostbyname(hostname); if (!hostent) { printf("host %s not found", hostname); exit(1); } - if (hostent->h_length != sizeof(u_long)) { + if (hostent->h_length != sizeof(unsigned int)) { printf("host address is disagreeable length (%d)", hostent->h_length); exit(1); } @@ -36,8 +35,8 @@ GetIpAddress(hostname) return host; } -main(argc, argv) - char **argv; +int +main(int argc, char **argv) { struct rx_connection *conn; u_long host; @@ -59,4 +58,6 @@ main(argc, argv) error = TEST_Sub(conn, i, i * 2, &result); printf(" ==> %d, error %d\n", result, error); } + + return 0; } diff --git a/src/rx/simple.example/sample_server.c b/src/rx/simple.example/sample_server.c index dbc7c7846..6aa8cc6cd 100644 --- a/src/rx/simple.example/sample_server.c +++ b/src/rx/simple.example/sample_server.c @@ -18,7 +18,10 @@ #define N_SECURITY_OBJECTS 1 -main() +static void Quit(char *); + +int +main(int argc, char **argv) { struct rx_securityClass *(securityObjects[N_SECURITY_OBJECTS]); struct rx_service *service; @@ -41,13 +44,12 @@ main() rx_StartServer(1); /* Donate this process to the server process pool */ Quit("StartServer returned?"); + + return 0; } int -TEST_Add(call, a, b, result) - struct rx_call *call; - int a, b; - int *result; +STEST_Add(struct rx_call *call, int a, int b, int *result) { printf("TEST_Add(%d,%d)\n", a, b); *result = a + b; @@ -55,19 +57,16 @@ TEST_Add(call, a, b, result) } int -TEST_Sub(call, a, b, result) - struct rx_call *call; - int a, b; - int *result; +STEST_Sub(struct rx_call *call, int a, int b, int *result) { printf("TEST_Sub(%d,%d)\n", a, b); *result = a - b; return 0; } -Quit(msg, a, b) - char *msg; +static void +Quit(char *msg) { - fprintf(stderr, msg, a, b); + fprintf(stderr, "%s", msg); exit(1); }