Update GOPATH in VSCode project (now in gerrit)
[src/xds/xds-gdb.git] / gdb-common_linux.go
1 /*
2  * Copyright (C) 2017-2018 "IoT.bzh"
3  * Author Sebastien Douheret <sebastien@iot.bzh>
4  *
5  * Licensed under the Apache License, Version 2.0 (the "License");
6  * you may not use this file except in compliance with the License.
7  * You may obtain a copy of the License at
8  *
9  *   http://www.apache.org/licenses/LICENSE-2.0
10  *
11  * Unless required by applicable law or agreed to in writing, software
12  * distributed under the License is distributed on an "AS IS" BASIS,
13  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
14  * See the License for the specific language governing permissions and
15  * limitations under the License.
16  *
17  */
18
19 package main
20
21 import (
22         "os"
23         "syscall"
24         "unsafe"
25 )
26
27 const syscallEBADE = syscall.EBADE
28
29 func fcntl(fd uintptr, cmd int, arg int) (val int, err error) {
30         r, _, e := syscall.Syscall(syscall.SYS_FCNTL, fd, uintptr(cmd),
31                 uintptr(arg))
32         val = int(r)
33         if e != 0 {
34                 err = e
35         }
36         return
37 }
38
39 func tcsetattr(fd uintptr, termios *syscall.Termios) error {
40         r, _, e := syscall.Syscall(syscall.SYS_IOCTL,
41                 fd, uintptr(syscall.TCSETS), uintptr(unsafe.Pointer(termios)))
42         if r != 0 {
43                 return os.NewSyscallError("SYS_IOCTL", e)
44         }
45         return nil
46 }
47
48 func tcgetattr(fd uintptr, termios *syscall.Termios) error {
49         r, _, e := syscall.Syscall(syscall.SYS_IOCTL,
50                 fd, uintptr(syscall.TCGETS), uintptr(unsafe.Pointer(termios)))
51         if r != 0 {
52                 return os.NewSyscallError("SYS_IOCTL", e)
53         }
54         return nil
55 }
56
57 func isIgnoredSignal(sig os.Signal) bool {
58         return (sig == syscall.SIGWINCH)
59 }