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.
This commit is contained in:
Robert Watson 2015-03-16 17:42:53 +00:00
parent ad7ea69dce
commit d2925cccc1
Notes: svn2git 2020-12-20 02:59:44 +00:00
svn path=/head/; revision=280148
2 changed files with 8 additions and 3 deletions

View File

@ -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, cap_rights_t *rights);
/*
* 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_*).
*/

View File

@ -232,6 +232,11 @@ typedef __useconds_t useconds_t; /* microseconds (unsigned) */
#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;