61 | | === 1) int '''_sys_tty_alloc'''() === |
62 | | This function allocates a private TTY terminal to the calling task, and registers the TTY index in the task context. |
63 | | Returns 0 if success, returns -1 if not enough terminals. |
64 | | |
65 | | === 2) int '''_sys_tty_write'''( const char* buffer, unsigned int length, unsigned int channel ) === |
| 61 | === 1) int '''_sys_tty_alloc'''( unsigned int shared ) === |
| 62 | This function allocates a private TTY terminal to the calling thread, and registers the TTY terminal index (called channel) in the thread context. If the <shared> argument is non-zero, the same TTY channel is registered in the context of all others threads in the same vspace, resulting in one single TTY terminal shared by all threads in the vspace. The number of users is registered in the _tty_channel[channel] array. |
| 63 | |
| 64 | Returns 0 if success. |
| 65 | Returns -1 if no available TTY channel, or TTY already allocated. |
| 66 | |
| 67 | === 2) '''_sys_tty_release'''( ) === |
| 68 | This function release the TTY channel allocated to the calling thread. The corresponding thread context slot is reset (0xFFFFFFFF value), and the _tty_channel[channel] entry is decremented. The corresponding channel keep busy until |
| 69 | the value stored in _tty_channel[channel] is non-zero. |
| 70 | |
| 71 | Returns 0 if success. |
| 72 | Returns -1 if TTY already released. |
| 73 | |
| 74 | === 3) int '''_sys_tty_write'''( const char* buffer, unsigned int length, unsigned int channel ) === |