1 .\" @(#)rpcgen.1 1.35 93/06/02 SMI
2 .\" $FreeBSD: src/usr.bin/rpcgen/rpcgen.1,v 1.24 2005/09/02 18:37:34 stefanf Exp $
3 .\" $DragonFly: src/usr.bin/rpcgen/rpcgen.1,v 1.4 2008/04/16 07:21:57 swildner Exp $
4 .\" Copyright 1985-1993 Sun Microsystems, Inc.
11 .Nd an RPC protocol compiler
20 .Fl D Ns Ar name Ns Op Ar =value
23 .Op Fl I Fl P Op Fl K Ar seconds
57 utility is a tool that generates C code to implement an
62 is a language similar to C known as
64 Language (Remote Procedure Call Language).
68 utility is normally used as in the first synopsis where
69 it takes an input file and generates three output files.
82 and client-side stubs in
94 utility can also generate sample client and server files
95 that can be customized to suit a particular application.
101 options generate sample client, server and makefile, respectively.
104 option generates all files, including sample files.
109 then the client side sample file is written to
111 the server side sample file to
113 and the sample makefile to
119 the server created can be started both by the port monitors
123 When it is started by a port monitor,
124 it creates servers only for the transport for which
128 The name of the transport may be specified
129 by setting up the environment variable
131 When the server generated by
134 it creates server handles for all the transports
137 environment variable,
139 it creates server handles for all the visible transports from
143 the transports are chosen at run time and not at compile time.
144 When the server is self-started,
145 it backgrounds itself by default.
146 A special define symbol
148 can be used to run the server process in foreground.
150 The second synopsis provides special features which allow
151 for the creation of more sophisticated
154 These features include support for user provided
161 dispatch table contain:
162 .Bl -bullet -offset indent -compact
164 pointers to the service routine corresponding to that procedure,
166 a pointer to the input and output arguments,
168 the size of these routines.
170 A server can use the dispatch table to check authorization
171 and then to execute the service routine;
172 a client library may use it to deal with the details of storage
173 management and XDR data conversion.
175 The other three synopses shown above are used when
176 one does not want to generate all the output files,
177 but only a particular one.
180 section below for examples of
188 it creates servers for that particular class of transports.
193 it creates a server for the transport specified by
199 accepts the standard input.
203 is run on the input file before it is actually interpreted by
205 For each type of output file,
207 defines a special preprocessor symbol for use by the
210 .Bl -tag -width indent
212 defined when compiling into headers
214 defined when compiling into XDR routines
216 defined when compiling into server-side stubs
218 defined when compiling into client-side stubs
220 defined when compiling into RPC dispatch tables
223 Any line beginning with
225 is passed directly into the output file,
228 To specify the path name of the C preprocessor use
232 For every data type referred to in
235 assumes that there exists a
236 routine with the string
238 prepended to the name of the data type.
239 If this routine does not exist in the
241 library, it must be provided.
242 Providing an undefined data type
243 allows customization of
247 The following options are available:
248 .Bl -tag -width indent
250 Generate all files, including sample files.
252 Backward compatibility mode.
253 Generate transport specific
255 code for older versions
256 of the operating system.
262 Generate ANSI C code.
263 This is always done, the flag is only provided for backwards compatibility.
265 .It Fl D Ns Ar name=value
266 .\".It Fl D Ns Ar name Ns Op Ar =value
271 directive in the source.
278 This option may be specified more than once.
280 Compile into C data-definitions (a header).
282 option can be used in conjunction to produce a
283 header which supports
287 Size at which to start generating inline code.
288 This option is useful for optimization.
289 The default size is 5.
291 Note: in order to provide backwards compatibility with the older
295 platform, the default is actually 0 (which means
296 that inline code generation is disabled by default).
298 a non-zero value explicitly to override this default.
302 in the server side stubs.
303 Such servers can be self-started or can be started by
305 When the server is self-started, it backgrounds itself by default.
306 A special define symbol
308 can be used to run the
309 server process in foreground, or the user may simply compile without
314 If there are no pending client requests, the
316 servers exit after 120 seconds (default).
317 The default can be changed with the
320 All the error messages for
323 are always logged with
327 Contrary to some systems, in
329 this option is needed to generate
330 servers that can be invoked through portmonitors and
334 By default, services created using
337 port monitors wait 120 seconds
338 after servicing a request before exiting.
339 That interval can be changed using the
342 To create a server that exits immediately upon servicing a request,
345 To create a server that never exits, the appropriate argument is
348 When monitoring for a server,
351 spawn a new process in response to a service request.
352 If it is known that a server will be used with such a monitor, the
353 server should exit immediately on completion.
359 Compile into client-side stubs.
361 When the servers are started in foreground, use
363 to log the server errors instead of printing them on the standard
366 Compile into server-side stubs,
367 but do not generate a
370 This option is useful for doing callback-routines
371 and for users who need to write their own
373 routine to do initialization.
375 Generate multithread-safe stubs for passing arguments and results between
376 rpcgen generated code and user written code.
377 This option is useful
378 for users who want to use threads in their code.
381 functions are not yet MT-safe, which means that rpcgen generated server-side
382 code will not be MT-safe.
384 Allow procedures to have multiple arguments.
385 It also uses the style of parameter passing that closely resembles C.
386 So, when passing an argument to a remote procedure, you do not have to
387 pass a pointer to the argument, but can pass the argument itself.
388 This behavior is different from the old style of
391 To maintain backward compatibility,
392 this option is not the default.
394 Compile into server-side stubs for the transport
397 There should be an entry for
401 This option may be specified more than once,
402 so as to compile a server that serves multiple transports.
404 Specify the name of the output file.
405 If none is specified,
406 standard output is used
422 in the server side stubs.
425 Contrary to some systems, in
427 this option is needed to generate
428 servers that can be monitored.
432 option has been specified,
434 is turned off automatically.
436 Compile into server-side stubs for all the
437 transports belonging to the class
439 The supported classes are
451 for the meanings associated with these classes).
452 This option may be specified more than once.
454 the transports are chosen at run time and not at compile time.
456 Generate sample client code that uses remote procedure calls.
460 which can be used for compiling the application.
462 Generate sample server code that uses remote procedure calls.
468 Generate the code to support
483 are used exclusively to generate a particular type of file,
488 are global and can be used with the other options.
490 Give the name of the directory where
492 will start looking for the C-preprocessor.
495 The following example:
496 .Dl example% rpcgen -T prot.x
498 generates all the five files:
506 The following example sends the C data-definitions (header)
507 to the standard output.
508 .Dl example% rpcgen -h prot.x
510 To send the test version of the
512 server side stubs for
513 all the transport belonging to the class
515 to standard output, use:
516 .Dl example% rpcgen -s datagram_n -DTEST prot.x
518 To create the server side stubs for the transport indicated
523 .Dl example% rpcgen -n tcp -o prot_svc.c prot.x
527 .Xr rpc_svc_calls 3 ,
532 .%T The rpcgen chapter in the NETP manual