History log of /haiku/src/system/libroot/posix/semaphore.cpp
Revision Date Author Comments
# f64c46e6 25-Jul-2023 Augustin Cavalier <waddlesplash@gmail.com>

kernel & libroot: Implement per-team unnamed semaphores.

This requires breaking syscall ABI to add the "flags" parameter
to _kern_mutex_sem_release.

Resolves a TODO.


# a866e2d9 16-Feb-2022 Jérôme Duval <jerome.duval@gmail.com>

POSIX: introduce sem_clockwait

will appear in the next version: https://www.opengroup.org/austin/docs/austin_1110.pdf

Change-Id: Iee3faf23647aa5244ad316fe1c3d825592483935
Reviewed-on: https://review.haiku-os.org/c/haiku/+/4966
Reviewed-by: waddlesplash <waddlesplash@gmail.com>
Tested-by: Commit checker robot <no-reply+buildbot@haiku-os.org>


# f1fafe31 12-Apr-2019 Augustin Cavalier <waddlesplash@gmail.com>

kernel/OS.h: Include sys/types.h instead of pthread.h.

This avoids polluting the namespace significantly. Also adjust
all files which depended on this behavior to include pthread.h
directly.


# 718d7149 10-Feb-2018 Jérôme Duval <jerome.duval@gmail.com>

white space cleanup


# d6d439f3 11-May-2015 Hamish Morrison <hamishm53@gmail.com>

Reimplement unnamed POSIX semaphores using user_mutex

* Fixes sharing semantics, so non-shared semaphores in non-shared
memory do not become shared after a fork.
* Adds two new system calls: _user_mutex_sem_acquire/release(),
which reuse the user_mutex address-hashed wait mechanism.
* Named semaphores continue to use traditional sem_id semaphores.


# f1a3e05d 11-Dec-2012 Jérôme Duval <jerome.duval@gmail.com>

style fix as suggested by axeld and jscipione.


# 3cdae651 29-Nov-2012 Sam Toyer <sam@qxcv.net>

sem_timedwait: fix errno, return value and NULL behaviour

* Takes into account remarks from Ingo.

Signed-off-by: Jerome Duval <jerome.duval@gmail.com>
Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>


# ae901935 24-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Introduce __set_errno() throughout libroot.

* add errno_private.h, which defines the __set_errno() macro with
and without tracing
* instead of setting errno manually, all libroot's code now invokes
__set_errno(), which makes it much easier to trace changes to errno
* redirect glibc's use of __set_errno() to our own version


