This is the mail archive of the
newlib@sourceware.org
mailing list for the newlib project.
Re: General termios
On 6/2/06, Shaun Jackman <sjackman@gmail.com> wrote:
Is it better to leave the function undefined, or define the function
to return ENOSYS?
On second thought, I prefer leaving the functions undefined if the
ioctl isn't provided.
Cheers,
Shaun
Index: libc/sys/linux/termios.c
===================================================================
RCS file: /cvs/src/src/newlib/libc/sys/linux/termios.c,v
retrieving revision 1.3
diff -u -r1.3 termios.c
--- libc/sys/linux/termios.c 26 Aug 2002 18:56:08 -0000 1.3
+++ libc/sys/linux/termios.c 2 Jun 2006 16:18:27 -0000
@@ -9,13 +9,16 @@
#include <sys/ioctl.h>
+#ifdef TCGETS
int
tcgetattr(int fd,struct termios *termios_p)
{
return ioctl(fd,TCGETS,termios_p);
}
+#endif
+#ifdef TCSETS
int
tcsetattr(int fd,int optional_actions,const struct termios *termios_p)
{
@@ -37,8 +40,10 @@
}
return ioctl(fd,cmd,termios_p);
}
+#endif
#if !defined(_ELIX_LEVEL) || _ELIX_LEVEL >= 4
+# ifdef TIOCGPGRP
pid_t
tcgetpgrp(int fd)
{
@@ -48,25 +53,31 @@
return (pid_t)-1;
return (pid_t)p;
}
+# endif
+# ifdef TIOCSPGRP
int
tcsetpgrp(int fd, pid_t pid)
{
int p = (int)pid;
return ioctl(fd,TIOCSPGRP,&p);
}
+# endif
#endif /* !_ELIX_LEVEL || _ELIX_LEVEL >= 4 */
+#ifdef TCXONC
int
tcflow (int fd, int action)
{
return ioctl (fd, TCXONC, action);
}
+#endif
+#ifdef TCFLSH
int
tcflush (int fd, int queue_selector)
{
return ioctl (fd, TCFLSH, queue_selector);
}
-
+#endif