-
Notifications
You must be signed in to change notification settings - Fork 41
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
Add std{in,out} for communication with child process #31
base: main
Are you sure you want to change the base?
Conversation
assert_eq!(libc::close(io1_fds[0]), 0); | ||
|
||
assert_eq!(dup2(io2_fds[1], STDOUT_FILENO), STDOUT_FILENO); | ||
assert_eq!(libc::close(io2_fds[1]), 0); |
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.
nit: indent these to match the other statements in this block.
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 think I would prefer having stdin/stdout access be something you have to explicitly request via a sandbox profile. Servo doesn't need this and I don't want more HANDLEs available in the child process than absolutely necessary.
cmd.stdout.read_exact(&mut buf[..]).unwrap(); | ||
assert_eq!(buf, b"B"); | ||
|
||
cmd.wait().unwrap(); |
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.
nit: fix indentation here too.
assert_eq!(buf, b"A"); | ||
|
||
io::stdout().write_all(b"B").unwrap(); | ||
io::stdout().flush().unwrap(); |
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.
nit: fix indentation here.
|
||
// Set this `prctl` flag so that we can wait on our grandchild. (Otherwise it'll be | ||
// reparented to init.) | ||
assert!(seccomp::prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0) == 0); | ||
assert_eq!(seccomp::prctl(PR_SET_CHILD_SUBREAPER, 1, 0, 0, 0), 0); |
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.
Can you move this cleanup to a separate commit?
@pcwalton, sure, I should I put this stuff into a new Operation? |
☔ The latest upstream changes (presumably #51) made this pull request unmergeable. Please resolve the merge conflicts. |
Sorry for asking a question here.
Nevermind. I somehow did it. |
No description provided.