ioctl.go 950 B

123456789101112131415161718192021222324252627282930
  1. // 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. // +build aix darwin dragonfly freebsd linux netbsd openbsd solaris
  5. package unix
  6. import "runtime"
  7. // IoctlSetWinsize performs an ioctl on fd with a *Winsize argument.
  8. //
  9. // To change fd's window size, the req argument should be TIOCSWINSZ.
  10. func IoctlSetWinsize(fd int, req uint, value *Winsize) error {
  11. // TODO: if we get the chance, remove the req parameter and
  12. // hardcode TIOCSWINSZ.
  13. err := ioctlSetWinsize(fd, req, value)
  14. runtime.KeepAlive(value)
  15. return err
  16. }
  17. // IoctlSetTermios performs an ioctl on fd with a *Termios.
  18. //
  19. // The req value will usually be TCSETA or TIOCSETA.
  20. func IoctlSetTermios(fd int, req uint, value *Termios) error {
  21. // TODO: if we get the chance, remove the req parameter.
  22. err := ioctlSetTermios(fd, req, value)
  23. runtime.KeepAlive(value)
  24. return err
  25. }