0
0
mirror of https://github.com/netwide-assembler/nasm.git synced 2025-10-10 00:25:06 -04:00
Files
nasm/nasmlib/rlimit.c
H. Peter Anvin 37d8ee5768 nasmlib/rlimit.c: fix broken comment
A comment that apparently was mangled during SPDX conversion.

Signed-off-by: H. Peter Anvin (Intel) <hpa@zytor.com>
2025-10-01 13:53:05 -07:00

49 lines
898 B
C

/* SPDX-License-Identifier: BSD-2-Clause */
/* Copyright 2020 The NASM Authors - All Rights Reserved */
#include "compiler.h"
#include "nasmlib.h"
#ifdef HAVE_SYS_RESOURCE_H
# include <sys/resource.h>
#endif
#if defined(HAVE_GETRLIMIT) && defined(RLIMIT_STACK)
size_t nasm_get_stack_size_limit(void)
{
struct rlimit rl;
if (getrlimit(RLIMIT_STACK, &rl))
return SIZE_MAX;
# ifdef RLIM_SAVED_MAX
if (rl.rlim_cur == RLIM_SAVED_MAX)
rl.rlim_cur = rl.rlim_max;
# endif
if (
# ifdef RLIM_INFINITY
rl.rlim_cur >= RLIM_INFINITY ||
# endif
# ifdef RLIM_SAVED_CUR
rl.rlim_cur == RLIM_SAVED_CUR ||
# endif
# ifdef RLIM_SAVED_MAX
rl.rlim_cur == RLIM_SAVED_MAX ||
# endif
(size_t)rl.rlim_cur != rl.rlim_cur)
return SIZE_MAX;
return rl.rlim_cur;
}
#else
size_t nasm_get_stack_size_limit(void)
{
return SIZE_MAX;
}
#endif