public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: Use sysconf (_SC_SIGSTKSZ) to set SIGSTKSZ and MINSIGSTKSZ.
@ 2023-05-16 11:11 Manjunath Matti
  2023-05-24 19:08 ` Florian Weimer
  0 siblings, 1 reply; 14+ messages in thread
From: Manjunath Matti @ 2023-05-16 11:11 UTC (permalink / raw)
  To: libc-alpha; +Cc: rajis, Manjunath Matti

Add support in PowerPC to use sysconf (_SC_SIGSTKSZ) to set SIGSTKSZ
and MINSIGSTKSZ similar to x86. The minimum signal stack size derived
from AT_MINSIGSTKSZ, which is the minimum number of bytes of free stack
space required in order to gurantee successful, non-nested handling
of a single signal whose handler is an empty function.

The kernel commit 2896b2dff49d0377e4372f470dcddbcb26f2be59 implements
AT_MINSIGSTKSZ AUXV entry, allowing userspace to dynamically size
stack allocations.
---
 .../unix/sysv/linux/powerpc/bits/sigstksz.h   | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h

diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h b/sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h
new file mode 100644
index 0000000000..399a49c1b0
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h
@@ -0,0 +1,33 @@
+/* Definition of MINSIGSTKSZ and SIGSTKSZ.  Linux/PowerPC version.
+   Copyright (C) 2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigstksz.h> directly; use <signal.h> instead."
+#endif
+
+#if defined __USE_DYNAMIC_STACK_SIZE && __USE_DYNAMIC_STACK_SIZE
+# include <unistd.h>
+
+/* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ).  */
+# undef SIGSTKSZ
+# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
+
+/* Minimum stack size for a signal handler: SIGSTKSZ/4.  */
+# undef MINSIGSTKSZ
+# define MINSIGSTKSZ (SIGSTKSZ >> 2)
+#endif
-- 
2.37.2


^ permalink raw reply	[flat|nested] 14+ messages in thread
* [PATCH] powerpc: Use sysconf (_SC_SIGSTKSZ) to set SIGSTKSZ and MINSIGSTKSZ.
@ 2023-04-24 10:52 Manjunath Matti
  2023-04-28 18:05 ` Tulio Magno Quites Machado Filho
  0 siblings, 1 reply; 14+ messages in thread
From: Manjunath Matti @ 2023-04-24 10:52 UTC (permalink / raw)
  To: libc-alpha; +Cc: rajis, Manjunath Matti

Add support in PowerPC to use sysconf (_SC_SIGSTKSZ) to set SIGSTKSZ
and MINSIGSTKSZ similar to x86.
---
 .../unix/sysv/linux/powerpc/bits/sigstksz.h   | 33 +++++++++++++++++++
 1 file changed, 33 insertions(+)
 create mode 100644 sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h

diff --git a/sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h b/sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h
new file mode 100644
index 0000000000..2bec1e7917
--- /dev/null
+++ b/sysdeps/unix/sysv/linux/powerpc/bits/sigstksz.h
@@ -0,0 +1,33 @@
+/* Definition of MINSIGSTKSZ and SIGSTKSZ.  Linux/PowerPC version.
+   Copyright (C) 2020-2023 Free Software Foundation, Inc.
+   This file is part of the GNU C Library.
+
+   The GNU C Library is free software; you can redistribute it and/or
+   modify it under the terms of the GNU Lesser General Public
+   License as published by the Free Software Foundation; either
+   version 2.1 of the License, or (at your option) any later version.
+
+   The GNU C Library is distributed in the hope that it will be useful,
+   but WITHOUT ANY WARRANTY; without even the implied warranty of
+   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
+   Lesser General Public License for more details.
+
+   You should have received a copy of the GNU Lesser General Public
+   License along with the GNU C Library; if not, see
+   <https://www.gnu.org/licenses/>.  */
+
+#ifndef _SIGNAL_H
+# error "Never include <bits/sigstksz.h> directly; use <signal.h> instead."
+#endif
+
+#if defined __USE_DYNAMIC_STACK_SIZE && __USE_DYNAMIC_STACK_SIZE
+# include <unistd.h>
+
+/* Default stack size for a signal handler: sysconf (SC_SIGSTKSZ).  */
+# undef SIGSTKSZ
+# define SIGSTKSZ sysconf (_SC_SIGSTKSZ)
+
+/* Minimum stack size for a signal handler: SIGSTKSZ/4.  */
+# undef MINSIGSTKSZ
+# define MINSIGSTKSZ (SIGSTKSZ >> 2)
+#endif
-- 
2.37.2


^ permalink raw reply	[flat|nested] 14+ messages in thread

end of thread, other threads:[~2023-06-23 12:01 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-05-16 11:11 [PATCH] powerpc: Use sysconf (_SC_SIGSTKSZ) to set SIGSTKSZ and MINSIGSTKSZ Manjunath Matti
2023-05-24 19:08 ` Florian Weimer
2023-06-23 12:01   ` Manjunath S Matti
  -- strict thread matches above, loose matches on Subject: below --
2023-04-24 10:52 Manjunath Matti
2023-04-28 18:05 ` Tulio Magno Quites Machado Filho
2023-05-03 16:12   ` Manjunath S Matti
2023-05-03 17:48     ` Tulio Magno Quites Machado Filho
2023-05-05 10:15       ` Manjunath S Matti
2023-05-05 14:14         ` Tulio Magno Quites Machado Filho
2023-05-09 12:24           ` Manjunath S Matti
2023-05-09 17:33             ` Tulio Magno Quites Machado Filho
2023-05-11 16:50               ` Manjunath S Matti
2023-05-17 22:18                 ` Rajalakshmi Srinivasaraghavan
2023-05-17 23:09                   ` H.J. Lu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).