1 .\" @(#)rpcgen.1 1.35 93/06/02 SMI
2 .\" $FreeBSD: src/usr.bin/rpcgen/rpcgen.1,v 1.12.2.4 2002/06/21 15:28:50 charnier Exp $
3 .\" $DragonFly: src/usr.bin/rpcgen/rpcgen.1,v 1.3 2004/03/11 12:28:58 hmp Exp $
4 .\" Copyright 1985-1993 Sun Microsystems, Inc.
10 .Nd an RPC protocol compiler
19 .Fl D Ns Ar name Ns Op Ar =value
22 .Op Fl I Op Fl K Ar seconds
56 utility is a tool that generates C code to implement an
61 is a language similar to C known as
63 Language (Remote Procedure Call Language).
67 utility is normally used as in the first synopsis where
68 it takes an input file and generates three output files.
81 and client-side stubs in
93 utility can also generate sample client and server files
94 that can be customized to suit a particular application.
100 options generate sample client, server and makefile, respectively.
103 option generates all files, including sample files.
108 then the client side sample file is written to
110 the server side sample file to
112 and the sample makefile to
115 The server created can be started both by the port monitors
119 When it is started by a port monitor,
120 it creates servers only for the transport for which
124 The name of the transport must be specified
125 by setting up the environment variable
127 When the server generated by
130 it creates server handles for all the transports
133 environment variable,
135 it creates server handles for all the visible transports from
139 the transports are chosen at run time and not at compile time.
140 When the server is self-started,
141 it backgrounds itself by default.
142 A special define symbol
144 can be used to run the server process in foreground.
146 The second synopsis provides special features which allow
147 for the creation of more sophisticated
150 These features include support for user provided
157 dispatch table contain:
158 .Bl -bullet -offset indent -compact
160 pointers to the service routine corresponding to that procedure,
162 a pointer to the input and output arguments,
164 the size of these routines.
166 A server can use the dispatch table to check authorization
167 and then to execute the service routine;
168 a client library may use it to deal with the details of storage
169 management and XDR data conversion.
171 The other three synopses shown above are used when
172 one does not want to generate all the output files,
173 but only a particular one.
176 section below for examples of
184 it creates servers for that particular class of transports.
189 it creates a server for the transport specified by
195 accepts the standard input.
199 is run on the input file before it is actually interpreted by
201 For each type of output file,
203 defines a special preprocessor symbol for use by the
206 .Bl -tag -width indent
208 defined when compiling into headers
210 defined when compiling into XDR routines
212 defined when compiling into server-side stubs
214 defined when compiling into client-side stubs
216 defined when compiling into RPC dispatch tables
219 Any line beginning with
221 is passed directly into the output file,
224 To specify the path name of the C preprocessor use
228 For every data type referred to in
231 assumes that there exists a
232 routine with the string
234 prepended to the name of the data type.
235 If this routine does not exist in the
237 library, it must be provided.
238 Providing an undefined data type
239 allows customization of
243 The following options are available:
244 .Bl -tag -width indent
246 Generate all files, including sample files.
248 Backward compatibility mode.
249 Generate transport specific
251 code for older versions
252 of the operating system.
256 this compatibility flag is turned on by
259 supports only the older
267 Generate header and stub files which can be used with
269 C compilers. Headers generated with this flag can also be
270 used with C++ programs.
272 .It Fl D Ns Ar name=value
273 .\".It Fl D Ns Ar name Ns Op Ar =value
278 directive in the source.
285 This option may be specified more than once.
287 Compile into C data-definitions (a header).
289 option can be used in conjunction to produce a
290 header which supports
294 Size at which to start generating inline code.
295 This option is useful for optimization.
296 The default size is 5.
298 Note: in order to provide backwards compatibility with the older
302 platform, the default is actually 0 (which means
303 that inline code generation is disabled by default). You must specify
304 a non-zero value explicitly to override this default.
308 in the server side stubs.
309 Such servers can be self-started or can be started by
311 When the server is self-started, it backgrounds itself by default.
312 A special define symbol
314 can be used to run the
315 server process in foreground, or the user may simply compile without
320 If there are no pending client requests, the
322 servers exit after 120 seconds (default).
323 The default can be changed with the
326 All the error messages for
329 are always logged with
333 .\" this option is supported for backward compatibility only.
336 .\" generates servers that can be invoked through portmonitors.
339 By default, services created using
342 port monitors wait 120 seconds
343 after servicing a request before exiting.
344 That interval can be changed using the
347 To create a server that exits immediately upon servicing a request,
350 To create a server that never exits, the appropriate argument is
353 When monitoring for a server,
356 spawn a new process in response to a service request.
357 If it is known that a server will be used with such a monitor, the
358 server should exit immediately on completion.
364 Compile into client-side stubs.
366 When the servers are started in foreground, use
368 to log the server errors instead of printing them on the standard
371 Compile into server-side stubs,
372 but do not generate a
375 This option is useful for doing callback-routines
376 and for users who need to write their own
378 routine to do initialization.
380 Generate multithread-safe stubs for passing arguments and results between
381 rpcgen generated code and user written code.
382 This option is useful
383 for users who want to use threads in their code.
386 functions are not yet MT-safe, which means that rpcgen generated server-side
387 code will not be MT-safe.
389 This option allows procedures to have multiple arguments.
390 It also uses the style of parameter passing that closely resembles C.
391 So, when passing an argument to a remote procedure, you do not have to
392 pass a pointer to the argument, but can pass the argument itself.
393 This behavior is different from the old style of
396 To maintain backward compatibility,
397 this option is not the default.
399 Compile into server-side stubs for the transport
402 There should be an entry for
406 This option may be specified more than once,
407 so as to compile a server that serves multiple transports.
409 Specify the name of the output file.
410 If none is specified,
411 standard output is used
426 Compile into server-side stubs for all the
427 transports belonging to the class
429 The supported classes are
441 for the meanings associated with these classes).
442 This option may be specified more than once.
444 the transports are chosen at run time and not at compile time.
446 Generate sample client code that uses remote procedure calls.
450 which can be used for compiling the application.
452 Generate sample server code that uses remote procedure calls.
458 Generate the code to support
473 are used exclusively to generate a particular type of file,
478 are global and can be used with the other options.
480 Give the name of the directory where
482 will start looking for the C-preprocessor.
485 The following example:
486 .Dl example% rpcgen -T prot.x
488 generates all the five files:
496 The following example sends the C data-definitions (header)
497 to the standard output.
498 .Dl example% rpcgen -h prot.x
500 To send the test version of the
502 server side stubs for
503 all the transport belonging to the class
505 to standard output, use:
506 .Dl example% rpcgen -s datagram_n -DTEST prot.x
508 To create the server side stubs for the transport indicated
513 .Dl example% rpcgen -n tcp -o prot_svc.c prot.x
519 .\" .BR rpc_svc_calls (3)
521 .%T The rpcgen chapter in the NETP manual