1 /* Test NPTL with stack limit that is not a multiple of the page size.
2 Copyright (C) 2012-2013 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>
25 /* This sets the stack resource limit to 1023kb, which is not a multiple
26 of the page size since every architecture's page size is > 1k. */
27 #ifndef ODD_STACK_LIMIT
28 # define ODD_STACK_LIMIT (1023 * 1024)
31 static const char *command;
39 ret = getrlimit (RLIMIT_STACK, &rlim);
42 printf ("getrlimit failed: %s\n", strerror (errno));
45 rlim.rlim_cur = ODD_STACK_LIMIT;
46 ret = setrlimit (RLIMIT_STACK, &rlim);
49 printf ("setrlimit failed: %s\n", strerror (errno));
52 ret = system (command);
55 printf ("system failed: %s\n", strerror (errno));
59 return WEXITSTATUS (ret);
64 #define OPT_COMMAND 10000
65 #define CMDLINE_OPTIONS \
66 { "command", required_argument, NULL, OPT_COMMAND },
67 #define CMDLINE_PROCESS \
71 #define TEST_FUNCTION do_test ()
72 #include "../test-skeleton.c"