Skip to content
Snippets Groups Projects

Compare revisions

Changes are shown as if the source revision was being merged into the target revision. Learn more about comparing revisions.

Source

Select target project
No results found

Target

Select target project
  • Maytha8/glibc
  • vimerbf-guest/glibc
  • schopin/glibc
  • yumeyao/glibc
  • carlespina/po-debconf-manager-glibc
  • Claudia/glibc-widevine
  • andrewsh/glibc
  • jscott/glibc
  • bluca/glibc
  • gioele/glibc
  • rouca/glibc
  • sven/glibc
  • josch/glibc
  • cjwatson/glibc
  • fw/glibc
  • rbalint/glibc
  • bsd-team/glibc-packaging
  • glibc-team/glibc
  • bigon/glibc
  • ahrex-guest/glibc
  • friki/glibc
21 results
Show changes
Commits on Source (6)
Showing
with 639 additions and 878 deletions
glibc (2.37-16) UNRELEASED; urgency=medium
 
[ Samuel Thibault ]
* debian/patches/hurd-i386/submitted-AF_ROUTE.diff: Also comment out
PF_ROUTE/AF_ROUTE.
* debian/patches/hurd-i386/git-proc_getchildren_rusage.diff: Implement
RUSAGE_CHILDREN, should fix the grep testsuite.
 
[ Aurelien Jarno ]
* debian/rules.d/build.mk: present glibc with a compiler that does not
default to -D_FILE_OFFSET_BITS=64 -D_TIME_BITS=64, as upstream doesn't
support this configuration. This has the consequence of hiding real issues
found by the testsuite, but there is a consensus that this is the way to
go for now. Thanks to Helmut Grohne for the hint and starting the
discussion. Closes: #1068251.
* debian/debhelper.in/glibc-doc.{links,manpages},
debian/local/manpages/pthread_*: drop the man pages for libpthread
functions, as they are now included in manpages-dev. Closes: #1068188.
* debian/control.in/main: update glibc-doc description following the removal
of the pthread manpages.
* debian/control.in/main: downgrade the Recommends from libc-dev-bin to
libc-devtools to a Suggests. Closes: #1067909.
* debian/patches/git-updates.diff: update from upstream stable branch.
[ Steve Langasek ]
* Drop transitional dependency from libc6-dev to libnsl-dev.
-- Samuel Thibault <sthibault@debian.org> Mon, 05 Feb 2024 23:20:47 +0000
 
