I was wondering if I could return a string from a XV6 system call since all the system call functions have the prototype int sys_xxx(void)
in sysproc.h
. I know different types of parameters can be passed using argint
, argptr
. Is there any such mechanism for returning a pointer as well? Or are there any indirect way of returning a string other than passing the char array as a parameter?
Asked
Active
Viewed 965 times
1

Abhik Bhattacharjee
- 45
- 6
-
3I do not specifically know xv6, but usually, you have to provide the space for a string in userspace and pass a pointer to that space to the kernel as a syscall argument. – Ctx Dec 23 '18 at 17:21
-
The only system call that *retruns* a pointer (that I can think of) is mmap() – wildplasser Dec 23 '18 at 17:37