-
-
Notifications
You must be signed in to change notification settings - Fork 71
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Posix wait #513
base: master
Are you sure you want to change the base?
Posix wait #513
Conversation
posix/init/src/stage2.cpp
Outdated
@@ -31,8 +31,7 @@ int main() { | |||
std::cout << "init: Starting udevd" << std::endl; | |||
auto udev = fork(); | |||
if(!udev) { | |||
// execl("/usr/sbin/udevd", "udevd", nullptr); | |||
execl("/usr/sbin/udevd", "udevd", "--debug", nullptr); | |||
assert(-1 != execl("/usr/sbin/udevd", "udevd", "--debug", nullptr)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Building with NDEBUG should not remove udev.
This definitely classifies as assert abuse.
Instead, we can write a wrapper macro that calls error()
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good point. I'll write a wrapper that calls error()
and then terminates by either calling exit()
or abort()
(whichever is deemed more appropriate).
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
error(3) terminates after printing the error if passed a nonzero value as the exit code
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This has been implemented; however due to the absense of error()
in mlibc this is stuck on mlibc#793
else if(pid == 0 && groupid != it->gid()){ | ||
continue; | ||
} | ||
else if(pid < -1 && groupid != it->gid()){ |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why are these cases distinct?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I did it like this because I was just going down the list of cases in the man-page; they do mean different things but because they all just continue;
it could also be one singular if-statement if so desired
resp.set_error(managarm::posix::Errors::WAIT_INTERRUPTED); | ||
} | ||
else { | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We really need a better way to map managarm errors to posix (not something for you to address, just saying)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Agreed, doing it this way feels clunky and the amount of code overhead isn't really optimal. I was thinking about just returning a POSIX error from Process::wait
, but that didn't seem appropriate either
8e16d6d
to
0b6196d
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Indentation is wrong in some places (4 spaces instead of a tab). Also else
goes on the same line as the closing }
of the if
body (as in: } else {
)
This PR aims to implement the
pid = 0
andpid <= -1
cases inProcess::wait
. It also adds checks ininit-stage2
to ensure that processes launched withexecl
actually get executed.