aboutsummaryrefslogtreecommitdiffstats
path: root/vendor/golang.org/x/sys/unix/ioctl_zos.go
diff options
context:
space:
mode:
authorLibravatar Rutger Broekhoff2023-12-29 21:31:53 +0100
committerLibravatar Rutger Broekhoff2023-12-29 21:31:53 +0100
commit404aeae4545d2426c089a5f8d5e82dae56f5212b (patch)
tree2d84e00af272b39fc04f3795ae06bc48970e57b5 /vendor/golang.org/x/sys/unix/ioctl_zos.go
parent209d8b0187ed025dec9ac149ebcced3462877bff (diff)
downloadgitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.tar.gz
gitolfs3-404aeae4545d2426c089a5f8d5e82dae56f5212b.zip
Make Nix builds work
Diffstat (limited to 'vendor/golang.org/x/sys/unix/ioctl_zos.go')
-rw-r--r--vendor/golang.org/x/sys/unix/ioctl_zos.go71
1 files changed, 71 insertions, 0 deletions
diff --git a/vendor/golang.org/x/sys/unix/ioctl_zos.go b/vendor/golang.org/x/sys/unix/ioctl_zos.go
new file mode 100644
index 0000000..c8b2a75
--- /dev/null
+++ b/vendor/golang.org/x/sys/unix/ioctl_zos.go
@@ -0,0 +1,71 @@
1// Copyright 2020 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 zos && s390x
6
7package unix
8
9import (
10 "runtime"
11 "unsafe"
12)
13
14// ioctl itself should not be exposed directly, but additional get/set
15// functions for specific types are permissible.
16
17// IoctlSetInt performs an ioctl operation which sets an integer value
18// on fd, using the specified request number.
19func IoctlSetInt(fd int, req int, value int) error {
20 return ioctl(fd, req, uintptr(value))
21}
22
23// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
24//
25// To change fd's window size, the req argument should be TIOCSWINSZ.
26func IoctlSetWinsize(fd int, req int, value *Winsize) error {
27 // TODO: if we get the chance, remove the req parameter and
28 // hardcode TIOCSWINSZ.
29 return ioctlPtr(fd, req, unsafe.Pointer(value))
30}
31
32// IoctlSetTermios performs an ioctl on fd with a *Termios.
33//
34// The req value is expected to be TCSETS, TCSETSW, or TCSETSF
35func IoctlSetTermios(fd int, req int, value *Termios) error {
36 if (req != TCSETS) && (req != TCSETSW) && (req != TCSETSF) {
37 return ENOSYS
38 }
39 err := Tcsetattr(fd, int(req), value)
40 runtime.KeepAlive(value)
41 return err
42}
43
44// IoctlGetInt performs an ioctl operation which gets an integer value
45// from fd, using the specified request number.
46//
47// A few ioctl requests use the return value as an output parameter;
48// for those, IoctlRetInt should be used instead of this function.
49func IoctlGetInt(fd int, req int) (int, error) {
50 var value int
51 err := ioctlPtr(fd, req, unsafe.Pointer(&value))
52 return value, err
53}
54
55func IoctlGetWinsize(fd int, req int) (*Winsize, error) {
56 var value Winsize
57 err := ioctlPtr(fd, req, unsafe.Pointer(&value))
58 return &value, err
59}
60
61// IoctlGetTermios performs an ioctl on fd with a *Termios.
62//
63// The req value is expected to be TCGETS
64func IoctlGetTermios(fd int, req int) (*Termios, error) {
65 var value Termios
66 if req != TCGETS {
67 return &value, ENOSYS
68 }
69 err := Tcgetattr(fd, &value)
70 return &value, err
71}