MFC r270691:

Fix handling of the third argument for fcntl(2).  The native syscall
uses long for arg, which needs translation.
This commit is contained in:
kib 2014-09-03 09:05:16 +00:00
parent 36aab21b56
commit 15564950f5
2 changed files with 27 additions and 1 deletions

View File

@ -3072,3 +3072,28 @@ freebsd32_procctl(struct thread *td, struct freebsd32_procctl_args *uap)
return (kern_procctl(td, uap->idtype, PAIR32TO64(id_t, uap->id),
uap->com, data));
}
int
freebsd32_fcntl(struct thread *td, struct freebsd32_fcntl_args *uap)
{
intptr_t tmp;
switch (uap->cmd) {
/*
* Do unsigned conversion for arg when operation
* interprets it as flags or pointer.
*/
case F_SETLK_REMOTE:
case F_SETLKW:
case F_SETLK:
case F_GETLK:
case F_SETFD:
case F_SETFL:
tmp = (unsigned int)(uap->arg);
break;
default:
tmp = uap->arg;
break;
}
return (kern_fcntl(td, uap->fd, uap->cmd, tmp));
}

View File

@ -200,7 +200,8 @@
89 AUE_GETDTABLESIZE NOPROTO { int getdtablesize(void); }
90 AUE_DUP2 NOPROTO { int dup2(u_int from, u_int to); }
91 AUE_NULL UNIMPL getdopt
92 AUE_FCNTL NOPROTO { int fcntl(int fd, int cmd, long arg); }
92 AUE_FCNTL STD { int freebsd32_fcntl(int fd, int cmd, \
int arg); }
93 AUE_SELECT STD { int freebsd32_select(int nd, fd_set *in, \
fd_set *ou, fd_set *ex, \
struct timeval32 *tv); }