Skip to content

Commit 890f33e

Browse files
committed
unix: support isTerminal on GNU/Hurd
golang does not yet support GNU/Hurd, but adding TIOCGETA fixes logrus' isTerminal and mattn's isatty.IsTerminal, and consequently fixing several dozen of package build failures, and notably gitlab's runner.
1 parent 3b1fc93 commit 890f33e

File tree

6 files changed

+54
-6
lines changed

6 files changed

+54
-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 || linux || netbsd || openbsd || solaris || hurd
6+
// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris hurd
77

88
package unix
99

unix/zerrors_hurd_386.go

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
//go:build 386 && hurd
2+
// +build 386,hurd
3+
4+
package unix
5+
6+
const (
7+
TIOCGETA = 0x62251713
8+
)

unix/zsyscall_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/ztypes_hurd_386.go

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

0 commit comments

Comments
 (0)