| 1 | /* sysconf_sigstksz (). Linux version. |
| 2 | Copyright (C) 2020 Free Software Foundation, Inc. |
| 3 | This file is part of the GNU C Library. |
| 4 | |
| 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. |
| 9 | |
| 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. |
| 14 | |
| 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 | <https://www.gnu.org/licenses/>. */ |
| 18 | |
| 19 | /* Return sysconf (_SC_SIGSTKSZ). */ |
| 20 | |
| 21 | static long int |
| 22 | sysconf_sigstksz (void) |
| 23 | { |
| 24 | long int minsigstacksize = GLRO(dl_minsigstacksize); |
| 25 | assert (minsigstacksize != 0); |
| 26 | _Static_assert (__builtin_constant_p (MINSIGSTKSZ), |
| 27 | "MINSIGSTKSZ is constant" ); |
| 28 | if (minsigstacksize < MINSIGSTKSZ) |
| 29 | minsigstacksize = MINSIGSTKSZ; |
| 30 | /* MAX (MINSIGSTKSZ, sysconf (_SC_MINSIGSTKSZ)) * 4. */ |
| 31 | long int sigstacksize = minsigstacksize * 4; |
| 32 | /* Return MAX (SIGSTKSZ, sigstacksize). */ |
| 33 | _Static_assert (__builtin_constant_p (SIGSTKSZ), |
| 34 | "SIGSTKSZ is constant" ); |
| 35 | if (sigstacksize < SIGSTKSZ) |
| 36 | sigstacksize = SIGSTKSZ; |
| 37 | return sigstacksize; |
| 38 | } |
| 39 | |