Subject: rpcgen generates wrong server code
To: None <tech-userlevel@netbsd.org>
From: Ian Zagorskih <ianzag@megasignal.com>
List: tech-userlevel
Date: 05/11/2004 10:21:23
uname -a
NetBSD IANZAG 2.0_BETA NetBSD 2.0_BETA (IANZAG) #0: Fri May  7 17:55:29 NOVST 
2004

I'm trying to build some simple RPC examples from "UNIX IPC" by Stevens like 
listed below:

--- square.x---
struct square_in {              /* input (argument) */
  long  arg1;
};

struct square_out {             /* output (result) */
  long  res1;
};

program SQUARE_PROG {
    version SQUARE_VERS {
        square_out      SQUAREPROC(square_in) = 1; /* procedure number = 1 */
    } = 1;                              /* version number */
} = 0x31230000;                 /* program number */
--- square.x---

While building the client side seems to be fine but there's some problems with 
server:

---cut---
rpcgen -C square.x
gcc -g -O2 -D_REENTRANT -Wall  -c client.c
gcc -g -O2 -D_REENTRANT -Wall  -c square_clnt.c
gcc -g -O2 -D_REENTRANT -Wall  -c square_xdr.c
gcc -g -O2 -D_REENTRANT -Wall -o client client.o square_clnt.o 
square_xdr.o  ../../libunpipc.a -lpthread
gcc -g -O2 -D_REENTRANT -Wall  -c server.c
gcc -g -O2 -D_REENTRANT -Wall  -c square_svc.c
square_svc.c: In function `closedown':
square_svc.c:60: error: storage size of `tinfo' isn't known
square_svc.c:62: warning: implicit declaration of function `t_getinfo'
square_svc.c:62: error: `T_CLTS' undeclared (first use in this function)
square_svc.c:62: error: (Each undeclared identifier is reported only once
square_svc.c:62: error: for each function it appears in.)
square_svc.c:60: warning: unused variable `tinfo'
square_svc.c: In function `main':
square_svc.c:137: error: `FMNAMESZ' undeclared (first use in this function)
square_svc.c:139: error: `I_LOOK' undeclared (first use in this function)
square_svc.c:153: error: `I_POP' undeclared (first use in this function)
square_svc.c:153: error: `I_PUSH' undeclared (first use in this function)
square_svc.c:158: warning: implicit declaration of function `t_getstate'
square_svc.c:158: error: `T_DATAXFER' undeclared (first use in this function)
square_svc.c:137: warning: unused variable `mname'
square_svc.c: At top level:
square_svc.c:35: warning: `_rpcfdtype' defined but not used
*** Error code 1
---cut---

AFAIU the author tested his code primary on Solaris 2.6 platform so maybe 
there's some hints how to build RPC code on BSD ?

// wbr