Re: scotty 2.0.0 -> 2.0.1 and Ultrix

Juergen Schoenwaelder (schoenw@ibr.cs.tu-bs.de)
Fri, 20 Oct 1995 13:04:15 +0100

Hi!

khj@beagle.cs.appstate.edu (Kenneth Jacker) said:

Kenneth> As I, too, am interested in running tkined/scotty on a
Kenneth> DECstation 5000 using Ultrix, I thought I'd send along
Kenneth> the pertinent output from the above on our machine.
Kenneth> What follows is from Ultrix ULTRIX V4.3A (Rev 146):

Thanks. Thats exactly what I expected. Ultrix simply does not have the
clnt_create() interface, but it has clnttcp_create() and
clntudp_create(). I changed sunrpc.c to use these instead of
clnt_create(). I hope this will solve the portability problem (and not
create new problems). Below is a diff. It would be nice if someone
could test it on a Ultrix box (and maybe other UNIX boxes).

Juergen> And I guess there will be more machine dependend stuff
Juergen> in the future as dynamic loading looks very attractive
Juergen> now. I could change the installation procedure to put
Juergen> all the machine dependend stuff in a machine dependend
Juergen> subdirectory.

Kenneth> All efforts to keep the entire distribution
Kenneth> architecture-independent will be most appreciated!

Do you mean we should stay away from doing machine dependend things?
Or are you saying that an installation procedure that takes care of
multiple architectures is fine for you?

Juergen

*** sunrpc.c-orig Thu Sep 14 19:35:39 1995
--- sunrpc.c Fri Oct 20 12:33:31 1995
***************
*** 66,73 ****
SunrpcGetHostname _ANSI_ARGS_((Tcl_Interp *interp, char *str));

static int
! SunrpcSocket _ANSI_ARGS_((Tcl_Interp *interp,
! struct sockaddr_in *rsocket, char *host));
static int
SunrpcOpenEtherd _ANSI_ARGS_((Tcl_Interp *interp, char *host));

--- 66,73 ----
SunrpcGetHostname _ANSI_ARGS_((Tcl_Interp *interp, char *str));

static int
! SunrpcGetAddr _ANSI_ARGS_((Tcl_Interp *interp, char *host,
! struct sockaddr_in *addr));
static int
SunrpcOpenEtherd _ANSI_ARGS_((Tcl_Interp *interp, char *host));

***************
*** 163,175 ****
}

/*
! * Initialize sockaddr structure for some RPC calls.
*/

static int
! SunrpcSocket (interp, rsocket, host)
Tcl_Interp *interp;
! struct sockaddr_in *rsocket;
char* host;
{
struct hostent *hp;
--- 163,175 ----
}

/*
! * Initialize the sockaddr structure needed for some RPC calls.
*/

static int
! SunrpcGetAddr (interp, host, addr)
Tcl_Interp *interp;
! struct sockaddr_in *addr;
char* host;
{
struct hostent *hp;
***************
*** 178,192 ****
return TCL_ERROR;
}

! rsocket->sin_family = AF_INET;
! rsocket->sin_port = 0;
! rsocket->sin_addr.s_addr = INADDR_ANY;

if ((hp = gethostbyname (host)) == NULL) {
Tcl_AppendResult (interp, "unknown host name ", host, (char *) NULL);
return TCL_ERROR;
}
! rsocket->sin_addr.s_addr = * (unsigned long *) hp->h_addr;

return TCL_OK;
}
--- 178,192 ----
return TCL_ERROR;
}

! addr->sin_family = AF_INET;
! addr->sin_port = 0;
! addr->sin_addr.s_addr = INADDR_ANY;

if ((hp = gethostbyname (host)) == NULL) {
Tcl_AppendResult (interp, "unknown host name ", host, (char *) NULL);
return TCL_ERROR;
}
! addr->sin_addr.s_addr = * (unsigned long *) hp->h_addr;

return TCL_OK;
}
***************
*** 213,223 ****
--- 213,231 ----
int dummy;
ether_handle *p;
etherstat *res;
+ struct sockaddr_in _addr;
+ struct sockaddr_in *addr = &_addr;
+ struct timeval timeout = {2, 0};
+ int socket = RPC_ANYSOCK;

if ((host = SunrpcGetHostname (interp, host)) == NULL) {
return TCL_ERROR;
}

