Skip to content

Commit f612efb

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 f612efb

File tree

5 files changed

+58
-6
lines changed

5 files changed

+58
-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: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
// Copyright 2022 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//go:build hurd
6+
// +build hurd
7+
8+
package unix
9+
10+
/*
11+
#include <stdint.h>
12+
int ioctl(int, unsigned long int, uintptr_t);
13+
*/
14+
import "C"
15+
16+
func ioctl(fd int, req uint, arg uintptr) (err error) {
17+
r0, er := C.ioctl(C.int(fd), C.ulong(req), C.uintptr_t(arg))
18+
if r0 == -1 && er != nil {
19+
err = er
20+
}
21+
return
22+
}
23+

unix/syscall_hurd_386.go

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
// Copyright 2022 The Go Authors. All rights reserved.
2+
// Use of this source code is governed by a BSD-style
3+
// license that can be found in the LICENSE file.
4+
5+
//go:build 386 && hurd
6+
// +build 386,hurd
7+
8+
package unix
9+
10+
const (
11+
TIOCGETA = 0x62251713
12+
)
13+
14+
type Winsize struct {
15+
Row uint16
16+
Col uint16
17+
Xpixel uint16
18+
Ypixel uint16
19+
}
20+
21+
type Termios struct {
22+
Iflag uint32
23+
Oflag uint32
24+
Cflag uint32
25+
Lflag uint32
26+
Cc [20]uint8
27+
Ispeed int32
28+
Ospeed int32
29+
}

0 commit comments

Comments
 (0)