svn commit: r280148 - head/sys/sys

Robert Watson rwatson at FreeBSD.org
Mon Mar 16 17:42:54 UTC 2015


Author: rwatson
Date: Mon Mar 16 17:42:53 2015
New Revision: 280148
URL: https://svnweb.freebsd.org/changeset/base/280148

Log:
  Introduce a cap_ioctl_t used for the 'cmds' arguments to cap_ioctls_limit()
  and cap_ioctls_get().  On FreeBSD, these are 'unsigned long', but on Linux,
  ioctl(2) takes an 'int', making mild abstraction desirable.
  
  MFC after:	3 days
  Sponsored by:	Google, Inc.

Modified:
  head/sys/sys/capsicum.h
  head/sys/sys/types.h

Modified: head/sys/sys/capsicum.h
==============================================================================
--- head/sys/sys/capsicum.h	Mon Mar 16 16:29:33 2015	(r280147)
+++ head/sys/sys/capsicum.h	Mon Mar 16 17:42:53 2015	(r280148)
@@ -1,5 +1,5 @@
 /*-
- * Copyright (c) 2008-2010 Robert N. M. Watson
+ * Copyright (c) 2008-2010, 2015 Robert N. M. Watson
  * Copyright (c) 2012 FreeBSD Foundation
  * All rights reserved.
  *
@@ -398,13 +398,13 @@ int __cap_rights_get(int version, int fd
 /*
  * Limits allowed ioctls for the given descriptor.
  */
-int cap_ioctls_limit(int fd, const unsigned long *cmds, size_t ncmds);
+int cap_ioctls_limit(int fd, const cap_ioctl_t *cmds, size_t ncmds);
 /*
  * Returns array of allowed ioctls for the given descriptor.
  * If all ioctls are allowed, the cmds array is not populated and
  * the function returns CAP_IOCTLS_ALL.
  */
-ssize_t cap_ioctls_get(int fd, unsigned long *cmds, size_t maxcmds);
+ssize_t cap_ioctls_get(int fd, cap_ioctl_t *cmds, size_t maxcmds);
 /*
  * Limits allowed fcntls for the given descriptor (CAP_FCNTL_*).
  */

Modified: head/sys/sys/types.h
==============================================================================
--- head/sys/sys/types.h	Mon Mar 16 16:29:33 2015	(r280147)
+++ head/sys/sys/types.h	Mon Mar 16 17:42:53 2015	(r280148)
@@ -232,6 +232,11 @@ typedef	__useconds_t	useconds_t;	/* micr
 #define	_USECONDS_T_DECLARED
 #endif
 
+#ifndef _CAP_IOCTL_T_DECLARED
+#define	_CAP_IOCTL_T_DECLARED
+typedef	unsigned long	cap_ioctl_t;
+#endif
+
 #ifndef _CAP_RIGHTS_T_DECLARED
 #define	_CAP_RIGHTS_T_DECLARED
 struct cap_rights;


More information about the svn-src-all mailing list