X-Git-Url: https://git.openafs.org/?p=openafs.git;a=blobdiff_plain;f=src%2Fsys%2Frmtsyss.c;h=5cf2f77fa74e8f85fe7249284c4f1b39e6357f80;hp=ac329eb65b5f753deadd823f0d1b1d08f65a3b8f;hb=e6d321fcd4cbf0fdc6b153c0894f8d4c222093ad;hpb=e7ec0d4213853117dc463a3629651e280c6cf0fa diff --git a/src/sys/rmtsyss.c b/src/sys/rmtsyss.c index ac329eb..5cf2f77 100644 --- a/src/sys/rmtsyss.c +++ b/src/sys/rmtsyss.c @@ -12,10 +12,9 @@ * currently fires up this module, when the "-rmtsys" flag is given. * This module resides in the lib/afs/librmtsys.a library. */ -#include #include +#include -RCSID("$Header$"); #include #include @@ -25,16 +24,15 @@ RCSID("$Header$"); #include #include #include +#include #include +#include #include -#ifdef HAVE_STRING_H #include -#endif +#include /*#include */ #include "rmtsys.h" - -extern int errno; /* We ship this over the net if needed */ -extern RMTSYS_ExecuteRequest(); +#include "sys_prototypes.h" #define NFS_EXPORTER 1 /* To probably handle more later */ #define PSETPAG 110 /* Also defined in afs/afs_pioctl.c */ @@ -55,7 +53,9 @@ extern RMTSYS_ExecuteRequest(); /* Main routine of the remote AFS system call server. The calling process will * never return; this is currently called from afsd (when "-rmtsys" is passed * as a parameter) */ -rmtsysd() { +void +rmtsysd(void) +{ /* void catchsig(int); */ struct rx_securityClass *(securityObjects[N_SECURITY_OBJECTS]); struct rx_service *service; @@ -67,30 +67,30 @@ rmtsysd() { signal(SIGHUP, SIG_IGN); /* Initialize the rx-based RMTSYS server */ - if (rx_Init(htons(AFSCONF_RMTSYSPORT)) < 0) + if (rx_Init(htons(AFSCONF_RMTSYSPORT)) < 0) rmt_Quit("rx_init"); securityObjects[0] = rxnull_NewServerSecurityObject(); - if (securityObjects[0] == (struct rx_securityClass *) 0) + if (securityObjects[0] == (struct rx_securityClass *)0) rmt_Quit("rxnull_NewServerSecurityObject"); - service = rx_NewService(0, RMTSYS_SERVICEID, AFSCONF_RMTSYSSERVICE, - securityObjects, N_SECURITY_OBJECTS, - RMTSYS_ExecuteRequest); - if (service == (struct rx_service *) 0) + service = + rx_NewService(0, RMTSYS_SERVICEID, AFSCONF_RMTSYSSERVICE, + securityObjects, N_SECURITY_OBJECTS, + RMTSYS_ExecuteRequest); + if (service == NULL) rmt_Quit("rx_NewService"); /* One may wish to tune some default RX params for better performance * at some point... */ rx_SetMaxProcs(service, 2); - rx_StartServer(1); /* Donate this process to the server process pool */ + rx_StartServer(1); /* Donate this process to the server process pool */ } /* Implements the remote setpag(2) call. Note that unlike the standard call, * here we also get back the new pag value; we need this so that the caller * can add it to its group list via setgroups() */ -int SRMTSYS_SetPag(call, creds, newpag, errornumber) -struct rx_call *call; -clientcred *creds; -afs_int32 *newpag, *errornumber; +afs_int32 +SRMTSYS_SetPag(struct rx_call *call, clientcred *creds, afs_int32 *newpag, + afs_int32 *errornumber) { afs_uint32 blob[PIOCTL_HEADER]; struct ViceIoctl data; @@ -100,28 +100,26 @@ afs_int32 *newpag, *errornumber; SETCLIENTCONTEXT(blob, rx_HostOf(call->conn->peer), creds->uid, creds->group0, creds->group1, PSETPAG, NFS_EXPORTER); data.in = (caddr_t) blob; - data.in_size = sizeof (blob); + data.in_size = sizeof(blob); data.out = (caddr_t) blob; - data.out_size = sizeof (blob); + data.out_size = sizeof(blob); /* force local pioctl call */ error = lpioctl(0, _VICEIOCTL(PSetClientContext), &data, 1); if (error) { - if (errno == PSETPAG) { - *newpag = blob[0]; /* new pag value */ - } else - *errornumber = errno; + if (errno == PSETPAG) { + *newpag = blob[0]; /* new pag value */ + } else + *errornumber = errno; } return 0; } /* Implements the remote pioctl(2) call */ -int SRMTSYS_Pioctl(call, creds, path, cmd, follow, InData, OutData, errornumber) -struct rx_call *call; -clientcred *creds; -afs_int32 cmd, follow, *errornumber; -char *path; -rmtbulk *InData, *OutData; +afs_int32 +SRMTSYS_Pioctl(struct rx_call *call, clientcred *creds, char *path, + afs_int32 cmd, afs_int32 follow, rmtbulk *InData, + rmtbulk *OutData, afs_int32 *errornumber) { register afs_int32 error; struct ViceIoctl data; @@ -129,15 +127,19 @@ rmtbulk *InData, *OutData; afs_uint32 blob[PIOCTL_HEADER]; *errornumber = 0; - SETCLIENTCONTEXT(blob, rx_HostOf(call->conn->peer), creds->uid, + SETCLIENTCONTEXT(blob, rx_HostOf(call->conn->peer), creds->uid, creds->group0, creds->group1, cmd, NFS_EXPORTER); - data.in = (char *)malloc(InData->rmtbulk_len + PIOCTL_HEADER*sizeof(afs_int32)); - if (!data.in) return (-1); /* helpless here */ - if (!strcmp(path, NIL_PATHP)) pathp = (char *)0; /* It meant to be NIL */ - bcopy(blob, data.in, sizeof(blob)); + data.in = + (char *)malloc(InData->rmtbulk_len + + PIOCTL_HEADER * sizeof(afs_int32)); + if (!data.in) + return (-1); /* helpless here */ + if (!strcmp(path, NIL_PATHP)) + pathp = (char *)0; /* It meant to be NIL */ + memcpy(data.in, blob, sizeof(blob)); inparam_conversion(cmd, InData->rmtbulk_val, 1); - bcopy(InData->rmtbulk_val, data.in+sizeof(blob), InData->rmtbulk_len); - data.in_size = InData->rmtbulk_len + PIOCTL_HEADER*sizeof(afs_int32); + memcpy(data.in + sizeof(blob), InData->rmtbulk_val, InData->rmtbulk_len); + data.in_size = InData->rmtbulk_len + PIOCTL_HEADER * sizeof(afs_int32); data.out = OutData->rmtbulk_val; data.out_size = OutData->rmtbulk_len; /* force local pioctl call */ @@ -156,10 +158,13 @@ rmtbulk *InData, *OutData; return (0); } -rmt_Quit(msg, a, b) - char *msg; +void +rmt_Quit(char *msg, ...) { - fprintf(stderr, msg, a, b); + va_list ap; + + va_start(ap, msg); + vfprintf(stderr, msg, ap); + va_end(ap); exit(1); } -