Lines Matching refs:the
4 Your guide to the ancient and twisted locking policies of the tty layer and
5 the warped logic behind them. Beware all ye who read on.
11 Line disciplines are registered with tty_register_ldisc() passing the
12 discipline number and the ldisc structure. At the point of registration the
14 the call returns success. If the call returns an error then it won't get
15 called. Do not re-use ldisc numbers as they are part of the userspace ABI
17 After the return the ldisc data has been copied so you may free your own
18 copy of the structure. You must not re-register over the top of the line
19 discipline even with the same data or your computer again will be eaten by
23 In ancient times this always worked. In modern times the function will
24 return -EBUSY if the ldisc is currently in use. Since the ldisc referencing
25 code manages the module counts this should not usually be a concern.
27 Heed this warning: the reference count field of the registered copies of the
28 tty_ldisc structure in the ldisc table counts the number of lines using this
29 discipline. The reference count of the tty_ldisc structure within a tty
30 counts the number of active users of the ldisc at this instant. In effect it
31 counts the number of threads of execution within an ldisc method (plus those
39 open() - Called when the line discipline is attached to
40 the terminal. No other call into the line
43 state needed by the ldisc, and set receive_room
44 in the tty_struct to the maximum amount of data
45 the line discipline is willing to accept from the
47 Returning an error will prevent the ldisc from
50 close() - This is called on a terminal when the line
51 discipline is being unplugged. At the point of
52 execution no further users will enter the
55 hangup() - Called when the tty line is hung up.
56 The line discipline should cease I/O to the tty.
57 No further calls into the ldisc code will occur.
61 the line. Multiple read calls may occur in parallel
62 and the ldisc must deal with serialization issues.
63 If not defined, the process will receive an EIO
66 write() - (optional) A process requests writing data to the
67 line. Multiple write calls are serialized by the
68 tty layer for the ldisc. If not defined, the
72 open and close, and instructs the line discipline
75 chars_in_buffer() - (optional) Report the number of bytes in the input
79 The caller passes the old termios data and the
80 current data is in the tty. Called under the
84 poll() - (optional) Check the status for the poll/select
88 ioctl() - (optional) Called when an ioctl is handed to the
89 tty layer that might be for the ldisc. Multiple
93 to the tty layer that might be for the ldisc.
99 receive_buf() - (optional) Called by the low-level driver to hand
100 a buffer of received bytes to the ldisc for
102 to exceed the current value of tty->receive_room.
105 receive_buf2() - (optional) Called by the low-level driver to hand
106 a buffer of received bytes to the ldisc for
107 processing. Returns the number of bytes processed.
114 is needed but always races versus calls. Thus the
119 from the ->write call from the ldisc as the ldisc
120 is permitted to call the driver write method from
123 dcd_change() - Report to the tty line the current DCD pin status
124 changes and the relative timestamp. The timestamp
130 Line discipline methods can call the following methods of the underlying
131 hardware driver through the function pointers within the tty->driver
134 write() Write a block of characters to the tty device.
135 Returns the number of characters accepted. The
139 put_char() Queues a character for writing to the tty device.
140 If there is no room in the queue, the character is
147 write_room() Returns the numbers of characters the tty driver
154 set_termios() Notify the tty driver that the device's termios
157 the "old" argument.
159 The API is defined such that the driver should return
160 the actual modes selected. This means that the
162 bits in the request it cannot fulfill to indicate
163 the actual modes being used. A device with no
167 throttle() Notify the tty driver that input buffers for the
170 sent to the tty.
172 unthrottle() Notify the tty driver that characters can now be
173 sent to the tty without fear of overrunning the
174 input buffers of the line disciplines.
176 stop() Ask the tty driver to stop outputting characters
177 to the tty device.
179 start() Ask the tty driver to resume sending characters
180 to the tty device.
182 hangup() Ask the tty driver to hang up the tty device.
184 break_ctl() (Optional) Ask the tty driver to turn on or off
185 BREAK status on the RS-232 port. If state is -1,
186 then the BREAK status should be turned on; if
191 wait_until_sent() Waits until the device has written out all of the
194 send_xchar() Send a high-priority XON/XOFF character to the device.
199 Line discipline methods have access to tty->flags field containing the
206 TTY_DO_WRITE_WAKEUP If set, causes the driver to call the ldisc's
212 calls on the tty to fail, returning -EIO.
214 TTY_OTHER_CLOSED Device is a pty and the other side has closed.
222 Callers to the line discipline functions from the tty layer are required to
223 take line discipline locks. The same is true of calls from the driver side
230 takes a handle to the line discipline in the tty and returns it. If no ldisc
231 is currently attached or the ldisc is being closed and re-opened at this
232 point then NULL is returned. While this handle is held the ldisc will not
237 Returns the ldisc reference and allows the ldisc to be closed. Returning the
238 reference takes away your right to call the ldisc functions until you take
243 Performs the same function as tty_ldisc_ref except that it will wait for an
244 ldisc change to complete and then return a reference to the new ldisc.
246 While these functions are slightly slower than the old code they should have
247 minimal impact as most receive logic uses the flip buffers and they only
248 need to take a reference when they push bits up through the driver.
251 functions are called with the ldisc unavailable. Thus tty_ldisc_ref will
261 close() - Called when a device is closed. At the point of
262 return from this call the driver must make no
265 write() - Called to write bytes to the device. May not
270 put_char() - Stuff a single character onto the queue. The
274 flush_chars() - Ask the kernel to write put_char queue
276 write_room() - Return the number of characters that can be stuffed
277 into the port buffers without overflow (or less).
281 ioctl() - Called when an ioctl may be for the driver
286 set_ldisc() - Notifier for discipline change. At the point this
287 is done the discipline is not yet usable. Can now
290 throttle() - Called by the ldisc to ask the driver to do flow
292 is the job of the ldisc layer.
294 unthrottle() - Called by the ldisc to ask the driver to stop flow
297 stop() - Ldisc notifier to the driver to stop output. As with
298 throttle the serializations with start() are down
299 to the ldisc layer.
301 start() - Ldisc notifier to the driver to start output.
303 hangup() - Ask the tty driver to cause a hangup initiated
304 from the host side. [Can sleep ??]
310 wait_until_sent() - Wait for characters to exit the hardware queue
311 of the driver. Can sleep
313 send_xchar() - Send XON/XOFF and if possible jump the queue with