rpc_svc_calls.3n (2010 09)

r
rpc_svc_calls(3N) rpc_svc_calls(3N)
RPC request arrives, the svc_run() function calls the appropriate service procedure. This pro-
cedure is usually waiting for the poll()
library call to return.
Applications executing in the Automatic or User MT modes should invoke the
svc_run() function
exactly once. In the Automatic MT mode, the function creates threads to service client requests. In
the User MT mode, the function provides a framework for service developers to create and manage
their own threads for servicing client requests.
bool_t svc_sendreply()
This function is called by an RPC service dispatch routine to send the results of a remote procedure
call. The xprt parameter is the transport handle of the request. The outproc parameter is the XDR
routine which is used to encode the results. The out parameter is the address of the results. This
routine returns
TRUE if it succeeds, FALSE
otherwise.
This function is safe in multithreaded applications utilizing the Automatic or User MT modes.
void svc_fd_negotiate_ucred()
This function is called by an RPC server to inform the underlying transport that the function wishes
to receive ucreds for local calls, including those over IP transports.
fd_set svc_fdset
A global variable reflecting the RPC server’s read file descriptor bit mask. This is only of interest if
service implementors do not call svc_run(), but rather do their own asynchronous event process-
ing. This variable is read-only, and it may change after calls to svc_getreqset()
or any crea-
tion routines. Do not pass its address to
select(). Instead, pass the address of a copy.
Multithreaded applications executing in either the Automatic or the User MT modes should never
read this variable. They should use auxiliary threads to do asynchronous event processing.
The
svc_fdset variable is limited to 1024 file descriptors and is considered obsolete. Use of
svc_pollfd is recommended instead.
pollfd_t *svc_pollfd
The svc_pollfd global variable points to an array of pollfd_t structures that reflect the RPC
server’s read file descriptor array. This is only of interest if service service implementors do not call
svc_run() but rather do their own asynchronous event processing. This variable is read-only,
and it may change after calls to svc_getreg_poll()
or any creation routines. Do no pass its
address to
poll(). Instead, pass the address of a copy. By default, svc_pollfd is limited to
1024 entries. Use rpc_control()
to remove this limitation.
Multithreaded applications executing in either the Automatic or the User MT mode should never
read this variable. They should use auxiliary threads to do asynchronous event processing.
int svc_max_pollfd
The svc_max_pollfd global variable contains the maximum length of the
svc_pollfd array.
This variable is read-only, and it may change after calls to
svc_getreg_poll()
or any creation
routines.
MULTITHREAD USAGE
Thread Safe: See Notes below.
Cancel Safe: See Notes below.
Fork Safe: No
Async-cancel Safe: No
Async-signal Safe: No
In a multithreaded environment, these functions are not safe to be called by a child process after
fork()
and before exec(). These functions should not be called by a multithreaded application that supports
asynchronous cancellation or asynchronous signals.
Notes
svc_dg_enablecache() and svc_getrpccaller() are Thread Safe and Cancel Safe in mul-
tithreaded applications. svc_freeargs(), svc_getargs(), and svc_sendreply() are Thread
Safe and Cancel Safe in multithreaded applications that use the Automatic or the User MT modes. The
svc_getreq_common(), svc_getreqset(), and svc_getreq_poll() functions are unsafe in
multithreaded applications and should be called only from the main thread.
HP-UX 11i Version 3: September 2010 3 Hewlett-Packard Company 3