History log of /haiku/headers/private/libroot/libroot_private.h
Revision Date Author Comments
# 04be20a7 01-May-2021 Jérôme Duval <jerome.duval@gmail.com>

Implement stack protection support

this adds kernel & libroot stack protector hooks. it uses /dev/random in userspace.
A configure option --enable-stack-protector is added to activate -fstack-protector
on selected system components (ATM apps, kits, servers).

Change-Id: If3a2920ba9aa0a85eaff4ba6778947f8c76ade31
Reviewed-on: https://review.haiku-os.org/c/haiku/+/3895
Reviewed-by: Adrien Destugues <pulkomandy@gmail.com>


# 0d7d1fcc 27-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

libroot: Implement the general case of posix_spawn using load_image.

The goal here is to avoid potentially expensive fork()ing.

The time for a fork() is (for a process with no real heap usage
and thus few areas) 300-400us on my system. load_image() takes
3000us (3ms) or so, but this of course includes exec() time.

Overall, for compiling HaikuDepot (with a tweaked jam to use
posix_spawn on Haiku, not just on Linux) there is a slight
decrease in time:

before:
real 1m21.727s
user 1m2.131s
sys 0m43.029s

after:
real 1m19.472s
user 1m1.752s
sys 0m41.740s

Which is probably within the realm of "noise", so more benchmarks
are needed. Likely if we tweak our jam usage to not need as many
shells when running commands, this would be a much more noticeable
change.

Change-Id: I217f2476b1ed9aa18322b3c2bc8986571d89549a


# 016cc668 03-Sep-2019 Jaroslaw Pelczar <jarek@jpelczar.com>

Remove arch_get_caller

Use the gcc builtin instead, which generates more efficient code (it
saves a function call) and means less platform specific code to write
for us.

Change-Id: I1d55b5703027b2ea4ecde2438ea306bd4850eb32
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1859
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# be06cb25 11-Sep-2019 Jérôme Duval <jerome.duval@gmail.com>

libroot: make API version available.

Change-Id: I370d5c8e9b4f076e7f115ca6c87bc7f943d36c17
Reviewed-on: https://review.haiku-os.org/c/haiku/+/1850
Reviewed-by: Rene Gollent <rene@gollent.com>


# 12eb0e5d 30-Aug-2019 Augustin Cavalier <waddlesplash@gmail.com>

libroot: Add a private __look_up_in_path function.

Refactored out of execvpe. Originally I did this for my attempted
change to posix_spawn, but that change turned out to be wrong and
actually not that beneficial. This bit seems potentially useful,
though, so here it is.


# e4103b1b 25-Dec-2018 Michael Lotz <mmlr@mlotz.ch>

libroot: Introduce thread specific heap init/exit hooks.

This allows heap implementations to initialize and clean up any thread
specific structures. The current default hoard heap does not use these.

Note that the thread exit hook will not be called for the main thread as
the heap may be needed during process termination (__cxa_finalize for
example).

Change-Id: I703fbd34dec0d9029d619a2125c5b19d8c1933aa
Reviewed-on: https://review.haiku-os.org/799
Reviewed-by: waddlesplash <waddlesplash@gmail.com>


# 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.


# f474606e 12-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

libroot_debug: Merge guarded heap into libroot_debug.

The individual debug heap implementations are now exposed via a
structure of function pointers and a common frontend dispatches the
malloc and malloc_debug APIs through them.

The MALLOC_DEBUG environment variable can be used to select the guarded
heap by adding 'g', otherwise the debug heap is used as the default.
Consequently the separate libroot_guarded is not needed anymore and has
been removed.

To allow the use of environment variables this early, init_env_post_heap
has been added and the heap dependent atfork() moved there. This allowed
to fold the code of init_heap_post_env into init_heap so the former has
been removed.


# c012e7e9 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

libroot: Add private __arch_get_stack_trace().

It can be used to get a stack trace of the current thread. Note that
this works by walking frame pointers and will not produce anything
useful if an application is compiled with the frame pointers omitted.

