[Search for users] [Overall Top Noters] [List of all Conferences] [Download this site]

Conference turris::digital_unix

Title:DIGITAL UNIX(FORMERLY KNOWN AS DEC OSF/1)
Notice:Welcome to the Digital UNIX Conference
Moderator:SMURF::DENHAM
Created:Thu Mar 16 1995
Last Modified:Fri Jun 06 1997
Last Successful Update:Fri Jun 06 1997
Number of topics:10068
Total number of notes:35879

9238.0. "svc_register() fails and rpcinfo question" by HYDRA::BRYANT () Thu Mar 20 1997 10:59

These two issues came in from a partner who is porting their app from Sun to DU
4.0.  Can anyone shed some light on why the failure with svc_register and also
provide an answer to the question on rpcinfo?

Thanks
Pat Bryant
Software Partner Engineering
----------------------------------------------------------------------
Two servers A and B. A creates and registers RPC services successfuly.
B can successfully do an svctcp_create() but svc_register() fails. The
value of errno after calling svc_register is 9 (EBADF). Both A and B
use objects of the same class to handle the RPC registration. Here is
the relevant portion of that code:

>        errno = 0;
>        SVCXPRT *transp = svctcp_create(RPC_ANYSOCK, 0, 0);
>        if (!transp) {
>            DPRINTTIMEC("omurpc", 3, "errno(svctcp_create) = %d", errno);
>            RAISE_RpcServiceCreateFail(Urgent, pv.prognum, pv.versnum);
>        }
>        errno = 0;
>        if (!svc_register(transp, pv.prognum, pv.versnum,
>                &ImRPCManager::handleRPC, IPPROTO_TCP)) {
>            DPRINTTIMEC("omurpc", 3, "errno(svc_register) = %d", errno);
>            RAISE_RpcServiceCreateFail(Urgent, pv.prognum, pv.versnum);
>        }
>

Would you have an idea of why svc_register() fails? I know that the
port mapper does not have an entry for that program number.

Another question is: does using rpcinfo -t suffice as the means to
perform a heartbeat check on RPC services for a particular program?
I'm trying to use that instead of having to put together a small
client program. In other words, doe rpcinfo -t use clnt_create()
and all that good stuff?
T.RTitleUserPersonal
Name
DateLines
9238.1Re: svc_register() fails and rpcinfo questionQUABBI::"[email protected]"Thu Mar 20 1997 19:0352
[email protected] writes:
>Two servers A and B. A creates and registers RPC services successfuly.
>B can successfully do an svctcp_create() but svc_register() fails.

Are the two servers separate machines or separate programs?

 The
>value of errno after calling svc_register is 9 (EBADF).

Errno is set on error returns from system calls.  It's generally
useless or confusing when examined after library calls unless you have
source code handy.

>>        errno = 0;
>>        SVCXPRT *transp = svctcp_create(RPC_ANYSOCK, 0, 0);
>>        if (!transp) {
>>            DPRINTTIMEC("omurpc", 3, "errno(svctcp_create) = %d", errno);
>>            RAISE_RpcServiceCreateFail(Urgent, pv.prognum, pv.versnum);
>>        }
>>        errno = 0;
>>        if (!svc_register(transp, pv.prognum, pv.versnum,
>>                &ImRPCManager::handleRPC, IPPROTO_TCP)) {
>>            DPRINTTIMEC("omurpc", 3, "errno(svc_register) = %d", errno);
>>            RAISE_RpcServiceCreateFail(Urgent, pv.prognum, pv.versnum);
>>        }
>>

>Would you have an idea of why svc_register() fails? I know that the
>port mapper does not have an entry for that program number.

The only two reasons are registering a second version of a RPC program
with a different dispatch routine or if a call to pmap_set fails.

pmap_set fails if it can't create a UDP client handle to portmap (which it
certainly should) or if the PMAPPROC_SET call fails (which will leave
an error message in a syslog file via "syslog(LOG_ERR, clnt_sperror(client,
"Cannot register service"));".  If that's the case, the message in the
syslog file (daemon.log?) will have additional hints.  If the client handle
create failed, the code may not have called clnt_pcreateerror(), so your
customer might try that too.

>Another question is: does using rpcinfo -t suffice as the means to
>perform a heartbeat check on RPC services for a particular program?
>I'm trying to use that instead of having to put together a small
>client program. In other words, doe rpcinfo -t use clnt_create()
>and all that good stuff?

Yes - it will call the NULL procedure of the target service.
-- 
  <>    Eric (Ric) Werme   <>      This space under reconstruction       <>
  <>  <[email protected]>  <>                                            <>
[posted by Notes-News gateway]