From cdc49e5fb72dfadd09831a10dbb2387afaed5001 Mon Sep 17 00:00:00 2001 From: Dmitry Vyukov Date: Mon, 4 Jun 2018 11:16:25 +0200 Subject: Update syscall_descriptions_syntax.md extend resource description --- docs/syscall_descriptions_syntax.md | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) (limited to 'docs') diff --git a/docs/syscall_descriptions_syntax.md b/docs/syscall_descriptions_syntax.md index c3159155e..6a683145b 100644 --- a/docs/syscall_descriptions_syntax.md +++ b/docs/syscall_descriptions_syntax.md @@ -131,14 +131,13 @@ but rather length of a particular chosen option. ## Resources -Custom resources are described as: +Resources represent values that need to be passed from output of one syscall to input of another syscall. For example, `close` syscall requires an input value (fd) previously returned by `open` or `pipe` syscall. To achieve this, `fd` is declared as a resource. Resources are described as: ``` -resource identifier "[" underlying_type "]" [ ":" const ("," const)* ] +"resource" identifier "[" underlying_type "]" [ ":" const ("," const)* ] ``` -`underlying_type` is either one of `int8`, `int16`, `int32`, `int64`, `intptr` or another resource. -Resources can then be used as types. For example: +`underlying_type` is either one of `int8`, `int16`, `int32`, `int64`, `intptr` or another resource (which models inheritance, for example, a socket is a subype of fd). The optional set of constants represent resource special values, for example, `0xffffffffffffffff` (-1) for "no fd", or `AT_FDCWD` for "the current dir". Special values are used once in a while as resource values. If no special values specified, special value of `0` is used. Resources can then be used as types, for example: ``` resource fd[int32]: 0xffffffffffffffff, AT_FDCWD, 1000000 -- cgit mrf-deployment