Merge Chromium + Blink git repositories
[chromium-blink-merge.git] / native_client_sdk / src / libraries / nacl_io / ioctl.h
blobd0c015615e8361f319362db51755d2944290ada8
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
3 * found in the LICENSE file. */
5 #ifndef LIBRARIES_NACL_IO_IOCTL_H_
6 #define LIBRARIES_NACL_IO_IOCTL_H_
8 #include <sys/types.h>
11 * ioctl to register an output handler with the tty node. Will fail with
12 * EALREADY if a handler is already registered. Expects an argument of type
13 * tioc_nacl_output. The handler will be called during calls to write() on the
14 * thread that calls write(), or, for echoed input during the
15 * NACL_IOC_HANDLEMESSAGE ioctl() on the thread calling ioctl(). The handler
16 * should return the number of bytes written/handled, or -errno if an error
17 * occured.
19 #define TIOCNACLOUTPUT 0xadcd03
22 * ioctl used to set a name for a JavaScript pipe. The name
23 * is a string that is used to uniquely identify messages posted to and from
24 * JavaScript which signifies that the message is destined for a
25 * particular pipe device. For this reason each device must have a
26 * unique prefix. Until a prefix is set on a given pipe any I/O operations
27 * will return EIO.
29 #define NACL_IOC_PIPE_SETNAME 0xadcd04
32 * Find out how much space is available in a nacl_io pipe.
33 * Argument type is "int*" which will be set to the amount of space in the
34 * pipe in bytes.
36 #define NACL_IOC_PIPE_GETOSPACE 0xadcd06
37 #define NACL_IOC_PIPE_GETISPACE 0xadcd07
40 * ioctl used to pass messages from JavaScript to a node.
41 * Argument type is "struct PP_Var*".
43 #define NACL_IOC_HANDLEMESSAGE 0xadcd05
45 typedef char* naclioc_jspipe_name;
47 typedef ssize_t (*tioc_nacl_output_handler_t)(const char* buf,
48 size_t count,
49 void* user_data);
51 struct tioc_nacl_output {
52 tioc_nacl_output_handler_t handler;
53 void* user_data;
57 #endif /* LIBRARIES_NACL_IO_NACL_IO_H_ */