Skip to content

Commit 597b99c

Browse files
committed
unix: support TIOCGETA on GNU/Hurd
Add minimal support for GNU/Hurd to allow building third party packages which detect terminal support.
1 parent 3b1fc93 commit 597b99c

File tree

5 files changed

+50
-6
lines changed

5 files changed

+50
-6
lines changed

unix/gccgo.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build gccgo && !aix
6-
// +build gccgo,!aix
5+
//go:build gccgo && !aix && !hurd
6+
// +build gccgo,!aix,!hurd
77

88
package unix
99

unix/gccgo_c.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
// +build gccgo
6-
// +build !aix
5+
// +build gccgo,!hurd
6+
// +build !aix,!hurd
77

88
#include <errno.h>
99
#include <stdint.h>

unix/ioctl.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
// Use of this source code is governed by a BSD-style
33
// license that can be found in the LICENSE file.
44

5-
//go:build aix || darwin || dragonfly || freebsd || linux || netbsd || openbsd || solaris
6-
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
5+
//go:build aix || darwin || dragonfly || freebsd || hurd || linux || netbsd || openbsd || solaris
6+
// +build aix darwin dragonfly freebsd hurd linux netbsd openbsd solaris
77

88
package unix
99

unix/syscall_hurd.go

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
//go:build hurd
2+
// +build hurd
3+
4+
package unix
5+
6+
/*
7+
#include <stdint.h>
8+
int ioctl(int, unsigned long int, uintptr_t);
9+
*/
10+
import "C"
11+
12+
func ioctl(fd int, req uint, arg uintptr) (err error) {
13+
r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg))
14+
if r0 == -1 && er != nil {
15+
err = er
16+
}
17+
return
18+
}
19+

unix/syscall_hurd_386.go

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
//go:build 386 && hurd
2+
// +build 386,hurd
3+
4+
package unix
5+
6+
const (
7+
TIOCGETA = 0x62251713
8+
)
9+
10+
type Winsize struct {
11+
Row uint16
12+
Col uint16
13+
Xpixel uint16
14+
Ypixel uint16
15+
}
16+
17+
type Termios struct {
18+
Iflag uint32
19+
Oflag uint32
20+
Cflag uint32
21+
Lflag uint32
22+
Cc [20]uint8
23+
Ispeed int32
24+
Ospeed int32
25+
}

0 commit comments

Comments
 (0)