From d2925cccc146681120aa583180333b1217df0c4d Mon Sep 17 00:00:00 2001 From: Robert Watson Date: Mon, 16 Mar 2015 17:42:53 +0000 Subject: [PATCH] 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. --- sys/sys/capsicum.h | 6 +++--- sys/sys/types.h | 5 +++++ 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/sys/sys/capsicum.h b/sys/sys/capsicum.h index 8502a967498a..fe4910e0c65c 100644 --- a/sys/sys/capsicum.h +++ b/sys/sys/capsicum.h @@ -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_*). */ diff --git a/sys/sys/types.h b/sys/sys/types.h index 03eaa6002ef6..c2930f5a2f18 100644 --- a/sys/sys/types.h +++ b/sys/sys/types.h @@ -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;