Jump to contentJump to page navigation: previous page [access key p]/next page [access key n]
documentation.suse.com / SUSE Linux Enterprise Real Time Documentation / How to Shield Your Linux Resources / Using Shortcuts
Applies to SUSE Linux Enterprise Real Time 12 SP5

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

tux > cset shield -s -p 1234
tux > cset sh -s -p 1234
tux > cset set -c 1,3 -s newset
tux > cset se -c 1,3 -s newset
tux > cset proc -s newset -e bash
tux > cset p -s newset -e bash

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

tux > cset shield -s -p 1234,500-649
tux > cset sh 1234,500-649
tux > cset shield -s -e bash
tux > cset sh bash

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

tux > cset shield -s -p 1234
tux > cset sh -s 1234
tux > cset shield -u -p 1234
tux > cset sh -u 1234

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

tux > cset set -l -s myset
tux > cset se -l myset
tux > cset se -l myset
tux > cset se myset
tux > cset set -c 1,2,3 -s newset
tux > cset se -c 1,2,3 newset
tux > cset set -d -s newset
tux > cset se -d newset
tux > cset set -n newname -s oldname
tux > cset se -n newname oldname

In fact, if you want to apply either the list or the destroy options to multiple cpusets 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 ourset


cset 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 cpusets:

Long method

Short method

tux > cset proc -l -s myset

or

tux > cset proc -l -f myset

or

tux > cset proc -l -t myset
tux > cset p -l myset
tux > cset p -l myset
tux > cset p myset
tux > cset proc -l -s one two
tux > cset p -l one two
tux > cset p -l one two
tux > cset p one two

To execute a process into a cpuset:

Long method

Short method

tux > cset proc -s myset -e bash
tux > cset p myset -e bash

Moving tasks into and out of cpusets have the following shortcuts. To move a PIDSPEC into a cpuset:

Long method

Short method

tux > cset proc -m -p 4242,4243 -s myset
tux > cset p -m 4242,4243 myset
tux > cset proc -m -p 12 -t myset
tux > cset p -m 12 myset

To move all tasks from one cpuset to another:

Long method

Short method

tux > cset proc -m -f set1 -t set2

or

tux > cset proc -m -s set1 -t set2

or

tux > cset proc -m -f set1 -s set2
tux > cset p -m set1 set2