1. 08 Apr, 2016 3 commits
  2. 06 Apr, 2016 1 commit
  3. 05 Apr, 2016 1 commit
  4. 02 Apr, 2016 2 commits
  5. 25 Mar, 2016 1 commit
  6. 22 Mar, 2016 2 commits
  7. 15 Mar, 2016 1 commit
  8. 03 Mar, 2016 1 commit
  9. 29 Feb, 2016 1 commit
    • Benoit Sigoure's avatar
      x/sys/unix: Add support for the setns system call. · 54535356
      Benoit Sigoure authored
      This system call is used to reassociate the current thread with a Linux
      namespace (e.g. a network namespace or a mount namespace).  This system
      call is key to interacting with the primitives enabling Linux containers.
      The users of this system call will most likely want to wrap their calls
      with a pair of LockOSThread / UnlockOSThread calls.  Here is an example
      that is a reasonably close approximation of the `ns_exec' program given
      as an example in `man 2 setns':
      
      	package main
      
      	import (
      		"log"
      		"os"
      		"os/exec"
      		"runtime"
      
      		"golang.org/x/sys/unix"
      	)
      
      	func main() {
      		if len(os.Args) < 3 {
      			log.Fatalf("%s /proc/PID/ns/FILE cmd args...", os.Args[0])
      		}
      		fd, err := unix.Open(os.Args[1], unix.O_RDONLY, 0)
      		if err != nil {
      			log.Fatalf("open: %s", err)
      		}
      		runtime.LockOSThread()
      		defer runtime.UnlockOSThread()
      		if err = unix.Setns(fd, 0); err != nil {
      			log.Fatalf("setns: %s", err)
      		}
      		cmd := exec.Command(os.Args[2], os.Args[3:]...)
      		cmd.Stdin = os.Stdin
      		cmd.Stdout = os.Stdout
      		cmd.Stderr = os.Stderr
      		err = cmd.Run()
      		if err != nil {
      			log.Fatalf("exec: %s", err)
      		}
      	}
      
      Fixes golang/go#5968.
      
      Change-Id: I78dc54667cfaef4f9e99a08d48f6e423686f1b22
      Reviewed-on: https://go-review.googlesource.com/20054Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      54535356
  10. 28 Feb, 2016 2 commits
  11. 22 Feb, 2016 1 commit
  12. 04 Feb, 2016 1 commit
  13. 27 Jan, 2016 1 commit
  14. 21 Jan, 2016 1 commit
  15. 13 Jan, 2016 1 commit
  16. 11 Dec, 2015 1 commit
  17. 24 Nov, 2015 1 commit
    • Nick Patavalis's avatar
      unix: Fix Termios type definition · 2bacc619
      Nick Patavalis authored
      - types_linux.go: Use the kernel-defined termios structure, *not* the
        LIBC-defined one. The LIBC termios structure cannot be safely used
        to do tty-related ioctls on all architectures (e.g. ppc64,
        ppc64le). The kernel termios structure, and the associated
        macros/constants, are defined in: "asm/termbits.h" which is included
        by "linux/termios.h". The LIBC termios structure is defined in
        "bits/termios.h" which is included by "termios.h". These structures
        are *not* the same.
      
        For systems that have both "struct termios" and "struct termios2"
        use the latter to define the Termios type. This is ok, since the
        "struct termios2" memory layout is compatible with "struct termios"
        (with a couple of fields added at the end). This way, type Termios
        can be used with both: the "old-style" TCSETS[FW], TCGETS ioctls,
        *and* with the new TCSETS[FW]2, TCGETS2 ioctls. The new ioctls allow
        configuring arbitrary baudrates.
      
        The new Termios definitions (kernel-compatible) have the same fields
        as the old ones (LIBC-derived) so there should be no user-code
        compatibility issues.
      
      Change-Id: I3c1484c60f45b28e13404765c01616c33063afd5
      Reviewed-on: https://go-review.googlesource.com/17185Reviewed-by: 's avatarIan Lance Taylor <iant@golang.org>
      Reviewed-by: 's avatarBrad Fitzpatrick <bradfitz@golang.org>
      2bacc619
  18. 23 Nov, 2015 1 commit
  19. 29 Oct, 2015 1 commit
  20. 09 Oct, 2015 1 commit
  21. 08 Oct, 2015 1 commit
  22. 25 Sep, 2015 2 commits
  23. 24 Sep, 2015 1 commit
  24. 17 Sep, 2015 1 commit
    • Shawn Walker-Salas's avatar
      unix: add various missing syscalls available on Linux · 68a71b6b
      Shawn Walker-Salas authored
      Various syscalls offered by x/sys/unix on Linux are not available on
      Solaris and should be, such as Mkfifo, Getwd(), Futimes() and others.
      In particular, all of the *at() variants of existing functions were
      added where appropriate.
      
      Getgroups() was fixed to use the correct value for its sanity check on
      the maximum number of groups.
      
      Utimesnano() was updated to use the native Solaris utimensat function
      for setting nanosecond-precision time.
      
      Utimes() was updated to have the same error semantics and checking as
      other platforms.
      
      Getgroups(), anysocktoaddr(), and Recvmsg() were fixed to check the
      return value before assuming syscall failure instead of relying solely
      on errno being set.
      
      mksyscall_solaris.pl needed some updates to better match the output of
      the one found in syscall.
      
      mkerrors.sh needed some updates to work out of the box on Solaris,
      matching those recently done to the one in syscall.
      
      The signatures (names) of some function parameters were changed to be
      consistent with other platforms for the sake of documentation.
      
      Fixes #8609
      
      Change-Id: I9e4e2fee6d3ecfad9f4d845a5702ffde5166e804
      Reviewed-on: https://go-review.googlesource.com/14643Reviewed-by: 's avatarAram Hăvărneanu <aram@mgk.ro>
      68a71b6b
  25. 10 Sep, 2015 1 commit
  26. 09 Sep, 2015 1 commit
  27. 02 Sep, 2015 2 commits
  28. 01 Sep, 2015 2 commits
  29. 31 Aug, 2015 2 commits
  30. 30 Aug, 2015 1 commit
  31. 24 Aug, 2015 1 commit