aboutsummaryrefslogtreecommitdiffstats
path: root/gdb-common_darwin.go
diff options
context:
space:
mode:
Diffstat (limited to 'gdb-common_darwin.go')
-rw-r--r--gdb-common_darwin.go42
1 files changed, 42 insertions, 0 deletions
diff --git a/gdb-common_darwin.go b/gdb-common_darwin.go
new file mode 100644
index 0000000..d167c5d
--- /dev/null
+++ b/gdb-common_darwin.go
@@ -0,0 +1,42 @@
+package main
+
+import (
+ "os"
+ "syscall"
+ "unsafe"
+)
+
+const (
+ syscallEBADE = syscall.EBADEXEC
+
+ syscall_TCGETS = 0x402c7413
+ syscall_TCSETS = 0x802c7414
+)
+
+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
+}