]>
git.ipfire.org Git - thirdparty/glibc.git/blob - hurd/hurd/ioctl.h
1 /* User-registered handlers for specific `ioctl' requests.
2 Copyright (C) 1993, 1994, 1995, 1996, 1997 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Library General Public License as
7 published by the Free Software Foundation; either version 2 of the
8 License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Library General Public License for more details.
15 You should have received a copy of the GNU Library General Public
16 License along with the GNU C Library; see the file COPYING.LIB. If not,
17 write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330,
18 Boston, MA 02111-1307, USA. */
21 #define _HURD_IOCTL_H 1
23 #define __need___va_list
28 /* Type of handler function, called like ioctl to do its entire job. */
29 typedef int (*ioctl_handler_t
) (int fd
, int request
, void *arg
);
31 /* Structure that records an ioctl handler. */
34 /* Range of handled _IOC_NOTYPE (REQUEST) values. */
35 int first_request
, last_request
;
37 /* Handler function, called like ioctl to do its entire job. */
38 ioctl_handler_t handler
;
40 struct ioctl_handler
*next
; /* Next handler. */
44 /* Register HANDLER to handle ioctls with REQUEST values between
45 FIRST_REQUEST and LAST_REQUEST inclusive. Returns zero if successful.
46 Return nonzero and sets `errno' for an error. */
48 extern int hurd_register_ioctl_handler (int first_request
, int last_request
,
49 ioctl_handler_t handler
);
52 /* Define a library-internal handler for ioctl commands between FIRST and
53 LAST inclusive. The last element gratuitously references HANDLER to
54 avoid `defined but not used' warnings. */
56 #define _HURD_HANDLE_IOCTLS(handler, first, last) \
57 static const struct ioctl_handler handler##_ioctl_handler \
58 __attribute__ ((__unused__)) = \
59 { _IOC_NOTYPE (first), _IOC_NOTYPE (last), \
60 (int (*) (int, int, void *)) (handler), NULL }; \
61 text_set_element (_hurd_ioctl_handler_lists, ##handler##_ioctl_handler)
63 /* Define a library-internal handler for a single ioctl command. */
65 #define _HURD_HANDLE_IOCTL(handler, ioctl) \
66 _HURD_HANDLE_IOCTLS (handler, (ioctl), (ioctl))
69 /* Lookup the handler for the given ioctl request. */
71 ioctl_handler_t
_hurd_lookup_ioctl_handler (int request
);
74 #endif /* hurd/ioctl.h */