svc_run man page on SmartOS

Man page or keyword search:  
man Server   16655 pages
apropos Keyword Search (all sections)
Output format
SmartOS logo
[printable version]

RPC_SVC_CALLS(3NSL)					   RPC_SVC_CALLS(3NSL)

NAME
       rpc_svc_calls,	svc_dg_enablecache,   svc_done,	 svc_exit,  svc_fdset,
       svc_freeargs,	svc_getargs,	svc_getreq_common,    svc_getreq_poll,
       svc_getreqset,  svc_getrpccaller,  svc_max_pollfd, svc_pollfd, svc_run,
       svc_sendreply,  svc_getcallerucred,  svc_fd_negotiate_ucred  -  library
       routines for RPC servers

SYNOPSIS
       cc [ flag... ] file... -lnsl [ library...]
       #include <rpc/rpc.h>

       int svc_dg_enablecache(SVCXPRT *xprt, const uint_t cache_size);

       int svc_done(SVCXPRT *xprt);

       void svc_exit(void);

       void svc_fd_negotiate_ucred(int fd);

       bool_t svc_freeargs(const SVCXPRT *xprt, const txdrproc_t inproc,
	    caddr_t in);

       bool_t svc_getargs(const SVCXPRT *xprt, const xdrproc_t inproc,
	    caddr_t in);

       int svc_getcallerucred(const SVCXPRT *xprt, ucred_t **ucred);

       void svc_getreq_common(const int fd);

       void svc_getreqset(fd_set *rdfds);

       void svc_getreq_poll(struct pollfd *pfdp, const int pollretval);

       struct netbuf *svc_getrpccaller(const SVCXPRT *xprt);

       void svc_run(void);

       bool_t svc_sendreply(const SVCXPRT *xprt, const xdrproc_t outproc,
	    caddr_t outint svc_max_pollfd;
       fd_set svc_fdset;
       pollfd_t *svc_pollfd;

DESCRIPTION
       These routines are part of the RPC library which allows C language pro‐
       grams to make procedure calls on other machines across the network.

       These routines are associated with the server side of  the  RPC	mecha‐
       nism.   Some  of	 them are called by the server side dispatch function.
       Others, such as svc_run(), are called when the server is initiated.

       Because the service transport handle SVCXPRT  contains  a  single  data
       area  for decoding arguments and encoding results, the structure cannot
       freely be shared between threads that call functions  to	 decode	 argu‐
       ments  and  encode results. When a server is operating in the Automatic
       or User MT modes, however, a copy of this structure is  passed  to  the
       service	dispatch  procedure in order to enable concurrent request pro‐
       cessing. Under these circumstances, some routines which would otherwise
       be  Unsafe, become Safe. These are marked as such. Also marked are rou‐
       tines that are Unsafe for multithreaded applications, and are not to be
       used  by	 such  applications.  See  rpc(3NSL) for the definition of the
       SVCXPRT data structure.

       The svc_dg_enablecache() function allocates a duplicate	request	 cache
       for the service endpoint xprt, large enough to hold cache_size entries.
       Once enabled, there is no way to disable caching. The function  returns
       1  if  space  necessary	for a cache of the given size was successfully
       allocated, and 0 otherwise. This	 function  is  Safe  in	 multithreaded
       applications.

       The  svc_done()	function frees resources allocated to service a client
       request directed to the service endpoint xprt. This call pertains  only
       to  servers executing in the User MT mode. In the User MT mode, service
       procedures must invoke this  call  before  returning,  either  after  a
       client  request has been serviced, or after an error or abnormal condi‐
       tion that prevents  a  reply  from  being  sent.	 After	svc_done()  is
       invoked, the service endpoint xprt should not be referenced by the ser‐
       vice procedure. Server multithreading modes and parameters can  be  set
       using  the  rpc_control()  call. This function is Safe in multithreaded
       applications. It will have no effect if invoked in modes other than the
       User MT mode.

       The svc_exit() function when called by any of the RPC server procedures
       or otherwise, destroys all services registered by the server and causes
       svc_run()  to return. If RPC server activity is to be resumed, services
       must be reregistered with the RPC library either	 through  one  of  the
       rpc_svc_create(3NSL)   functions,  or  using  xprt_register(3NSL).  The
       svc_exit() function has global scope and ends all RPC server activity.

       The svc_freeargs() function macro  frees	 any  data  allocated  by  the
       RPC/XDR	system	when  it  decoded the arguments to a service procedure
       using svc_getargs(). This routine returns TRUE if the results were suc‐
       cessfully  freed,  and  FALSE otherwise. This function macro is Safe in
       multithreaded applications utilizing the Automatic or User MT modes.

       The svc_getargs() function  macro  decodes  the	arguments  of  an  RPC
       request	associated  with  the  RPC  service transport handle xprt. The
       parameter in is the address where the arguments will be placed;	inproc
       is  the	XDR routine used to decode the arguments. This routine returns
       TRUE if decoding succeeds, and FALSE otherwise.	This function macro is
       Safe  in	 multithreaded applications utilizing the Automatic or User MT
       modes.

       The svc_getreq_common() function is called to handle  a	request	 on  a
       file descriptor.

       The  svc_getreq_poll() function is only of interest if a service imple‐
       mentor does not call svc_run(), but instead implements custom asynchro‐
       nous event processing. It is called when poll(2) has determined that an
       RPC request has arrived on some RPC file descriptors; pollretval is the
       return value from poll(2) and pfdp is the array of pollfd structures on
       which the poll(2) was done. It is assumed to be an array	 large	enough
       to   contain   the   maximal   number   of  descriptors	allowed.   The
       svc_getreq_poll() function macro is Unsafe  in  multithreaded  applica‐
       tions.

       The svc_getreqset() function is only of interest if a service implemen‐
       tor does not call svc_run(), but instead implements custom asynchronous
       event  processing.  It is called when select(3C) has determined that an
       RPC request has arrived on some RPC  file  descriptors;	rdfds  is  the
       resultant  read	file descriptor bit mask. The routine returns when all
       file descriptors associated with the value of rdfds have been serviced.
       This function macro is Unsafe in multithreaded applications.

       The svc_getrpccaller() function is the approved way of getting the net‐
       work address of the caller of a procedure associated with the RPC  ser‐
       vice  transport	handle	xprt.  This  function  macro is Safe in multi‐
       threaded applications.

       The svc_run() function never  returns.  In  single-threaded  mode,  the
       function waits for RPC requests to arrive. When an RPC request arrives,
       the svc_run() function calls the appropriate  service  procedure.  This
       procedure is usually waiting for the poll(2) library call to return.

       Applications  that  execute in the Automatic or the User MT mode should
       invoke the svc_run() function exactly once. In the Automatic  MT	 mode,
       the  svc_run()  function creates threads to service client requests. In
       the User MT mode, the function provides a framework for service	devel‐
       opers  to  create  and  manage  their  own threads for servicing client
       requests.

       The svc_fdset global variable  reflects	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  pro‐
       cessing.	  This	variable  is  read-only	 may  change  after  calls  to
       svc_getreqset() or after any creation routine. Do not pass its  address
       to  select(3C).	 Instead,  pass	 the  address of a copy. multithreaded
       applications executing in either the Automatic MT mode or the  user  MT
       mode 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.

       The svc_pollfd global variable points to an array  of  pollfd_t	struc‐
       tures that reflect the RPC server's read file descriptor array. This is
       only of interest if 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(2). Instead, pass the
       address of a copy. By default, svc_pollfd is limited to	1024  entries.
       Use rpc_control(3NSL) to remove this limitation. multithreaded applica‐
       tions executing in either the Automatic MT mode or  the	user  MT  mode
       should  never  be read this variable. They should use auxiliary threads
       to do asynchronous event processing.

       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.

       The svc_sendreply() function is called by an RPC service dispatch  rou‐
       tine 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  used  to  encode  the  results.  The out parameter is the
       address of the results. This routine returns TRUE if it succeeds, FALSE
       otherwise.  The svc_sendreply() function macro is Safe in multithreaded
       applications that use the Automatic or the User MT mode.

       The svc_fd_negotiate_ucred() 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.

       The svc_getcallerucred() function  attempts  to	retrieve  the  ucred_t
       associated  with the caller. The function returns 0 when successful and
       -1 when not.

       When successful, the svc_getcallerucred() function stores  the  pointer
       to a freshly allocated ucred_t in the memory location pointed to by the
       ucred argument if that memory location contains the  null  pointer.  If
       the  memory  location  is  non-null,  the  function reuses the existing
       ucred_t.	 When ucred is no longer needed,  a  credential	 allocated  by
       svc_getcallerucred() should be freed with ucred_free(3C).

ATTRIBUTES
       See attributes(5) for descriptions of attribute types and values.

       ┌───────────────┬─────────────────┐
       │ATTRIBUTE TYPE │ ATTRIBUTE VALUE │
       ├───────────────┼─────────────────┤
       │MT-Level       │ See below.	 │
       └───────────────┴─────────────────┘

       The svc_fd_negotiate_ucred(), svc_dg_enablecache(), svc_getrpccaller(),
       and svc_getcallerucred() functions are Safe in  multithreaded  applica‐
       tions. The svc_freeargs(), svc_getargs(), and svc_sendreply() functions
       are Safe in multithreaded applications that use the  Automatic  or  the
       User   MT   mode.   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.

SEE ALSO
       rpcgen(1),  poll(2),  getpeerucred(3C),	rpc(3NSL),  rpc_control(3NSL),
       rpc_svc_create(3NSL), rpc_svc_err(3NSL), rpc_svc_reg(3NSL), select(3C),
       ucred_free(3C), xprt_register(3NSL), attributes(5)

				 Oct 28, 2013		   RPC_SVC_CALLS(3NSL)
[top]

List of man pages available for SmartOS

Copyright (c) for man pages and the logo by the respective OS vendor.

For those who want to learn more, the polarhome community provides shell access and support.

[legal] [privacy] [GNU] [policy] [cookies] [netiquette] [sponsors] [FAQ]
Tweet
Polarhome, production since 1999.
Member of Polarhome portal.
Based on Fawad Halim's script.
....................................................................
Vote for polarhome
Free Shell Accounts :: the biggest list on the net