1 /*
2 * CDDL HEADER START
3 *
4 * The contents of this file are subject to the terms of the
5 * Common Development and Distribution License (the "License").
6 * You may not use this file except in compliance with the License.
7 *
8 * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE
9 * or http://www.opensolaris.org/os/licensing.
10 * See the License for the specific language governing permissions
11 * and limitations under the License.
12 *
13 * When distributing Covered Code, include this CDDL HEADER in each
14 * file and include the License file at usr/src/OPENSOLARIS.LICENSE.
15 * If applicable, add the following below this CDDL HEADER, with the
16 * fields enclosed by brackets "[]" replaced with your own identifying
17 * information: Portions Copyright [yyyy] [name of copyright owner]
18 *
19 * CDDL HEADER END
20 */
21 /*
22 * Copyright 2006 Sun Microsystems, Inc. All rights reserved.
23 * Use is subject to license terms.
24 */
25
26 #ifndef _SYS_LDLINUX_H
27 #define _SYS_LDLINUX_H
28
29 #pragma ident "%Z%%M% %I% %E% SMI"
30
31 /*
32 * The ldlinux streams module is only intended for use in lx branded zones.
33 * This streams module implements the following ioctls:
34 * TIOCSETLD and TIOCGETLD
35 *
36 * These ioctls are special ioctls supported only by the ldlinux streams
37 * module and invoked only by the lx brand emulation library. These ioctls
38 * do not exist on native Linux systems.
39 *
40 * The TIOCSETLD ioctl is used when emulating the following Linux ioctls:
41 * TCSETS/TCSETSW/TCSETSF
42 * TCSETA/TCSETAW/TCSETAF
43 *
44 * The TIOCGETLD ioctl is used when emulating the following Linux ioctls:
45 * TCGETS/TCGETA
46 *
47 * This module is needed to emulate these ioctls because the following arrays:
48 * termio.c_cc
49 * termios.c_cc
50 * which are parameters for the following ioctls:
51 * TCSETS/TCSETSW/TCSETSF
52 * TCSETA/TCSETAW/TCSETAF
53 * TCGETS/TCGETA
54 *
55 * are defined differently on Solaris and Linux.
56 *
57 * According to the termio(7I) man page on Solaris the following is true of
58 * the members of the c_cc array:
59 * The VMIN element is the same element as the VEOF element.
60 * The VTIME element is the same element as the VEOL element.
61 *
62 * But on Linux the termios(3) man page states:
63 * These symbolic subscript values are all different, except that
64 * VTIME, VMIN may have the same value as VEOL, VEOF, respectively.
65 *
66 * While the man page indicates that these values may be the same empirical
67 * tests shows them to be different. Since these values are different on
68 * Linux systems it's possible that applications could set the members of
69 * the c_cc array to different values and then later expect to be able to
70 * read back those same separate values. The ldlinux module exists to provide
71 * a per-stream storage area where the lx_brand emulation library can save
72 * these values. The values are set and retrieved via the TIOCSETLD and
73 * TIOCGETLD ioctls respectively.
74 */
75
76 #include <sys/termios.h>
77
78 #ifdef __cplusplus
79 extern "C" {
80 #endif
81
82 #define LDLINUX_MOD "ldlinux"
83
84 #ifdef _KERNEL
85
86 /*
87 * LDLINUX_MODID - This should be a unique number associated with
88 * this particular module. Unfortunatly there is no authority responsible
89 * for administering this name space, hence there's no real guarantee that
90 * whatever number we choose will be unique. Luckily, this constant
91 * is not really used anywhere by the system. It is used by some
92 * kernel subsystems to check for the presence of certain streams
93 * modules with known id vaules. Since no other kernel subsystem
94 * checks for the presence of this module we'll just set the id to 0.
95 */
96 #define LDLINUX_MODID 0
97
98 struct ldlinux {
99 int state; /* state information */
100 /* Linux expects the next four c_cc values */
101 /* to be distinct, whereas solaris (legally) */
102 /* overlaps their storage */
103 unsigned char veof; /* veof value */
104 unsigned char veol; /* veol value */
105 unsigned char vmin; /* vmin value */
106 unsigned char vtime; /* vtime value */
107 };
108
109 #define ISPTSTTY 0x01
110
111 #endif /* _KERNEL */
112
113 #ifdef __cplusplus
114 }
115 #endif
116
117 #endif /* _SYS_LDLINUX_H */