History log of /haiku/src/system/libroot/posix/unistd/exec.cpp
Revision Date Author Comments
# 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.


# 34671d60 23-Jul-2015 Axel Dörfler <axeld@pinc-software.de>

Added execvpe().

* This closes #12114 again; while not POSIX, it's just a line away.
* Removed exect() from the header -- not sure where this came from.
but I can't find anything about it on the net.
* Consolidated use of asterisk style in exec.cpp.


# 463d38e4 08-Jul-2015 Axel Dörfler <axeld@pinc-software.de>

Fixed exec*(), and __flatten_process_args() with NULL env.

* Not sure if it's following any standard, but environ can be NULL
(either by manually setting it to NULL, or by calling clearenv()).


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


# 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


# db033113 02-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

Closing #7056:
* inherit umask of calling process to images loaded via exec...()

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


# 6638711a 26-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

execvp() also needs to verify that an entry it found in the path is a
file. It would try to execute directories before (#1963).



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


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

Fixed my previous execvp() endless loop fix, which would always cause
an infinite loop.


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


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

execvp() was looping endlessly if PATH contained empty entries.
Reorganized the loop so that this won't happen anymore.


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


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

Implemented execvp() for real.


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


# 34671d601a9a471323f61c2ee40bd779dad5f139 23-Jul-2015 Axel Dörfler <axeld@pinc-software.de>

Added execvpe().

* This closes #12114 again; while not POSIX, it's just a line away.
* Removed exect() from the header -- not sure where this came from.
but I can't find anything about it on the net.
* Consolidated use of asterisk style in exec.cpp.


# 463d38e40bf70769d0440d6e15c54ca122d068c1 08-Jul-2015 Axel Dörfler <axeld@pinc-software.de>

Fixed exec*(), and __flatten_process_args() with NULL env.

* Not sure if it's following any standard, but environ can be NULL
(either by manually setting it to NULL, or by calling clearenv()).


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


# 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


# db0331134210bf63c82a298bb734f5fda4167a38 02-Jan-2011 Oliver Tappe <zooey@hirschkaefer.de>

Closing #7056:
* inherit umask of calling process to images loaded via exec...()

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


# 6638711aa9c4ca1edc391c11d9679fc5ab55191c 26-Mar-2008 Ingo Weinhold <ingo_weinhold@gmx.de>

execvp() also needs to verify that an entry it found in the path is a
file. It would try to execute directories before (#1963).



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


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

Fixed my previous execvp() endless loop fix, which would always cause
an infinite loop.


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


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

execvp() was looping endlessly if PATH contained empty entries.
Reorganized the loop so that this won't happen anymore.


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


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

Implemented execvp() for real.


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