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