diff options
author | Mark Wielaard <mjw@redhat.com> | 2010-03-19 13:00:50 +0100 |
---|---|---|
committer | Mark Wielaard <mjw@redhat.com> | 2010-03-19 13:20:57 +0100 |
commit | 8bd0f6dce9effdb8bde2fb2cc6ab2c68be8d32d7 (patch) | |
tree | dbe38d1df4deeca7904a6285202f8a8dbcdd0898 /tapset/aux_syscalls.stp | |
parent | 3651ea20da2292ec86cafca4ca4a8f220df910cf (diff) | |
download | systemtap-steved-8bd0f6dce9effdb8bde2fb2cc6ab2c68be8d32d7.tar.gz systemtap-steved-8bd0f6dce9effdb8bde2fb2cc6ab2c68be8d32d7.tar.xz systemtap-steved-8bd0f6dce9effdb8bde2fb2cc6ab2c68be8d32d7.zip |
PR11402 Support pipe2 syscall.
The pipe2() was added to Linux in version 2.6.27. It is a variant of the
normal pipe syscall, but takes an extra flags argument which can be the
ORed value of O_NONBLOCK and O_CLOEXEC.
* tapset/aux_syscalls.stp (_sys_pipe2_flag_str:string): New helper function.
* tapset/syscalls2.stp (syscall.pipe2, syscall.pipe2.return): New probes.
Diffstat (limited to 'tapset/aux_syscalls.stp')
-rw-r--r-- | tapset/aux_syscalls.stp | 19 |
1 files changed, 19 insertions, 0 deletions
diff --git a/tapset/aux_syscalls.stp b/tapset/aux_syscalls.stp index fdd6f6af..84342448 100644 --- a/tapset/aux_syscalls.stp +++ b/tapset/aux_syscalls.stp @@ -554,6 +554,25 @@ function _flock_cmd_str(c) { return substr(bs,0,strlen(bs)-1) } +/* `man 2 pipe2` for more information */ +function _sys_pipe2_flag_str:string (f:long) +%{ /* pure */ /* unprivileged */ + long flags = THIS->f; + char *str = THIS->__retvalue; + int len; + +#if defined(O_NONBLOCK) && defined(O_CLOEXEC) + if (flags & O_NONBLOCK) + strlcat(str, "O_NONBLOCK|", MAXSTRINGLEN); + if (flags & O_CLOEXEC) + strlcat(str, "O_CLOEXEC|", MAXSTRINGLEN); +#endif + + len = strlen(str); + if (len) + str[strlen(str)-1] = 0; +%} + /* `man 2 open` for more information */ function _sys_open_flag_str:string (f:long) %{ /* pure */ |