RPC_CLNT_CALLS(3)
RPC_CLNT_CALLS(3) π
okay bestie, buckle UP β this is the Library Functions Manual page for all the client-side call routines, and it's literally the whole friend group: rpc_clnt_calls, clnt_call, clnt_freeres, clnt_geterr, clnt_perrno, clnt_perror, clnt_sperrno, clnt_sperror, rpc_broadcast, rpc_broadcast_exp, rpc_call. no cap. π¦
β¨ NAME β¨
rpc_clnt_calls, clnt_call, clnt_freeres, clnt_geterr, clnt_perrno, clnt_perror, clnt_sperrno, clnt_sperror, rpc_broadcast, rpc_broadcast_exp, rpc_call β library routines for client side calls π
πΈ SYNOPSIS πΈ
#include <rpc/rpc.h>
enum clnt_stat
clnt_call(CLIENT *clnt, const rpcproc_t procnum, const xdrproc_t inproc,
const caddr_t in, const xdrproc_t outproc, caddr_t out,
const struct timeval tout);
bool_t
clnt_freeres(CLIENT *clnt, const xdrproc_t outproc, caddr_t out);
void
clnt_geterr(const CLIENT * clnt, struct rpc_err * errp);
void
clnt_perrno(const enum clnt_stat stat);
void
clnt_perror(CLIENT *clnt, const char *s);
char *
clnt_sperrno(const enum clnt_stat stat);
char *
clnt_sperror(CLIENT *clnt, const char * s);
enum clnt_stat
rpc_broadcast(const rpcprog_t prognum, const rpcvers_t versnum,
const rpcproc_t procnum, const xdrproc_t inproc, const caddr_t in,
const xdrproc_t outproc, caddr_t out, const resultproc_t eachresult,
const char *nettype);
enum clnt_stat
rpc_broadcast_exp(const rpcprog_t prognum, const rpcvers_t versnum,
const rpcproc_t procnum, const xdrproc_t xargs, caddr_t argsp,
const xdrproc_t xresults, caddr_t resultsp,
const resultproc_t eachresult, const int inittime,
const int waittime, const char * nettype);
enum clnt_stat
rpc_call(const char *host, const rpcprog_t prognum,
const rpcvers_t versnum, const rpcproc_t procnum,
const xdrproc_t inproc, const char *in, const xdrproc_t outproc,
char *out, const char *nettype);
π DESCRIPTION π
so basically β RPC library routines let your C language program make procedure calls on other machines across the network. iconic behaviour fr fr. here's the lil dance that happens: first the client calls a procedure to send a request to the server πΈ. upon receipt of the request, the server calls a dispatch routine to perform the requested service, and then sends back a reply. it's giving β¨networkingβ¨.
clnt_call(), rpc_call(), and rpc_broadcast() are the main characters here β they handle the client side of the procedure call. the remaining routines deal with error handling in the case of errors π (yes bestie, things go wrong sometimes).
some of these routines take a CLIENT handle as one of the arguments. a CLIENT handle can be created by an RPC creation routine such as clnt_create() (see rpc_clnt_create(3)). slay.
these routines are safe for use in multithreaded applications π₯. CLIENT handles can be shared between threads, however in this implementation requests by different threads are serialized (that is, the first request will receive its results before the second request is sent). so it's a queue, not chaos. periodt. π
π Routines π
see rpc(3) for the definition of the CLIENT data structure. iykyk.
clnt_call()β a function macro that calls the remote procedureprocnumassociated with the client handle,clnt, which is obtained with an RPC client creation routine such asclnt_create()(seerpc_clnt_create(3)). theinprocargument is the XDR function used to encode the procedure's arguments, andoutprocis the XDR function used to decode the procedure's results;inis the address of the procedure's argument(s), andoutis the address of where to place the result(s). thetoutargument is the time allowed for results to be returned, which is overridden by a time-out set explicitly throughclnt_control(), seerpc_clnt_create(3). if the remote call succeeds, the status returned isRPC_SUCCESS, otherwise an appropriate status is returned. πclnt_freeres()β a function macro that frees any data allocated by the RPC/XDR system when it decoded the results of an RPC call. theoutargument is the address of the results, andoutprocis the XDR routine describing the results. this routine returns1if the results were successfully freed, and0otherwise. (cleanup era π§Ήβ¨)clnt_geterr()β a function macro that copies the error structure out of the client handle to the structure at addresserrp. simple. elegant. we love her. πclnt_perrno()β print a message to standard error corresponding to the condition indicated bystat. a newline is appended. normally used after a procedure call fails for a routine for which a client handle is not needed, for instancerpc_call(). πclnt_perror()β print a message to the standard error indicating why an RPC call failed;clntis the handle used to do the call. the message is prepended with stringsand a colon. a newline is appended. normally used after a remote procedure call fails for a routine which requires a client handle, for instanceclnt_call(). πclnt_sperrno()β take the same arguments asclnt_perrno(), but instead of sending a message to the standard error indicating why an RPC call failed, return a pointer to a string which contains the message. theclnt_sperrno()function is normally used instead ofclnt_perrno()when the program does not have a standard error (as a program running as a server quite likely does not), or if the programmer does not want the message to be output withprintf()(seeprintf(3)), or if a message format different than that supported byclnt_perrno()is to be used. note: unlikeclnt_sperror()andclnt_spcreateerror()(seerpc_clnt_create(3)),clnt_sperrno()does not return pointer to static data so the result will not get overwritten on each call. β¨ lowkey the responsible one in the group chat.clnt_sperror()β likeclnt_perror(), except that (likeclnt_sperrno()) it returns a string instead of printing to standard error. however,clnt_sperror()does not append a newline at the end of the message.
β οΈ warning bestie: returns pointer to a buffer that is overwritten on each call. do NOT hold onto it, she will betray you. π
rpc_broadcast()β likerpc_call(), except the call message is broadcast to all the connectionless transports specified bynettype. ifnettypeisNULL, it defaults to"netpath". each time it receives a response, this routine callseachresult(), whose form is:bool_t eachresult(caddr_t out, const struct netbuf * addr, const struct netconfig * netconf)whereoutis the same asoutpassed torpc_broadcast(), except that the remote procedure's output is decoded there;addrpoints to the address of the machine that sent the results, andnetconfis the netconfig structure of the transport on which the remote server responded. ifeachresult()returns0,rpc_broadcast()waits for more replies; otherwise it returns with appropriate status.
β οΈ warning: broadcast file descriptors are limited in size to the maximum transfer size of that transport. for Ethernet, this value is 1500 bytes. π
the rpc_broadcast() function uses AUTH_SYS credentials by default (see rpc_clnt_auth(3)). π
rpc_broadcast_exp()β likerpc_broadcast(), except that the initial timeout,inittimeand the maximum timeout,waittimeare specified in milliseconds. theinittimeargument is the initial time thatrpc_broadcast_exp()waits before resending the request. after the first resend, the re-transmission interval increases exponentially until it exceedswaittime. π it's giving exponential backoff, and honestly? obsessed.rpc_call()β call the remote procedure associated withprognum,versnum, andprocnumon the machine,host. theinprocargument is used to encode the procedure's arguments, andoutprocis used to decode the procedure's results;inis the address of the procedure's argument(s), andoutis the address of where to place the result(s). thenettypeargument can be any of the values listed onrpc(3). this routine returnsRPC_SUCCESSif it succeeds, or an appropriate status is returned. use theclnt_perrno()routine to translate failure status into error messages. π«Ά
β οΈ warning:rpc_call()uses the first available transport belonging to the classnettype, on which it can create a connection. you do not have control of timeouts or authentication using this routine. no cap, she's a little ungovernable. π
π AVAILABILITY π
these functions are part of libtirpc. π
π SEE ALSO π
printf(3), rpc(3), rpc_clnt_auth(3), rpc_clnt_create(3)
and that's the whole page bestie!! π¦ this one came from the Debian crew, dated May 7, 1993 β yeah she's an icon from way back and she's still serving. mwah π go call some remote procedures, you got this. ππβ¨
π¦ 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