Skip to content

Add std{in,out} for communication with child process#31

Open
manuels wants to merge 1 commit into
servo:mainfrom
manuels:master
Open

Add std{in,out} for communication with child process#31
manuels wants to merge 1 commit into
servo:mainfrom
manuels:master

Conversation

@manuels

@manuels manuels commented Oct 2, 2016

Copy link
Copy Markdown

No description provided.

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);

Copy link
Copy Markdown
Contributor

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.

@pcwalton pcwalton left a comment

Copy link
Copy Markdown
Contributor

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.

Comment thread tests/stdio.rs
cmd.stdout.read_exact(&mut buf[..]).unwrap();
assert_eq!(buf, b"B");

cmd.wait().unwrap();

Copy link
Copy Markdown
Contributor

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.

Comment thread tests/stdio.rs
assert_eq!(buf, b"A");

io::stdout().write_all(b"B").unwrap();
io::stdout().flush().unwrap();

Copy link
Copy Markdown
Contributor

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);

Copy link
Copy Markdown
Contributor

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?

@manuels

manuels commented Oct 6, 2016

Copy link
Copy Markdown
Author

@pcwalton, sure, I should I put this stuff into a new Operation?

@bors-servo

Copy link
Copy Markdown

☔ The latest upstream changes (presumably #51) made this pull request unmergeable. Please resolve the merge conflicts.

@kdy1

kdy1 commented Jan 14, 2020

Copy link
Copy Markdown

Sorry for asking a question here.

How can I add stderr support? I need a sandbox, but I'm not familiar with linux programming.

Nevermind. I somehow did it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants