| OLD | NEW |
| 1 /* Copyright 2013 The Chromium Authors. All rights reserved. | 1 /* Copyright 2013 The Chromium Authors. All rights reserved. |
| 2 * Use of this source code is governed by a BSD-style license that can be | 2 * Use of this source code is governed by a BSD-style license that can be |
| 3 * found in the LICENSE file. */ | 3 * found in the LICENSE file. */ |
| 4 | 4 |
| 5 #ifndef LIBRARIES_NACL_IO_IOCTL_H_ | 5 #ifndef LIBRARIES_NACL_IO_IOCTL_H_ |
| 6 #define LIBRARIES_NACL_IO_IOCTL_H_ | 6 #define LIBRARIES_NACL_IO_IOCTL_H_ |
| 7 | 7 |
| 8 /* ioctl to tell a tty mount to prefix every message with a particular | 8 #include <sys/types.h> |
| 9 * null-terminated string. Accepts a pointer to a C string which will | |
| 10 * be the prefix. | |
| 11 */ | |
| 12 #define TIOCNACLPREFIX 0xadcd01 | |
| 13 | 9 |
| 14 /* ioctl to feed input to a tty mount. Accepts a pointer to the following | 10 /* |
| 11 * ioctl to feed input to a tty node. Accepts a pointer to the following |
| 15 * struct (tioc_nacl_input_string), which contains a pointer to an array | 12 * struct (tioc_nacl_input_string), which contains a pointer to an array |
| 16 * of characters. | 13 * of characters. |
| 17 */ | 14 */ |
| 18 #define TIOCNACLINPUT 0xadcd02 | 15 #define TIOCNACLINPUT 0xadcd02 |
| 19 | 16 |
| 17 /* |
| 18 * ioctl to register an output handler with the tty node. Will fail |
| 19 * with EALREADY if a handler is already registered. Expects an |
| 20 * argument of type tioc_nacl_output. The handler will be called during |
| 21 * calls to write() on the thread that calls write(), or, for echoed input |
| 22 * during the TIOCNACLINPUT ioctl() on the thread calling ioctl(). The |
| 23 * handler should return the number of bytes written/handled, or -errno |
| 24 * if an error occured. |
| 25 */ |
| 26 #define TIOCNACLOUTPUT 0xadcd03 |
| 27 |
| 20 struct tioc_nacl_input_string { | 28 struct tioc_nacl_input_string { |
| 21 size_t length; | 29 size_t length; |
| 22 const char* buffer; | 30 const char* buffer; |
| 23 }; | 31 }; |
| 24 | 32 |
| 33 |
| 34 typedef ssize_t (*tioc_nacl_output_handler_t)(const char* buf, |
| 35 size_t count, |
| 36 void* user_data); |
| 37 |
| 38 struct tioc_nacl_output { |
| 39 tioc_nacl_output_handler_t handler; |
| 40 void* user_data; |
| 41 }; |
| 42 |
| 43 |
| 25 #endif /* LIBRARIES_NACL_IO_NACL_IO_H_ */ | 44 #endif /* LIBRARIES_NACL_IO_NACL_IO_H_ */ |
| OLD | NEW |