mirror of
https://git.openafs.org/openafs.git
synced 2025-01-31 13:38:01 +00:00
Revert "Linux: normalize error return for emulated syscalls"
This reverts commit 0bc837f68a72ba1f75d940cc5dd057774d9f36bb. Sadly, this change fixed setpag(), but broke all of the pioctls. The problem is actually a little more nuanced than we at first thought. What's happening is yet another case of Linux's special handling of negative return values. When an ioctl handler returns a negative return code to the kernel, it does errno = -code, and sets the return code to -1. If you pass it a postive return code, however, it just returns that straight to the application. The pioctl code gets this right. However, the setpag code doesn't, and so tries to return postive values, which is why ioctl appears to be returning the error code in the return value, not in the errno. Change-Id: I192ff45ad15b72a493a3c9c98546b026761dd95f Reviewed-on: http://gerrit.openafs.org/4222 Tested-by: BuildBot <buildbot@rampaginggeek.com> Tested-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Marc Dionne <marc.c.dionne@gmail.com> Reviewed-by: Derrick Brashear <shadow@dementia.org>
This commit is contained in:
parent
c78694fdb7
commit
ff2933a122
@ -20,7 +20,6 @@
|
||||
#include <sys/ioctl.h>
|
||||
#include <unistd.h>
|
||||
#include <stdio.h>
|
||||
#include <errno.h>
|
||||
#ifdef AFS_SUN5_ENV
|
||||
#include <fcntl.h>
|
||||
#endif
|
||||
@ -29,29 +28,24 @@
|
||||
#ifdef AFS_LINUX20_ENV
|
||||
int proc_afs_syscall(long syscall, long param1, long param2, long param3,
|
||||
long param4, int *rval) {
|
||||
struct afsprocdata syscall_data;
|
||||
int fd = open(PROC_SYSCALL_FNAME, O_RDWR);
|
||||
if(fd < 0)
|
||||
fd = open(PROC_SYSCALL_ARLA_FNAME, O_RDWR);
|
||||
if(fd < 0)
|
||||
return -1;
|
||||
struct afsprocdata syscall_data;
|
||||
int fd = open(PROC_SYSCALL_FNAME, O_RDWR);
|
||||
if(fd < 0)
|
||||
fd = open(PROC_SYSCALL_ARLA_FNAME, O_RDWR);
|
||||
if(fd < 0)
|
||||
return -1;
|
||||
|
||||
syscall_data.syscall = syscall;
|
||||
syscall_data.param1 = param1;
|
||||
syscall_data.param2 = param2;
|
||||
syscall_data.param3 = param3;
|
||||
syscall_data.param4 = param4;
|
||||
syscall_data.syscall = syscall;
|
||||
syscall_data.param1 = param1;
|
||||
syscall_data.param2 = param2;
|
||||
syscall_data.param3 = param3;
|
||||
syscall_data.param4 = param4;
|
||||
|
||||
*rval = ioctl(fd, VIOC_SYSCALL, &syscall_data);
|
||||
*rval = ioctl(fd, VIOC_SYSCALL, &syscall_data);
|
||||
|
||||
close(fd);
|
||||
close(fd);
|
||||
|
||||
/* Callers expect us to emulate a syscall - return -1 on error, set errno */
|
||||
if (*rval) {
|
||||
errno = *rval;
|
||||
*rval = -1;
|
||||
}
|
||||
return 0;
|
||||
return 0;
|
||||
}
|
||||
#endif
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user