glibc (2.37-15) unstable; urgency=critical
......
......@@ -49,7 +49,8 @@ Section: libdevel
Priority: optional
Multi-Arch: foreign
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: manpages, manpages-dev, libc-devtools (>> 2.37)
Recommends: manpages, manpages-dev
Suggests: libc-devtools (>> 2.37)
Build-Profiles: <!stage1>
Description: GNU C Library: Development binaries
This package contains utility programs related to the GNU C Library
......@@ -96,9 +97,8 @@ Depends: ${misc:Depends}
Suggests: glibc-doc-reference
Build-Profiles: <!stage1>
Description: GNU C Library: Documentation
Contains man pages for libpthread functions and the complete GNU C Library
ChangeLog. The GNU C Library Reference manual has been moved into
glibc-doc-reference for licensing reasons.
Contains the complete GNU C Library ChangeLog. The GNU C Library Reference
manual has been moved into glibc-doc-reference for licensing reasons.
Package: glibc-source
Architecture: all
......@@ -190,7 +190,7 @@ Architecture: amd64 arc arm64 armel armhf hppa i386 loong64 m68k mips mipsel mip
Section: libdevel
Priority: optional
Multi-Arch: same
Depends: libc6 (= ${binary:Version}) <!stage1>, libc-dev-bin (= ${binary:Version}), ${misc:Depends}, linux-libc-dev [linux-any], gnumach-dev [hurd-i386], hurd-dev (>= 20080607-3) [hurd-i386] | hurd-headers-dev [hurd-i386], ${libcrypt-dev:Depends}, ${libnsl-dev:Depends}, ${rpcsvc-proto:Depends}
Depends: libc6 (= ${binary:Version}) <!stage1>, libc-dev-bin (= ${binary:Version}), ${misc:Depends}, linux-libc-dev [linux-any], gnumach-dev [hurd-i386], hurd-dev (>= 20080607-3) [hurd-i386] | hurd-headers-dev [hurd-i386], ${libcrypt-dev:Depends}, ${rpcsvc-proto:Depends}
Replaces: hurd-dev (<< 20120408-3) [hurd-i386], libc6 (<= 2.32-1)
Suggests: glibc-doc, manpages-dev
Provides: libc-dev (= ${binary:Version}), libc6-dev [alpha ia64 hurd-i386]
......@@ -262,7 +262,7 @@ Architecture: alpha ia64
Section: libdevel
Priority: optional
Multi-Arch: same
Depends: libc6.1 (= ${binary:Version}) <!stage1>, libc-dev-bin (= ${binary:Version}), ${misc:Depends}, linux-libc-dev [linux-any], gnumach-dev [hurd-i386], hurd-dev (>= 20080607-3) [hurd-i386] | hurd-headers-dev [hurd-i386], ${libcrypt-dev:Depends}, ${libnsl-dev:Depends}, ${rpcsvc-proto:Depends}
Depends: libc6.1 (= ${binary:Version}) <!stage1>, libc-dev-bin (= ${binary:Version}), ${misc:Depends}, linux-libc-dev [linux-any], gnumach-dev [hurd-i386], hurd-dev (>= 20080607-3) [hurd-i386] | hurd-headers-dev [hurd-i386], ${libcrypt-dev:Depends}, ${rpcsvc-proto:Depends}
Replaces: hurd-dev (<< 20120408-3) [hurd-i386], libc6.1 (<= 2.32-1)
Suggests: glibc-doc, manpages-dev
Provides: libc-dev (= ${binary:Version}), libc6-dev [alpha ia64 hurd-i386]
......@@ -334,7 +334,7 @@ Architecture: hurd-i386
Section: libdevel
Priority: optional
Multi-Arch: same
Depends: libc0.3 (= ${binary:Version}) <!stage1>, libc-dev-bin (= ${binary:Version}), ${misc:Depends}, linux-libc-dev [linux-any], gnumach-dev [hurd-i386], hurd-dev (>= 20080607-3) [hurd-i386] | hurd-headers-dev [hurd-i386], ${libcrypt-dev:Depends}, ${libnsl-dev:Depends}, ${rpcsvc-proto:Depends}
Depends: libc0.3 (= ${binary:Version}) <!stage1>, libc-dev-bin (= ${binary:Version}), ${misc:Depends}, linux-libc-dev [linux-any], gnumach-dev [hurd-i386], hurd-dev (>= 20080607-3) [hurd-i386] | hurd-headers-dev [hurd-i386], ${libcrypt-dev:Depends}, ${rpcsvc-proto:Depends}
Replaces: hurd-dev (<< 20120408-3) [hurd-i386], libc0.3 (<= 2.32-1)
Suggests: glibc-doc, manpages-dev
Provides: libc-dev (= ${binary:Version}), libc6-dev [alpha ia64 hurd-i386]
......
......@@ -33,7 +33,7 @@ Architecture: @archs@
Section: libdevel
Priority: optional
Multi-Arch: same
Depends: @libc@ (= ${binary:Version}) <!stage1>, libc-dev-bin (= ${binary:Version}), ${misc:Depends}, linux-libc-dev [linux-any], gnumach-dev [hurd-i386], hurd-dev (>= 20080607-3) [hurd-i386] | hurd-headers-dev [hurd-i386], ${libcrypt-dev:Depends}, ${libnsl-dev:Depends}, ${rpcsvc-proto:Depends}
Depends: @libc@ (= ${binary:Version}) <!stage1>, libc-dev-bin (= ${binary:Version}), ${misc:Depends}, linux-libc-dev [linux-any], gnumach-dev [hurd-i386], hurd-dev (>= 20080607-3) [hurd-i386] | hurd-headers-dev [hurd-i386], ${libcrypt-dev:Depends}, ${rpcsvc-proto:Depends}
Replaces: hurd-dev (<< 20120408-3) [hurd-i386], @libc@ (<= 2.32-1)
Suggests: glibc-doc, manpages-dev
Provides: libc-dev (= ${binary:Version}), libc6-dev [alpha ia64 hurd-i386]
......
......@@ -49,7 +49,8 @@ Section: libdevel
Priority: optional
Multi-Arch: foreign
Depends: ${shlibs:Depends}, ${misc:Depends}
Recommends: manpages, manpages-dev, libc-devtools (>> @DEB_VERSION_UPSTREAM@)
Recommends: manpages, manpages-dev
Suggests: libc-devtools (>> @DEB_VERSION_UPSTREAM@)
Build-Profiles: <!stage1>
Description: GNU C Library: Development binaries
This package contains utility programs related to the GNU C Library
......@@ -96,9 +97,8 @@ Depends: ${misc:Depends}
Suggests: glibc-doc-reference
Build-Profiles: <!stage1>
Description: GNU C Library: Documentation
Contains man pages for libpthread functions and the complete GNU C Library
ChangeLog. The GNU C Library Reference manual has been moved into
glibc-doc-reference for licensing reasons.
Contains the complete GNU C Library ChangeLog. The GNU C Library Reference
manual has been moved into glibc-doc-reference for licensing reasons.
Package: glibc-source
Architecture: all
......
usr/share/man/man3/pthread_condattr_init.3.gz usr/share/man/man3/pthread_condattr_destroy.3.gz
usr/share/man/man3/pthread_cond_init.3.gz usr/share/man/man3/pthread_cond_signal.3.gz
usr/share/man/man3/pthread_cond_init.3.gz usr/share/man/man3/pthread_cond_broadcast.3.gz
usr/share/man/man3/pthread_cond_init.3.gz usr/share/man/man3/pthread_cond_wait.3.gz
usr/share/man/man3/pthread_cond_init.3.gz usr/share/man/man3/pthread_cond_timedwait.3.gz
usr/share/man/man3/pthread_cond_init.3.gz usr/share/man/man3/pthread_cond_destroy.3.gz
usr/share/man/man3/pthread_key_create.3.gz usr/share/man/man3/pthread_getspecific.3.gz
usr/share/man/man3/pthread_key_create.3.gz usr/share/man/man3/pthread_key_delete.3.gz
usr/share/man/man3/pthread_key_create.3.gz usr/share/man/man3/pthread_setspecific.3.gz
usr/share/man/man3/pthread_mutexattr_init.3.gz usr/share/man/man3/pthread_mutexattr_destroy.3.gz
usr/share/man/man3/pthread_mutexattr_init.3.gz usr/share/man/man3/pthread_mutexattr_settype.3.gz
usr/share/man/man3/pthread_mutexattr_init.3.gz usr/share/man/man3/pthread_mutexattr_gettype.3.gz
usr/share/man/man3/pthread_mutexattr_setkind_np.3.gz usr/share/man/man3/pthread_mutexattr_getkind_np.3.gz
usr/share/man/man3/pthread_mutex_init.3.gz usr/share/man/man3/pthread_mutex_lock.3.gz
usr/share/man/man3/pthread_mutex_init.3.gz usr/share/man/man3/pthread_mutex_trylock.3.gz
usr/share/man/man3/pthread_mutex_init.3.gz usr/share/man/man3/pthread_mutex_unlock.3.gz
usr/share/man/man3/pthread_mutex_init.3.gz usr/share/man/man3/pthread_mutex_destroy.3.gz
debian/local/manpages/pthread_atfork.3
debian/local/manpages/pthread_condattr_init.3
debian/local/manpages/pthread_cond_init.3
debian/local/manpages/pthread_key_create.3
debian/local/manpages/pthread_mutexattr_init.3
debian/local/manpages/pthread_mutexattr_setkind_np.3
debian/local/manpages/pthread_mutex_init.3
debian/local/manpages/pthread_once.3
.TH PTHREAD_ATFORK 3 LinuxThreads
.SH NAME
pthread_atfork \- register handlers to be called at fork(2) time
.SH SYNOPSIS
.B #include <pthread.h>
.BI "int pthread_atfork(void (*" prepare ")(void), void (*" parent ")(void), void (*" child ")(void));"
.SH DESCRIPTION
\fBpthread_atfork\fP registers handler functions to be called just before
and just after a new process is created with \fBfork\fP(2). The \fIprepare\fP
handler will be called from the parent process, just before the new
process is created. The \fIparent\fP handler will be called from the parent
process, just before \fBfork\fP(2) returns. The \fIchild\fP handler will be
called from the child process, just before \fBfork\fP(2) returns.
One or several of the three handlers \fIprepare\fP, \fIparent\fP and \fIchild\fP
can be given as \fBNULL\fP, meaning that no handler needs to be called at
the corresponding point.
\fBpthread_atfork\fP can be called several times to install several sets
of handlers. At \fBfork\fP(2) time, the \fIprepare\fP handlers are called in
LIFO order (last added with \fBpthread_atfork\fP, first called before \fBfork\fP),
while the \fIparent\fP and \fIchild\fP handlers are called in FIFO order
(first added, first called).
To understand the purpose of \fBpthread_atfork\fP, recall that \fBfork\fP(2)
duplicates the whole memory space, including mutexes in their current
locking state, but only the calling thread: other threads are not
running in the child process. The mutexes are not usable after the
\fBfork\fP and must be initialized with \fIpthread_mutex_init\fP in the child
process. This is a limitation of the current implementation and might
or might not be present in future versions.
.SH "RETURN VALUE"
\fBpthread_atfork\fP returns 0 on success and a non-zero error code on error.
.SH ERRORS
.TP
\fBENOMEM\fP
insufficient memory available to register the handlers.
.SH AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
.SH "SEE ALSO"
\fBfork\fP(2),
\fBpthread_mutex_lock\fP(3),
\fBpthread_mutex_unlock\fP(3).
.TH PTHREAD_COND 3 LinuxThreads
.SH NAME
pthread_cond_init, pthread_cond_destroy, pthread_cond_signal, pthread_cond_broadcast, pthread_cond_wait, pthread_cond_timedwait \- operations on conditions
.SH SYNOPSIS
.B #include <pthread.h>
.BI "pthread_cond_t " cond " = PTHREAD_COND_INITIALIZER;"
.BI "int pthread_cond_init(pthread_cond_t *" cond ", pthread_condattr_t *" cond_attr ");"
.BI "int pthread_cond_signal(pthread_cond_t *" cond ");"
.BI "int pthread_cond_broadcast(pthread_cond_t *" cond ");"
.BI "int pthread_cond_wait(pthread_cond_t *" cond ", pthread_mutex_t *" mutex ");"
.BI "int pthread_cond_timedwait(pthread_cond_t *" cond ", pthread_mutex_t *" mutex ", const struct timespec *" abstime ");"
.BI "int pthread_cond_destroy(pthread_cond_t *" cond ");"
.SH DESCRIPTION
A condition (short for ``condition variable'') is a synchronization
device that allows threads to suspend execution and relinquish the
processors until some predicate on shared data is satisfied. The basic
operations on conditions are: signal the condition (when the
predicate becomes true), and wait for the condition, suspending the
thread execution until another thread signals the condition.
A condition variable must always be associated with a mutex, to avoid
the race condition where a thread prepares to wait on a condition
variable and another thread signals the condition just before the
first thread actually waits on it.
\fBpthread_cond_init\fP initializes the condition variable \fIcond\fP, using the
condition attributes specified in \fIcond_attr\fP, or default attributes
if \fIcond_attr\fP is \fBNULL\fP. The LinuxThreads implementation supports no
attributes for conditions, hence the \fIcond_attr\fP parameter is actually
ignored.
Variables of type \fBpthread_cond_t\fP can also be initialized
statically, using the constant \fBPTHREAD_COND_INITIALIZER\fP.
\fBpthread_cond_signal\fP restarts one of the threads that are waiting on
the condition variable \fIcond\fP. If no threads are waiting on \fIcond\fP,
nothing happens. If several threads are waiting on \fIcond\fP, exactly one
is restarted, but it is not specified which.
\fBpthread_cond_broadcast\fP restarts all the threads that are waiting on
the condition variable \fIcond\fP. Nothing happens if no threads are
waiting on \fIcond\fP.
\fBpthread_cond_wait\fP atomically unlocks the \fImutex\fP (as per
\fBpthread_unlock_mutex\fP) and waits for the condition variable \fIcond\fP to
be signaled. The thread execution is suspended and does not consume
any CPU time until the condition variable is signaled. The \fImutex\fP
must be locked by the calling thread on entrance to
\fBpthread_cond_wait\fP. Before returning to the calling thread,
\fBpthread_cond_wait\fP re-acquires \fImutex\fP (as per \fBpthread_lock_mutex\fP).
Unlocking the mutex and suspending on the condition variable is done
atomically. Thus, if all threads always acquire the mutex before
signaling the condition, this guarantees that the condition cannot be
signaled (and thus ignored) between the time a thread locks the mutex
and the time it waits on the condition variable.
\fBpthread_cond_timedwait\fP atomically unlocks \fImutex\fP and waits on
\fIcond\fP, as \fBpthread_cond_wait\fP does, but it also bounds the duration
of the wait. If \fIcond\fP has not been signaled within the amount of time
specified by \fIabstime\fP, the mutex \fImutex\fP is re-acquired and
\fBpthread_cond_timedwait\fP returns the error \fBETIMEDOUT\fP.
The \fIabstime\fP parameter specifies an absolute time, with the same
origin as \fBtime\fP(2) and \fBgettimeofday\fP(2): an \fIabstime\fP of 0
corresponds to 00:00:00 GMT, January 1, 1970.
\fBpthread_cond_destroy\fP destroys a condition variable, freeing the
resources it might hold. No threads must be waiting on the condition
variable on entrance to \fBpthread_cond_destroy\fP. In the LinuxThreads
implementation, no resources are associated with condition variables,
thus \fBpthread_cond_destroy\fP actually does nothing except checking that
the condition has no waiting threads.
.SH CANCELLATION
\fBpthread_cond_wait\fP and \fBpthread_cond_timedwait\fP are cancellation
points. If a thread is cancelled while suspended in one of these
functions, the thread immediately resumes execution, then locks again
the \fImutex\fP argument to \fBpthread_cond_wait\fP and
\fBpthread_cond_timedwait\fP, and finally executes the cancellation.
Consequently, cleanup handlers are assured that \fImutex\fP is locked when
they are called.
.SH "ASYNC-SIGNAL SAFETY"
The condition functions are not async-signal safe, and should not be
called from a signal handler. In particular, calling
\fBpthread_cond_signal\fP or \fBpthread_cond_broadcast\fP from a signal
handler may deadlock the calling thread.
.SH "RETURN VALUE"
All condition variable functions return 0 on success and a non-zero
error code on error.
.SH ERRORS
\fBpthread_cond_init\fP, \fBpthread_cond_signal\fP, \fBpthread_cond_broadcast\fP,
and \fBpthread_cond_wait\fP never return an error code.
The \fBpthread_cond_timedwait\fP function returns the following error codes
on error:
.RS
.TP
\fBETIMEDOUT\fP
the condition variable was not signaled until the timeout specified by
\fIabstime\fP
.TP
\fBEINTR\fP
\fBpthread_cond_timedwait\fP was interrupted by a signal
.RE
The \fBpthread_cond_destroy\fP function returns the following error code
on error:
.RS
.TP
\fBEBUSY\fP
some threads are currently waiting on \fIcond\fP.
.RE
.SH AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
.SH "SEE ALSO"
\fBpthread_condattr_init\fP(3),
\fBpthread_mutex_lock\fP(3),
\fBpthread_mutex_unlock\fP(3),
\fBgettimeofday\fP(2),
\fBnanosleep\fP(2).
.SH EXAMPLE
Consider two shared variables \fIx\fP and \fIy\fP, protected by the mutex \fImut\fP,
and a condition variable \fIcond\fP that is to be signaled whenever \fIx\fP
becomes greater than \fIy\fP.
.RS
.ft 3
.nf
.sp
int x,y;
pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
pthread_cond_t cond = PTHREAD_COND_INITIALIZER;
.ft
.LP
.RE
.fi
Waiting until \fIx\fP is greater than \fIy\fP is performed as follows:
.RS
.ft 3
.nf
.sp
pthread_mutex_lock(&mut);
while (x <= y) {
pthread_cond_wait(&cond, &mut);
}
/* operate on x and y */
pthread_mutex_unlock(&mut);
.ft
.LP
.RE
.fi
Modifications on \fIx\fP and \fIy\fP that may cause \fIx\fP to become greater than
\fIy\fP should signal the condition if needed:
.RS
.ft 3
.nf
.sp
pthread_mutex_lock(&mut);
/* modify x and y */
if (x > y) pthread_cond_broadcast(&cond);
pthread_mutex_unlock(&mut);
.ft
.LP
.RE
.fi
If it can be proved that at most one waiting thread needs to be waken
up (for instance, if there are only two threads communicating through
\fIx\fP and \fIy\fP), \fBpthread_cond_signal\fP can be used as a slightly more
efficient alternative to \fBpthread_cond_broadcast\fP. In doubt, use
\fBpthread_cond_broadcast\fP.
To wait for \fIx\fP to becomes greater than \fIy\fP with a timeout of 5
seconds, do:
.RS
.ft 3
.nf
.sp
struct timeval now;
struct timespec timeout;
int retcode;
pthread_mutex_lock(&mut);
gettimeofday(&now);
timeout.tv_sec = now.tv_sec + 5;
timeout.tv_nsec = now.tv_usec * 1000;
retcode = 0;
while (x <= y && retcode != ETIMEDOUT) {
retcode = pthread_cond_timedwait(&cond, &mut, &timeout);
}
if (retcode == ETIMEDOUT) {
/* timeout occurred */
} else {
/* operate on x and y */
}
pthread_mutex_unlock(&mut);
.ft
.LP
.RE
.fi
.TH PTHREAD_CONDATTR 3 LinuxThreads
.SH NAME
pthread_condattr_init, pthread_condattr_destroy \- condition creation attributes
.SH SYNOPSIS
.B #include <pthread.h>
.BI "int pthread_condattr_init(pthread_condattr_t *" attr ");"
.BI "int pthread_condattr_destroy(pthread_condattr_t *" attr ");"
.SH DESCRIPTION
Condition attributes can be specified at condition creation time, by passing a
condition attribute object as second argument to \fBpthread_cond_init\fP(3).
Passing \fBNULL\fP is equivalent to passing a condition attribute object with
all attributes set to their default values.
The LinuxThreads implementation supports no attributes for
conditions. The functions on condition attributes are included only
for compliance with the POSIX standard.
\fBpthread_condattr_init\fP initializes the condition attribute object
\fIattr\fP and fills it with default values for the attributes.
\fBpthread_condattr_destroy\fP destroys a condition attribute object,
which must not be reused until it is reinitialized. Both functions do
nothing in the LinuxThreads implementation.
.SH "RETURN VALUE"
\fBpthread_condattr_init\fP and \fBpthread_condattr_destroy\fP always return 0.
.SH AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
.SH "SEE ALSO"
\fBpthread_cond_init\fP(3).
.TH PTHREAD_SPECIFIC 3 LinuxThreads
.SH NAME
pthread_key_create, pthread_key_delete, pthread_setspecific, pthread_getspecific \- management of thread-specific data
.SH SYNOPSIS
.B #include <pthread.h>
.BI "int pthread_key_create(pthread_key_t *" key ", void (*" destr_function ") (void *));"
.BI "int pthread_key_delete(pthread_key_t " key ");"
.BI "int pthread_setspecific(pthread_key_t " key ", const void *" pointer ");"
.BI "void * pthread_getspecific(pthread_key_t " key ");"
.SH DESCRIPTION
Programs often need global or static variables that have different
values in different threads. Since threads share one memory space,
this cannot be achieved with regular variables. Thread-specific data
is the POSIX threads answer to this need.
Each thread possesses a private memory block, the thread-specific data
area, or TSD area for short. This area is indexed by TSD keys. The TSD
area associates values of type \fBvoid *\fP to TSD keys. TSD keys are
common to all threads, but the value associated with a given TSD key
can be different in each thread.
For concreteness, the TSD areas can be viewed as arrays of \fBvoid *\fP
pointers, TSD keys as integer indices into these arrays, and the value
of a TSD key as the value of the corresponding array element in the
calling thread.
When a thread is created, its TSD area initially associates \fBNULL\fP
with all keys.
\fBpthread_key_create\fP allocates a new TSD key. The key is stored in the
location pointed to by \fIkey\fP. There is a limit of \fBPTHREAD_KEYS_MAX\fP
on the number of keys allocated at a given time. The value initially
associated with the returned key is \fBNULL\fP in all currently executing
threads.
The \fIdestr_function\fP argument, if not \fBNULL\fP, specifies a destructor
function associated with the key. When a thread terminates via
\fBpthread_exit\fP or by cancellation, \fIdestr_function\fP is called with
arguments the value associated with the key in that thread. The
\fIdestr_function\fP is not called if that value is \fBNULL\fP. The order in
which destructor functions are called at thread termination time is
unspecified.
Before the destructor function is called, the \fBNULL\fP value is
associated with the key in the current thread. A destructor function
might, however, re-associate non-\fBNULL\fP values to that key or some
other key. To deal with this, if after all the destructors have been
called for all non-\fBNULL\fP values, there are still some non-\fBNULL\fP
values with associated destructors, then the process is repeated. The
LinuxThreads implementation stops the process after
\fBPTHREAD_DESTRUCTOR_ITERATIONS\fP iterations, even if some non-\fBNULL\fP
values with associated descriptors remain. Other implementations may
loop indefinitely.
\fBpthread_key_delete\fP deallocates a TSD key. It does not check whether
non-\fBNULL\fP values are associated with that key in the currently
executing threads, nor call the destructor function associated with
the key.
\fBpthread_setspecific\fP changes the value associated with \fIkey\fP in the
calling thread, storing the given \fIpointer\fP instead.
\fBpthread_getspecific\fP returns the value currently associated with
\fIkey\fP in the calling thread.
.SH "RETURN VALUE"
\fBpthread_key_create\fP, \fBpthread_key_delete\fP, and \fBpthread_setspecific\fP
return 0 on success and a non-zero error code on failure. If
successful, \fBpthread_key_create\fP stores the newly allocated key in the
location pointed to by its \fIkey\fP argument.
\fBpthread_getspecific\fP returns the value associated with \fIkey\fP on
success, and \fBNULL\fP on error.
.SH ERRORS
\fBpthread_key_create\fP returns the following error code on error:
.RS
.TP
\fBEAGAIN\fP
\fBPTHREAD_KEYS_MAX\fP keys are already allocated
.RE
\fBpthread_key_delete\fP and \fBpthread_setspecific\fP return the following
error code on error:
.RS
.TP
\fBEINVAL\fP
\fIkey\fP is not a valid, allocated TSD key
.RE
\fBpthread_getspecific\fP returns \fBNULL\fP if \fIkey\fP is not a valid,
allocated TSD key.
.SH AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
.SH "SEE ALSO"
pthread_create(3), pthread_exit(3), pthread_testcancel(3).
.SH EXAMPLE
The following code fragment allocates a thread-specific array of 100
characters, with automatic reclaimation at thread exit:
.RS
.ft 3
.nf
.sp
/* Key for the thread-specific buffer */
static pthread_key_t buffer_key;
/* Once-only initialisation of the key */
static pthread_once_t buffer_key_once = PTHREAD_ONCE_INIT;
/* Allocate the thread-specific buffer */
void buffer_alloc(void)
{
pthread_once(&buffer_key_once, buffer_key_alloc);
pthread_setspecific(buffer_key, malloc(100));
}
/* Return the thread-specific buffer */
char * get_buffer(void)
{
return (char *) pthread_getspecific(buffer_key);
}
/* Allocate the key */
static void buffer_key_alloc()
{
pthread_key_create(&buffer_key, buffer_destroy);
}
/* Free the thread-specific buffer */
static void buffer_destroy(void * buf)
{
free(buf);
}
.ft
.LP
.RE
.fi
.TH PTHREAD_MUTEX 3 LinuxThreads
.SH NAME
pthread_mutex_init, pthread_mutex_lock, pthread_mutex_trylock, pthread_mutex_unlock, pthread_mutex_destroy \- operations on mutexes
.SH SYNOPSIS
.B #include <pthread.h>
.BI "pthread_mutex_t " fastmutex " = PTHREAD_MUTEX_INITIALIZER;"
.BI "pthread_mutex_t " recmutex " = PTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP;"
.BI "pthread_mutex_t " errchkmutex " = PTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP;"
.BI "int pthread_mutex_init(pthread_mutex_t *" mutex ", const pthread_mutexattr_t *" mutexattr ");"
.BI "int pthread_mutex_lock(pthread_mutex_t *" mutex ");"
.BI "int pthread_mutex_trylock(pthread_mutex_t *" mutex ");"
.BI "int pthread_mutex_unlock(pthread_mutex_t *" mutex ");"
.BI "int pthread_mutex_destroy(pthread_mutex_t *" mutex ");"
.SH DESCRIPTION
A mutex is a MUTual EXclusion device, and is useful for protecting
shared data structures from concurrent modifications, and implementing
critical sections and monitors.
A mutex has two possible states: unlocked (not owned by any thread),
and locked (owned by one thread). A mutex can never be owned by two
different threads simultaneously. A thread attempting to lock a mutex
that is already locked by another thread is suspended until the owning
thread unlocks the mutex first.
\fBpthread_mutex_init\fP initializes the mutex object pointed to by
\fImutex\fP according to the mutex attributes specified in \fImutexattr\fP.
If \fImutexattr\fP is \fBNULL\fP, default attributes are used instead.
The LinuxThreads implementation supports only one mutex attributes,
the \fImutex kind\fP, which is either ``fast'', ``recursive'', or
``error checking''. The kind of a mutex determines whether
it can be locked again by a thread that already owns it.
The default kind is ``fast''. See \fBpthread_mutexattr_init\fP(3) for more
information on mutex attributes.
Variables of type \fBpthread_mutex_t\fP can also be initialized
statically, using the constants \fBPTHREAD_MUTEX_INITIALIZER\fP (for fast
mutexes), \fBPTHREAD_RECURSIVE_MUTEX_INITIALIZER_NP\fP (for recursive
mutexes), and \fBPTHREAD_ERRORCHECK_MUTEX_INITIALIZER_NP\fP (for error checking
mutexes).
\fBpthread_mutex_lock\fP locks the given mutex. If the mutex is currently
unlocked, it becomes locked and owned by the calling thread, and
\fBpthread_mutex_lock\fP returns immediately. If the mutex is already
locked by another thread, \fBpthread_mutex_lock\fP suspends the calling
thread until the mutex is unlocked.
If the mutex is already locked by the calling thread, the behavior of
\fBpthread_mutex_lock\fP depends on the kind of the mutex. If the mutex is
of the ``fast'' kind, the calling thread is suspended until the mutex
is unlocked, thus effectively causing the calling thread to
deadlock. If the mutex is of the ``error checking'' kind,
\fBpthread_mutex_lock\fP returns immediately with the error code \fBEDEADLK\fP.
If the mutex is of the ``recursive'' kind, \fBpthread_mutex_lock\fP
succeeds and returns immediately, recording the number of times the
calling thread has locked the mutex. An equal number of
\fBpthread_mutex_unlock\fP operations must be performed before the mutex
returns to the unlocked state.
\fBpthread_mutex_trylock\fP behaves identically to \fBpthread_mutex_lock\fP,
except that it does not block the calling thread if the mutex is
already locked by another thread (or by the calling thread in the case
of a ``fast'' mutex). Instead, \fBpthread_mutex_trylock\fP returns
immediately with the error code \fBEBUSY\fP.
\fBpthread_mutex_unlock\fP unlocks the given mutex. The mutex is assumed
to be locked and owned by the calling thread on entrance to
\fBpthread_mutex_unlock\fP. If the mutex is of the ``fast'' kind,
\fBpthread_mutex_unlock\fP always returns it to the unlocked state. If it
is of the ``recursive'' kind, it decrements the locking count of the
mutex (number of \fBpthread_mutex_lock\fP operations performed on it by
the calling thread), and only when this count reaches zero is the
mutex actually unlocked.
On ``error checking'' and ``recursive'' mutexes,
\fBpthread_mutex_unlock\fP actually checks at run-time that the mutex is
locked on entrance, and that it was locked by the same thread that is
now calling \fBpthread_mutex_unlock\fP. If these conditions are not met,
an error code is returned and the mutex remains unchanged. ``Fast''
mutexes perform no such checks, thus allowing a locked mutex to be
unlocked by a thread other than its owner. This is non-portable behavior
and must not be relied upon.
\fBpthread_mutex_destroy\fP destroys a mutex object, freeing the resources
it might hold. The mutex must be unlocked on entrance. In the
LinuxThreads implementation, no resources are associated with mutex
objects, thus \fBpthread_mutex_destroy\fP actually does nothing except
checking that the mutex is unlocked.
.SH CANCELLATION
None of the mutex functions is a cancellation point, not even
\fBpthread_mutex_lock\fP, in spite of the fact that it can suspend a
thread for arbitrary durations. This way, the status of mutexes at
cancellation points is predictable, allowing cancellation handlers to
unlock precisely those mutexes that need to be unlocked before the
thread stops executing. Consequently, threads using deferred
cancellation should never hold a mutex for extended periods of time.
.SH "ASYNC-SIGNAL SAFETY"
The mutex functions are not async-signal safe. What this means is that
they should not be called from a signal handler. In particular,
calling \fBpthread_mutex_lock\fP or \fBpthread_mutex_unlock\fP from a signal
handler may deadlock the calling thread.
.SH "RETURN VALUE"
\fBpthread_mutex_init\fP always returns 0. The other mutex functions
return 0 on success and a non-zero error code on error.
.SH ERRORS
The \fBpthread_mutex_lock\fP function returns the following error code
on error:
.RS
.TP
\fBEINVAL\fP
the mutex has not been properly initialized.
.TP
\fBEDEADLK\fP
the mutex is already locked by the calling thread
(``error checking'' mutexes only).
.RE
The \fBpthread_mutex_trylock\fP function returns the following error codes
on error:
.RS
.TP
\fBEBUSY\fP
the mutex could not be acquired because it was currently locked.
.TP
\fBEINVAL\fP
the mutex has not been properly initialized.
.RE
The \fBpthread_mutex_unlock\fP function returns the following error code
on error:
.RS
.TP
\fBEINVAL\fP
the mutex has not been properly initialized.
.TP
\fBEPERM\fP
the calling thread does not own the mutex (``error checking'' mutexes only).
.RE
The \fBpthread_mutex_destroy\fP function returns the following error code
on error:
.RS
.TP
\fBEBUSY\fP
the mutex is currently locked.
.RE
.SH AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
.SH "SEE ALSO"
\fBpthread_mutexattr_init\fP(3),
\fBpthread_mutexattr_setkind_np\fP(3),
\fBpthread_cancel\fP(3).
.SH EXAMPLE
A shared global variable \fIx\fP can be protected by a mutex as follows:
.RS
.ft 3
.nf
.sp
int x;
pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER;
.ft
.LP
.RE
.fi
All accesses and modifications to \fIx\fP should be bracketed by calls to
\fBpthread_mutex_lock\fP and \fBpthread_mutex_unlock\fP as follows:
.RS
.ft 3
.nf
.sp
pthread_mutex_lock(&mut);
/* operate on x */
pthread_mutex_unlock(&mut);
.ft
.LP
.RE
.fi
.TH PTHREAD_MUTEXATTR 3 LinuxThreads
.SH NAME
pthread_mutexattr_init, pthread_mutexattr_destroy, pthread_mutexattr_settype, pthread_mutexattr_gettype \- mutex creation attributes
.SH SYNOPSIS
.B #include <pthread.h>
.BI "int pthread_mutexattr_init(pthread_mutexattr_t *" attr ");"
.BI "int pthread_mutexattr_destroy(pthread_mutexattr_t *" attr ");"
.BI "int pthread_mutexattr_settype(pthread_mutexattr_t *" attr ", int " kind ");"
.BI "int pthread_mutexattr_gettype(const pthread_mutexattr_t *" attr ", int *" kind ");"
.SH DESCRIPTION
Mutex attributes can be specified at mutex creation time, by passing a
mutex attribute object as second argument to \fBpthread_mutex_init\fP(3).
Passing \fBNULL\fP is equivalent to passing a mutex attribute object with
all attributes set to their default values.
\fBpthread_mutexattr_init\fP initializes the mutex attribute object \fIattr\fP
and fills it with default values for the attributes.
\fBpthread_mutexattr_destroy\fP destroys a mutex attribute object, which
must not be reused until it is reinitialized. \fBpthread_mutexattr_destroy\fP
does nothing in the LinuxThreads implementation.
LinuxThreads supports only one mutex attribute: the mutex kind, which
is either \fBPTHREAD_MUTEX_FAST_NP\fP for ``fast'' mutexes,
\fBPTHREAD_MUTEX_RECURSIVE_NP\fP for ``recursive'' mutexes,
or \fBPTHREAD_MUTEX_ERRORCHECK_NP\fP for ``error checking'' mutexes.
As the \fBNP\fP suffix indicates, this is a non-portable extension to the
POSIX standard and should not be employed in portable programs.
The mutex kind determines what happens if a thread attempts to lock a
mutex it already owns with \fBpthread_mutex_lock\fP(3). If the mutex is of
the ``fast'' kind, \fBpthread_mutex_lock\fP(3) simply suspends the calling
thread forever. If the mutex is of the ``error checking'' kind,
\fBpthread_mutex_lock\fP(3) returns immediately with the error code
\fBEDEADLK\fP. If the mutex is of the ``recursive'' kind, the call to
\fBpthread_mutex_lock\fP(3) returns immediately with a success return
code. The number of times the thread owning the mutex has locked it is
recorded in the mutex. The owning thread must call
\fBpthread_mutex_unlock\fP(3) the same number of times before the mutex
returns to the unlocked state.
The default mutex kind is ``fast'', that is, \fBPTHREAD_MUTEX_FAST_NP\fP.
\fBpthread_mutexattr_settype\fP sets the mutex kind attribute in \fIattr\fP
to the value specified by \fIkind\fP.
\fBpthread_mutexattr_gettype\fP retrieves the current value of the
mutex kind attribute in \fIattr\fP and stores it in the location pointed
to by \fIkind\fP.
.SH "RETURN VALUE"
\fBpthread_mutexattr_init\fP, \fBpthread_mutexattr_destroy\fP and
\fBpthread_mutexattr_gettype\fP always return 0.
\fBpthread_mutexattr_settype\fP returns 0 on success and a non-zero
error code on error.
.SH ERRORS
On error, \fBpthread_mutexattr_settype\fP returns the following error code:
.TP
\fBEINVAL\fP
\fIkind\fP is neither \fBPTHREAD_MUTEX_FAST_NP\fP nor \fBPTHREAD_MUTEX_RECURSIVE_NP\fP
nor \fBPTHREAD_MUTEX_ERRORCHECK_NP\fP
.SH AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
.SH "SEE ALSO"
\fBpthread_mutex_init\fP(3),
\fBpthread_mutex_lock\fP(3),
\fBpthread_mutex_unlock\fP(3).
.TH PTHREAD_MUTEXATTR_SETKIND_NP 3 LinuxThreads
.SH NAME
pthread_mutexattr_setkind_np, pthread_mutexattr_getkind_np \- deprecated mutex creation attributes
.SH SYNOPSIS
.B #include <pthread.h>
.BI "int pthread_mutexattr_setkind_np(pthread_mutexattr_t *" attr ", int " kind ");"
.BI "int pthread_mutexattr_getkind_np(const pthread_mutexattr_t *" attr ", int *" kind ");"
.SH DESCRIPTION
These functions are deprecated, use \fBpthread_mutexattr_settype\fP(3)
and \fBpthread_mutexattr_gettype\fP(3) instead.
.SH "RETURN VALUE"
\fBpthread_mutexattr_getkind_np\fP always returns 0.
\fBpthread_mutexattr_setkind_np\fP returns 0 on success and a non-zero
error code on error.
.SH ERRORS
On error, \fBpthread_mutexattr_setkind_np\fP returns the following error code:
.TP
\fBEINVAL\fP
\fIkind\fP is neither \fBPTHREAD_MUTEX_FAST_NP\fP nor \fBPTHREAD_MUTEX_RECURSIVE_NP\fP
nor \fBPTHREAD_MUTEX_ERRORCHECK_NP\fP
.SH AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
.SH "SEE ALSO"
\fBpthread_mutexattr_settype\fP(3),
\fBpthread_mutexattr_gettype\fP(3).
.TH PTHREAD_ONCE 3 LinuxThreads
.SH NAME
pthread_once \- once-only initialization
.SH SYNOPSIS
.B #include <pthread.h>
.BI "pthread_once_t " once_control " = PTHREAD_ONCE_INIT;"
.BI "int pthread_once(pthread_once_t *" once_control ", void (*" init_routine ") (void));"
.SH DESCRIPTION
The purpose of \fBpthread_once\fP is to ensure that a piece of
initialization code is executed at most once. The \fIonce_control\fP
argument points to a static or extern variable statically initialized
to \fBPTHREAD_ONCE_INIT\fP.
The first time \fBpthread_once\fP is called with a given \fIonce_control\fP
argument, it calls \fIinit_routine\fP with no argument and changes the
value of the \fIonce_control\fP variable to record that initialization has
been performed. Subsequent calls to \fBpthread_once\fP with the same
\fBonce_control\fP argument do nothing.
.SH "RETURN VALUE"
\fBpthread_once\fP always returns 0.
.SH ERRORS
None.
.SH AUTHOR
Xavier Leroy <Xavier.Leroy@inria.fr>
This diff is collapsed.
......@@ -97,8 +97,8 @@ endif
echo -n "Build started: " ; date --rfc-2822; \
echo "---------------"; \
cd $(DEB_BUILDDIR) && \
CC="$(call xx,CC)" \
CXX=$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),:,"$(call xx,CXX)") \
CC="$(call xx,CC) -U_FILE_OFFSET_BITS -U_TIME_BITS" \
CXX=$(if $(filter nocheck,$(DEB_BUILD_OPTIONS)),:,"$(call xx,CXX) -U_FILE_OFFSET_BITS -U_TIME_BITS") \
MIG="$(call xx,MIG)" \
AUTOCONF=false \
MAKEINFO=: \
......
......@@ -135,7 +135,6 @@ endif
ifeq ($(filter stage1 stage2,$(DEB_BUILD_PROFILES)),)
echo 'libgcc:Depends=libgcc-s1 [!hppa !m68k], libgcc-s2 [m68k], libgcc-s4 [hppa]' >> tmp.substvars
echo 'libcrypt-dev:Depends=libcrypt-dev' >> tmp.substvars
echo 'libnsl-dev:Depends=libnsl-dev' >> tmp.substvars
echo 'rpcsvc-proto:Depends=rpcsvc-proto' >> tmp.substvars
echo 'libc-dev:Breaks=$(libc)-dev-$(DEB_HOST_ARCH)-cross (<< $(DEB_VERSION_UPSTREAM)~)' >> tmp.substvars
endif
......