The stack base and end addresses have to be provided as arguments and
are used to check that the frame pointers fall within that range. These
values are thread specific and can be retrieved with get_thread_info().
No other sanity checks (like checking for loops in the linked list) are
done.

This is a simplified rewrite of the stack trace code from the kernel
debugger.

As this code is common to x86 and x86_64 but is not generic across
architectures I introduced x86_common as a directory to put such
sources.


# ec0190ad 10-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

malloc_debug: Implement allocation dump on exit in guarded heap.

When enabled (using heap_debug_dump_allocations_on_exit(true) or
MALLOC_DEBUG=e) this causes a dump of all remaining allocations when
libroot_debug is unloaded. It uses terminate_after to be called as
late as possible.

When combined with alloc stack traces this makes for a nice if a bit
crude leak checker. Note that a lot of allocations usually remain
even at that stage due to statically, lazyly and globally allocated
stuff from the various system libraries where it isn't necessarily
worth the overhead to free them when the program terminates anyway.


# e551626f 01-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Implement support for a SYS:ENV attribute on executable

__flatten_process_args() does now have the executable path as an
additional (optional) parameter. If specified, the function will read
the file's SYS:ENV attribute (if set) and use its value to modified the
environment it is preparing for the new process. Currently supported
attribute values are strings consisting of "<var>=<value>" substrings
separated by "\0" (backslash zero), with '\' being used as an escape
character. The environment will be altered to contain the specified
"<var>=<value>" elements, replacing a preexisting <var> element (if
any).

A possible use case would be setting a SYS:ENV attribute with value
"DISABLE_ASLR=1" on an executable that needs ASLR disabled.


# 07e1875e 15-May-2013 Pawel Dziepak <pdziepak@quarnos.org>

libroot: explicitly check ABI version

As Axel suggested use simple, explicit checks for legacy ABI version
instead of obscure "compatibility mode".


# 5d0a1da8 14-May-2013 Pawel Dziepak <pdziepak@quarnos.org>

libroot: make all areas executable for old binaries

* If at least one image is either B_HAIKU_ABI_GCC_2_ANCIENT or
B_HAIKU_ABI_GCC_2_BEOS almost all areas are marked as executable.
* B_EXECUTE_AREA and B_STACK_AREA are made public. The former is enforced since
the introduction of DEP and apps need it to correctly set area protection.
The latter is currently needed only to recognize stack areas and fix their
protection in compatibility mode, but may also be useful if an app wants
to use sigaltstack from POSIX API.


# e85e399f 17-Mar-2013 Pawel Dziepak <pdziepak@quarnos.org>

commpage: randomize position of commpage

This patch introduces randomization of commpage position. From now on commpage
table contains offsets from begining to of the commpage to the particular
commpage entry. Similary addresses of symbols in ELF memory image "commpage"
are just offsets from the begining of the commpage.

This patch also updates KDL so that commpage entries are recognized and shown
correctly in stack trace. An update of Debugger is yet to be done.


# 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


# bafa7591 24-Feb-2011 Jérôme Duval <korli@users.berlios.de>

now correctly init the thread id in the pthread struct for main thread and threads spawned with spawn_thread(). This definitely helps for #7235.


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


# 3d0d4b62 15-Feb-2011 Axel Dörfler <axeld@pinc-software.de>

* Implemented a way to specify additional debug options via MALLOC_DEBUG when
using libroot_debug.so, instead of having to hardcode them in the application
via calling private heap functions.
* The following options are implemented: 'p' turns on paranoid validation,
'w' triggers periodic wall checking every 500ms ('W' does the same, but every
100ms), 'g' to use guard pages (beware, this will dramatically increase
memory usage), and 'r' which forbids reusing of memory, freed memory is never
actually freed.


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


# 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


# f4ab5d73 26-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* This fixes the remaining warnings in exit.c


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


