#include <afs/param.h>
#include <roken.h>
-#ifdef IGNORE_SOME_GCC_WARNINGS
-# pragma GCC diagnostic warning "-Wdeprecated-declarations"
-#endif
-
#define VFS 1
#include <afs/stds.h>
/*
* Global configuration variables.
*/
-static afs_int32 enable_rxbind = 0;
-static afs_int32 afs_shutdown = 0;
-static afs_int32 cacheBlocks; /*Num blocks in the cache */
-static afs_int32 cacheFiles; /*Optimal # of files in workstation cache */
-static afs_int32 rwpct = 0;
-static afs_int32 ropct = 0;
-static afs_int32 cacheStatEntries; /*Number of stat cache entries */
-static char *cacheBaseDir; /*Where the workstation AFS cache lives */
-static char *confDir; /*Where the workstation AFS configuration lives */
+static int enable_rxbind = 0;
+static int afs_shutdown = 0;
+static int cacheBlocks; /*Num blocks in the cache */
+static int cacheFiles; /*Optimal # of files in workstation cache */
+static int rwpct = 0;
+static int ropct = 0;
+static int cacheStatEntries; /*Number of stat cache entries */
+static char *cacheBaseDir; /*Where the workstation AFS cache lives */
+static char *confDir; /*Where the workstation AFS configuration lives */
static char fullpn_DCacheFile[1024]; /*Full pathname of DCACHEFILE */
static char fullpn_VolInfoFile[1024]; /*Full pathname of VOLINFOFILE */
static char fullpn_CellInfoFile[1024]; /*Full pathanem of CELLINFOFILE */
int PartSizeOverflow(char *path, int cs);
+static int afsd_syscall(int code, ...);
+
#if defined(AFS_SUN510_ENV) && defined(RXK_LISTENER_ENV)
-static void fork_rx_syscall_wait();
+static void fork_rx_syscall_wait(const char *rn, int syscall, ...);
#endif
-static void fork_rx_syscall();
-static void fork_syscall();
+static void fork_rx_syscall(const char *rn, int syscall, ...);
+static void fork_syscall(const char *rn, int syscall, ...);
enum optionsList {
OPT_blocks,
afs_uint32 addrbuf[MAXIPADDRS], maskbuf[MAXIPADDRS],
mtubuf[MAXIPADDRS];
char reason[1024];
- afs_int32 code;
+ int code;
code =
parseNetFiles(addrbuf, maskbuf, mtubuf, MAXIPADDRS, reason,
if (code > 0) {
/* Note we're refreshing */
code = code | 0x40000000;
- afsd_call_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
+ afsd_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
} else
printf("ADVISEADDR: Error in specifying interface addresses:%s\n",
reason);
static char rn[] = "ParseCacheInfoFile"; /*This routine's name */
FILE *cachefd; /*Descriptor for cache info file */
int parseResult; /*Result of our fscanf() */
- afs_int32 tCacheBlocks;
+ int tCacheBlocks;
char tCacheBaseDir[1024], *tbd, tCacheMountDir[1024], *tmd;
if (afsd_debug)
{
int isHomeCell;
int i, code;
- afs_int32 cellFlags = 0;
+ int cellFlags = 0;
afs_int32 hosts[MAXHOSTSPERCELL];
/* figure out if this is the home cell */
* for upwards compatibility */
/* configure one cell */
- code = afsd_call_syscall(AFSOP_ADDCELL2, hosts, /* server addresses */
+ code = afsd_syscall(AFSOP_ADDCELL2, hosts, /* server addresses */
aci->name, /* cell name */
cellFlags, /* is this the home cell? */
aci->linkedCell); /* Linked cell, if any */
void *arock, struct afsconf_dir *adir)
{
/* push the alias into the kernel */
- afsd_call_syscall(AFSOP_ADDCELLALIAS, aca->aliasName, aca->realName);
+ afsd_syscall(AFSOP_ADDCELLALIAS, aca->aliasName, aca->realName);
return 0;
}
/* On some platforms you only get 4 args to an AFS call */
int sizeArg = ((sizeof acellName) << 16) | (sizeof kernelMsg);
code =
- afsd_call_syscall(AFSOP_AFSDB_HANDLER, acellName, kernelMsg, sizeArg);
+ afsd_syscall(AFSOP_AFSDB_HANDLER, acellName, kernelMsg, sizeArg);
if (code) { /* Something is wrong? */
sleep(1);
continue;
/* pushing in a buffer this large */
uspc->bufSz = 256;
- code = afsd_call_syscall(AFSOP_BKG_HANDLER, uspc, srcName, dstName);
+ code = afsd_syscall(AFSOP_BKG_HANDLER, uspc, srcName, dstName);
if (code) { /* Something is wrong? */
if (code == -2) /* shutting down */
break;
exit(1);
}
BkgHandler();
-#elif defined(AFS_AIX32_ENV)
- afsd_call_syscall(AFSOP_START_BKG, 0);
#else
- afsd_call_syscall(AFSOP_START_BKG);
+ afsd_syscall(AFSOP_START_BKG, 0);
#endif
return NULL;
}
* Cold shutdown is the default
*/
printf("afsd: Shutting down all afs processes and afs state\n");
- code = afsd_call_syscall(AFSOP_SHUTDOWN, 1);
+ code = afsd_syscall(AFSOP_SHUTDOWN, 1);
if (code) {
printf("afsd: AFS still mounted; Not shutting down\n");
exit(1);
int rxpck;
cmd_OptionAsInt(as, OPT_rxpck, &rxpck);
printf("afsd: set rxpck = %d\n", rxpck);
- code = afsd_call_syscall(AFSOP_SET_RXPCK, rxpck);
+ code = afsd_syscall(AFSOP_SET_RXPCK, rxpck);
if (code) {
printf("afsd: failed to set rxpck\n");
exit(1);
struct afsconf_dir *cdir; /* config dir */
int lookupResult; /*Result of GetLocalCellName() */
int i;
- afs_int32 code; /*Result of fork() */
+ int code; /*Result of fork() */
char *fsTypeMsg = NULL;
int cacheIteration; /*How many times through cache verification */
int vFilesFound; /*How many data cache files were found in sweep */
/*
* Set the primary cell name.
*/
- afsd_call_syscall(AFSOP_SET_THISCELL, LclCellName);
+ afsd_syscall(AFSOP_SET_THISCELL, LclCellName);
/* Initialize RX daemons and services */
if (code > 0) {
if (enable_rxbind)
code = code | 0x80000000;
- afsd_call_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
+ afsd_syscall(AFSOP_ADVISEADDR, code, addrbuf, maskbuf, mtubuf);
} else
printf("ADVISEADDR: Error in specifying interface addresses:%s\n",
reason);
fork_rx_syscall(rn, AFSOP_START_RXCALLBACK, preallocs, enable_peer_stats,
enable_process_stats);
#else
- fork_syscall(rn, AFSOP_START_RXCALLBACK, preallocs);
+ fork_syscall(rn, AFSOP_START_RXCALLBACK, preallocs, 0, 0);
#endif
#if defined(AFS_SUN5_ENV) || defined(RXK_LISTENER_ENV) || defined(RXK_UPCALL_ENV)
if (afsd_verbose)
printf("%s: Forking AFSDB lookup handler.\n", rn);
afsd_fork(0, afsdb_thread, NULL);
}
- code = afsd_call_syscall(AFSOP_BASIC_INIT, 1);
+ code = afsd_syscall(AFSOP_BASIC_INIT, 1);
if (code) {
printf("%s: Error %d in basic initialization.\n", rn, code);
exit(1);
cparams.setTimeFlag = 0;
cparams.memCacheFlag = cacheFlags;
cparams.dynamic_vcaches = afsd_dynamic_vcaches;
- afsd_call_syscall(AFSOP_CACHEINIT, &cparams);
+ afsd_syscall(AFSOP_CACHEINIT, &cparams);
/* do it before we init the cache inodes */
if (enable_splitcache) {
- afsd_call_syscall(AFSOP_BUCKETPCT, 1, rwpct);
- afsd_call_syscall(AFSOP_BUCKETPCT, 2, ropct);
+ afsd_syscall(AFSOP_BUCKETPCT, 1, rwpct);
+ afsd_syscall(AFSOP_BUCKETPCT, 2, ropct);
}
if (afsd_CloseSynch)
- afsd_call_syscall(AFSOP_CLOSEWAIT);
+ afsd_syscall(AFSOP_CLOSEWAIT);
/*
* Sweep the workstation AFS cache directory, remembering the inodes of
fullpn_DCacheFile);
/* once again, meaningless for a memory-based cache. */
if (!(cacheFlags & AFSCALL_INIT_MEMCACHE))
- afsd_call_syscall(AFSOP_CACHEINFO, fullpn_DCacheFile);
+ afsd_syscall(AFSOP_CACHEINFO, fullpn_DCacheFile);
/*
* Pass the kernel the name of the workstation cache file holding the
if (afsd_debug)
printf("%s: Calling AFSOP_CELLINFO: cell info file is '%s'\n", rn,
fullpn_CellInfoFile);
- afsd_call_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
+ afsd_syscall(AFSOP_CELLINFO, fullpn_CellInfoFile);
}
if (rxmaxfrags) {
if (afsd_verbose)
printf("%s: Setting rxmaxfrags in kernel = %d\n", rn, rxmaxfrags);
- code = afsd_call_syscall(AFSOP_SET_RXMAXFRAGS, rxmaxfrags);
+ code = afsd_syscall(AFSOP_SET_RXMAXFRAGS, rxmaxfrags);
if (code)
printf("%s: Error seting rxmaxfrags\n", rn);
}
if (rxmaxmtu) {
if (afsd_verbose)
printf("%s: Setting rxmaxmtu in kernel = %d\n", rn, rxmaxmtu);
- code = afsd_call_syscall(AFSOP_SET_RXMAXMTU, rxmaxmtu);
+ code = afsd_syscall(AFSOP_SET_RXMAXMTU, rxmaxmtu);
if (code)
printf("%s: Error seting rxmaxmtu\n", rn);
}
if (afsd_verbose)
printf("%s: Enabling dynroot support in kernel%s.\n", rn,
(enable_dynroot==2)?", not showing cells.":"");
- code = afsd_call_syscall(AFSOP_SET_DYNROOT, 1);
+ code = afsd_syscall(AFSOP_SET_DYNROOT, 1);
if (code)
printf("%s: Error enabling dynroot support.\n", rn);
}
printf("%s: Enabling fakestat support in kernel%s.\n", rn,
(enable_fakestat==1)?" for all mountpoints."
:" for crosscell mountpoints");
- code = afsd_call_syscall(AFSOP_SET_FAKESTAT, enable_fakestat);
+ code = afsd_syscall(AFSOP_SET_FAKESTAT, enable_fakestat);
if (code)
printf("%s: Error enabling fakestat support.\n", rn);
}
if (enable_backuptree) {
if (afsd_verbose)
printf("%s: Enabling backup tree support in kernel.\n", rn);
- code = afsd_call_syscall(AFSOP_SET_BACKUPTREE, enable_backuptree);
+ code = afsd_syscall(AFSOP_SET_BACKUPTREE, enable_backuptree);
if (code)
printf("%s: Error enabling backup tree support.\n", rn);
}
if (afsd_verbose)
printf("%s: Calling AFSOP_ROOTVOLUME with '%s'\n", rn,
rootVolume);
- afsd_call_syscall(AFSOP_ROOTVOLUME, rootVolume);
+ afsd_syscall(AFSOP_ROOTVOLUME, rootVolume);
}
/*
fullpn_VolInfoFile);
/* once again, meaningless for a memory-based cache. */
if (!(cacheFlags & AFSCALL_INIT_MEMCACHE))
- afsd_call_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile);
+ afsd_syscall(AFSOP_VOLUMEINFO, fullpn_VolInfoFile);
/*
* Give the kernel the names of the AFS files cached on the workstation's
for (currVFile = 0; currVFile < cacheFiles; currVFile++) {
if (!nocachefile) {
sprintf(fullpn_VFile, "%s/D%d/V%d", cacheBaseDir, dir_for_V[currVFile], currVFile);
- code = afsd_call_syscall(AFSOP_CACHEFILE, fullpn_VFile);
+ code = afsd_syscall(AFSOP_CACHEFILE, fullpn_VFile);
if (code) {
if (currVFile == 0) {
if (afsd_debug)
}
/* fall through to setup-by-inode */
}
-#ifdef AFS_SGI62_ENV
- afsd_call_syscall(AFSOP_CACHEINODE,
- (afs_uint32) (inode_for_V[currVFile] >> 32),
- (afs_uint32) (inode_for_V[currVFile] & 0xffffffff));
-#elif !(defined(AFS_LINUX26_ENV) || defined(AFS_CACHE_VNODE_PATH))
- afsd_call_syscall(AFSOP_CACHEINODE, inode_for_V[currVFile]);
+#if defined(AFS_SGI62_ENV) || !(defined(AFS_LINUX26_ENV) || defined(AFS_CACHE_VNODE_PATH))
+ afsd_syscall(AFSOP_CACHEINODE, inode_for_V[currVFile]);
#else
printf
("%s: Error calling AFSOP_CACHEINODE: not configured\n",
if (afsd_debug)
printf("%s: Calling AFSOP_GO with cacheSetTime = %d\n", rn,
0);
- afsd_call_syscall(AFSOP_GO, 0);
+ afsd_syscall(AFSOP_GO, 0);
/*
* At this point, we have finished passing the kernel all the info
return cmd_Dispatch(argc, argv);
}
-struct afsd_syscall_args {
- long syscall;
- long param1;
- long param2;
- long param3;
- long param4;
- long param5;
- const char *rn;
- int rxpri;
-};
-
/**
* entry point for calling a syscall from another proc/thread.
*
afsd_set_rx_rtpri();
}
- code = afsd_call_syscall(args->syscall, args->param1, args->param2,
- args->param3, args->param4, args->param5);
+ code = afsd_call_syscall(args);
if (code && args->syscall == AFSOP_START_CS) {
printf("%s: No check server daemon in client.\n", args->rn);
}
return NULL;
}
+static void
+afsd_syscall_populate(struct afsd_syscall_args *args, int syscall, va_list ap)
+{
+ afsd_syscall_param_t *params;
+
+ memset(args, 0, sizeof(struct afsd_syscall_args));
+
+ args->syscall = syscall;
+ params = args->params;
+
+ switch (syscall) {
+ case AFSOP_RXEVENT_DAEMON:
+ break;
+ case AFSOP_START_BKG:
+ case AFSOP_SHUTDOWN:
+ case AFSOP_SET_RXPCK:
+ case AFSOP_BASIC_INIT:
+ case AFSOP_SET_RXMAXFRAGS:
+ case AFSOP_SET_RXMAXMTU:
+ case AFSOP_SET_DYNROOT:
+ case AFSOP_SET_FAKESTAT:
+ case AFSOP_SET_BACKUPTREE:
+ case AFSOP_GO:
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, int)));
+ break;
+ case AFSOP_SET_THISCELL:
+ case AFSOP_ROOTVOLUME:
+ case AFSOP_VOLUMEINFO:
+ case AFSOP_CACHEFILE:
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ break;
+ case AFSOP_ADDCELLALIAS:
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[1] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ break;
+ case AFSOP_AFSDB_HANDLER:
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[1] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[2] = CAST_SYSCALL_PARAM((va_arg(ap, int)));
+ break;
+ case AFSOP_BKG_HANDLER:
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[1] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[2] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ break;
+ case AFSOP_RXLISTENER_DAEMON:
+ case AFSOP_START_RXCALLBACK:
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, int)));
+ params[1] = CAST_SYSCALL_PARAM((va_arg(ap, int)));
+ params[2] = CAST_SYSCALL_PARAM((va_arg(ap, int)));
+ break;
+ case AFSOP_ADVISEADDR:
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, int)));
+ params[1] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[2] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[3] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ break;
+ case AFSOP_ADDCELL2:
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[1] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ params[2] = CAST_SYSCALL_PARAM((va_arg(ap, afs_int32)));
+ params[3] = CAST_SYSCALL_PARAM((va_arg(ap, void *)));
+ break;
+ case AFSOP_CACHEINODE:
+#if defined AFS_SGI62_ENV
+ {
+ afs_int64 tmp = va_arg(ap, afs_int64);
+ params[0] = CAST_SYSCALL_PARAM((afs_uint32)(tmp >> 32));
+ params[1] = CAST_SYSCALL_PARAM((afs_uint32)(tmp & 0xffffffff));
+ }
+#else
+ params[0] = CAST_SYSCALL_PARAM((va_arg(ap, afs_uint32)));
+#endif
+ break;
+ default:
+ printf("Unknown syscall enountered: %d\n", syscall);
+ opr_Assert(0);
+ }
+}
+
/**
* common code for calling a syscall in another proc/thread.
*
* @param[in] syscall syscall to run
*/
static void
-fork_syscall_impl(int rx, int wait, const char *rn, long syscall, long param1,
- long param2, long param3, long param4, long param5)
+fork_syscall_impl(int rx, int wait, const char *rn, int syscall, va_list ap)
{
struct afsd_syscall_args *args;
args = malloc(sizeof(*args));
-
- args->syscall = syscall;
- args->param1 = param1;
- args->param2 = param2;
- args->param3 = param3;
- args->param4 = param4;
- args->param5 = param5;
+ afsd_syscall_populate(args, syscall, ap);
args->rxpri = rx;
args->rn = rn;
* call a syscall in another process or thread.
*/
static void
-fork_syscall(const char *rn, long syscall, long param1, long param2,
- long param3, long param4, long param5)
+fork_syscall(const char *rn, int syscall, ...)
{
- fork_syscall_impl(0, 0, rn, syscall, param1, param2, param3, param4, param5);
+ va_list ap;
+
+ va_start(ap, syscall);
+ fork_syscall_impl(0, 0, rn, syscall, ap);
+ va_end(ap);
}
/**
* call a syscall in another process or thread, and give it RX priority.
*/
static void
-fork_rx_syscall(const char *rn, long syscall, long param1, long param2,
- long param3, long param4, long param5)
+fork_rx_syscall(const char *rn, int syscall, ...)
{
- fork_syscall_impl(1, 0, rn, syscall, param1, param2, param3, param4, param5);
+ va_list ap;
+
+ va_start(ap, syscall);
+ fork_syscall_impl(1, 0, rn, syscall, ap);
+ va_end(ap);
}
#if defined(AFS_SUN510_ENV) && defined(RXK_LISTENER_ENV)
* for it to finish before returning.
*/
static void
-fork_rx_syscall_wait(const char *rn, long syscall, long param1, long param2,
- long param3, long param4, long param5)
+fork_rx_syscall_wait(const char *rn, int syscall, ...)
{
- fork_syscall_impl(1, 1, rn, syscall, param1, param2, param3, param4, param5);
+ va_list ap;
+
+ va_start(ap, syscall);
+ fork_syscall_impl(1, 1, rn, syscall, ap);
+ va_end(ap);
}
#endif /* AFS_SUN510_ENV && RXK_LISTENER_ENV */
+
+static int
+afsd_syscall(int syscall, ...)
+{
+ va_list ap;
+ struct afsd_syscall_args args;
+
+ va_start(ap, syscall);
+ afsd_syscall_populate(&args, syscall, ap);
+ va_end(ap);
+
+ return afsd_call_syscall(&args);
+}
#include <roken.h>
+#ifdef IGNORE_SOME_GCC_WARNINGS
+# pragma GCC diagnostic warning "-Wdeprecated-declarations"
+#endif
+
#define VFS 1
#include <afs/cmd.h>
SET_AFSD_RTPRI();
}
-#if !defined(AFS_SGI_ENV) && !defined(AFS_AIX32_ENV)
-
+#if defined(AFS_LINUX20_ENV)
int
-afsd_call_syscall(long param1, long param2, long param3, long param4, long param5,
- long param6, long param7)
+os_syscall(struct afsd_syscall_args *args)
{
int error;
-# ifdef AFS_LINUX20_ENV
- long eparm[4];
struct afsprocdata syscall_data;
+
int fd = open(PROC_SYSCALL_FNAME, O_RDWR);
if (fd < 0)
fd = open(PROC_SYSCALL_ARLA_FNAME, O_RDWR);
- eparm[0] = param4;
- eparm[1] = param5;
- eparm[2] = param6;
- eparm[3] = param7;
- param4 = (long)eparm;
+ if (fd < 0)
+ return -1;
syscall_data.syscall = AFSCALL_CALL;
- syscall_data.param1 = param1;
- syscall_data.param2 = param2;
- syscall_data.param3 = param3;
- syscall_data.param4 = param4;
- if (fd > 0) {
- error = ioctl(fd, VIOC_SYSCALL, &syscall_data);
- close(fd);
- } else
-# endif /* AFS_LINUX20_ENV */
-# ifdef AFS_DARWIN80_ENV
- struct afssysargs syscall_data;
- void *ioctldata;
- int fd = open(SYSCALL_DEV_FNAME,O_RDWR);
- int syscallnum;
-#ifdef AFS_DARWIN100_ENV
- int is64 = 0;
- struct afssysargs64 syscall64_data;
- if (sizeof(param1) == 8) {
- syscallnum = VIOC_SYSCALL64;
- is64 = 1;
- ioctldata = &syscall64_data;
- syscall64_data.syscall = (int)AFSCALL_CALL;
- syscall64_data.param1 = param1;
- syscall64_data.param2 = param2;
- syscall64_data.param3 = param3;
- syscall64_data.param4 = param4;
- syscall64_data.param5 = param5;
- syscall64_data.param6 = param6;
- } else {
-#endif
- syscallnum = VIOC_SYSCALL;
- ioctldata = &syscall_data;
- syscall_data.syscall = AFSCALL_CALL;
- syscall_data.param1 = param1;
- syscall_data.param2 = param2;
- syscall_data.param3 = param3;
- syscall_data.param4 = param4;
- syscall_data.param5 = param5;
- syscall_data.param6 = param6;
-#ifdef AFS_DARWIN100_ENV
- }
-#endif
- if(fd >= 0) {
- error = ioctl(fd, syscallnum, ioctldata);
- close(fd);
- } else {
- error = -1;
- }
- if (!error) {
-#ifdef AFS_DARWIN100_ENV
- if (is64)
- error=syscall64_data.retval;
- else
-#endif
- error=syscall_data.retval;
- }
-# elif defined(AFS_SUN511_ENV)
- {
- int rval;
- rval = ioctl_sun_afs_syscall(AFSCALL_CALL, param1, param2, param3,
- param4, param5, param6, &error);
- if (rval) {
- error = rval;
- }
- }
-# else /* AFS_DARWIN80_ENV */
- error =
- syscall(AFS_SYSCALL, AFSCALL_CALL, param1, param2, param3, param4,
- param5, param6, param7);
-# endif /* !AFS_DARWIN80_ENV */
+ syscall_data.param1 = args->syscall;
+ syscall_data.param2 = args->params[0];
+ syscall_data.param3 = args->params[1];
+ syscall_data.param4 = (long) &args->params[2];
- if (afsd_debug) {
-#ifdef AFS_NBSD40_ENV
- char *s = strerror(errno);
- printf("SScall(%d, %d, %d)=%d (%d, %s)\n", AFS_SYSCALL, AFSCALL_CALL,
- param1, error, errno, s);
-#else
- printf("SScall(%d, %d, %ld)=%d ", AFS_SYSCALL, AFSCALL_CALL, param1,
- error);
-#endif
- }
+ error = ioctl(fd, VIOC_SYSCALL, &syscall_data);
+ close(fd);
- return (error);
+ return error;
}
-#else /* !AFS_SGI_ENV && !AFS_AIX32_ENV */
-# if defined(AFS_SGI_ENV)
-int
-afsd_call_syscall(call, parm0, parm1, parm2, parm3, parm4)
+#elif defined(AFS_DARWIN80_ENV)
+
+# if defined(AFS_DARWIN100_ENV)
+static int
+os_syscall64(struct afsd_syscall_args *args)
{
+ int error;
+ struct afssysargs64 syscall64_data;
+ int fd = open(SYSCALL_DEV_FNAME, O_RDWR);
+ if (fd < 0)
+ return -1;
+
+ syscall64_data.syscall = (int)AFSCALL_CALL;
+ syscall64_data.param1 = args->syscall;
+ syscall64_data.param2 = args->params[0];
+ syscall64_data.param3 = args->params[1];
+ syscall64_data.param4 = args->params[2];
+ syscall64_data.param5 = args->params[3];
+ syscall64_data.param6 = args->params[4];
+
+ error = ioctl(fd, VIOC_SYSCALL64, syscall64_data);
+ close(fd);
+
+ if (error)
+ return error;
+
+ return syscall64_data.retval;
+}
+# endif
+
+static int
+os_syscall(struct afsd_syscall_args *args)
+{
int error;
+ struct afssysargs syscall_data;
+ int fd;
- error = afs_syscall(call, parm0, parm1, parm2, parm3, parm4);
- if (afsd_verbose)
- printf("SScall(%d, %d)=%d ", call, parm0, error);
+# ifdef AFS_DARWIN100_ENV
+ if (sizeof(long) == 8)
+ return os_syscall64(args);
+# endif
- return error;
+ fd = open(SYSCALL_DEV_FNAME, O_RDWR);
+ if (fd < 0)
+ return -1;
+
+ syscall_data.syscall = AFSCALL_CALL;
+ syscall_data.param1 = (unsigned int)(uintptr_t)args->syscall;
+ syscall_data.param2 = (unsigned int)(uintptr_t)args->params[0];
+ syscall_data.param3 = (unsigned int)(uintptr_t)args->params[1];
+ syscall_data.param4 = (unsigned int)(uintptr_t)args->params[2];
+ syscall_data.param5 = (unsigned int)(uintptr_t)args->params[3];
+ syscall_data.param6 = (unsigned int)(uintptr_t)args->params[4];
+
+ error = ioctl(fd, VIOC_SYSCALL, syscall_data);
+ close(fd);
+
+ if (error)
+ return error;
+
+ return syscall_data.retval;
}
-# else /* AFS_SGI_ENV */
-int
-afsd_call_syscall(call, parm0, parm1, parm2, parm3, parm4, parm5, parm6)
+
+#elif defined(AFS_SUN511_ENV)
+static int
+os_syscall(struct afsd_syscall_args *args)
{
+ int retval;
+
+ error = ioctl_sun_afs_syscall(AFSCALL_CALL, args->syscall,
+ args->params[0], args->params[1],
+ args->params[2], args->params[3],
+ args->params[4], &retval);
+ if (error)
+ return error;
- return syscall(AFSCALL_CALL, call, parm0, parm1, parm2, parm3, parm4,
- parm5, parm6);
+ return retval;
}
-# endif /* !AFS_SGI_ENV */
-#endif /* AFS_SGI_ENV || AFS_AIX32_ENV */
+#elif defined(AFS_SGI_ENV)
+static int
+os_syscall(struct afsd_syscall_args *args)
+{
+ return afs_syscall(args->syscall, args->params[0], args->params[1],
+ args->params[2], args->params[3], args->params[4]);
+}
+#elif defined(AFS_AIX32_ENV)
+static int
+os_syscall(struct afsd_syscall_args *args)
+{
+ return syscall(AFSCALL_CALL, args->syscall,
+ args->params[0], args->params[1], args->params[2],
+ args->params[3], args->params[4], args->params[5],
+ args->params[6]);
+}
+#else
+static int
+os_syscall(struct afsd_syscall_args *args)
+{
+ return syscall(AFS_SYSCALL, AFSCALL_CALL, args->syscall,
+ args->params[0], args->params[1], args->params[2],
+ args->params[3], args->params[4], args->params[5]);
+}
+#endif
+
+int
+afsd_call_syscall(struct afsd_syscall_args *args)
+{
+ int error;
+
+ error = os_syscall(args);
+ if (afsd_debug) {
+#ifdef AFS_NBSD40_ENV
+ char *s = strerror(errno);
+ printf("SScall(%d, %d, %d)=%d (%d, %s)\n", AFS_SYSCALL, AFSCALL_CALL,
+ (int)args->params[0], error, errno, s);
+#else
+ printf("SScall(%d, %d, %d)=%d ", AFS_SYSCALL, AFSCALL_CALL,
+ (int)args->params[0], error);
+#endif
+ }
+
+ return error;
+}
#ifdef AFS_AIX_ENV
/* Special handling for AIX's afs mount operation since they require much more