github.com/mvdan/u-root-coreutils@v0.0.0-20230122170626-c2eef2898555/cmds/exp/rush/attr_linux.go (about)

     1  // Copyright 2012-2017 the u-root 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 linux
     6  // +build linux
     7  
     8  package main
     9  
    10  import (
    11  	"syscall"
    12  )
    13  
    14  func builtinAttr(c *Command) {
    15  	c.Cmd.SysProcAttr.Cloneflags |= syscall.CLONE_NEWNS
    16  }
    17  
    18  func forkAttr(c *Command) {
    19  	c.Cmd.SysProcAttr = &syscall.SysProcAttr{}
    20  	if c.BG {
    21  		c.Cmd.SysProcAttr.Setpgid = true
    22  	} else {
    23  		c.Cmd.SysProcAttr.Foreground = true
    24  		c.Cmd.SysProcAttr.Ctty = int(ttyf.Fd())
    25  	}
    26  }