1/* $NetBSD: ioctl.h,v 1.36 2009/02/13 22:41:04 apb Exp $ */
2
3/*-
4 * Copyright (c) 1982, 1986, 1990, 1993, 1994
5 * The Regents of the University of California. All rights reserved.
6 * (c) UNIX System Laboratories, Inc.
7 * All or some portions of this file are derived from material licensed
8 * to the University of California by American Telephone and Telegraph
9 * Co. or Unix System Laboratories, Inc. and are reproduced herein with
10 * the permission of UNIX System Laboratories, Inc.
11 *
12 * Redistribution and use in source and binary forms, with or without
13 * modification, are permitted provided that the following conditions
14 * are met:
15 * 1. Redistributions of source code must retain the above copyright
16 * notice, this list of conditions and the following disclaimer.
17 * 2. Redistributions in binary form must reproduce the above copyright
18 * notice, this list of conditions and the following disclaimer in the
19 * documentation and/or other materials provided with the distribution.
20 * 3. Neither the name of the University nor the names of its contributors
21 * may be used to endorse or promote products derived from this software
22 * without specific prior written permission.
23 *
24 * THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
25 * ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
26 * IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
27 * ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
28 * FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
29 * DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
30 * OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
31 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
32 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
33 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
34 * SUCH DAMAGE.
35 *
36 * @(#)ioctl.h 8.6 (Berkeley) 3/28/94
37 */
38
39#ifndef _SYS_IOCTL_H_
40#define _SYS_IOCTL_H_
41
42#include <sys/ttycom.h>
43
44/*
45 * Pun for SunOS prior to 3.2. SunOS 3.2 and later support TIOCGWINSZ
46 * and TIOCSWINSZ (yes, even 3.2-3.5, the fact that it wasn't documented
47 * nonwithstanding).
48 */
49struct ttysize {
50 unsigned short ts_lines;
51 unsigned short ts_cols;
52 unsigned short ts_xxx;
53 unsigned short ts_yyy;
54};
55#define TIOCGSIZE TIOCGWINSZ
56#define TIOCSSIZE TIOCSWINSZ
57
58#include <sys/ioccom.h>
59
60#include <sys/dkio.h>
61#include <sys/filio.h>
62#include <sys/sockio.h>
63
64/*
65 * Passthrough ioctl commands. These are passed through to devices
66 * as they are, it is expected that the device (a module, for example),
67 * will know how to deal with them. One for each emulation, so that
68 * no namespace clashes will occur between them, for devices that
69 * may be dealing with specific ioctls for multiple emulations.
70 */
71
72struct ioctl_pt {
73 unsigned long com;
74 void *data;
75};
76
77#define PTIOCNETBSD _IOW('Z', 0, struct ioctl_pt)
78#define PTIOCSUNOS _IOW('Z', 1, struct ioctl_pt)
79#define PTIOCSVR4 _IOW('Z', 2, struct ioctl_pt)
80#define PTIOCLINUX _IOW('Z', 3, struct ioctl_pt)
81#define PTIOCFREEBSD _IOW('Z', 4, struct ioctl_pt)
82#define PTIOCOSF1 _IOW('Z', 5, struct ioctl_pt)
83#define PTIOCULTRIX _IOW('Z', 6, struct ioctl_pt)
84#define PTIOCWIN32 _IOW('Z', 7, struct ioctl_pt)
85
86#ifndef _KERNEL
87
88#include <sys/cdefs.h>
89
90__BEGIN_DECLS
91int ioctl(int, unsigned long, ...);
92__END_DECLS
93#endif /* !_KERNEL */
94#endif /* !_SYS_IOCTL_H_ */
95
96/*
97 * Keep outside _SYS_IOCTL_H_
98 * Compatibility with old terminal driver
99 *
100 * Source level -> #define USE_OLD_TTY
101 * Kernel level -> options COMPAT_43 or COMPAT_SUNOS or ...
102 */
103
104#if defined(_KERNEL_OPT)
105#include "opt_compat_freebsd.h"
106#include "opt_compat_sunos.h"
107#include "opt_compat_svr4.h"
108#include "opt_compat_43.h"
109#include "opt_compat_osf1.h"
110#include "opt_compat_ibcs2.h"
111#include "opt_modular.h"
112#endif
113
114#if defined(USE_OLD_TTY) || defined(COMPAT_43) || defined(COMPAT_SUNOS) || \
115 defined(COMPAT_SVR4) || defined(COMPAT_FREEBSD) || defined(COMPAT_OSF1) || \
116 defined(COMPAT_IBCS2) || defined(MODULAR)
117#include <sys/ioctl_compat.h>
118#endif
119