RPC servers can be started by port monitors such as inetd and listen. Port monitors listen for requests and spawn servers in response. The forked server process is passed the file descriptor 0 on which the request has been accepted. For inetd, when the server is done, it can exit immediately or wait a given interval for another service request. See also Appendix F, Writing a Port Monitor With the Service Access Facility (SAF).
For listen, servers should exit immediately after replying because listen() always spawns a new process. The following function call creates a SVCXPRT handle to be used by the services started by port monitors.
transp = svc_tli_create(0, nconf, (struct t_bind *)NULL, 0, 0)
nconf is the netconfig structure of the transport from which the request is received.
Because the port monitors have already registered the service with rpcbind, the service does not need to register with rpcbind. The service must call svc_reg() to register the service procedure.
svc_reg(transp, PROGNUM, VERSNUM, dispatch,(struct netconfig *)NULL)
The netconfig structure is NULL to prevent svc_reg() from registering the service with rpcbind.
transp = svc_fd_create(0, recvsize, sendsize);
A 0 file descriptor is the first argument. You can set the value of recvsize and sendsize to any appropriate buffer size. A 0 for either argument causes a system default size to be chosen. Application servers that do not do any listening of their own use svc_fd_create().
Table 5-3 RPC inetd Services
rquotad/1 tli rpc/udp wait root /usr/lib/nfs/rquotad rquotad
For more information, see the inetd.conf(4) man page.
pmadm -a -p pm_tag -s svctag -i id -v vers \ -m `nlsadmin -c command -D -R prog:vers`
The arguments are:
adds a service
specifies a tag associated with the port monitor providing access to the service
server's identifying code
the /etc/passwd user name assigned to service svctag
the version number for the port monitor's database file
# pmadm -a -p tcp -s rusers -i root -v 4 \ -m `nlsadmin -c /usr/sbin/rpc.ruserd -D -R 100002:1`
The command is given root permissions, installed in version 4 of the listener database file, and is made available over TCP transports. Because of the complexity of the arguments and options to pmadm, use a command script or the menu system to add RPC services. To use the menu system, type sysadm ports and choose the -port_services option.
# sacadm -k -p pmtag # sacadm -s -p pmtag
For more information, such as how to set up the listener process, see the listen(1M), pmadm(1M), and sacadm(1M) man pages. Also see How the TCP/IP Protocols Handle Data Communications in System Administration Guide: IP Services.