diff --git a/book/src/kernel/linux-compatibility/limitations-on-system-calls/system-call-matching-language.md b/book/src/kernel/linux-compatibility/limitations-on-system-calls/system-call-matching-language.md index fa1974aed..d17d71611 100644 --- a/book/src/kernel/linux-compatibility/limitations-on-system-calls/system-call-matching-language.md +++ b/book/src/kernel/linux-compatibility/limitations-on-system-calls/system-call-matching-language.md @@ -140,7 +140,7 @@ Consider [`sigaction`](https://man7.org/linux/man-pages/man2/sigaction.2.html): ```c struct sigaction = { - sa_flags: SA_NOCLDSTOP | SA_NOCLDWAIT, + sa_flags = SA_NOCLDSTOP | SA_NOCLDWAIT, .. }; ``` @@ -154,6 +154,23 @@ refers to the struct rule using the `` syntax. sigaction(signum, act = , oldact = ); ``` +Instead of defining a separate struct rule, +you can also inline the struct pattern directly in the parameter list. +This is convenient when the struct pattern is only used once +or when you want to express different constraints for the same struct type in different contexts. + +For example, the following rule inlines the struct pattern for `capget`: + +```c +capget( + hdrp = { + version = _LINUX_CAPABILITY_VERSION_3, + .. + }, + datap +); +``` + ### Matching Rules for Arrays SCML can describe how to match flags embedded inside the struct values of an array. @@ -276,23 +293,27 @@ Non‑terminals are in angle brackets, terminals in quotes. ::= '(' [ ] ')' ::= '..' | { ',' } [ ',' '..' ] - ::= '=' + ::= '=' + | '=' + | '=' | - ::= '|' - | - ::= + ::= { '|' } + ::= | '<' '>' - ::= '[' '<' '>' ']' + ::= '[' ']' + ::= '<' '>' - ::= 'struct' '=' '{' [ ',' '..' ] '}' + ::= 'struct' '=' + ::= '{' [ ',' '..' ] '}' ::= { ',' } ::= - | ':' - | ':' + | '=' + | '=' + | '=' - ::= '=' + ::= '=' ::= letter { letter | digit | '_' }