Linux: normalize error return for emulated syscalls
authorMarc Dionne <marc.c.dionne@gmail.com>
Thu, 1 Jul 2010 15:38:20 +0000 (11:38 -0400)
committerDerrick Brashear <shadow@dementia.org>
Sun, 19 Sep 2010 18:23:15 +0000 (11:23 -0700)
commit0bc837f68a72ba1f75d940cc5dd057774d9f36bb
tree57ca42b634a56f378c8a06074576336756e63b34
parent4bbf0dae237e01127f4d1a4d913f00e8dad859a3
Linux: normalize error return for emulated syscalls

pagsh and other code expect setpag() and pioctl() to behave like
a regular syscall or pioctl, that is to return -1 on error, with
errno set to the specific error code.
On Linux, the underlying emulation does a straight return of any
error code it gets from the ioctl, and errors are not properly
caught by the callers.

As an example, pagsh won't detect an error from setpag such as
exceeding a keyring quota limit.  With this patch, the user
will see this:

$ pagsh
setpag: Disk quota exceeded
sh-4.1$

The code in proc_afs_syscall is modified to set errno to the error
code and to set errorcode to -1 in case of error.

proc_afs_sycall is reindented while we're changing code there.

FIXES 126230

Change-Id: I945f2d28eb0ae26c7f42502c90eb2e6e95c29a58
Reviewed-on: http://gerrit.openafs.org/2770
Tested-by: BuildBot <buildbot@rampaginggeek.com>
Reviewed-by: Derrick Brashear <shadow@dementia.org>
Tested-by: Derrick Brashear <shadow@dementia.org>
src/sys/glue.c