Module Name: src
Committed By: riastradh
Date: Mon Sep 9 12:01:01 UTC 2024
Modified Files:
src/include: limits.h
Log Message:
limits.h: Define PTHREAD_STACK_MIN and tidy up comments.
Define this to be 4096, which is (as far as I can tell) the smallest
possible page size on any architecture NetBSD supports. This should
be MIN_PAGE_SIZE instead, but I don't think that is exposed in any
way that doesn't badly pollute the namespace. We should maybe have a
__MIN_PAGE_SIZE defined in some header file exposed to userland.
Of course, applications actually need to allocate at least
sysconf(_SC_THREAD_STACK_MIN) = getpagesize() bytes, which may be
larger than PTHREAD_STACK_MIN.
The various feature flags (dates) like _POSIX_THREAD_ATTR_STACKADDR
are defined (or not defined) by unistd.h, not by limits.h, so there's
no value in mentioning them here -- and the comment is wrong about
most of them (we have implemented _POSIX_THREAD_ATTR_STACKADDR, for
example).
PR standards/45435: PTHREAD_KEYS_MAX et al. missing in <limits.h>
To generate a diff of this commit:
cvs rdiff -u -r1.44 -r1.45 src/include/limits.h
Please note that diffs are not public domain; they are subject to the
copyright notices on the relevant files.
Modified files:
Index: src/include/limits.h
diff -u src/include/limits.h:1.44 src/include/limits.h:1.45
--- src/include/limits.h:1.44 Thu Aug 15 23:44:49 2024
+++ src/include/limits.h Mon Sep 9 12:01:01 2024
@@ -1,4 +1,4 @@
-/* $NetBSD: limits.h,v 1.44 2024/08/15 23:44:49 riastradh Exp $ */
+/* $NetBSD: limits.h,v 1.45 2024/09/09 12:01:01 riastradh Exp $ */
/*
* Copyright (c) 1988, 1993
@@ -61,35 +61,23 @@
#define _POSIX_SYMLOOP_MAX 8
/*
- * We have not implemented these yet
- *
- * _POSIX_THREAD_ATTR_STACKADDR
- * _POSIX_THREAD_ATTR_STACKSIZE
- * _POSIX_THREAD_CPUTIME
- * _POSIX_THREAD_PRIORITY_SCHEDULING
- * _POSIX_THREAD_PRIO_INHERIT
- * _POSIX_THREAD_PRIO_PROTECT
- * _POSIX_THREAD_PROCESS_SHARED
- * _POSIX_THREAD_SAFE_FUNCTIONS
- * _POSIX_THREAD_SPORADIC_SERVER
- */
-
-/*
- * The following 3 are defined in
+ * Exact minimum values prescribed by:
* Open Group Base Specifications Issue 7
+ * https://pubs.opengroup.org/onlinepubs/9699919799/basedefs/limits.h.html
*/
#define _POSIX_THREAD_DESTRUCTOR_ITERATIONS 4
#define _POSIX_THREAD_KEYS_MAX 128
#define _POSIX_THREAD_THREADS_MAX 64
/*
- * These are the correct names, defined in terms of the above
- * except for PTHREAD_KEYS_MAX which is bigger than standard
- * mandated minimum value _POSIX_THREAD_KEYS_MAX.
+ * Actual values used by libpthread, defined in terms of the above
+ * except for PTHREAD_KEYS_MAX which is bigger than standard mandated
+ * minimum value _POSIX_THREAD_KEYS_MAX, and PTHREAD_STACK_MIN which
+ * doesn't have a defined name for the minimum value of zero.
*/
#define PTHREAD_DESTRUCTOR_ITERATIONS _POSIX_THREAD_DESTRUCTOR_ITERATIONS
#define PTHREAD_KEYS_MAX 256
-/* Not yet: PTHREAD_STACK_MIN */
+#define PTHREAD_STACK_MIN 4096 /* XXX MIN_PAGE_SIZE */
#define PTHREAD_THREADS_MAX _POSIX_THREAD_THREADS_MAX
#define _POSIX_TIMER_MAX 32