History log of /haiku/src/system/libroot/posix/unistd/fork.c
Revision Date Author Comments
# 941c240a 17-Dec-2016 Jessica Hamilton <jessica.l.hamilton@gmail.com>

libroot/fork: fix gcc2 compilation.


# 17b2a3cf 17-Dec-2016 Jérôme Duval <jerome.duval@gmail.com>

fork(): Defer signals and lock the heaps while _kern_fork().

* Also defer signals while registering fork hooks.
* While malloc provides fork heap hooks which lock the heaps and unlock/reinit,
malloc_debug provides empty hooks.
* Ideas suggested by Ingo, patch reviewed by him. Thanks a lot!
* Also call fork parent hooks on failure.
* Solve locks-up when combining multithreading and process forking, should help
with #13111.


# b092f872 04-Jun-2015 Hamish Morrison <hamishm53@gmail.com>

fork: update the thread id in the pthread struct after forking

Otherwise the child process's main thread will inherit the thread id
of its parent and pthread operations will be directed at the wrong
thread.


# 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


# f7127458 15-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Private libroot locking primitives:
- Reimplemented mutex to use the _kern_mutex*() syscalls.
- The initializer functions cannot fail anymore -- changed their return type
to void.
- Changed the initializer function semantics to not copy the name by default
anymore (as in the kernel). Also added *_etc() versions of them that take an
additional flags.
- Added static initializer macros.
- Made the mutex (and thus recursive_lock) lock functions non-interruptable.
- Got rid of the "lazy" version. They are no longer needed, since the
initialization of the standard types can be done statically and cannot fail.
* Adjusted libroot, runtime loader, and other code using the private libroot
locking primitives to the new semantics.
* pthreads mutexes and condition variables:
- Reimplemented using the _kern_mutex*() syscalls.
- Consistently use POSIX error codes.
- Fixed some not quite POSIX compliant behavior.


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


# 6e069229 29-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Replace semaphores/benaphores in the env, fork, and user/group code by lazy
mutexes.


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


# 19d40f9e 01-Nov-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved the rld_export structure from <user_runtime.h> to
<runtime_loader.h>, since it isn't a kernel <-> userland interface.


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


# d1290701 21-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Release the fork lock when _kern_fork() failed or otherwise we'll
deadlock when trying the next fork().


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


# f8cb3071 02-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced the dummy implementations of the <grp.h> and <pwd.h>
functions by ones reading /etc/{group,passwd}.
* Added quasi-standard getpwent_r() and getgrent_r().
* Added _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX sysconf()
constants.
* Moved initgroups() and getgrouplist() definition to grp.cpp. They use
the same backend as the <grp.h> functions.
* Set the permissions of files created by the build system to what they
should be on the image (executables: 755, others: 644). Otherwise only
root could do anything under Haiku.
* Added build system variables HAIKU_ROOT_USER_NAME and
HAIKU_ROOT_USER_REAL_NAME to customize name and real name of Haiku's
root user.
* Added build system rules AddUserToHaikuImage and AddGroupToHaikuImage
for adding additional users and groups (by default only root user and
group and a "users" group are created).
* Adjusted BIND port and coreutils config.h files according to what
features have become available.
* Fixed HAIKU_DOCUMENTATION_OBJECT_DIR definition. Untested, but it used
a wrong variable name before.


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


# 1873b4b3 10-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Give the runtime loader a chance to reinit its semaphore after fork().


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


# a7854360 13-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Added vfork() as a wrapper to fork().


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


# 5af32e75 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed src/kernel to src/system.


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


# b092f872b3bba4a3a04577ce895827c4b1e2863b 04-Jun-2015 Hamish Morrison <hamishm53@gmail.com>

fork: update the thread id in the pthread struct after forking

Otherwise the child process's main thread will inherit the thread id
of its parent and pthread operations will be directed at the wrong
thread.


# 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


# f71274580bc2625bf438140839fe38193ece28e6 15-Apr-2010 Ingo Weinhold <ingo_weinhold@gmx.de>

* Private libroot locking primitives:
- Reimplemented mutex to use the _kern_mutex*() syscalls.
- The initializer functions cannot fail anymore -- changed their return type
to void.
- Changed the initializer function semantics to not copy the name by default
anymore (as in the kernel). Also added *_etc() versions of them that take an
additional flags.
- Added static initializer macros.
- Made the mutex (and thus recursive_lock) lock functions non-interruptable.
- Got rid of the "lazy" version. They are no longer needed, since the
initialization of the standard types can be done statically and cannot fail.
* Adjusted libroot, runtime loader, and other code using the private libroot
locking primitives to the new semantics.
* pthreads mutexes and condition variables:
- Reimplemented using the _kern_mutex*() syscalls.
- Consistently use POSIX error codes.
- Fixed some not quite POSIX compliant behavior.


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


# 6e069229083006f6e340aebe3a9b548d99b50180 29-Nov-2009 Ingo Weinhold <ingo_weinhold@gmx.de>

Replace semaphores/benaphores in the env, fork, and user/group code by lazy
mutexes.


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


# 19d40f9eb7dc8efdbbd637b21ceb83b9af3389df 01-Nov-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Moved the rld_export structure from <user_runtime.h> to
<runtime_loader.h>, since it isn't a kernel <-> userland interface.


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


# d129070196635a01436d63387e5285a01ea2c8b9 21-May-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Release the fork lock when _kern_fork() failed or otherwise we'll
deadlock when trying the next fork().


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


# f8cb30712e09e13b6eeb08f225810875aea1e6f8 02-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Replaced the dummy implementations of the <grp.h> and <pwd.h>
functions by ones reading /etc/{group,passwd}.
* Added quasi-standard getpwent_r() and getgrent_r().
* Added _SC_GETGR_R_SIZE_MAX and _SC_GETPW_R_SIZE_MAX sysconf()
constants.
* Moved initgroups() and getgrouplist() definition to grp.cpp. They use
the same backend as the <grp.h> functions.
* Set the permissions of files created by the build system to what they
should be on the image (executables: 755, others: 644). Otherwise only
root could do anything under Haiku.
* Added build system variables HAIKU_ROOT_USER_NAME and
HAIKU_ROOT_USER_REAL_NAME to customize name and real name of Haiku's
root user.
* Added build system rules AddUserToHaikuImage and AddGroupToHaikuImage
for adding additional users and groups (by default only root user and
group and a "users" group are created).
* Adjusted BIND port and coreutils config.h files according to what
features have become available.
* Fixed HAIKU_DOCUMENTATION_OBJECT_DIR definition. Untested, but it used
a wrong variable name before.


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


# 1873b4b37e5dbe9d90e3e186a5c39e51c3a80d99 10-Aug-2007 Ingo Weinhold <ingo_weinhold@gmx.de>

Give the runtime loader a chance to reinit its semaphore after fork().


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


# a7854360ac825a28fbfea0a97bff187887bb62d5 13-Dec-2006 Axel Dörfler <axeld@pinc-software.de>

Added vfork() as a wrapper to fork().


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


# 5af32e752606778be5dd7379f319fe43cb3f6b8c 13-Apr-2005 Axel Dörfler <axeld@pinc-software.de>

Renamed src/kernel to src/system.


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