diff options
author | Tom Lane | 2025-01-30 21:44:47 +0000 |
---|---|---|
committer | Tom Lane | 2025-01-30 21:44:47 +0000 |
commit | b9d232b9de89aa9282f9a2e7c85f783bcd334af2 (patch) | |
tree | f80e8c9c53e69761113beed93118beb33897dc09 /src/include/miscadmin.h | |
parent | b9aa4166fa3823d4f1f76286ca21fcfa991ce036 (diff) |
Use "ssize_t" not "long" in max_stack_depth-related code.
This change adapts these functions to the machine's address width
without depending on "long" to be the right size. (It isn't on
Win64, for example.) While it seems unlikely anyone would care
to run with a stack depth limit exceeding 2GB, this is part of a
general push to avoid using type "long" to represent memory sizes.
It's convenient to use ssize_t rather than the perhaps-more-obvious
choice of size_t/Size, because the code involved depends on working
with a signed data type. Our MAX_KILOBYTES limit already ensures
that ssize_t will be sufficient to represent the maximum value of
max_stack_depth.
Extracted from a larger patch by Vladlen, plus additional hackery
by me.
Author: Vladlen Popolitov <v.popolitov@postgrespro.ru>
Author: Tom Lane <tgl@sss.pgh.pa.us>
Discussion: https://postgr.es/m/1a01f0-66ec2d80-3b-68487680@27595217
Diffstat (limited to 'src/include/miscadmin.h')
-rw-r--r-- | src/include/miscadmin.h | 4 |
1 files changed, 2 insertions, 2 deletions
diff --git a/src/include/miscadmin.h b/src/include/miscadmin.h index d016a9c9248..a2b63495eec 100644 --- a/src/include/miscadmin.h +++ b/src/include/miscadmin.h @@ -293,7 +293,7 @@ extern PGDLLIMPORT bool VacuumCostActive; extern PGDLLIMPORT int max_stack_depth; /* Required daylight between max_stack_depth and the kernel limit, in bytes */ -#define STACK_DEPTH_SLOP (512 * 1024L) +#define STACK_DEPTH_SLOP (512 * 1024) typedef char *pg_stack_base_t; @@ -301,7 +301,7 @@ extern pg_stack_base_t set_stack_base(void); extern void restore_stack_base(pg_stack_base_t base); extern void check_stack_depth(void); extern bool stack_is_too_deep(void); -extern long get_stack_depth_rlimit(void); +extern ssize_t get_stack_depth_rlimit(void); /* in tcop/utility.c */ extern void PreventCommandIfReadOnly(const char *cmdname); |