RPC_SVC_CALLS(3)
π RPC_SVC_CALLS(3) β library routines for RPC servers π
okay bestie, welcome to the server-side section of the RPC library, aka RPC_SVC_CALLS(3). this is the manual page you open when you're the one answering the phone calls instead of making them. it covers the whole girl squad: svc_dg_enablecache, svc_exit, svc_fdset, svc_freeargs, svc_getargs, svc_getreq_common, svc_getreq_poll, svc_getreqset, svc_getrpccaller, svc_pollset, svc_run, and svc_sendreply. all twelve of them. no notes, they're all iconic. β¨
π¦ SYNOPSIS π¦
#include <rpc/rpc.h>
int
svc_dg_enablecache(SVCXPRT *xprt, const unsigned cache_size);
void
svc_exit(void);
bool_t
svc_freeargs(const SVCXPRT *xprt, const xdrproc_t inproc, caddr_t in);
bool_t
svc_getargs(const SVCXPRT *xprt, const xdrproc_t inproc, caddr_t in);
void
svc_getreq_common(const int fd);
void
svc_getreq_poll(struct pollfd *pfdp, const int pollretval);
void
svc_getreqset(fd_set * rdfds);
struct netbuf *
svc_getrpccaller(const SVCXPRT *xprt);
struct cmsgcred *
__svc_getcallercreds(const SVCXPRT *xprt);
struct pollfd svc_pollset[FD_SETSIZE];
void
svc_run(void);
bool_t
svc_sendreply(SVCXPRT *xprt, xdrproc_t outproc, char *out);
πΈ DESCRIPTION πΈ
these routines are part of the RPC library, which is the whole thing that lets C language programs make procedure calls on other machines across the network. networking, but make it C. π
these ones specifically are the server side of the RPC mechanism. some of them get called by the server side dispatch function, and others (hi, svc_run()) get called when the server is initiated. so like, you're not the caller, you're the one who picks up. main character energy, honestly.
π Routines π
peep rpc(3) for the definition of the SVCXPRT data structure. that's where the lore lives.
β svc_dg_enablecache()
this one allocates a duplicate request cache for the service endpoint xprt, big enough to hold cache_size entries. and bestie, listen: once it's enabled, there is no way to disable caching. it's giving permanent commitment.
returns 0 if the space necessary for a cache of the given size was successfully allocated, and 1 otherwise.
π svc_exit()
when this gets called by any of the RPC server procedure or otherwise, it causes svc_run() to return.
as currently implemented, svc_exit() zeroes the svc_fdset global variable. so if RPC server activity is to be resumed, services must be reregistered with the RPC library either through one of the rpc_svc_create(3) functions, or using xprt_register(). the svc_exit() function has global scope and ends all RPC server activity. like, everyone's packing up. the whole party. sorry. π
π¦ fd_set svc_fdset
a global variable reflecting the RPC server's read file descriptor bit mask. it's suitable as an argument to the select(2) system call.
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 β do not pass its address to select(2)! β yet it may change after calls to svc_getreqset() or any creation routines. so, read it, love it, don't hand out its address. π
π svc_freeargs()
a function macro that frees any data allocated by the RPC/XDR system when it decoded the arguments to a service procedure using svc_getargs(). the cleanup queen.
returns TRUE if the results were successfully freed, and FALSE otherwise.
β¨ svc_getargs()
a function macro that decodes the arguments of an RPC request associated with the RPC service transport handle xprt. the in argument is the address where the arguments will be placed; inproc is the XDR routine used to decode the arguments.
returns TRUE if decoding succeeds, and FALSE otherwise.
π svc_getreq_common()
this routine is called to handle a request on the given file descriptor. short, sweet, does exactly what it says on the tin.
π svc_getreq_poll()
this one is only of interest if a service implementor does not call svc_run(), but instead implements custom asynchronous event processing. it's 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. so bring a big enough array, bestie, or it's over for you.
π§ svc_getreqset()
also only of interest if a service implementor does not call svc_run(), but instead implements custom asynchronous event processing. it's called when poll(2) 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. she does not leave early. she's thorough. π
π svc_getrpccaller()
the approved way of getting the network address of the caller of a procedure associated with the RPC service transport handle xprt. approved, bestie. this is the sanctioned method. use this one.
π __svc_getcallercreds()
β οΈ Warning: this macro is specific to FreeBSD and thus not portable. iykyk.
this macro returns a pointer to a cmsgcred structure, defined in <sys/socket.h>, identifying the calling client. this only works if the client is calling the server over an AF_LOCAL socket. so like, cool trick, very platform-specific, do not take it on tour.
π struct pollfd svc_pollset[FD_SETSIZE];
svc_pollset is an array of pollfd structures derived from svc_fdset[]. it's suitable as an argument to the poll(2) system call.
the derivation of svc_pollset from svc_fdset is made in the current implementation in svc_run(). so if you're a service implementor who does not call svc_run() and you wish to use this array, you must perform this derivation yourself. nobody's doing it for you. do it yourself, diva. π«Ά
π svc_run()
this routine never returns. periodt. it waits for RPC requests to arrive, and calls the appropriate service procedure using svc_getreq_poll() when one arrives. this procedure is usually waiting for the poll(2) system call to return. forever. patiently. iconic behaviour honestly.
π svc_sendreply()
called by an RPC service's dispatch routine to send the results of a remote procedure call. the xprt argument is the request's associated transport handle; outproc is the XDR routine which is used to encode the results; and out is the address of the results.
returns TRUE if it succeeds, FALSE otherwise. sending the reply, as she should. β¨
π«Ά AVAILABILITY π«Ά
these functions are part of libtirpc.
π₯ SEE ALSO π₯
that's the whole page, bestie, you ate it. π this edition came to you from Debian, dated May 3, 1993 β a certified vintage, and she's still serving. mwah. π
π¦ where this page comes from
- alpine 3.22: libtirpc-doc 1.3.5-r0 Β· BSD-3-Clause
- alpine 3.23: libtirpc-doc 1.3.5-r1 Β· BSD-3-Clause
- alpine 3.24: libtirpc-doc 1.3.5-r1 Β· BSD-3-Clause
- arch rolling: libtirpc 1.3.8-1 Β· SISSL AND BSD-3-Clause
- centos-stream 10: libtirpc-devel 1.3.5-1.el10 Β· SISSL AND BSD-3-Clause
- centos-stream 9: libtirpc-devel 1.3.3-9.el9 Β· SISSL and BSD
- centos-stream 9: libtirpc-devel 1.3.3-9.el9 Β· SISSL and BSD
- debian bookworm: libtirpc-dev 1.3.3+ds-1 Β· BSD-3-Clause
- debian trixie: libtirpc-dev 1.3.6+ds-1 Β· BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-0.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-0.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-1.rc1.fc43 Β· SISSL AND BSD-3-Clause
- fedora 43: libtirpc-devel 1.3.7-1.rc1.fc43 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.7-2.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.7-2.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.8-0.fc44 Β· SISSL AND BSD-3-Clause
- fedora 44: libtirpc-devel 1.3.8-0.fc44 Β· SISSL AND BSD-3-Clause
- nixos 26.05: libtirpc 1.3.7
- nixpkgs unstable: libtirpc 1.3.7
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- opensuse-leap 16.0: libtirpc-devel 1.3.6-160000.2.2 Β· BSD-3-Clause
- ubuntu jammy: libtirpc-dev 1.3.2-2build1 Β· BSD-3-Clause
- ubuntu jammy: libtirpc-dev 1.3.2-2ubuntu0.1 Β· BSD-3-Clause
- ubuntu noble: libtirpc-dev 1.3.4+ds-1.1build1 Β· BSD-3-Clause
- ubuntu questing: libtirpc-dev 1.3.6+ds-1
- ubuntu resolute: libtirpc-dev 1.3.7-0.1 Β· BSD-3-Clause
- ubuntu stonking: libtirpc-dev 1.3.7+ds-1 Β· BSD-3-Clause
- Copyright 1989 AT&T
- Copyright (c) 1988 Sun Microsystems, Inc. - All Rights Reserved
- π girlified by deepseek-ai/DeepSeek-V4.1-Flash on : a language model's rewrite of the original, under its terms