+ if (SunrpcGetAddr(interp, host, addr) != TCL_OK) {
+ return TCL_ERROR;
+ }
+
for (p = eh_list; p != NULL; p = p->next) {
if (!strcmp (host, p->name)) {
return TCL_OK;
***************
*** 226,236 ****

p = (ether_handle *) ckalloc (sizeof(ether_handle));

! #ifdef HAVE_CLNT_CREATE
! p->clnt = clnt_create (host, ETHERPROG, ETHERVERS, "udp" );
! #else
! p->clnt = NULL;
! #endif
if (p->clnt == NULL) {
Tcl_AppendResult (interp, "can not connect to ", host, (char *) NULL);
return TCL_ERROR;
--- 234,240 ----

p = (ether_handle *) ckalloc (sizeof(ether_handle));

! p->clnt = clntudp_create(addr, ETHERPROG, ETHERVERS, timeout, &socket);
if (p->clnt == NULL) {
Tcl_AppendResult (interp, "can not connect to ", host, (char *) NULL);
return TCL_ERROR;
***************
*** 468,482 ****
Tcl_Interp *interp;
char *host;
{
! struct sockaddr_in _socket;
! struct sockaddr_in *rsocket = &_socket;
struct pmaplist *portmapperlist;

! if (SunrpcSocket(interp, rsocket, host) != TCL_OK) {
return TCL_ERROR;
}

! portmapperlist = pmap_getmaps (rsocket);
while (portmapperlist) {
int prog = portmapperlist->pml_map.pm_prog;
struct rpcent *re = getrpcbynumber(prog);
--- 472,486 ----
Tcl_Interp *interp;
char *host;
{
! struct sockaddr_in _addr;
! struct sockaddr_in *addr = &_addr;
struct pmaplist *portmapperlist;

! if (SunrpcGetAddr(interp, host, addr) != TCL_OK) {
return TCL_ERROR;
}

! portmapperlist = pmap_getmaps(addr);
while (portmapperlist) {
int prog = portmapperlist->pml_map.pm_prog;
struct rpcent *re = getrpcbynumber(prog);
***************
*** 505,516 ****
struct timeval timeout;
enum clnt_stat res;
CLIENT *clnt;

! if ((host = SunrpcGetHostname (interp, host)) == NULL) {
! return TCL_ERROR;
}

! clnt = clnt_create(host, MOUNTPROG, MOUNTVERS, "tcp");
if (! clnt) {
SunrpcCreateError(interp);
return TCL_ERROR;
--- 509,523 ----
struct timeval timeout;
enum clnt_stat res;
CLIENT *clnt;
+ struct sockaddr_in _addr;
+ struct sockaddr_in *addr = &_addr;
+ int socket = RPC_ANYSOCK;

! if (SunrpcGetAddr(interp, host, addr) != TCL_OK) {
! return TCL_ERROR;
}

! clnt = clnttcp_create(addr, MOUNTPROG, MOUNTVERS, &socket, 0, 0);
if (! clnt) {
SunrpcCreateError(interp);
return TCL_ERROR;
***************
*** 551,562 ****
char *grstr;
char buf[512];
int size = 0;

! if ((host = SunrpcGetHostname (interp, host)) == NULL) {
! return TCL_ERROR;
}

! clnt = clnt_create(host, MOUNTPROG, MOUNTVERS, "tcp");
if (! clnt) {
SunrpcCreateError(interp);
return TCL_ERROR;
--- 558,572 ----
char *grstr;
char buf[512];
int size = 0;
+ struct sockaddr_in _addr;
+ struct sockaddr_in *addr = &_addr;
+ int socket = RPC_ANYSOCK;

! if (SunrpcGetAddr(interp, host, addr) != TCL_OK) {
! return TCL_ERROR;
}

! clnt = clnttcp_create(addr, MOUNTPROG, MOUNTVERS, &socket, 0, 0);
if (! clnt) {
SunrpcCreateError(interp);
return TCL_ERROR;
***************
*** 611,620 ****
unsigned long version;
unsigned protocol;
{
! struct sockaddr_in _socket;
! struct sockaddr_in *rsocket = &_socket;
CLIENT *clnt;
! int sock = RPC_ANYSOCK;
struct timeval timeout;
enum clnt_stat res;
u_short port;
--- 621,630 ----
unsigned long version;
unsigned protocol;
{
! struct sockaddr_in _addr;
! struct sockaddr_in *addr = &_addr;
CLIENT *clnt;
! int socket = RPC_ANYSOCK;
struct timeval timeout;
enum clnt_stat res;
u_short port;
***************
*** 625,631 ****

timeout.tv_sec = 5; timeout.tv_usec = 0; /* timeout for this RPC call */

! if (SunrpcSocket (interp, rsocket, host) != TCL_OK) {
return TCL_ERROR;
}

--- 635,641 ----

timeout.tv_sec = 5; timeout.tv_usec = 0; /* timeout for this RPC call */

! if (SunrpcGetAddr(interp, host, addr) != TCL_OK) {
return TCL_ERROR;
}

***************
*** 634,648 ****
return TCL_ERROR;
}

! port = pmap_getport (rsocket, prognum, version, protocol);
! rsocket->sin_port = htons(port);

if (protocol == IPPROTO_TCP) {
! clnt = clnttcp_create (rsocket, prognum, version, &sock, 0, 0);
} else {
struct timeval wait;
wait.tv_sec = 1; wait.tv_usec = 0;
! clnt = clntudp_create (rsocket, prognum, version, wait, &sock);
}
if (clnt == NULL) {
SunrpcCreateError(interp);
--- 644,658 ----
return TCL_ERROR;
}

! port = pmap_getport (addr, prognum, version, protocol);
! addr->sin_port = htons(port);

if (protocol == IPPROTO_TCP) {
! clnt = clnttcp_create (addr, prognum, version, &socket, 0, 0);
} else {
struct timeval wait;
wait.tv_sec = 1; wait.tv_usec = 0;
! clnt = clntudp_create (addr, prognum, version, wait, &socket);
}
if (clnt == NULL) {
SunrpcCreateError(interp);