1ports(1M)               System Administration Commands               ports(1M)
2
3
4

NAME

6       ports - creates /dev entries and inittab entries for serial lines
7

SYNOPSIS

9       /usr/sbin/ports [-r rootdir]
10
11

DESCRIPTION

13       devfsadm(1M)  is  now  the  preferred command for /dev and /devices and
14       should be used instead of ports.
15
16
17       The ports command creates symbolic links in the /dev/term and  /dev/cua
18       directories  to  the serial-port character device files in /devices and
19       adds new entries in /etc/inittab for non-system  ports  found.  System-
20       board  ports  are  given single lower-case letters for names (such as a
21       and b) while other ports are named numerically.
22
23
24       ports searches the kernel  device  tree  to  find  the  serial  devices
25       attached  to  the  system. It also checks /dev/term and /dev/cua to see
26       what symbolic links to serial devices already exist.  ports  then  per‐
27       forms the following:
28
29           1.     Assigns  new  numbers (or letters for system-board ports) to
30                  ports that are attached  to  the  system  but  do  not  have
31                  /dev/term  and  /dev/cua  entries.  The  numbers  or letters
32                  assigned are the lowest-unused numbers or letters.
33
34           2.     Removes dangling links: links from  /dev/term  and  /dev/cua
35                  pointing to no-longer-existing ports.
36
37           3.     Creates  new  /dev/term  and  /dev/cua  links for new serial
38                  devices.
39
40           4.     Invokes sacadm(1M) to make new port monitor entries for  the
41                  new  devices.  This  is  not done automatically for on-board
42                  ports; on workstations these ports are often  not  used  for
43                  dial-in  sessions,  so a port-monitor for one of these ports
44                  must be created explicitly.
45
46
47       If the configuration has not changed, ports exits  without  doing  any‐
48       thing.
49
50   Notice to Driver Writers
51       ports   considers   devices   with   a   node  type  of  DDI_NT_SERIAL,
52       DDI_NT_SERIAL_MB, DDI_NT_SERIAL_DO, or DDI_NT_SERIAL_MB_DO to be serial
53       port  devices.  Devices  with one of these node types must create minor
54       device names that obey the following conventions when calling  ddi_cre‐
55       ate_minor_node(9F).
56
57           o      The  minor  name for non-system port devices (DDI_NT_SERIAL)
58                  consists of an ASCII numeric string, where the first port on
59                  the  device  is named 0, the second named 1, the third named
60                  2, up to the number of ports provided by the device.
61
62           o      The   minor   name   for    non-system    dialout    devices
63                  (DDI_NT_SERIAL_DO)  is the ASCII numeric port name, concate‐
64                  nated with ,cu. For example, the minor name  for  the  first
65                  dialout port on the serial board is 0,cu.
66
67           o      The    minor    name    for    system-board   port   devices
68                  (DDI_NT_SERIAL_MB) consists of a string containing a  single
69                  ASCII  lowercase  character,  where  the  first  port on the
70                  device is named a, the second is named b, the third is named
71                  c, for all ports on the device (or up through port z).
72
73           o      The    minor   name   for   system-board   dialout   devices
74                  (DDI_NT_SERIAL_MB_DO) consists of  the  lowercase  character
75                  port  name,  concatenated  with  ,cu. For example, the minor
76                  name for the first  dialout  port  on  the  on-board  serial
77                  device is a,cu.
78
79
80       To  prevent disks from attempting to automatically generate links for a
81       device, drivers must specify a private node type and refrain from using
82       one of the above node types when calling ddi_create_minor_node(9F).
83

OPTIONS

85       The following options are supported:
86
87       -r rootdir    Causes ports to presume that the /dev/term, /dev/cua, and
88                     /devices  directories  are  found  under   rootdir,   not
89                     directly   under   /.  If  this  argument  is  specified,
90                     sacadm(1M) is not invoked, since it would update terminal
91                     administration  files  under  /etc  without regard to the
92                     rootdir.
93
94

EXAMPLES

