Expression rules
Word expression rules
Pathnames may contain not only regular characters but also spaces, carriage returns and multibyte characters. Such pathnames can be managed by TOMOYO Linux using octal expressions. Information from the table below can be used to represent special characters.
The first row indicates the lower 4 bits and the first column indicates the higher 4 bits.
0x0 |
0x1 |
0x2 |
0x3 |
0x4 |
0x5 |
0x6 |
0x7 |
0x8 |
0x9 |
0xA |
0xB |
0xC |
0xD |
0xE |
0xF |
|
---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
0x0 |
\000 |
\001 |
\002 |
\003 |
\004 |
\005 |
\006 |
\007 |
\010 |
\011 |
\012 |
\013 |
\014 |
\015 |
\016 |
\017 |
0x1 |
\020 |
\021 |
\022 |
\023 |
\024 |
\025 |
\026 |
\027 |
\030 |
\031 |
\032 |
\033 |
\034 |
\035 |
\036 |
\037 |
0x2 |
\040 |
! |
" |
# |
$ |
% |
& |
' |
( |
) |
* |
+ |
, |
- |
. |
/ |
0x3 |
0 |
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
: |
; |
< |
= |
> |
? |
0x4 |
@ |
A |
B |
C |
D |
E |
F |
G |
H |
I |
J |
K |
L |
M |
N |
O |
0x5 |
P |
Q |
R |
S |
T |
U |
V |
W |
X |
Y |
Z |
[ |
\\ |
] |
^ |
_ |
0x6 |
` |
a |
b |
c |
d |
e |
f |
g |
h |
i |
j |
k |
l |
m |
n |
o |
0x7 |
p |
q |
r |
s |
t |
u |
v |
w |
x |
y |
z |
{ |
| |
} |
~ |
\177 |
0x8 |
\200 |
\201 |
\202 |
\203 |
\204 |
\205 |
\206 |
\207 |
\210 |
\211 |
\212 |
\213 |
\214 |
\215 |
\216 |
\217 |
0x9 |
\220 |
\221 |
\222 |
\223 |
\224 |
\225 |
\226 |
\227 |
\230 |
\231 |
\232 |
\233 |
\234 |
\235 |
\236 |
\237 |
0xA |
\240 |
\241 |
\242 |
\243 |
\244 |
\245 |
\246 |
\247 |
\250 |
\251 |
\252 |
\253 |
\254 |
\255 |
\256 |
\257 |
0xB |
\260 |
\261 |
\262 |
\263 |
\264 |
\265 |
\266 |
\267 |
\270 |
\271 |
\272 |
\273 |
\274 |
\275 |
\276 |
\277 |
0xC |
\300 |
\301 |
\302 |
\303 |
\304 |
\305 |
\306 |
\307 |
\310 |
\311 |
\312 |
\313 |
\314 |
\315 |
\316 |
\317 |
0xD |
\320 |
\321 |
\322 |
\323 |
\324 |
\325 |
\326 |
\327 |
\330 |
\331 |
\332 |
\333 |
\334 |
\335 |
\336 |
\337 |
0xE |
\340 |
\341 |
\342 |
\343 |
\344 |
\345 |
\346 |
\347 |
\350 |
\351 |
\352 |
\353 |
\354 |
\355 |
\356 |
\357 |
0xF |
\360 |
\361 |
\362 |
\363 |
\364 |
\365 |
\366 |
\367 |
\370 |
\371 |
\372 |
\373 |
\374 |
\375 |
\376 |
\377 |
Notes:
- The "\" character (0x5c) is used for indicating octal expression. Thus, "\\" must be used to represent a "\".
- The characters 0x00 to 0x20, and 0x7F to 0xFF are represented using the expression "\ooo".
- The space character (0x20) is used as a delimiter that separates words, while the line feed character (0x0A) is used as a delimiter that separates lines.
- All other characters are regarded as a space character.
- Multiple spaces are automatically compressed into one space, and leading and trailing spaces are automatically deleted.
Examples:
- The string "Hello world!" should be expressed as "Hello\040world!".
Wildcard expression rules
Pathnames may contain wildcards that match multiple pathnames. The supported wildcards are outlined in the following table:
Wildcard |
Pattern match |
Examples |
---|---|---|
\* |
0 or more repetitions of characters other than "/" |
/var/log/samba/\* |
\@ |
0 or more repetitions of characters other than "/" or "." |
/var/www/html/\@.html |
\? |
1 byte character other than "/" |
/tmp/mail.\?\?\?\?\?\? |
\$ |
1 or more repetitions of decimal digits |
/proc/\$/cmdline |
\+ |
1 decimal digit. |
/var/tmp/my_work.\+ |
\X |
1 or more repetitions of hexadecimal digits |
/var/tmp/my-work.\X |
\x |
1 hexadecimal digit |
/tmp/my-work.\x |
\A |
1 or more repetitions of alphabet characters |
/var/log/my-work/\$-\A-\$.log |
\a |
1 alphabet character |
/home/users/\a/\*/public_html/\*.html |
\- |
Pathname subtraction operator (negative match) |
/\*\-proc\-sys/ This will match /\*/ directories except "/proc/" and "/sys/". |
/\{dir\}/ |
Recursive directory matching operator. Matches "/" and 1 or more repetitions of "dir/". |
/var/www/html/\{\*\}/ This will match all subdirectories under /var/www/html/ . Note that /var/www/html/ will not match. /var/www/html/\{\*\}/\*.html This will match all *.html files in subdirectories under /var/www/html/ . Note that /var/www/html/\*.html will not match. |
Filesystem expression rules
Pathnames generally begin with a "/", but pathnames on filesystems that do not support rename() operation are represented using filesystem's name as a prefix.
To see a list of filesystems supported by your kernel, run the following command:
$ cat /proc/filesystems
The proc filesystem (which is likely mounted on /proc/ directory) is an example of filesystems that do not support rename() operation. Therefore, the file "/proc/meminfo" is represented as "proc:/meminfo".