Starting RPC from the inetd Daemon
An RPC server can be started from the inetd daemon. The only difference between using the inetd daemon and the usual code is that the service creation routine is called.
Because the inet passes a socket as file descriptor 0, the
following form is used:
transp = svcudp_create(0); /* For UDP */
transp = svctcp_create(0,0,0); /* For listener TCP sockets */
transp = svcfd_create(0,0,0); /* For connected TCP sockets */
In addition, call the svc_register routine as follows:
svc_register(transp, PROGNUM, VERSNUM, service, 0)
The final flag is 0 because the program is already registered by the inetd daemon. To exit from the server process and return control to the inet, the user must explicitly exit. The svc_run routine never returns.
Entries in the /etc/inetd.conf file for RPC services
take one of the following two forms:
p_name sunrpc_udp udp wait user server args version
p_name sunrpc_tcp tcp wait user server args version
where p_name is the symbolic name of the program as it appears in the RPC routine, server is the program implementing the server, and version is the version number of the service.
If the same program handles multiple versions, then the version
number can be a range, as in the following:
rstatd sunrpc_udp udp wait root /usr/sbin/rpc.rstatd rstatd 100001 1-2