# e10b4cac 08-Nov-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added __arch_get_caller(). Correctly implemented for x86 only.


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


# 2965c99f 23-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the _kern_exec() and _kern_load_image() syscalls. They expect
a flattened argument/environment buffer now. This simplifies the work
for the kernel a bit, since it can just copy the buffer and check
whether it looks OK instead of messing around with individual strings.
The runtime loader also gets a flattened array.
* Set the maximum size of the arguments/environment buffer to 128 KB.
When more arguments are passed, we fail with a proper error code
(instead of just truncating the arguments as before).
* On exec*() the first argument was silently replaced by the given path
name, which is not correct.


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


# f694f63e 18-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved private passwd/group/shadow passwd limit constants from
<libroot_private.h> to <user_group.h>.
* Added support in the registrar for adding and modifying users.


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


# a94ce1c9 17-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reorganized the passwd and group support: A dedicated thread in the
registrar provides access to the DBs via a port message based
protocol. The functions in libroot just ask the registrar now.
* Added Linuxish shadow passwd support. No putspent() though -- we'll
provide private functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25002 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


# c7c82420 24-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

_single_threaded should have C linkage. Was for some reason only a
problem with gcc 4.


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


# 30cce277 25-Feb-2008 Jérôme Duval <korli@users.berlios.de>

Patch from kaliber: use path of executable instead of the command. Thanks!
this fixes bug #1773 and #1824. I tested only #1773.


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


# 82062f80 13-Jan-2008 François Revol <revol@free.fr>

Works much better when actually allocating the TLS entry...
Now the backend works, Login can list users.


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


# 74c0424a 26-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
compile with _LOADER_MODE defined.


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


# 7f4e6824 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Added a private call to get the dependencies of a loaded image. This will be used
to determine linkage of libnet.so vs. libsocket.so/libbind.so in the libnetwork.so.


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


# 34a95562 05-Jan-2006 Stephan Aßmus <superstippi@gmx.de>

