1 /* Test NPTL with stack limit that is not a multiple of the page size.
2 Copyright (C) 2012-2015 Free Software Foundation, Inc.
3 This file is part of the GNU C Library.
5 The GNU C Library is free software; you can redistribute it and/or
6 modify it under the terms of the GNU Lesser General Public
7 License as published by the Free Software Foundation; either
8 version 2.1 of the License, or (at your option) any later version.
10 The GNU C Library is distributed in the hope that it will be useful,
11 but WITHOUT ANY WARRANTY; without even the implied warranty of
12 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
13 Lesser General Public License for more details.
15 You should have received a copy of the GNU Lesser General Public
16 License along with the GNU C Library; if not, see
17 <http://www.gnu.org/licenses/>. */
22 #include <sys/resource.h>
26 /* This sets the stack resource limit to 1023kb, which is not a multiple
27 of the page size since every architecture's page size is > 1k. */
28 #ifndef ODD_STACK_LIMIT
29 # define ODD_STACK_LIMIT (1023 * 1024)
32 static const char *command
;
40 ret
= getrlimit (RLIMIT_STACK
, &rlim
);
43 printf ("getrlimit failed: %s\n", strerror (errno
));
46 rlim
.rlim_cur
= ODD_STACK_LIMIT
;
47 ret
= setrlimit (RLIMIT_STACK
, &rlim
);
50 printf ("setrlimit failed: %s\n", strerror (errno
));
53 ret
= system (command
);
56 printf ("system failed: %s\n", strerror (errno
));
60 return WEXITSTATUS (ret
);
65 #define OPT_COMMAND 10000
66 #define CMDLINE_OPTIONS \
67 { "command", required_argument, NULL, OPT_COMMAND },
68 #define CMDLINE_PROCESS \
72 #define TEST_FUNCTION do_test ()
73 #include "../test-skeleton.c"