diff options
author | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-22 22:59:17 +0000 |
---|---|---|
committer | sbc@chromium.org <sbc@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2013-08-22 22:59:17 +0000 |
commit | e74fd8e46df2b255e8d5d2bb4cb03d3c683dbda7 (patch) | |
tree | 1475679712a34f72f825cc6a2973a41751ffd28e /native_client_sdk | |
parent | 96cfa7b85bc4b1bd5fa137836e6d142651d9deba (diff) | |
download | chromium_src-e74fd8e46df2b255e8d5d2bb4cb03d3c683dbda7.zip chromium_src-e74fd8e46df2b255e8d5d2bb4cb03d3c683dbda7.tar.gz chromium_src-e74fd8e46df2b255e8d5d2bb4cb03d3c683dbda7.tar.bz2 |
[NaCl SDK] Add more termios functions to nacl_io
These new functions are currently only stubs and
do effect the tty device.
R=binji@chromium.org
Review URL: https://codereview.chromium.org/22839018
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@219139 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'native_client_sdk')
10 files changed, 115 insertions, 0 deletions
diff --git a/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h b/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h index a817565..7a4af07 100644 --- a/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h +++ b/native_client_sdk/src/libraries/nacl_io/include/sys/termios.h @@ -99,6 +99,11 @@ #define TCSADRAIN 1 #define TCSAFLUSH 2 +#define TCOOFF 0 +#define TCOON 1 +#define TCIOFF 2 +#define TCION 3 + typedef unsigned char cc_t; typedef unsigned short tcflag_t; typedef char speed_t; @@ -120,8 +125,17 @@ struct termios { __BEGIN_DECLS +speed_t cfgetispeed(const struct termios *termios_p); +speed_t cfgetospeed(const struct termios *termios_p); +int cfsetispeed(struct termios *termios_p, speed_t speed); +int cfsetospeed(struct termios *termios_p, speed_t speed); +int cfsetspeed(struct termios *termios_p, speed_t speed); + +int tcdrain(int fd); +int tcflow(int fd, int action); int tcflush(int fd, int queue_selector); int tcgetattr(int fd, struct termios *termios_p); +int tcsendbreak(int fd, int duration); int tcsetattr(int fd, int optional_actions, const struct termios *termios_p); __END_DECLS diff --git a/native_client_sdk/src/libraries/nacl_io/library.dsc b/native_client_sdk/src/libraries/nacl_io/library.dsc index acd2ba8..533bcf4 100644 --- a/native_client_sdk/src/libraries/nacl_io/library.dsc +++ b/native_client_sdk/src/libraries/nacl_io/library.dsc @@ -47,6 +47,11 @@ "syscalls/accept.c", "syscalls/access.c", "syscalls/bind.c", + "syscalls/cfgetispeed.c", + "syscalls/cfgetospeed.c", + "syscalls/cfsetspeed.c", + "syscalls/cfsetispeed.c", + "syscalls/cfsetospeed.c", "syscalls/chdir.c", "syscalls/chmod.c", "syscalls/chown.c", @@ -82,8 +87,11 @@ "syscalls/recvfrom.c", "syscalls/recvmsg.c", "syscalls/remove.c", + "syscalls/tcdrain.c", + "syscalls/tcflow.c", "syscalls/tcflush.c", "syscalls/tcgetattr.c", + "syscalls/tcsendbreak.c", "syscalls/tcsetattr.c", "syscalls/select.c", "syscalls/send.c", diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfgetispeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/cfgetispeed.c new file mode 100644 index 0000000..747e234 --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/syscalls/cfgetispeed.c @@ -0,0 +1,10 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "nacl_io/kernel_intercept.h" +#include "nacl_io/kernel_wrap.h" + +speed_t cfgetispeed(const struct termios *termios_p) { + return termios_p->c_ispeed; +} diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfgetospeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/cfgetospeed.c new file mode 100644 index 0000000..1e6ccb7 --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/syscalls/cfgetospeed.c @@ -0,0 +1,10 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "nacl_io/kernel_intercept.h" +#include "nacl_io/kernel_wrap.h" + +speed_t cfgetospeed(const struct termios *termios_p) { + return termios_p->c_ospeed; +} diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetispeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetispeed.c new file mode 100644 index 0000000..7ae776c --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetispeed.c @@ -0,0 +1,11 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "nacl_io/kernel_intercept.h" +#include "nacl_io/kernel_wrap.h" + +int cfsetispeed(struct termios *termios_p, speed_t speed) { + termios_p->c_ispeed = speed; + return 0; +} diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetospeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetospeed.c new file mode 100644 index 0000000..7e13b1a --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetospeed.c @@ -0,0 +1,11 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "nacl_io/kernel_intercept.h" +#include "nacl_io/kernel_wrap.h" + +int cfsetospeed(struct termios *termios_p, speed_t speed) { + termios_p->c_ospeed = speed; + return 0; +} diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetspeed.c b/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetspeed.c new file mode 100644 index 0000000..3d618e3 --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/syscalls/cfsetspeed.c @@ -0,0 +1,12 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include "nacl_io/kernel_intercept.h" +#include "nacl_io/kernel_wrap.h" + +int cfsetspeed(struct termios *termios_p, speed_t speed) { + termios_p->c_ispeed = speed; + termios_p->c_ospeed = speed; + return 0; +} diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcdrain.c b/native_client_sdk/src/libraries/nacl_io/syscalls/tcdrain.c new file mode 100644 index 0000000..49c078bb --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/syscalls/tcdrain.c @@ -0,0 +1,13 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include <errno.h> + +#include "nacl_io/kernel_intercept.h" +#include "nacl_io/kernel_wrap.h" + +int tcdrain(int fd) { + errno = ENOSYS; + return -1; +} diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcflow.c b/native_client_sdk/src/libraries/nacl_io/syscalls/tcflow.c new file mode 100644 index 0000000..a299153 --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/syscalls/tcflow.c @@ -0,0 +1,13 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include <errno.h> + +#include "nacl_io/kernel_intercept.h" +#include "nacl_io/kernel_wrap.h" + +int tcflow(int fd, int action) { + errno = ENOSYS; + return -1; +} diff --git a/native_client_sdk/src/libraries/nacl_io/syscalls/tcsendbreak.c b/native_client_sdk/src/libraries/nacl_io/syscalls/tcsendbreak.c new file mode 100644 index 0000000..9674467 --- /dev/null +++ b/native_client_sdk/src/libraries/nacl_io/syscalls/tcsendbreak.c @@ -0,0 +1,13 @@ +/* Copyright 2013 The Chromium Authors. All rights reserved. + * Use of this source code is governed by a BSD-style license that can be + * found in the LICENSE file. */ + +#include <errno.h> + +#include "nacl_io/kernel_intercept.h" +#include "nacl_io/kernel_wrap.h" + +int tcsendbreak(int fd, int duration) { + errno = ENOSYS; + return -1; +} |