1wscons(7D)                          Devices                         wscons(7D)
2
3
4

NAME

6       wscons - workstation console
7

SYNOPSIS

9       #include <sys/strredir.h>
10
11
12       ioctl(fd, SRIOCSREDIR, target);
13
14
15       ioctl(fd, SRIOCISREDIR, target);
16
17

DESCRIPTION

19       The  wscons  workstation console consists of a workstation keyboard and
20       frame buffer that  act  together  to  emulate  an  ASCII  terminal.  It
21       includes  a redirection facility that allows I/O issued to the worksta‐
22       tion console to be diverted to a STREAMS device, enabling  window  sys‐
23       tems  to  redirect  output  that would otherwise appear directly on the
24       frame buffer in corrupted form.
25
26   Redirection
27       The wscons redirection facility maintains a list of  devices  that  are
28       designated   as  redirection  targets  through  the  SRIOCSREDIR  ioctl
29       described below. Only the current entry  is  active;  when  the  active
30       entry  is  closed,  the most recent remaining entry becomes active. The
31       active entry acts as a proxy for the device being redirected  and  han‐
32       dles  all read(2), write(2), ioctl(2), and poll(2) calls issued against
33       the redirectee.
34
35
36       The ioctls described below control the redirection  facility.  In  both
37       cases,  fd is a descriptor for the device being redirected (or worksta‐
38       tion console) and target is a descriptor for a STREAMS device.
39
40       SRIOCSREDIR     Designates target as the source and destination of  I/O
41                       ostensibly directed to the device denoted by fd.
42
43
44       SRIOCISREDIR    Returns  1  if target names the device currently acting
45                       as proxy for the device denoted by fd, and 0 if  it  is
46                       not.
47
48
49   ANSI Standard Terminal Emulation
50       The Solaris kernel terminal emulator provides ANSI X3.64 emulation both
51       on SPARC and x86 systems.
52
53
54       On SPARC systems, the PROM monitor is used to emulate  an  ANSI   X3.64
55       terminal  if  the  kernel terminal emulator is not available for emula‐
56       tion. See visual_io(7I) for more details.
57
58
59       Note: The VT100 adheres the ANSI X3.64 standard. However,  because  the
60       VT100 features nonstandard extensions to ANSI X3.64, it is incompatible
61       with Sun terminal emulators.
62
63
64       The SPARC console displays 34 lines of 80 ASCII  characters  per  line.
65       The  x86  console  displays  25  lines of 80 ASCII characters per line.
66       Devices with smaller text capacities may display less.  On  SPARC  sys‐
67       tems,  the  screen-#rows  screen-#columns  should  be  set  to 34 or 80
68       respectively or text capacities will vary from those  described  above.
69       On  SPARC  systems,  the  screen-#rows  and  screen-#columns fields are
70       stored in NVRAM/EEPROM. See eeprom(1M) for more information. Both SPARC
71       and  x86 consoles offer scrolling, (x, y) cursor addressing ability and
72       a number of other control functions.
73
74
75       The console cursor marks the current line and character position on the
76       screen.  ASCII  characters between 0x20 (space) and 0x7E (tilde) inclu‐
77       sive are printing characters. When a print character is written to  the
78       console (and is not part of an escape sequence), it is displayed at the
79       current cursor position and the cursor moves one position to the  right
80       on the current line.
81
82
83       On  SPARC  based systems, later  PROM revisions have the full 8-bit ISO
84       Latin-1 (ISO 8859-1) character  set.  Earlier  PROM  revisions  display
85       characters in the range 0xA0 through 0xFE as spaces.
86
87
88       When  the  cursor  is  at the right edge of the screen, it moves to the
89       first character position on the next line.  When the cursor is  at  the
90       screen's  right-bottom  edge,  the line-feed function is performed (see
91       CTRL-J below). The line-feed function scrolls the screen up by  one  or
92       more lines  before moving the cursor to the first character position on
93       the next line.
94
95   Control Sequence Syntax
96       The wscons console defines a number of control sequences that may occur
97       during  input.   When  a control sequence is written to the console, it
98       affects one of the control functions described below. Control sequences
99       are not displayed on screen.
100
101
102       A  number  of control sequences (or control character functions) are of
103       the form:
104
105
106       CTRL-x
107
108
109        where x represents a singe character., such  as  CNTRL-J  for  a  line
110       feed.
111
112
113       Other ANSI control sequences are of the form:
114
115         ESC [ params char
116
117
118       Note -
119
120         Spaces are included only for readability; these characters must occur
121         in the given sequence without the intervening spaces.
122
123       ESC       ASCII escape character (ESC, CTRL-[, 0x1B).
124
125
126       [         Left square bracket `[' (0x5B).
127
128
129       params    Sequence of zero or more decimal numbers made  up  of  digits
130                 between 0 and 9, separated by semicolons. Parameters are rep‐
131                 resented by n in the syntax descriptions for escape  sequence
132                 functions.
133
134
135       char      Function  character,  which  is  different  for  each control
136                 sequence and it represented by x in the  syntax  descriptions
137                 for control character functions.
138
139
140
141       In  the following examples of syntactically valid escape sequences, ESC
142       represent the single ASCII character, Escape:
143
144       ESC[m                 Select graphic rendition with default parameter
145
146
147       ESC[7m                Select graphic rendition with reverse image
148
149
150       ESC[33;54H            Set cursor position
151
152
153       ESC[123;456;0;;3;B    Move cursor down
154
155
156
157       Syntactically valid control characters and ANSI escape  sequences  that
158       are not currently interpreted by the console are ignored.
159
160
161       Each  control  function  requires  a specified number of parameters. If
162       fewer parameters are supplied, the remaining parameters  (with  certain
163       exceptions noted below) default  to 1. If more parameters are supplied,
164       the first n parameters are used by kernel terminal  emulator.  In  con‐
165       trast,   only  the  last  n parameters are used by PROM based emulator,
166       where n is the number required by that particular command character.
167
168
169       Parameters which are omitted or set to 0 are reset to the default value
170       of  1  (with  certain exceptions). For example, the command character M
171       requires one parameter. ESC[;M, ESC[0M, ESC[M and  ESC[23;15;32;1M  are
172       all equivalent to ESC[1M and provide a parameter value of 1.  Note that
173       ESC[;5M (interpreted as `ESC[5M') is not equivalent to ESC[5;M  (inter‐
174       preted as `ESC[5;1M') which is ultimately interpreted as `ESC[1M').
175
176   ANSI Control Functions
177       The following paragraphs specify the ANSI control functions implemented
178       by the console.  Each description provides:
179
180           o      Control sequence syntax
181
182           o      Hexadecimal equivalent of control characters where  applica‐
183                  ble
184
185           o      Control function name and ANSI or Sun abbreviation (if any).
186
187           o      Description of parameters required, if any
188
189           o      Description of the control function
190
191           o      Initial  setting  of the mode for functions that set a mode.
192                  To restore the initial settings,  use  the  SUNRESET  escape
193                  sequence.
194
195   Control Character Functions
196       The wscons control character functions are:
197
198       Bell (BEL),
199       CTRL-G
200       0x7
201                             Used  for  consoles that are not equipped with an
202                             audible bell. Current Sun workstation models also
203                             flash  the screen if the keyboard is not the con‐
204                             sole input device.
205
206
207       Backspace (BS),       The cursor moves one position to the left on  the
208       CTRL-H,               current  line.  If it is already at the left edge
209       0x8                   of the screen, no change takes place.
210
211
212       Tab (TAB),            The cursor moves right on the current line to the
213       CTRL-I,               next  tab stop.  The tab stops are fixed at every
214       0x9                   multiple of  eight  columns.  If  the  cursor  is
215                             already  at the right edge of the screen, nothing
216                             change takes place. Otherwise, the  cursor  moves
217                             right  a  minimum  of  one and a maximum of eight
218                             character positions.
219
220
221       Line-feed (LF),       The cursor, while remaining at the same character
222       CTRL-J,               position on the line, moves down one line. If the
223       0xA                   cursor is at the bottom line, the  screen  either
224                             scrolls  up or wraps around depending on the set‐
225                             ting of an internal variable n  (initially  1)  .
226                             The  internal  variable  can be changed using the
227                             ESC[r control sequence.  If  n  is  greater  than
228                             zero, the entire screen (including the cursor) is
229                             scrolled up by n lines before executing the line-
230                             feed.  The  top n lines scroll off the screen and
231                             are lost.  New blank lines n scroll onto the bot‐
232                             tom of the screen. After scrolling, move the cur‐
233                             sor down one line to execute the line feed.
234
235                             If n is zero, wrap-around mode  is  entered.  The
236                             ESC  [  1 r exits back to scroll mode. If a line-
237                             feed occurs on the bottom line in wrap mode,  the
238                             cursor goes to the same character position in the
239                             top line of the screen.  During  line-feeds,  the
240                             line  that  the cursor moves to is cleared and no
241                             scrolling occurs. Wrap-around mode is not  imple‐
242                             mented in the window system.
243
244                             On  SPARC  based  systems, the speed at which the
245                             screen scrolls is dependent on the amount of data
246                             waiting  to be printed.  Whenever a scroll occurs
247                             and the console is in normal scroll mode (ESC [ 1
248                             r), it scans the rest of the data awaiting print‐
249                             ing to see how many line-feeds occur in it.  This
250                             scan stops when the console finds a control char‐
251                             acter from the set {VT, FF,  SO,  SI,  DLE,  DC1,
252                             DC2,  DC3, DC4, NAK, SYN, ETB, CAN, EM, SUB, ESC,
253                             FS, GS, RS, US} .  At that point, the  screen  is
254                             scrolled  by  n lines (n ≥ 1) and processing con‐
255                             tinues. The scanned text  is  processed  normally
256                             and  fills in the newly created lines. As long as
257                             escape codes or other control characters are  not
258                             intermixed  with the text, this results in faster
259                             scrolling
260
261
262       Reverse Line-feed,    With kernel terminal emulator (while remaining at
263       CTRL-K,               the  same  character  position  on the line), the
264       0xB                   cursor  moves down one line. However,  with  PROM
265                             based emulator (while remaining at the same char‐
266                             acter position on the line), the cursor  moves up
267                             one  line.  If  the  cursor is already at the top
268                             line, no  change takes place.
269
270
271       Form-feed (FF)        The cursor is positioned  to  the  home  position
272       CTRL-L,               (upper-left  corner)  and  the  entire  screen is
273       0xC                   cleared.
274
275
276       Return (CR),          The cursor moves to the leftmost character  posi‐
277       CTRL-M,               tion on the current line.
278       0xD
279
280   Escape Sequence Functions
281       The wscons escape sequence functions are:
282
283       Escape (ESC),
284       CTRL-[,
285       0x1B
286
287           The  escape  character.  Escape initiates a multi-character control
288           sequence.
289
290
291       Insert Character (ICH)
292       ESC[#@
293
294           Takes one parameter, n (default 1).  Inserts n spaces at  the  cur‐
295           rent  cursor  position.   The current line, starting at the current
296           cursor position inclusive, is shifted to the right by  n  character
297           positions  to make room for the spaces.  The rightmost  n character
298           positions shift off the line and are lost. The position of the cur‐
299           sor is unchanged.
300
301
302       Cursor Up (CUU),
303       ESC[#A
304
305           Takes  one  parameter, n (default 1).  Moves the cursor up n lines.
306           If the cursor is fewer than  n lines from the top  of  the  screen,
307           moves  the cursor to the topmost line on the screen.  The character
308           position of the cursor on the line is unchanged.
309
310
311       Cursor Down (CUD),
312       ESC[#B
313
314           Takes one parameter,  (default 1).  Moves the cursor down  n lines.
315           If the cursor is fewer than  n lines from the bottom of the screen,
316           move the cursor to the last line  on  the  screen.   The  character
317           position of the cursor on the line is unchanged.
318
319
320       Cursor Forward (CUF),
321       ESC[#C
322
323           Takes  one parameter, n (default 1).  Moves the cursor to the right
324           by  n character positions on the current line.  If  the  cursor  is
325           fewer  than   n  positions from the right edge of the screen, moves
326           the cursor to the rightmost position on the current line.
327
328
329       Cursor Backward (CUB),
330       ESC[#D
331
332           Takes one parameter, n (default 1).  Moves the cursor to  the  left
333           by   n  character  positions on the current line.  If the cursor is
334           fewer than  n positions from the left edge of the screen, moves the
335           cursor to the leftmost position on the current line.
336
337
338       Cursor Next Line (CNL),
339       ESC[#E
340
341           Takes  one  parameter,  n (default 1).  Positions the cursor at the
342           leftmost character position on the  n-th  line  below  the  current
343           line.  If  the current line is less than n lines from the bottom of
344           the screen, positions the cursor at the leftmost character position
345           on the bottom line.
346
347
348       Horizontal and Vertical Position (HVP),
349       ESC[#1;#2f
350
351           or
352
353
354       Cursor Position (CUP),
355       ESC[#1;#2H
356
357           Takes  two  parameters, n1 and n2 (default 1, 1).  Moves the cursor
358           to the n2-th character position on the n1-th line.  Character posi‐
359           tions  are  numbered  from  1  at the left edge of the screen; line
360           positions are numbered from 1 at the top of the screen.  Hence,  if
361           both parameters are omitted, the default action moves the cursor to
362           the home position (upper left corner).  If only  one  parameter  is
363           supplied, the cursor moves to column 1 of the specified line.
364
365
366       Erase in Display (ED),
367       ESC[J
368
369           Takes  no  parameters.   Erases  from  the  current cursor position
370           inclusive to the end of the screen, that is, to the end of the cur‐
371           rent  line  and all lines below the current line.  The cursor posi‐
372           tion is unchanged.
373
374
375       Erase in Line (EL),
376       ESC[K
377
378           Takes no parameters.   Erases  from  the  current  cursor  position
379           inclusive  to  the end of the current line.  The cursor position is
380           unchanged.
381
382
383       Insert Line (IL),
384       ESC[#L
385
386           Takes one parameter, n (default 1).  Makes room  for  n  new  lines
387           starting at the current line by scrolling down by  n lines the por‐
388           tion of the screen from the current line inclusive to  the  bottom.
389           The   n  new lines at the cursor are filled with spaces; the bottom
390           n lines shift off the bottom of the screen and are lost.  The posi‐
391           tion of the cursor on the screen is unchanged.
392
393
394       Delete Line (DL),
395       ESC[#M
396
397           Takes  one  parameter,   n  (default 1).  Deletes n lines beginning
398           with the current line. The portion of the screen from  the  current
399           line  inclusive  to the bottom is scrolled upward by  n lines.  The
400           n new lines scrolling onto the bottom of the screen are filled with
401           spaces;  the  n old lines beginning at the cursor line are deleted.
402           The position of the cursor on the screen is unchanged.
403
404
405       Delete Character (DCH),
406       ESC[#P
407
408           Takes one parameter,  n (default 1).  Deletes  n characters  start‐
409           ing  with the current cursor position.  Shifts the tail of the cur‐
410           rent line to the left by  n character positions  from  the  current
411           cursor  position,  inclusive,  to  the end of the line.  Blanks are
412           shifted into the rightmost  n character positions.  The position of
413           the cursor on the screen is unchanged.
414
415
416       Select Graphic Rendition (SGR),
417       ESC[#m
418
419           Takes  one parameter,  n (default 0).  Note that unlike most escape
420           sequences, the parameter defaults to zero if omitted.  Invokes  the
421           graphic rendition specified by the parameter.  All following print‐
422           ing characters in the data stream are  rendered  according  to  the
423           parameter  until the next occurrence of this escape sequence in the
424           data stream. With PROM-based emulator, only two graphic  renditions
425           are defined:
426
427           0    Normal rendition
428
429
430           7    Negative (reverse) image
431
432           Negative  image displays characters as white-on-black if the screen
433           mode is currently black-on  white,  and  vice-versa.  Any  non-zero
434           value  of   n is currently equivalent to 7 and selects the negative
435           image rendition.
436
437           In addition to the two renditions mentioned  above,  the  following
438           ISO 6429-1983 graphic rendition values support color text with ker‐
439           nel terminal emulator:
440
441           30    black foreground
442
443
444           31    red foreground
445
446
447           32    green foreground
448
449
450           33    brown foreground
451
452
453           34    blue foreground
454
455
456           35    magenta foreground
457
458
459           36    cyan foreground
460
461
462           37    white foreground
463
464
465           40    black background
466
467
468           41    red background
469
470
471           42    green background
472
473
474           43    brown background
475
476
477           44    blue background
478
479
480           45    magenta background
481
482
483           46    cyan background
484
485
486           47    white background
487
488
489
490       Black On White (SUNBOW),
491       ESC[p
492
493           Takes no parameters.  On SPARC, sets the screen mode  to  black-on-
494           white.   If  the  screen  mode  is  already  black-on-white, has no
495           effect. In this mode, spaces display as solid white, other  charac‐
496           ters  as black-on-white. The cursor is a solid black block. Charac‐
497           ters displayed in negative image  rendition  (see  `Select  Graphic
498           Rendition'  above)  are  white-on-black. This comprises the initial
499           setting of the screen mode on reset. On x86 systems, use  ESC[q  to
500           set black-on-white.
501
502
503       White On Black (SUNWOB),
504       ESC[q
505
506           Takes  no  parameters.  On SPARC, sets the screen mode to white-on-
507           black.  If the  screen  mode  is  already  white-on-black,  has  no
508           effect.  In  this mode spaces display as solid black, other charac‐
509           ters as white-on-black.  The cursor is a solid white block.   Char‐
510           acters  displayed  in negative image rendition (see `Select Graphic
511           Rendition' above)  are  black-on-white.   Initial  setting  of  the
512           screen  mode  on reset is black on white. On x86 systems, use ESC[p
513           to set white-on-black.
514
515
516       ESC[#r
517       Set Scrolling (SUNSCRL)
518
519           Takes one parameter,  n (default 0). Sets to  n an internal  regis‐
520           ter  which  determines  how many lines the screen scrolls up when a
521           line-feed function is performed with the cursor on the bottom line.
522           A  parameter  of  2  or  3 introduces a small amount of jump when a
523           scroll occurs.  A parameter of 34 clears  the  screen  rather  than
524           scrolling.  The initial setting is 1 on reset.
525
526           A parameter of zero initiates wrap mode instead of scrolling.  If a
527           linefeed occurs on the bottom line during  wrap  mode,  the  cursor
528           goes  to the same character position in the top line of the screen.
529           When a line feed occurs, the line  that  the  cursor  moves  to  is
530           cleared  and  no  scrolling  occurs. ESC [ 1 r exits back to scroll
531           mode.
532
533           For more information, see the description of the Line-feed (CTRL-J)
534           control function above.
535
536
537       ESC[s
538       Reset terminal emulator (SUNRESET)
539
540           Takes no parameters.  Resets all modes to default, restores current
541           font from PROM. Screen and cursor position are unchanged.
542
543

RETURN VALUES

545       When there are no errors, the redirection ioctls have return values  as
546       described  above.  Otherwise, they return  −1 and set errno to indicate
547       the error. If the target stream is in an  error  state,  errno  is  set
548       accordingly.
549
550
551       If the target stream is in an error state, errno is set accordingly.
552

ERRORS

554       EBADF     target does not denote an open file.
555
556
557       ENOSTR    target does not denote a STREAMS device.
558
559

FILES

561       /dev/wscons     Workstation   console,  accessed  via  the  redirection
562                       facility
563
564
565       /dev/systty     Devices that must be opened  for  the  SRIOCSREDIR  and
566                       SRIOCISREDIR ioctls.
567
568
569       /dev/syscon     Access system console
570
571
572       /dev/console    Access system console
573
574

ATTRIBUTES

576       See attributes(5) for descriptions of the following attributes:
577
578
579
580
581       ┌─────────────────────────────┬─────────────────────────────┐
582       │      ATTRIBUTE TYPE         │      ATTRIBUTE VALUE        │
583       ├─────────────────────────────┼─────────────────────────────┤
584       │Interface Stability          │Stable                       │
585       └─────────────────────────────┴─────────────────────────────┘
586

SEE ALSO

588       cvcd(1M),  eeprom(1M),  ioctl(2),  poll(2), read(2), write(2), cvc(7D),
589       console(7D), visual_io(7I)
590

WARNINGS

592       The redirection ioctls block while there  is  I/O  outstanding  on  the
593       device  instance  being redirected. If you try to redirect the worksta‐
594       tion console while there is a outstanding read, the workstation console
595       will hang until the read completes.
596

NOTES

598       The cvc facility supersedes the SunOS wscons facility and should not be
599       used with wscons.
600
601
602
603SunOS 5.11                        26 May 2006                       wscons(7D)
Impressum