aboutsummaryrefslogtreecommitdiffstats
path: root/gdb-common_linux.go
diff options
context:
space:
mode:
Diffstat (limited to 'gdb-common_linux.go')
-rw-r--r--gdb-common_linux.go37
1 files changed, 37 insertions, 0 deletions
diff --git a/gdb-common_linux.go b/gdb-common_linux.go
new file mode 100644
index 0000000..a2f4bf6
--- /dev/null
+++ b/gdb-common_linux.go
@@ -0,0 +1,37 @@
+package main
+
+import (
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+const syscallEBADE = syscall.EBADE
+
+func fcntl(fd uintptr, cmd int, arg int) (val int, err error) {
+ r, _, e := syscall.Syscall(syscall.SYS_FCNTL, fd, uintptr(cmd),
+ uintptr(arg))
+ val = int(r)
+ if e != 0 {
+ err = e
+ }
+ return
+}
+
+func tcsetattr(fd uintptr, termios *syscall.Termios) error {
+ r, _, e := syscall.Syscall(syscall.SYS_IOCTL,
+ fd, uintptr(syscall.TCSETS), uintptr(unsafe.Pointer(termios)))
+ if r != 0 {
+ return os.NewSyscallError("SYS_IOCTL", e)
+ }
+ return nil
+}
+
+func tcgetattr(fd uintptr, termios *syscall.Termios) error {
+ r, _, e := syscall.Syscall(syscall.SYS_IOCTL,
+ fd, uintptr(syscall.TCGETS), uintptr(unsafe.Pointer(termios)))
+ if r != 0 {
+ return os.NewSyscallError("SYS_IOCTL", e)
+ }
+ return nil
+}