This is the mail archive of the
libc-alpha@sourceware.org
mailing list for the glibc project.
[PATCH 2/2] Document LIBC_PTHREAD_DEFAULT_STACKSIZE_NP
- From: Siddhesh Poyarekar <siddhesh at redhat dot com>
- To: libc-alpha at sourceware dot org
- Date: Tue, 15 Jan 2013 15:31:33 +0530
- Subject: [PATCH 2/2] Document LIBC_PTHREAD_DEFAULT_STACKSIZE_NP
Hi,
Attached patch adds documentation for
LIBC_PTHREAD_DEFAULT_STACKSIZE_NP. This adds an additional chapter
for NPTL with placeholders for a couple of sections.
Siddhesh
* manual/Makefile (chapters): Add nptl.
* manual/debug.texi: Add NPTL as next node.
* manual/nptl.texi: New chapter.
diff --git a/manual/Makefile b/manual/Makefile
index c1a304c..10314a9 100644
--- a/manual/Makefile
+++ b/manual/Makefile
@@ -42,7 +42,7 @@ chapters = $(addsuffix .texi, \
message search pattern io stdio llio filesys \
pipe socket terminal syslog math arith time \
resource setjmp signal startup process job nss \
- users sysinfo conf crypt debug)
+ users sysinfo conf crypt debug nptl)
add-chapters = $(wildcard $(foreach d, $(add-ons), ../$d/$d.texi))
appendices = lang.texi header.texi install.texi maint.texi platform.texi \
contrib.texi
diff --git a/manual/debug.texi b/manual/debug.texi
index b2bcb31..63a9aac 100644
--- a/manual/debug.texi
+++ b/manual/debug.texi
@@ -1,5 +1,5 @@
@node Debugging Support
-@c @node Debugging Support, , Cryptographic Functions, Top
+@c @node Debugging Support, NPTL, Cryptographic Functions, Top
@c %MENU% Functions to help debugging applications
@chapter Debugging support
diff --git a/manual/nptl.texi b/manual/nptl.texi
new file mode 100644
index 0000000..846cf32
--- /dev/null
+++ b/manual/nptl.texi
@@ -0,0 +1,67 @@
+@node NPTL
+@c @node NPTL, , Cryptographic Functions, Top
+@chapter Native POSIX Threads Library (NPTL)
+@c %MENU% NPTL
+@cindex pthreads
+
+This chapter describes the the glibc pthread implementation.
+
+TODO: Add a description.
+
+@menu
+* Multithreading Concepts:: An introduction to concepts and terminology.
+* Thread Management:: Allocating storage for your program data
+* Non-POSIX Extensions:: Additional functions to extend pthread
+ functionality
+@end menu
+
+
+@node Multithreading Concepts
+@section Multithreading Concepts
+
+TODO: Explain the concept of multithreading and show a sample program.
+
+
+@node Thread Management
+@section Creating and Managing Threads
+
+TODO: Explain @code{pthread_create}, @code{pthread_join}, @code{pthread_exit}, etc.
+
+@node Non-POSIX Extensions
+@section Non-POSIX Extensions
+
+In addition to implementing the POSIX API for pthreads, NPTL provides
+additional functions and interfaces to provide functionality not specified in
+the standard.
+
+@menu
+* Thread Stack Size:: Setting default stack size
+@end menu
+
+@node Thread Stack Size
+@subsection Setting Process-wide defaults for thread stack size
+
+The pthread implementation allows a developer to specify the stack size for
+threads it creates by creating an @code{pthread_attr_t} type with the stack
+size defined and then using that for each pthread_create call. There is
+however no way in the standard to do this at an administrative level either by
+using a configuration file or an environment variable. With NPTL this is
+possible by exporting an environment variable
+@code{LIBC_PTHREAD_DEFAULT_STACKSIZE_NP} in the environment of the process.
+The stack size all threads spawned by the program (except the main thread) to
+have this size, adjusted upwards for internal data structures and alignment.
+If the size is less than @code{PTHREAD_STACK_MIN}, then it is ignored and the
+minimum stack size is used.
+
+In addition to the environment variable, one may also use the following
+functions to get and set the default stack size from code.
+
+@table @code
+@item size_t pthread_get_default_stacksize_np (void)
+Get the currently set default stack size.
+
+@item int pthread_set_default_stacksize_np (size_t @var{size})
+Sets the current default stack size to @var{size}. If the value is less than
+@code{PTHREAD_STACK_MIN}, it returns @code{EINVAL}, or else it returns 0.
+
+@end table