summaryrefslogtreecommitdiff
path: root/sys/src/9/port/auth.c
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2014-01-20 00:47:55 +0100
committercinap_lenrek <cinap_lenrek@felloff.net>2014-01-20 00:47:55 +0100
commit6c2e983d328874ea41cb35bacb510bf2709a229f (patch)
treee2a5c596a3fcd1af3ed792494b78f2d503911b44 /sys/src/9/port/auth.c
parentb99ecee6cd8c7c9fce1ff2cfa56d5a6807a0fc7c (diff)
kernel: apply uintptr for ulong when a pointer is stored
this change is in preparation for amd64. the systab calling convention was also changed to return uintptr (as segattach returns a pointer) and the arguments are now passed as va_list which handles amd64 arguments properly (all arguments are passed in 64bit quantities on the stack, tho the upper part will not be initialized when the element is smaller than 8 bytes). this is partial. xalloc needs to be converted in the future.
Diffstat (limited to 'sys/src/9/port/auth.c')
-rw-r--r--sys/src/9/port/auth.c58
1 files changed, 33 insertions, 25 deletions
diff --git a/sys/src/9/port/auth.c b/sys/src/9/port/auth.c
index 2c8e8a34d..04b96a57d 100644
--- a/sys/src/9/port/auth.c
+++ b/sys/src/9/port/auth.c
@@ -19,59 +19,68 @@ iseve(void)
return strcmp(eve, up->user) == 0;
}
-long
-sysfversion(ulong *arg)
+uintptr
+sysfversion(va_list list)
{
+ uint msize, arglen;
char *vers;
- uint arglen, m, msize;
Chan *c;
+ int fd;
- msize = arg[1];
- vers = (char*)arg[2];
- arglen = arg[3];
- validaddr(arg[2], arglen, 1);
+ fd = va_arg(list, int);
+ msize = va_arg(list, uint);
+ vers = va_arg(list, char*);
+ arglen = va_arg(list, uint);
+ validaddr((uintptr)vers, arglen, 1);
/* check there's a NUL in the version string */
if(arglen==0 || memchr(vers, 0, arglen)==0)
error(Ebadarg);
- c = fdtochan(arg[0], ORDWR, 0, 1);
+ c = fdtochan(fd, ORDWR, 0, 1);
if(waserror()){
cclose(c);
nexterror();
}
-
- m = mntversion(c, vers, msize, arglen);
-
+ msize = mntversion(c, vers, msize, arglen);
cclose(c);
poperror();
- return m;
+ return msize;
}
-long
-sys_fsession(ulong *arg)
+uintptr
+sys_fsession(va_list list)
{
- /* deprecated; backwards compatibility only */
+ int fd;
+ char *str;
+ uint len;
- if(arg[2] == 0)
+ /* deprecated; backwards compatibility only */
+ fd = va_arg(list, int);
+ str = va_arg(list, char*);
+ len = va_arg(list, uint);
+ if(len == 0)
error(Ebadarg);
- validaddr(arg[1], arg[2], 1);
- ((uchar*)arg[1])[0] = '\0';
+ validaddr((uintptr)str, len, 1);
+ *str = '\0';
+ USED(fd);
return 0;
}
-long
-sysfauth(ulong *arg)
+uintptr
+sysfauth(va_list list)
{
Chan *c, *ac;
char *aname;
int fd;
- validaddr(arg[1], 1, 0);
- aname = validnamedup((char*)arg[1], 1);
+ fd = va_arg(list, int);
+ aname = va_arg(list, char*);
+ validaddr((uintptr)aname, 1, 0);
+ aname = validnamedup(aname, 1);
if(waserror()){
free(aname);
nexterror();
}
- c = fdtochan(arg[0], ORDWR, 0, 1);
+ c = fdtochan(fd, ORDWR, 0, 1);
if(waserror()){
cclose(c);
nexterror();
@@ -96,8 +105,7 @@ sysfauth(ulong *arg)
/* always mark it close on exec */
ac->flag |= CCEXEC;
-
- return fd;
+ return (uintptr)fd;
}
/*