aboutsummaryrefslogtreecommitdiffstats
path: root/docs/syscall_descriptions_syntax.md
diff options
context:
space:
mode:
authorDmitry Vyukov <dvyukov@google.com>2018-05-17 12:02:30 +0200
committerDmitry Vyukov <dvyukov@google.com>2018-05-17 12:02:30 +0200
commit031c7941d7bd97b4acbf9bcd2513ed695b387ff2 (patch)
treed64f385075a30115dd950a8e2d714e22eef5e18b /docs/syscall_descriptions_syntax.md
parent90c54c496b268f0977517448e8f7de54e93b975d (diff)
pkg/compiler: add optional builtin template
type optional[T] [ val T void void ] [varlen]
Diffstat (limited to 'docs/syscall_descriptions_syntax.md')
-rw-r--r--docs/syscall_descriptions_syntax.md12
1 files changed, 8 insertions, 4 deletions
diff --git a/docs/syscall_descriptions_syntax.md b/docs/syscall_descriptions_syntax.md
index 47986651c..4708dc804 100644
--- a/docs/syscall_descriptions_syntax.md
+++ b/docs/syscall_descriptions_syntax.md
@@ -185,10 +185,7 @@ type filename string[filename]
## Type Templates
-**Note: type templates are experimental, can have error handling bugs and are subject to change**
-
Type templates can be declared as follows:
-
```
type buffer[DIR] ptr[DIR, array[int8]]
type fileoff[BASE] BASE
@@ -200,11 +197,18 @@ type nlattr[TYPE, PAYLOAD] {
```
and later used as follows:
-
```
syscall(a buffer[in], b fileoff[int64], c ptr[in, nlattr[FOO, int32]])
```
+There is builtin type template `optional` defined as:
+```
+type optional[T] [
+ val T
+ void void
+] [varlen]
+```
+
## Length
You can specify length of a particular field in struct or a named argument by using `len`, `bytesize` and `bitsize` types, for example: