Skip to contentSkip to conversation

getrlimit.2: RLIMIT_STACK

PATCH New Bruno Haible 1 participant 1 message May 23, 2021 Man-pages: manual pages for Linux -- Sections 2, 3, 4, 5, and 7

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 getrlimit.2: RLIMIT_STACK

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.

From 563e660d8cb46b566ea716d250cca4136a0ba88e Mon Sep 17 00:00:00 2001
From: Bruno Haible <[email protected]>
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(-)
man2/getrlimit.2 +2 -2
index 648fd3c..e8a123a 100644
@@ -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.
Signature · 1 line
2.7.4