In a homework assignment we were asked to add a system call to the Linux Kernel (Red Hat 2.4.18). According to the assignment the return value of the new system call should be void. The system call in itself is quite simple (just one assignment) and there is no chance for error.
From what I read and learnt system calls usually return a negative value to indicate failure or 0 to indicate success. My question is whether this is just a common practice or a must? Can a system call return void?
In a homework assignment we were asked to add a system call to the
Share
In Linux all system calls return long, if they return at all. Say you declare your system call using:
This results in:
If you don’t have any useful return and the call cannot fail, simply return 0 every time to signal success.