Welcome to mirror list, hosted at ThFree Co, Russian Federation.

cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'newlib/libc/sys/linux/termios.c')
-rw-r--r--newlib/libc/sys/linux/termios.c72
1 files changed, 53 insertions, 19 deletions
diff --git a/newlib/libc/sys/linux/termios.c b/newlib/libc/sys/linux/termios.c
index 94567b16d..bc0ac550a 100644
--- a/newlib/libc/sys/linux/termios.c
+++ b/newlib/libc/sys/linux/termios.c
@@ -9,29 +9,63 @@
#include <sys/ioctl.h>
-int tcgetattr(int fd,struct termios *termios_p)
+int
+tcgetattr(int fd,struct termios *termios_p)
{
- return ioctl(fd,TCGETS,termios_p);
+ return ioctl(fd,TCGETS,termios_p);
}
-int tcsetattr(int fd,int optional_actions,const struct termios *termios_p)
+int
+tcsetattr(int fd,int optional_actions,const struct termios *termios_p)
{
- int cmd;
-
- switch (optional_actions) {
- case TCSANOW:
- cmd = TCSETS;
- break;
- case TCSADRAIN:
- cmd = TCSETSW;
- break;
- case TCSAFLUSH:
- cmd = TCSETSF;
- break;
- default:
- errno = EINVAL;
- return -1;
+ int cmd;
+
+ switch (optional_actions) {
+ case TCSANOW:
+ cmd = TCSETS;
+ break;
+ case TCSADRAIN:
+ cmd = TCSETSW;
+ break;
+ case TCSAFLUSH:
+ cmd = TCSETSF;
+ break;
+ default:
+ errno = EINVAL;
+ return -1;
}
- return ioctl(fd,cmd,termios_p);
+ return ioctl(fd,cmd,termios_p);
+}
+
+
+pid_t
+tcgetpgrp(int fd)
+{
+ int p;
+
+ if (ioctl(fd,TIOCGPGRP,&p) < 0)
+ return (pid_t)-1;
+ return (pid_t)p;
+}
+
+
+int
+tcsetpgrp(int fd, pid_t pid)
+{
+ int p = (int)pid;
+ return ioctl(fd,TIOCSPGRP,&p);
+}
+
+int
+tcflow (int fd, int action)
+{
+ return ioctl (fd, TCXONC, action);
}
+
+int
+tcflush (int fd, int queue_selector)
+{
+ return ioctl (fd, TCFLSH, queue_selector);
+}
+