4 Using Shortcuts #
The commands listed in the previous sections always used all the required
options. However, cset
does have a shortcut facility
that will execute certain commands without specifying all options. An
effort has been made to do this with the “principle of least
surprise”. This means that if you do not specify options, but do
specify parameters, then the outcome of the command should be intuitive as
possible.
Using shortcuts is not necessary. In fact, you can use either shortcuts or
long options. However, using long options instead of shortcuts does have a
use case: when you write a script intended to be self-documenting, or
perhaps when you generate cset
documentation.
To begin, the subcommands shield
,
set
and proc
can themselves be
shortened to the fewest number of characters that are unambiguous. For
example, the following commands are identical:
Long method |
Short method |
---|---|
|
|
|
|
|
|
The proc
command can be shortened to
p
, while shield
and
set
need two letters to disambiguate.
4.1 shield Subcommand Shortcuts #
The shield
subcommand supports two areas with
shortcuts: the short method (when there are no options given and where to
shield is the common use case), and the long method (which makes
-p/--pid
optional for the -s/--shield
and -u/--unshield
options).
For the common use case of actually shielding either a PIDSPEC or execing
a command into the shield, the following cset
commands
are equivalent.
Long method | Short method |
---|---|
|
|
|
|
When using the -s
or -u
shield/unshield
options, it is optional to use the -p
option to specify
a PIDSPEC. For example:
Long method |
Short method |
---|---|
|
|
|
|
4.2 set Subcommand Shortcuts #
The set
subcommand has a limited number of shortcuts.
The option --set
is optional usually
and the --list
option is also optional to
list sets. For example, these commands are equivalent:
Long method |
Short method |
---|---|
|
|
|
|
|
|
|
|
|
|
In fact, if you want to apply either the list or the destroy options to
multiple cpuset
s with one cset
command, you will not
need to use the -s
option. For example:
cset
se -d myset yourset ourset --> destroys cpusets: myset, yourset and oursetcset
se -l prio_high prio_med prio_low --> lists only cpusets prio_high, prio_med and prio_low --> the -l is optional in this case since list is default
4.3 proc
Subcommand Shortcuts #
For the proc
subcommand, the -s
, -t
and
-f
options to specify the cpuset
, the origination cpuset
and the destination cpuset
can sometimes be optional. For example, the
following commands are equivalent. To list tasks in cpuset
s:
Long method |
Short method |
---|---|
or
or
|
|
|
|
|
|
|
|
To execute a process into a cpuset
:
Long method |
Short method |
---|---|
|
|
Moving tasks into and out of cpuset
s have the following shortcuts.
To move a PIDSPEC into a cpuset
:
Long method |
Short method |
---|---|
|
|
|
|
To move all tasks from one cpuset
to another:
Long method |
Short method |
---|---|
or
or
|
|