Commit Graph

19 Commits

Author SHA1 Message Date
Kir Kolyshkin af6b9e7fa9 nit: do not use syscall package
In many places (not all of them though) we can use `unix.`
instead of `syscall.` as these are indentical.

In particular, x/sys/unix defines:

```go
type Signal = syscall.Signal
type Errno = syscall.Errno
type SysProcAttr = syscall.SysProcAttr

const ENODEV      = syscall.Errno(0x13)
```

and unix.Exec() calls syscall.Exec().

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-04-18 16:16:49 -07:00
Kir Kolyshkin 0e062a78ae Remove signalmap, use unix.SignalNum
Since [1], x/sys/unix has a function to convert signal name
to a number. Let's use it and drop home-grown signal map.

While at it, add a test case.

[1] d455e41777

Signed-off-by: Kir Kolyshkin <kolyshkin@gmail.com>
2020-03-16 19:59:06 -07:00
Dominik Süß 0b412e9482 various cleanups to address linter issues
Signed-off-by: Dominik Süß <dominik@suess.wtf>
2018-10-13 21:14:03 +02:00
Valentin Kulesh 7ac503d1a2
kill.go: Remove unnecessary checks
... that prevent sending signals not mentioned in signal map.
Currently these are SIGRTMIN..SIGRTMAX.

Signed-off-by: Valentin Kulesh <valentin.kulesh@virtuozzo.com>
2018-01-26 09:52:05 +03:00
Vladimir Stefanovic 9916b7918d Put signalMap in a separate file, so it may be arch-specific
Some architectures don't have all the signals listed.
(Those architectures are mips and mips64, which don't have SIGSTKFLT
and SIGUNUSED. The next commit defines the map for mips and mips64.)

Signed-off-by: Vladimir Stefanovic <vladimir.stefanovic@imgtec.com>
2017-06-02 22:29:24 +02:00
Christy Perez 187d2d85be Moving the rest of runc to x/sys/unix
Signed-off-by: Christy Perez <christy@linux.vnet.ibm.com>
2017-05-22 17:36:02 -05:00
Giuseppe Scrivano 1d6447797e kill: requires max 2 arguments
Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-02-02 17:32:54 +01:00
Giuseppe Scrivano b760919f33 kill: make second argument optional
commit b517076907 added a check that kill accepts two arguments.
Since the second argument is optional, change it back to accept the
shorter form "kill CONTAINER".

Signed-off-by: Giuseppe Scrivano <gscrivan@redhat.com>
2017-01-19 10:13:08 +01:00
Zhang Wei b517076907 Check args numbers before application start
Add a general args number validator for all client commands.

Signed-off-by: Zhang Wei <zhangwei555@huawei.com>
2016-11-29 11:18:51 +08:00
Michael Crosby e58671e530 Add --all flag to kill
This allows a user to send a signal to all the processes in the
container within a single atomic action to avoid new processes being
forked off before the signal can be sent.

This is basically taking functionality that we already use being
`delete` and exposing it ok the `kill` command by adding a flag.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-11-08 09:35:02 -08:00
Shukui Yang a367e4b95c Add num check for kill command
Signed-off-by: Shukui Yang <yangshukui@huawei.com>
2016-10-11 14:15:04 +08:00
Mrunal Patel a753b06645 Replace github.com/codegangsta/cli by github.com/urfave/cli
The package got moved to a different repository

Signed-off-by: Mrunal Patel <mrunalp@gmail.com>
2016-06-06 11:47:20 -07:00
Zhao Lei 8cd952f0a2 manual: Unify EXAMPLE title in code and manual
There are 3 types of EXAMPLE title in manual and code:
1: "# EXAMPLE"
   runc-delete.8.md
   runc-exec.8.md
   runc-kill.8.md
2: "EXAMPE:"
   runc-spec.8.md
3: EXAMPLE title exist in manual, but not exist in code's --help output
   delete.go
   exec.go
   kill.go

This patch unified above format, and deleted some useless blanks.

Signed-off-by: Zhao Lei <zhaolei@cn.fujitsu.com>
2016-05-25 10:48:11 +08:00
Qiang Huang 8477638aab Update cli package
The old one has bug when showing help message for IntFlags.

Signed-off-by: Qiang Huang <h.huangqiang@huawei.com>
2016-05-10 13:58:09 +08:00
Mike Brown f4e37ab63e updating usage for runc and runc commands
Signed-off-by: Mike Brown <brownwm@us.ibm.com>
2016-02-17 09:00:39 -06:00
Michael Crosby a7278cad98 Require containerd id as arg 1
Closes #532

This requires the container id to always be passed to all runc commands
as arg one on the cli.  This was the result of the last OCI meeting and
how operations work with the spec.

Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2016-02-09 11:20:55 -08:00
Lai Jiangshan 6abd42c1b6 Add the default signal (SIGTERM) for runc kill
Signed-off-by: Lai Jiangshan <jiangshanlai@gmail.com>
2015-08-13 23:42:54 +08:00
Michael Crosby fbb8d3e8fe Add parse signal function for runc kill
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
2015-08-04 11:35:13 -07:00
rajasec 067890ce20 container kill support
Signed-off-by: rajasec <rajasec79@gmail.com>
2015-08-03 16:12:20 +05:30