96       Example 1 Creating the Serial and Dialout Minor Device Nodes
97
98
99       The following example creates the serial and dialout minor device nodes
100       from the xkserial driver's attach(9E) function:
101
102
103         /*
104         * Create the minor number by combining the instance number
105         * with the port number.
106         */ #define XKNUMPORTS           8
107         #define XKMINORNUM(i, p)     ((i) << 4 | (p))
108         #define XKMINORNUM_DO(i, p)  ((i) << 4 | (p) | 0x80)
109         int
110         xkserialattach(dev_info_t *dip, ddi_attach_cmd_t cmd)
111         {
112            int instance, portnum;
113            char name[8];
114                /* other stuff in attach... */
115            instance = ddi_get_instance(dip);
116            for (portnum = 0; portnum < XKNUMPORTS; portnum++) {
117                /*
118                 * create the serial port device
119                 */
120                 sprintf(name, "%d", portnum);
121                 ddi_create_minor_node(dip, name, S_IFCHR,
122                    XKMINORNUM(instance, portnum), DDI_NT_SERIAL, 0);
123
124                 /*
125                  * create the dialout device
126                  */
127                  sprintf(name,"%d,cu", portnum);
128                  ddi_create_minor_node(dip, name, S_IFCHR,
129                      XKMINORNUM_DO(instance, portnum), DDI_NT_SERIAL_DO, 0);
130              }
131         }
132
133
134
135       Example 2 Installing the xkserial Port Driver on a Sun Fire 4800
136
137
138       The  following  example installs the xkserial port driver on a Sun Fire
139       4800 (with the driver controlling the fictional XKSerial 8 port  serial
140       board), with these special files in /devices:
141
142
143         # ls -l /devices/ssm@0,0/pci@18,700000/pci@1/xkserial@f,800000/
144         crw-r-----   1 root sys   32,  16 Aug 29 00:02 xkserial@2000:0
145         crw-r-----   1 root sys   32, 144 Aug 29 00:02 xkserial@2000:0,cu
146         crw-r-----   1 root sys   32,  17 Aug 29 00:02 xkserial@2000:1
147         crw-r-----   1 root sys   32, 145 Aug 29 00:02 xkserial@2000:1,cu
148         crw-r-----   1 root sys   32,  18 Aug 29 00:02 xkserial@2000:2
149         crw-r-----   1 root sys   32, 146 Aug 29 00:02 xkserial@2000:2,cu
150         crw-r-----   1 root sys   32,  19 Aug 29 00:02 xkserial@2000:3
151         crw-r-----   1 root sys   32, 147 Aug 29 00:02 xkserial@2000:3,cu
152         crw-r-----   1 root sys   32,  20 Aug 29 00:02 xkserial@2000:4
153         crw-r-----   1 root sys   32, 148 Aug 29 00:02 xkserial@2000:4,cu
154         crw-r-----   1 root sys   32,  21 Aug 29 00:02 xkserial@2000:5
155         crw-r-----   1 root sys   32, 149 Aug 29 00:02 xkserial@2000:5,cu
156         crw-r-----   1 root sys   32,  22 Aug 29 00:02 xkserial@2000:6
157         crw-r-----   1 root sys   32, 150 Aug 29 00:02 xkserial@2000:6,cu
158         crw-r-----   1 root sys   32,  23 Aug 29 00:02 xkserial@2000:7
159         crw-r-----   1 root sys   32, 151 Aug 29 00:02 xkserial@2000:7,cu
160
161
162
163
164       /dev/term  contain  symbolic  links  to the serial port device nodes in
165       /devices
166
167
168         # ls -l /dev/term
169         /dev/term/0 -> ../../devices/[....]/xkserial@2000:0
170         /dev/term/1 -> ../../devices/[....]/xkserial@2000:1
171         /dev/term/2 -> ../../devices/[....]/xkserial@2000:2
172         /dev/term/3 -> ../../devices/[....]/xkserial@2000:3
173         /dev/term/4 -> ../../devices/[....]/xkserial@2000:4
174         /dev/term/5 -> ../../devices/[....]/xkserial@2000:5
175         /dev/term/6 -> ../../devices/[....]/xkserial@2000:6
176         /dev/term/7 -> ../../devices/[....]/xkserial@2000:7
177
178
179
180
181       and /dev/cua contain symbolic links to the dialout port device nodes in
182       /devices
183
184
185         # ls -l /dev/cua
186
187         /dev/cua/0 -> ../../devices/[....]/xkserial@2000:0,cu
188         /dev/cua/1 -> ../../devices/[....]/xkserial@2000:1,cu
189         /dev/cua/2 -> ../../devices/[....]/xkserial@2000:2,cu
190         /dev/cua/3 -> ../../devices/[....]/xkserial@2000:3,cu
191         /dev/cua/4 -> ../../devices/[....]/xkserial@2000:4,cu
192         /dev/cua/5 -> ../../devices/[....]/xkserial@2000:5,cu
193         /dev/cua/6 -> ../../devices/[....]/xkserial@2000:6,cu
194         /dev/cua/7 -> ../../devices/[....]/xkserial@2000:7,cu
195
196
197

FILES

199       /dev/term/n     Logical serial port devices
200
201
202       /dev/cua/n      Logical dialout port devices
203
204
205       /etc/inittab
206
207
208       /etc/saf/*
209
210

ATTRIBUTES

212       See attributes(5) for descriptions of the following attributes:
213
214
215
216
217       ┌─────────────────────────────┬─────────────────────────────┐
218       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
219       ├─────────────────────────────┼─────────────────────────────┤
220       │Availability                 │ SUNWcsu                     │
221       └─────────────────────────────┴─────────────────────────────┘
222

SEE ALSO

224       add_drv(1M),   devfsadm(1M),   drvconfig(1M),   pmadm(1M),  sacadm(1M),
225       attributes(5), devfs(7FS), attach(9E), ddi_create_minor_node(9F)
226
227
228
229
230
231
232SunOS 5.11                        8 Nov 2002                         ports(1M)
Impressum