On Tue, Mar 15, 2016 at 04:37:19PM +0800, Fei Jie wrote: > * resource.c (SYS_FUNC(getpriority)): Print the second syscall > argument using %d format. > * resource.c (SYS_FUNC(setpriority)): Print the second syscall > argument using %d format.
This could and should be merged into a single "line", e.g. * resource.c (SYS_FUNC(getpriority), SYS_FUNC(setpriority)): Print the second syscall argument using %d format. > +++ b/tests/xetpriority.c > @@ -0,0 +1,41 @@ > +#include "tests.h" > +#include <sys/syscall.h> > + > +#if defined __NR_getpriority && defined __NR_setpriority > + > +# include <errno.h> > +# include <stdio.h> > +# include <sys/time.h> > +# include <sys/resource.h> > +# include <unistd.h> > + > +int > +main(void) > +{ > + const int pid = getpid(); > + int rc = syscall(__NR_getpriority, PRIO_PROCESS, > + (unsigned long) 0xffffffff00000000 | pid); > + printf("getpriority(PRIO_PROCESS, %d) = %d\n", > + pid, rc); > + > + rc = syscall(__NR_setpriority, PRIO_PROCESS, > + (unsigned long) 0xffffffff00000000 | pid, > + (unsigned long) 0xffffffff00000000); > + > + printf("setpriority(PRIO_PROCESS, %d, 0) = ", pid); > + if (rc == 0) { > + printf("%d\n", rc); > + } else { > + printf("%d %s (%m)\n", > + rc, errno == EPERM ? "EPERM" : "EACCES"); > + } Theoretically, printf can clobber errno, so let's do it without a common printf statement. -- ldv
pgpS2d_kpAxWn.pgp
Description: PGP signature
------------------------------------------------------------------------------ Transform Data into Opportunity. Accelerate data analysis in your applications with Intel Data Analytics Acceleration Library. Click to learn more. http://pubads.g.doubleclick.net/gampad/clk?id=278785231&iu=/4140
_______________________________________________ Strace-devel mailing list Strace-devel@lists.sourceforge.net https://lists.sourceforge.net/lists/listinfo/strace-devel