#941277 dispatch function missing in header file generated for RPC service

Package:
libc-dev-bin
Source:
glibc
Description:
GNU C Library: Development binaries
Submitter:
Simon Richter
Date:
2019-09-28 12:03:05 UTC
Severity:
minor
Tags:
#941277#5
Date:
2019-09-27 16:42:51 UTC
From:
To:
Hi,

while implementing an RPC service (in 2019, no less!) I found out that the
dispatch function generated by rpcgen is not listed in the generated header
file, so if the service is generated without a main function or inetd
interface, the code using it needs to create its own declaration.

The signature is easy to guess, but nonetheless I think it should be
provided by the header.

   Simon

#941277#10
Date:
2019-09-27 20:30:21 UTC
From:
To:
* Simon Richter:

Ugh, can you describe exactly what is missing?  Then I can file it
here (or just submit a patch):

  <https://github.com/thkukuk/rpcsvc-proto>

Thanks.

(I'm not sure if we are going to patch glibc's rpcgen for this; nobody
is supposed to use it these days.)

#941277#15
Date:
2019-09-28 11:52:00 UTC
From:
To:
Hi,

If you compile a service description for the server side, e.g.

    rpcgen -m /usr/include/rpcsvc/mount.x

you get the dispatch function that takes an incoming request and calls
the appropriate server function. For single-service programs, you would
normally generate the main function as well, using

    rpcgen -s tcp /usr/include/rpcsvc/mount.x

This way, the dispatch function is adequately registered. If you need to
provide your own main function (i.e. the RPC service is part of a larger
program), you need to call svc_register yourself, so you need a
declaration of this function, for the mount service that would be

    void mountprog_1(struct svc_req *rqstp, register SVCXPRT *transp);

That function is absent from the header generated using

    rpcgen -h /usr/include/rpcsvc/mount.x

If you generate dispatch tables using -T, the table is declared in the
header, so I'd also expect the dispatch function to be declared.

   Simon