# 24df6592 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6b202f4e 13-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
several kernel headers into a shared part and one that is still kernel
private. Adjusted all affected Jamfiles and source in the standard x86
build accordingly. The build for other architectures and for test code
may be broken.
* Quite a bit of userland code still includes private kernel headers.
Mostly those are <util/*> headers. The ones that aren't strictly
kernel-only should be moved to some other place (maybe
headers/private/shared/util).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3dfe682f 07-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added some padding to the sem_t structure.
* Changed the semantics of unnamed semaphores. Before parent and child
of a fork() would always share an earlier created semaphore. Now we do
that only, if the "shared" parameter of sem_init() was true. That's
still not quite the behavior Linux and Solaris have, but should be
perfectly fine with how reasonable code would use the API.
* There's a global table for shared unnamed semaphores now. ATM a
semaphore is leaked when no one explicitly destroys it (just as with
named sems).
* Enforce per-team and global semaphore number limits.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25362 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e8f1b18e 06-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Clear O_EXCL, if O_CREAT is not given.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25343 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98e67131 06-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved realtime_sem.{cpp,h} into new posix subdirectory.
* Renamed the old kernel_posix[_arch...].o to kernel_lib_posix...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25336 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5142c2ac 05-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for POSIX semaphores (the ones from the XSI extension
Realtime option group). The implementation should be complete, but is
totally untested yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25326 a95241bf-73f2-0310-859d-f6bbb57e9c96


# d6d439f3f75a0986063d42eda8ff5281adcb29b1 11-May-2015 Hamish Morrison <hamishm53@gmail.com>

Reimplement unnamed POSIX semaphores using user_mutex

* Fixes sharing semantics, so non-shared semaphores in non-shared
memory do not become shared after a fork.
* Adds two new system calls: _user_mutex_sem_acquire/release(),
which reuse the user_mutex address-hashed wait mechanism.
* Named semaphores continue to use traditional sem_id semaphores.


# f1a3e05d8c26328f345d29afb705dc828b631bf3 11-Dec-2012 Jérôme Duval <jerome.duval@gmail.com>

style fix as suggested by axeld and jscipione.


# 3cdae65125db9d867f328391d69970197e4b9556 29-Nov-2012 Sam Toyer <sam@qxcv.net>

sem_timedwait: fix errno, return value and NULL behaviour

* Takes into account remarks from Ingo.

Signed-off-by: Jerome Duval <jerome.duval@gmail.com>
Signed-off-by: Ingo Weinhold <ingo_weinhold@gmx.de>


# ae9019359606f1db67632ef51a77ce70001d3770 24-Nov-2011 Oliver Tappe <zooey@hirschkaefer.de>

Introduce __set_errno() throughout libroot.

* add errno_private.h, which defines the __set_errno() macro with
and without tracing
* instead of setting errno manually, all libroot's code now invokes
__set_errno(), which makes it much easier to trace changes to errno
* redirect glibc's use of __set_errno() to our own version


# 24df65921befcd0ad0c5c7866118f922da61cb96 11-Jun-2011 Ingo Weinhold <ingo_weinhold@gmx.de>

Merged signals-merge branch into trunk with the following changes:
* Reorganized the kernel locking related to threads and teams.
* We now discriminate correctly between process and thread signals. Signal
handlers have been moved to teams. Fixes #5679.
* Implemented real-time signal support, including signal queuing, SA_SIGINFO
support, sigqueue(), sigwaitinfo(), sigtimedwait(), waitid(), and the addition
of the real-time signal range. Closes #1935 and #2695.
* Gave SIGBUS a separate signal number. Fixes #6704.
* Implemented <time.h> clock and timer support, and fixed/completed alarm() and
[set]itimer(). Closes #5682.
* Implemented support for thread cancellation. Closes #5686.
* Moved send_signal() from <signal.h> to <OS.h>. Fixes #7554.
* Lots over smaller more or less related changes.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@42116 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 6b202f4e3da73d4c131355fcd82b792d153f84f6 13-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Introduced new header directory headers/private/system which is supposed
to contain headers shared by kernel and userland (mainly libroot).
* Moved quite a few private kernel headers to the new location. Split
several kernel headers into a shared part and one that is still kernel
private. Adjusted all affected Jamfiles and source in the standard x86
build accordingly. The build for other architectures and for test code
may be broken.
* Quite a bit of userland code still includes private kernel headers.
Mostly those are <util/*> headers. The ones that aren't strictly
kernel-only should be moved to some other place (maybe
headers/private/shared/util).


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25486 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 3dfe682f55250bfe5309902ec217fea71b50c7bb 07-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Added some padding to the sem_t structure.
* Changed the semantics of unnamed semaphores. Before parent and child
of a fork() would always share an earlier created semaphore. Now we do
that only, if the "shared" parameter of sem_init() was true. That's
still not quite the behavior Linux and Solaris have, but should be
perfectly fine with how reasonable code would use the API.
* There's a global table for shared unnamed semaphores now. ATM a
semaphore is leaked when no one explicitly destroys it (just as with
named sems).
* Enforce per-team and global semaphore number limits.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25362 a95241bf-73f2-0310-859d-f6bbb57e9c96


# e8f1b18ec29d89f8f04b6e823e0dab703ff99ae5 06-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Clear O_EXCL, if O_CREAT is not given.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25343 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 98e67131727de15752bc87a530612040c6955d17 06-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved realtime_sem.{cpp,h} into new posix subdirectory.
* Renamed the old kernel_posix[_arch...].o to kernel_lib_posix...


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25336 a95241bf-73f2-0310-859d-f6bbb57e9c96


# 5142c2ac86c0f020ffa3fc31cea9f1f2f1b6ef91 05-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added support for POSIX semaphores (the ones from the XSI extension
Realtime option group). The implementation should be complete, but is
totally untested yet.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25326 a95241bf-73f2-0310-859d-f6bbb57e9c96