On Tue, Mar 08, 2016 at 02:23:19PM +0800, Fei Jie wrote:
> * tests/xetrlimit.c: New file.
> * tests/xetrlimit.test: New test.
> * tests/.gitignore: Add xetrlimit.
> * tests/Makefile.am (check_PROGRAMS): Likewise.
> (TESTS): Add xetrlimit.test.
> ---
>  tests/.gitignore     |  1 +
>  tests/Makefile.am    |  2 ++
>  tests/xetrlimit.c    | 38 ++++++++++++++++++++++++++++++++++++++
>  tests/xetrlimit.test | 11 +++++++++++
>  4 files changed, 52 insertions(+)
>  create mode 100644 tests/xetrlimit.c
>  create mode 100755 tests/xetrlimit.test
> 
> diff --git a/tests/.gitignore b/tests/.gitignore
> index c6a94d8..c842781 100644
> --- a/tests/.gitignore
> +++ b/tests/.gitignore
> @@ -139,4 +139,5 @@ xattr
>  xet_robust_list
>  xetitimer
>  xetpgid
> +xetrlimit
>  xettimeofday
> diff --git a/tests/Makefile.am b/tests/Makefile.am
> index 92d3255..32d7e0a 100644
> --- a/tests/Makefile.am
> +++ b/tests/Makefile.am
> @@ -187,6 +187,7 @@ check_PROGRAMS = \
>       xet_robust_list \
>       xetitimer \
>       xetpgid \
> +     xetrlimit \
>       xettimeofday \
>       # end of check_PROGRAMS
>  
> @@ -344,6 +345,7 @@ TESTS = \
>       xet_robust_list.test \
>       xetitimer.test \
>       xetpgid.test \
> +     xetrlimit.test \
>       xettimeofday.test \
>       \
>       count.test \
> diff --git a/tests/xetrlimit.c b/tests/xetrlimit.c
> new file mode 100644
> index 0000000..a2444d9
> --- /dev/null
> +++ b/tests/xetrlimit.c
> @@ -0,0 +1,38 @@
> +#include "tests.h"
> +#include <sys/syscall.h>
> +
> +#if defined __NR_getrlimit && defined __NR_setrlimit
> +
> +# include <errno.h>
> +# include <sys/time.h>
> +# include <sys/resource.h>
> +# include <stdio.h>
> +# include <unistd.h>
> +
> +int
> +main(void)
> +{
> +     struct rlimit *const rlim = tail_alloc(sizeof(struct rlimit));
> +     int rc = syscall(__NR_getrlimit, RLIMIT_NPROC, rlim);
> +     if (rc == -1)
> +             perror_msg_and_fail("getrlimit");
> +
> +     printf("getrlimit(RLIMIT_NPROC, {rlim_cur=%d, rlim_max=%d}) = %d\n",
> +            (int) rlim->rlim_cur, (int) rlim->rlim_max, rc);

Why "int"?  What about RLIM_INFINITY?


-- 
ldv

Attachment: pgp9FyYn9XuEA.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=278785111&iu=/4140
_______________________________________________
Strace-devel mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/strace-devel

Reply via email to