Skip to content

Commit

Permalink
Update signal to USR1 for backwards compat
Browse files Browse the repository at this point in the history
Signed-off-by: Michael Crosby <[email protected]>
  • Loading branch information
crosbymichael committed May 25, 2016
1 parent 72b4127 commit 41a5d5a
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 22 deletions.
18 changes: 9 additions & 9 deletions libcontainer/container.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,13 +76,13 @@ type BaseContainer interface {
//
// errors:
// ContainerDestroyed - Container no longer exists,
// Systemerror - System error.
// SystemError - System error.
Status() (Status, error)

// State returns the current container's state information.
//
// errors:
// Systemerror - System error.
// SystemError - System error.
State() (*State, error)

// Returns the current config of the container.
Expand All @@ -92,7 +92,7 @@ type BaseContainer interface {
//
// errors:
// ContainerDestroyed - Container no longer exists,
// Systemerror - System error.
// SystemError - System error.
//
// Some of the returned PIDs may no longer refer to processes in the Container, unless
// the Container state is PAUSED in which case every PID in the slice is valid.
Expand All @@ -102,15 +102,15 @@ type BaseContainer interface {
//
// errors:
// ContainerDestroyed - Container no longer exists,
// Systemerror - System error.
// SystemError - System error.
Stats() (*Stats, error)

// Set resources of container as configured
//
// We can use this to change resources when containers are running.
//
// errors:
// Systemerror - System error.
// SystemError - System error.
Set(config configs.Config) error

// Start a process inside the container. Returns error if process fails to
Expand All @@ -120,7 +120,7 @@ type BaseContainer interface {
// ContainerDestroyed - Container no longer exists,
// ConfigInvalid - config is invalid,
// ContainerPaused - Container is paused,
// Systemerror - System error.
// SystemError - System error.
Start(process *Process) (err error)

// StartI immediatly starts the process inside the conatiner. Returns error if process
Expand All @@ -131,7 +131,7 @@ type BaseContainer interface {
// ContainerDestroyed - Container no longer exists,
// ConfigInvalid - config is invalid,
// ContainerPaused - Container is paused,
// Systemerror - System error.
// SystemError - System error.
StartI(process *Process) (err error)

// Destroys the container after killing all running processes.
Expand All @@ -140,12 +140,12 @@ type BaseContainer interface {
// No error is returned if the container is already destroyed.
//
// errors:
// Systemerror - System error.
// SystemError - System error.
Destroy() error

// Signal sends the provided signal code to the container's initial process.
//
// errors:
// Systemerror - System error.
// SystemError - System error.
Signal(s os.Signal) error
}
8 changes: 3 additions & 5 deletions libcontainer/container_linux.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ const stdioFdCount = 3

// InitContinueSignal is used to signal the container init process to
// start the users specified process after the container create has finished.
const InitContinueSignal = syscall.SIGCONT
const InitContinueSignal = syscall.SIGUSR1

type linuxContainer struct {
id string
Expand Down Expand Up @@ -1089,10 +1089,8 @@ func (c *linuxContainer) runType() (Status, error) {
return Stopped, newSystemErrorWithCausef(err, "reading /proc/%d/environ", pid)
}
check := []byte("_LIBCONTAINER")
for _, v := range bytes.Split(environ, []byte("\x00")) {
if bytes.Contains(v, check) {
return Created, nil
}
if bytes.Contains(environ, check) {
return Created, nil
}
return Running, nil
}
Expand Down
14 changes: 6 additions & 8 deletions libcontainer/integration/template_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -89,14 +89,12 @@ func newTemplateConfig(rootfs string) *configs.Config {
Data: "mode=1777,size=65536k",
Flags: defaultMountFlags,
},
/*
{
Source: "mqueue",
Destination: "/dev/mqueue",
Device: "mqueue",
Flags: defaultMountFlags,
},
*/
{
Source: "mqueue",
Destination: "/dev/mqueue",
Device: "mqueue",
Flags: defaultMountFlags,
},
{
Source: "sysfs",
Destination: "/sys",
Expand Down

0 comments on commit 41a5d5a

Please sign in to comment.