From: Bruno Haible <bruno@clisp.org>
To: mtk.manpages@gmail.com, linux-man@vger.kernel.org
Subject: [patch] getrlimit.2: RLIMIT_STACK
Date: Sun, 23 May 2021 23:44:03 +0200 [thread overview]
Message-ID: <2409395.251dEh2nii@omega> (raw)
[-- Attachment #1: Type: text/plain, Size: 439 bytes --]
Hi,
The getrlimit(2) page says the RLIMIT_STACK applies to "the process stack".
However, in a multithreaded app, each thread has a stack. And RLIMIT_STACK
determines the size of the thread's stack (unless overridden by the
program).
I verified this through a test program on Linux/i386 and Linux/x86_64.
The code which implements this is in
- glibc/nptl/nptl-init.c for Linux,
- glibc/htl/pt-create.c for the Hurd.
Patch attached.
[-- Attachment #2: 0001-getrlimit.2-RLIMIT_STACK-applies-to-each-thread-s-st.patch --]
[-- Type: text/x-patch, Size: 1107 bytes --]
From 563e660d8cb46b566ea716d250cca4136a0ba88e Mon Sep 17 00:00:00 2001
From: Bruno Haible <bruno@clisp.org>
Date: Sun, 23 May 2021 23:37:12 +0200
Subject: [PATCH] getrlimit.2: RLIMIT_STACK applies to each thread's stack.
---
man2/getrlimit.2 | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/man2/getrlimit.2 b/man2/getrlimit.2
index 648fd3c..e8a123a 100644
--- a/man2/getrlimit.2
+++ b/man2/getrlimit.2
@@ -61,7 +61,7 @@
.\" 2008-05-07, mtk / Peter Zijlstra, Added description of RLIMIT_RTTIME
.\" 2010-11-06, mtk: Added documentation of prlimit()
.\"
-.TH GETRLIMIT 2 2021-03-22 "Linux" "Linux Programmer's Manual"
+.TH GETRLIMIT 2 2021-05-23 "Linux" "Linux Programmer's Manual"
.SH NAME
getrlimit, setrlimit, prlimit \- get/set resource limits
.SH SYNOPSIS
@@ -427,7 +427,7 @@ queued to the process.
.\" that was present in kernels <= 2.6.7. MTK Dec 04
.TP
.B RLIMIT_STACK
-This is the maximum size of the process stack, in bytes.
+This is the maximum size of the stack of each thread, in bytes.
Upon reaching this limit, a
.B SIGSEGV
signal is generated.
--
2.7.4
reply other threads:[~2021-05-23 22:42 UTC|newest]
Thread overview: [no followups] expand[flat|nested] mbox.gz Atom feed
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=2409395.251dEh2nii@omega \
--to=bruno@clisp.org \
--cc=linux-man@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox