On Fri, Feb 26, 2016 at 05:41:39PM +0800, Fei Jie wrote: > * tests/umask.c: New file. > * tests/umask.test: New test. > * tests/.gitignore: Add umask. > * tests/Makefile.am (check_PROGRAMS): Likewise. > (TESTS): Add umask.test. > --- > tests/.gitignore | 1 + > tests/Makefile.am | 2 ++ > tests/umask.c | 25 +++++++++++++++++++++++++ > tests/umask.test | 11 +++++++++++ > 4 files changed, 39 insertions(+) > create mode 100644 tests/umask.c > create mode 100755 tests/umask.test > > diff --git a/tests/.gitignore b/tests/.gitignore > index a5d586d..31b643c 100644 > --- a/tests/.gitignore > +++ b/tests/.gitignore > @@ -121,6 +121,7 @@ uid > uid16 > uid32 > uio > +umask > umount > umount2 > umovestr > diff --git a/tests/Makefile.am b/tests/Makefile.am > index 4603c92..6ce2def 100644 > --- a/tests/Makefile.am > +++ b/tests/Makefile.am > @@ -169,6 +169,7 @@ check_PROGRAMS = \ > uid16 \ > uid32 \ > uio \ > + umask \ > umount \ > umount2 \ > umovestr \ > @@ -325,6 +326,7 @@ TESTS = \ > uid16.test \ > uid32.test \ > uio.test \ > + umask.test \ > umount.test \ > umount2.test \ > umovestr.test \ > diff --git a/tests/umask.c b/tests/umask.c > new file mode 100644 > index 0000000..badc6f5 > --- /dev/null > +++ b/tests/umask.c > @@ -0,0 +1,25 @@ > +#include "tests.h" > +#include <sys/syscall.h> > + > +#ifdef __NR_umask > + > +# include <stdio.h> > +# include <sys/types.h> > +# include <sys/stat.h> > +# include <unistd.h> > + > +int > +main(void) > +{ > + mode_t rc = syscall(__NR_umask, 044);
You can assume that umask function provided by libc works and use it safely instead of syscall(). > + printf("umask(0%o) = 0%o\n", 044, rc); This would print zero umask as 00, which is probably not what you want. Let's use %#o format like strace parser does. -- ldv
pgpM62bk_wdVY.pgp
Description: PGP signature
------------------------------------------------------------------------------ Site24x7 APM Insight: Get Deep Visibility into Application Performance APM + Mobile APM + RUM: Monitor 3 App instances at just $35/Month Monitor end-to-end web transactions and take corrective actions now Troubleshoot faster and improve end-user experience. Signup Now! http://pubads.g.doubleclick.net/gampad/clk?id=272487151&iu=/4140
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel