Results 1 to 4 of 4
I've implemented a few custom system calls in my Ubuntu kernel, but I'm having some issues with the return values. Each function returns a variety of non-negative integers depending on ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 04-30-2011 #1Just Joined!
- Join Date
- Apr 2011
- Posts
- 5
Return values from system calls
I've implemented a few custom system calls in my Ubuntu kernel, but I'm having some issues with the return values. Each function returns a variety of non-negative integers depending on which error is encountered. However, when I'm testing the system calls, the only negative value that gets returned to the user program is -1, regardless of what I have in the code.
Is there some special path I have to take to get the proper return values?
Thanks.
- 04-30-2011 #2Just Joined!
- Join Date
- Apr 2011
- Posts
- 2
I'm having the exact same problem. This wouldn't be for a school project would it?
I have verified that the code returning other negative values is getting executed by placing printk()'s before those return statements.
Yet the -1 is all I can get.
EDIT: I may have solved this. I've looked into errno. I may be wrong about this, but I think the calls will only return -1 specifying that an error has occurred, then the caller must check errno to see what error that was.Last edited by ragnaroktomorrow; 04-30-2011 at 02:56 AM.
- 04-30-2011 #3Just Joined!
- Join Date
- Apr 2011
- Posts
- 5
No, it's not for a school project.
I thought that it might be an errno issue, but I've only recently started tinkering with linux under the hood. Do I have to explicitly set errno in the system call? Or will a negative value jump into it automatically?
- 05-01-2011 #4Just Joined!
- Join Date
- Apr 2011
- Posts
- 2


Reply With Quote

