tcflush & co.

107 views
Skip to first unread message

drago....@gmail.com

unread,
Sep 10, 2013, 5:27:42 PM9/10/13
to golan...@googlegroups.com
Hello,
I am trying to implement some of the linux syscalls: tcflush, tcdrain, etc, but apparently syscall, doesn't include the needed defines.
For example:
TCIOFLUSH constant is defined in the following files:
syscall/zerrors_netbsd_amd64.go:1250:   TCIOFLUSH                         = 0x3
syscall/zerrors_freebsd_amd64.go:1297:  TCIOFLUSH                         = 0x3
syscall/zerrors_netbsd_386.go:1260:     TCIOFLUSH                         = 0x3
syscall/zerrors_darwin_amd64.go:1008:   TCIOFLUSH                         = 0x3
syscall/zerrors_netbsd_arm.go:1249:     TCIOFLUSH                         = 0x3
syscall/zerrors_freebsd_arm.go:1303:    TCIOFLUSH                         = 0x3
syscall/zerrors_freebsd_386.go:1297:    TCIOFLUSH                         = 0x3
syscall/zerrors_openbsd_amd64.go:1166:  TCIOFLUSH                         = 0x3
syscall/zerrors_darwin_386.go:1008:     TCIOFLUSH                         = 0x3
syscall/zerrors_openbsd_386.go:1160:    TCIOFLUSH                         = 0x3

but not on my target platform: syscall/zerrors_linux_amd64.go 

The needed defines are in the following files on my machine:
/usr/include/asm-generic/termbits.h:192:#define      TCIOFLUSH       2                                                                                                                                                          
/usr/include/bits/termios.h:210:#define      TCIOFLUSH       2                                                                                                                                                                  
/usr/include/term.h:122:#ifndef TCIOFLUSH 
/usr/include/term.h:123:#define TCIOFLUSH 2

To make the needed syscall for the flush, I need its definition, it is defined in:
/usr/include/asm-generic/ioctls.h:29:#define TCFLSH          0x540B                                                                                                                                                             

Why these defines are not in the syscall, and are they supposed to be there at all?
Will I need to define them in my source code?
Thanks.

Ian Lance Taylor

unread,
Sep 10, 2013, 5:44:12 PM9/10/13
to Dragomir Ivanov, golang-nuts
I think this is a bug. Please file an issue. In mkerrors.sh
includes_Linux ought to #include <termios.h>.

> Why these defines are not in the syscall, and are they supposed to be there
> at all?
> Will I need to define them in my source code?

For now, yes, I think you will. Sorry.

Ian

Dave Cheney

unread,
Sep 11, 2013, 9:22:46 PM9/11/13
to Ian Lance Taylor, Dragomir Ivanov, golang-nuts
https://codereview.appspot.com/13660043/

If you wanted any other TC constants, now is the time to ask.
> --
> You received this message because you are subscribed to the Google Groups "golang-nuts" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
> For more options, visit https://groups.google.com/groups/opt_out.
Reply all
Reply to author
Forward
0 new messages