diff options
author | Frans Kaashoek <[email protected]> | 2022-08-22 19:53:09 -0400 |
---|---|---|
committer | Frans Kaashoek <[email protected]> | 2022-08-22 19:53:09 -0400 |
commit | 2a391ebc8ba1fd0e6f0899277218d531fd5c7396 (patch) | |
tree | 81fb25b6d7317db8b7a02ae1a9f5705776368c63 /kernel/sysfile.c | |
parent | 7086197c27f7c00544ca006561336d8d5791a482 (diff) | |
download | xv6-labs-2a391ebc8ba1fd0e6f0899277218d531fd5c7396.tar.gz xv6-labs-2a391ebc8ba1fd0e6f0899277218d531fd5c7396.tar.bz2 xv6-labs-2a391ebc8ba1fd0e6f0899277218d531fd5c7396.zip |
Make argint() and argaddr() of type void (thanks Harry Porter)
Diffstat (limited to 'kernel/sysfile.c')
-rw-r--r-- | kernel/sysfile.c | 29 |
1 files changed, 17 insertions, 12 deletions
diff --git a/kernel/sysfile.c b/kernel/sysfile.c index 5dc453b..970a72a 100644 --- a/kernel/sysfile.c +++ b/kernel/sysfile.c @@ -24,8 +24,7 @@ argfd(int n, int *pfd, struct file **pf) int fd; struct file *f; - if(argint(n, &fd) < 0) - return -1; + argint(n, &fd); if(fd < 0 || fd >= NOFILE || (f=myproc()->ofile[fd]) == 0) return -1; if(pfd) @@ -73,7 +72,9 @@ sys_read(void) int n; uint64 p; - if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) + argaddr(1, &p); + argint(2, &n); + if(argfd(0, 0, &f) < 0) return -1; return fileread(f, p, n); } @@ -84,8 +85,10 @@ sys_write(void) struct file *f; int n; uint64 p; - - if(argfd(0, 0, &f) < 0 || argint(2, &n) < 0 || argaddr(1, &p) < 0) + + argaddr(1, &p); + argint(2, &n); + if(argfd(0, 0, &f) < 0) return -1; return filewrite(f, p, n); @@ -110,7 +113,8 @@ sys_fstat(void) struct file *f; uint64 st; // user pointer to struct stat - if(argfd(0, 0, &f) < 0 || argaddr(1, &st) < 0) + argaddr(1, &st); + if(argfd(0, 0, &f) < 0) return -1; return filestat(f, st); } @@ -292,7 +296,8 @@ sys_open(void) struct inode *ip; int n; - if((n = argstr(0, path, MAXPATH)) < 0 || argint(1, &omode) < 0) + argint(1, &omode); + if((n = argstr(0, path, MAXPATH)) < 0) return -1; begin_op(); @@ -375,9 +380,9 @@ sys_mknod(void) int major, minor; begin_op(); + argint(1, &major); + argint(2, &minor); if((argstr(0, path, MAXPATH)) < 0 || - argint(1, &major) < 0 || - argint(2, &minor) < 0 || (ip = create(path, T_DEVICE, major, minor)) == 0){ end_op(); return -1; @@ -419,7 +424,8 @@ sys_exec(void) int i; uint64 uargv, uarg; - if(argstr(0, path, MAXPATH) < 0 || argaddr(1, &uargv) < 0){ + argaddr(1, &uargv); + if(argstr(0, path, MAXPATH) < 0) { return -1; } memset(argv, 0, sizeof(argv)); @@ -462,8 +468,7 @@ sys_pipe(void) int fd0, fd1; struct proc *p = myproc(); - if(argaddr(0, &fdarray) < 0) - return -1; + argaddr(0, &fdarray); if(pipealloc(&rf, &wf) < 0) return -1; fd0 = -1; |