Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 3 Sep 2014 09:05:17 +0000 (UTC)
From:      Konstantin Belousov <kib@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r271010 - stable/10/sys/compat/freebsd32
Message-ID:  <201409030905.s8395H7r008817@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: kib
Date: Wed Sep  3 09:05:16 2014
New Revision: 271010
URL: http://svnweb.freebsd.org/changeset/base/271010

Log:
  MFC r270691:
  Fix handling of the third argument for fcntl(2).  The native syscall
  uses long for arg, which needs translation.

Modified:
  stable/10/sys/compat/freebsd32/freebsd32_misc.c
  stable/10/sys/compat/freebsd32/syscalls.master
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/sys/compat/freebsd32/freebsd32_misc.c
==============================================================================
--- stable/10/sys/compat/freebsd32/freebsd32_misc.c	Wed Sep  3 08:45:58 2014	(r271009)
+++ stable/10/sys/compat/freebsd32/freebsd32_misc.c	Wed Sep  3 09:05:16 2014	(r271010)
@@ -3072,3 +3072,28 @@ freebsd32_procctl(struct thread *td, str
 	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));
+}

Modified: stable/10/sys/compat/freebsd32/syscalls.master
==============================================================================
--- stable/10/sys/compat/freebsd32/syscalls.master	Wed Sep  3 08:45:58 2014	(r271009)
+++ stable/10/sys/compat/freebsd32/syscalls.master	Wed Sep  3 09:05:16 2014	(r271010)
@@ -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); }



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201409030905.s8395H7r008817>