blob: f121a8d64b8c8dad3982f5233ff6605e6c705441 [file] [log] [blame]
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -07001// Copyright 2018 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// +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
6
7package unix
8
Girish Gowdra161d27a2021-05-05 12:01:44 -07009import "runtime"
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070010
11// IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
12//
13// To change fd's window size, the req argument should be TIOCSWINSZ.
14func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
15 // TODO: if we get the chance, remove the req parameter and
16 // hardcode TIOCSWINSZ.
Girish Gowdra161d27a2021-05-05 12:01:44 -070017 err := ioctlSetWinsize(fd, req, value)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070018 runtime.KeepAlive(value)
19 return err
20}
21
22// IoctlSetTermios performs an ioctl on fd with a *Termios.
23//
24// The req value will usually be TCSETA or TIOCSETA.
25func IoctlSetTermios(fd int, req uint, value *Termios) error {
26 // TODO: if we get the chance, remove the req parameter.
Girish Gowdra161d27a2021-05-05 12:01:44 -070027 err := ioctlSetTermios(fd, req, value)
Matteo Scandoloa6a3aee2019-11-26 13:30:14 -070028 runtime.KeepAlive(value)
29 return err
30}