Made our glue code compatible to BeOS again. IOW executables compiled for Haiku will
now run under BeOS as well (as long as they don't use any functions that are not
available under R5).
The solution is a bit messy, but we have to live with it :-)
The runtime loader now patches the __gRuntimeLoader symbol in libroot.so to point
to its exported structure instead of passing it to the init functions as an
argument.
(Hax0red by axeld and bonefish on stippi's assimilated machine -- resistence is futile)


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


# 09bb4e9a 03-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

The real_time_data structure contains an architecture specific
substructure now (that's the only member actually). The system time
offset is therefore accessed via architecture specific accessor
functions.
Note, that this commit breaks the PPC build. Since I want to rename at
least one file I've already changed, I can't avoid that.


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


# 43ed6aa0 13-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

The "shebang" handler is supposed to parse arguments, too - we now do that.
Also, when the line is too long, E2BIG is returned.
Thanks to Korli who pointed me to this: http://homepages.cwi.nl/~aeb/std/shebang/


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


# be22452f 14-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Apparently, both load_image() and exec*() support running scripts. We do that
now as well.
Also, both functions will now test if the executable exists and is valid; that
way, load_image()/exec*() can catch many errors without having to create a new
team (or erase the current one - an exec*("my invalid app") might now return
with an error).
The runtime linker now exports a function to test executables that is aware
of the search paths, and will also check user permissions upfront.


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


# c4472a00 22-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

The heap is now initialized by libroot_init.c::initialize_before(), so
that we no longer need an initialize_after().
Put the architecture dependent hoard functions into the BPrivate namespace
as well. Minor cleanup.


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


# 2bf23eaa 10-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Added __init_env() prototype.


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


# 312ecc1e 17-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for __init_time() and __arch_init_time().


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


# 709d0334 12-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for __init_image() and __init_dlfcn() so that they don't have
to be defined in the source files anymore.


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


# d6f96fbf 02-May-2004 Axel Dörfler <axeld@pinc-software.de>

Added a header that contains private libroot definitions.


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


# f474606ee92a7afddb5b3b6350a97ffd31e22c42 12-Aug-2015 Michael Lotz <mmlr@mlotz.ch>

libroot_debug: Merge guarded heap into libroot_debug.

The individual debug heap implementations are now exposed via a
structure of function pointers and a common frontend dispatches the
malloc and malloc_debug APIs through them.

The MALLOC_DEBUG environment variable can be used to select the guarded
heap by adding 'g', otherwise the debug heap is used as the default.
Consequently the separate libroot_guarded is not needed anymore and has
been removed.

To allow the use of environment variables this early, init_env_post_heap
has been added and the heap dependent atfork() moved there. This allowed
to fold the code of init_heap_post_env into init_heap so the former has
been removed.


# c012e7e9305fa8acbf3ead9f8b1ca19b7c677b06 11-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

libroot: Add private __arch_get_stack_trace().

It can be used to get a stack trace of the current thread. Note that
this works by walking frame pointers and will not produce anything
useful if an application is compiled with the frame pointers omitted.

The stack base and end addresses have to be provided as arguments and
are used to check that the frame pointers fall within that range. These
values are thread specific and can be retrieved with get_thread_info().
No other sanity checks (like checking for loops in the linked list) are
done.

This is a simplified rewrite of the stack trace code from the kernel
debugger.

As this code is common to x86 and x86_64 but is not generic across
architectures I introduced x86_common as a directory to put such
sources.


# ec0190adb0a9abe5a796d31468f421896eb47124 10-Apr-2015 Michael Lotz <mmlr@mlotz.ch>

malloc_debug: Implement allocation dump on exit in guarded heap.

When enabled (using heap_debug_dump_allocations_on_exit(true) or
MALLOC_DEBUG=e) this causes a dump of all remaining allocations when
libroot_debug is unloaded. It uses terminate_after to be called as
late as possible.

When combined with alloc stack traces this makes for a nice if a bit
crude leak checker. Note that a lot of allocations usually remain
even at that stage due to statically, lazyly and globally allocated
stuff from the various system libraries where it isn't necessarily
worth the overhead to free them when the program terminates anyway.


# e551626f40c89e7ff5dcac8ce368690fcf382375 01-Dec-2013 Ingo Weinhold <ingo_weinhold@gmx.de>

Implement support for a SYS:ENV attribute on executable

__flatten_process_args() does now have the executable path as an
additional (optional) parameter. If specified, the function will read
the file's SYS:ENV attribute (if set) and use its value to modified the
environment it is preparing for the new process. Currently supported
attribute values are strings consisting of "<var>=<value>" substrings
separated by "\0" (backslash zero), with '\' being used as an escape
character. The environment will be altered to contain the specified
"<var>=<value>" elements, replacing a preexisting <var> element (if
any).

A possible use case would be setting a SYS:ENV attribute with value
"DISABLE_ASLR=1" on an executable that needs ASLR disabled.


# 07e1875ea21bd0a05e949cce0d4e4558b6684ee0 15-May-2013 Pawel Dziepak <pdziepak@quarnos.org>

libroot: explicitly check ABI version

As Axel suggested use simple, explicit checks for legacy ABI version
instead of obscure "compatibility mode".


# 5d0a1da8bf914d4a26bba97ba40cbb36bf99ce52 14-May-2013 Pawel Dziepak <pdziepak@quarnos.org>

libroot: make all areas executable for old binaries

* If at least one image is either B_HAIKU_ABI_GCC_2_ANCIENT or
B_HAIKU_ABI_GCC_2_BEOS almost all areas are marked as executable.
* B_EXECUTE_AREA and B_STACK_AREA are made public. The former is enforced since
the introduction of DEP and apps need it to correctly set area protection.
The latter is currently needed only to recognize stack areas and fix their
protection in compatibility mode, but may also be useful if an app wants
to use sigaltstack from POSIX API.


# e85e399fd7b229b8bc92f28928a059876d7216d3 17-Mar-2013 Pawel Dziepak <pdziepak@quarnos.org>

commpage: randomize position of commpage

This patch introduces randomization of commpage position. From now on commpage
table contains offsets from begining to of the commpage to the particular
commpage entry. Similary addresses of symbols in ELF memory image "commpage"
are just offsets from the begining of the commpage.

This patch also updates KDL so that commpage entries are recognized and shown
correctly in stack trace. An update of Debugger is yet to be done.


# 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


# bafa759148a8c7d7ee34164591511930cac4e8f7 24-Feb-2011 Jérôme Duval <korli@users.berlios.de>

now correctly init the thread id in the pthread struct for main thread and threads spawned with spawn_thread(). This definitely helps for #7235.


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


# 3d0d4b6200bc16c89e241afb715ce35f15f50020 15-Feb-2011 Axel Dörfler <axeld@pinc-software.de>

* Implemented a way to specify additional debug options via MALLOC_DEBUG when
using libroot_debug.so, instead of having to hardcode them in the application
via calling private heap functions.
* The following options are implemented: 'p' turns on paranoid validation,
'w' triggers periodic wall checking every 500ms ('W' does the same, but every
100ms), 'g' to use guard pages (beware, this will dramatically increase
memory usage), and 'r' which forbids reusing of memory, freed memory is never
actually freed.


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


# 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


# f4ab5d73ce231f9b0327003c2c287b2d5b8d1e5a 26-Nov-2009 Axel Dörfler <axeld@pinc-software.de>

* This fixes the remaining warnings in exit.c


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


# e10b4cace53f6c8f3ff3703c5a36cba3904b8af0 08-Nov-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

Added __arch_get_caller(). Correctly implemented for x86 only.


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


# 2965c99fea660b23b03b58a3c9955a16bed0e019 23-Jun-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Changed the _kern_exec() and _kern_load_image() syscalls. They expect
a flattened argument/environment buffer now. This simplifies the work
for the kernel a bit, since it can just copy the buffer and check
whether it looks OK instead of messing around with individual strings.
The runtime loader also gets a flattened array.
* Set the maximum size of the arguments/environment buffer to 128 KB.
When more arguments are passed, we fail with a proper error code
(instead of just truncating the arguments as before).
* On exec*() the first argument was silently replaced by the given path
name, which is not correct.


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


# f694f63e2bb877820914fddd71dbdc71884f33f6 18-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Moved private passwd/group/shadow passwd limit constants from
<libroot_private.h> to <user_group.h>.
* Added support in the registrar for adding and modifying users.


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


# a94ce1c912808a0129c989f8d5c2e2aff4fec871 17-Apr-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

* Reorganized the passwd and group support: A dedicated thread in the
registrar provides access to the DBs via a port message based
protocol. The functions in libroot just ask the registrar now.
* Added Linuxish shadow passwd support. No putspent() though -- we'll
provide private functions.


git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@25002 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


# c7c82420e1268d9b6dd484f8f84590b45ddf39cf 24-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

_single_threaded should have C linkage. Was for some reason only a
problem with gcc 4.


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


# 30cce2777045e655a0ea301c3ccadb3d53ff1750 25-Feb-2008 Jérôme Duval <korli@users.berlios.de>

Patch from kaliber: use path of executable instead of the command. Thanks!
this fixes bug #1773 and #1824. I tested only #1773.


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


# 82062f804c1106ddc51f22b2b452b45181d3d6c4 13-Jan-2008 François Revol <revol@free.fr>

Works much better when actually allocating the TLS entry...
Now the backend works, Login can list users.


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


# 74c0424a43b550536d4b55b8fc13631ca4edfcb0 26-Jul-2007 Axel Dörfler <axeld@pinc-software.de>

* Added a mechanism to retrieve a BMessage with eventual error descriptions
for _kern_load_image().
* Added KMessage to the runtime_loader (a bit hacky, though) - it will use
it to deliver the above mentioned functionality.
* load_dependencies() did return the wrong status code in case a library
was missing; now it returns B_MISSING_LIBRARY.
* load_dependencies() will now try to load all dependencies when a report
message is requested; therefore, all missing libraries are listed.
* Renamed uspace_program_args to user_space_program_args.
* The kernel filled in various members of the user_space_program_args structure
unsafely, ie. was not using user_memcpy().
* Renamed some local variables in team.c to better fit our style guide (ie.
uargs to userArgs).
* Changed Tracker to use the new _kern_load_image() variant on Haiku to retrieve
and report all missing libraries. This fixes bug #1324.
* Adapted kernel_cpp.cpp to the runtime loader as well; the latter will now
compile with _LOADER_MODE defined.


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


# 7f4e6824dfccc85a3c7ed45fd8ef4b7a944c395b 06-Oct-2006 Axel Dörfler <axeld@pinc-software.de>

Added a private call to get the dependencies of a loaded image. This will be used
to determine linkage of libnet.so vs. libsocket.so/libbind.so in the libnetwork.so.


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


# 34a9556215f39bb00d4bb6cf2376543aca82436d 05-Jan-2006 Stephan Aßmus <superstippi@gmx.de>

Made our glue code compatible to BeOS again. IOW executables compiled for Haiku will
now run under BeOS as well (as long as they don't use any functions that are not
available under R5).
The solution is a bit messy, but we have to live with it :-)
The runtime loader now patches the __gRuntimeLoader symbol in libroot.so to point
to its exported structure instead of passing it to the init functions as an
argument.
(Hax0red by axeld and bonefish on stippi's assimilated machine -- resistence is futile)


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


# 09bb4e9ac5dc193f63b02b33e88085f22d8719ab 03-Jan-2006 Ingo Weinhold <ingo_weinhold@gmx.de>

The real_time_data structure contains an architecture specific
substructure now (that's the only member actually). The system time
offset is therefore accessed via architecture specific accessor
functions.
Note, that this commit breaks the PPC build. Since I want to rename at
least one file I've already changed, I can't avoid that.


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


# 43ed6aa0db36b7caa37a15a9f12c4fc2b56b0d6d 13-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

The "shebang" handler is supposed to parse arguments, too - we now do that.
Also, when the line is too long, E2BIG is returned.
Thanks to Korli who pointed me to this: http://homepages.cwi.nl/~aeb/std/shebang/


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


# be22452f3b328b448c41fe540f0bc70935dda6db 14-Jun-2005 Axel Dörfler <axeld@pinc-software.de>

Apparently, both load_image() and exec*() support running scripts. We do that
now as well.
Also, both functions will now test if the executable exists and is valid; that
way, load_image()/exec*() can catch many errors without having to create a new
team (or erase the current one - an exec*("my invalid app") might now return
with an error).
The runtime linker now exports a function to test executables that is aware
of the search paths, and will also check user permissions upfront.


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


# c4472a00b18debad374ab1c1a15b02af6385e9d2 22-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

The heap is now initialized by libroot_init.c::initialize_before(), so
that we no longer need an initialize_after().
Put the architecture dependent hoard functions into the BPrivate namespace
as well. Minor cleanup.


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


# 2bf23eaa75301054d4dd7fc1ec9106b1c1b2ef48 10-Mar-2005 Axel Dörfler <axeld@pinc-software.de>

Added __init_env() prototype.


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


# 312ecc1ec36de57d91818362f1ef8644bab3f184 17-Nov-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for __init_time() and __arch_init_time().


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


# 709d033403632d2fd171c62abd80b230572e5b88 12-Oct-2004 Axel Dörfler <axeld@pinc-software.de>

Added prototypes for __init_image() and __init_dlfcn() so that they don't have
to be defined in the source files anymore.


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


# d6f96fbff910e0d315a42cbc839b3a7928e9c978 02-May-2004 Axel Dörfler <axeld@pinc-software.de>

Added a header that contains private libroot definitions.


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