Skip to content
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

Use Prctl() and ioctl wrapper functions from x/sys/unix #1504

Merged
merged 3 commits into from
Jul 10, 2017
Merged

Use Prctl() and ioctl wrapper functions from x/sys/unix #1504

merged 3 commits into from
Jul 10, 2017

Conversation

tklauser
Copy link
Contributor

@tklauser tklauser commented Jul 3, 2017

Update golang.org/x/sys/unix once again to get some more newly added wrapper functions and switch libcontainer to use them instead of manually reimplemented local wrappers.

@tklauser
Copy link
Contributor Author

tklauser commented Jul 3, 2017

Rebased on latest master to hopefully fix the shfmt issues which made Travis CI fail.

@@ -123,8 +123,8 @@ func unlockpt(f *os.File) error {

// ptsname retrieves the name of the first available pts for the given master.
func ptsname(f *os.File) (string, error) {
var n int32
if err := ioctl(f.Fd(), unix.TIOCGPTN, uintptr(unsafe.Pointer(&n))); err != nil {
n, err := unix.IoctlGetInt(int(f.Fd()), unix.TIOCGPTN)
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks ! Do you also want to make the same changes to https://github.com/containerd/console/blob/master/tc_linux.go ?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, will look into it and prepare a PR.

@cyphar
Copy link
Member

cyphar commented Jul 3, 2017

LGTM. I know we've said this before, but 👍 for doing this work. 😸

Approved with PullApprove

@cyphar
Copy link
Member

cyphar commented Jul 3, 2017

The shfmt issue is not related to this PR. This is happening because we pull shfmt from master and they just changed some of their requirements. I'll send a PR to fix it.

@cyphar
Copy link
Member

cyphar commented Jul 3, 2017

It looks like this is actually a bug in shfmt...

declare -F $completions_func >/dev/null && $completions_func

mvdan/sh#129

Update golang.org/x/sys to get newly added functions and constants which
will be used in successive commits.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Use unix.Prctl() instead of manually reimplementing it using
unix.RawSyscall. Also use unix.SECCOMP_MODE_FILTER instead of locally
defining it.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
Use IoctlGetInt and IoctlGetTermios/IoctlSetTermios instead of manually
reimplementing them.

Because of unlockpt, the ioctl wrapper is still needed as it needs to
pass a pointer to a value, which is not supported by any ioctl function
in x/sys/unix yet.

Signed-off-by: Tobias Klauser <tklauser@distanz.ch>
@tklauser
Copy link
Contributor Author

Rebased on latest master with shfmt removed. Travis is now happy again 😎

@dqminh
Copy link
Contributor

dqminh commented Jul 10, 2017

LGTM

Approved with PullApprove

1 similar comment
@crosbymichael
Copy link
Member

crosbymichael commented Jul 10, 2017

LGTM

Approved with PullApprove

@crosbymichael crosbymichael merged commit a0159fd into opencontainers:master Jul 10, 2017
@tklauser tklauser deleted the more-unix-funcs branch July 11, 2017 09:21
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