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

linux: Add splice, tee, vmsplice #172

Merged
merged 1 commit into from Feb 5, 2016

Conversation

Projects
None yet
2 participants
@kamalmarhubi
Copy link
Contributor

kamalmarhubi commented Feb 4, 2016

No description provided.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 4, 2016

Looks good to me, thanks! Just waiting on CI

@kamalmarhubi kamalmarhubi force-pushed the kamalmarhubi:splice-and-friends branch from 8657872 to 0f26733 Feb 5, 2016

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

Had to change some *const to *mut to (hopefully) get the CI to pass. Conceptually they are constant, but I guess that's up to a higher level than libc to enforce.

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

So I'm not sure what's going on here. On my system:

$ uname -r
4.3.0-1-amd64
$ printf "#define _GNU_SOURCE\n#include <fcntl.h>" | cpp - | grep -A1 vmsplice
extern ssize_t vmsplice (int __fdout, const struct iovec *__iov,
    size_t __count, unsigned int __flags);

But the man pages:

       ssize_t vmsplice(int fd, const struct iovec *iov,
                        unsigned long nr_segs, unsigned int flags);

http://man7.org/linux/man-pages/man2/vmsplice.2.html

@kamalmarhubi kamalmarhubi force-pushed the kamalmarhubi:splice-and-friends branch from 0f26733 to ce57bd6 Feb 5, 2016

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

I've pushed a version with a size_t instead, will see what that does. Concerned I'll have to dig into headers unknown and trace some ifdef stuff.

@alexcrichton what's the best thing to do here?

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

Well that seems to have passed. But even the syscall's signature says unsigned long:

asmlinkage long sys_vmsplice(int fd, const struct iovec __user *iov,
                 unsigned long nr_segs, unsigned int flags);

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/linux/syscalls.h#n788

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 5, 2016

Ah yeah the man pages often differ from the headers slightly, for example eventfd is this way as well (man page says unsigned int and header says int). In terms of API the size of unsigned long and size_t is the same everywhere now (they're all just usize), so ABI wise we're fine.

Can you rebase this as well? Unfortunately github with branch protection only allows merging a fully rebased PR...

@kamalmarhubi kamalmarhubi force-pushed the kamalmarhubi:splice-and-friends branch from ce57bd6 to 9adaa1f Feb 5, 2016

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

Rebased.

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

Ah yeah the man pages often differ from the headers slightly, for example eventfd is this way as well (man page says unsigned int and header says int).

I guess this is ok because they're the same size?

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 5, 2016

Yeah I think it's ok because they're the same size. or presumably glibc does something to do the translation.

Looks like the OSX failures were spurious, so I restarted the build.

@alexcrichton

This comment has been minimized.

Copy link
Member

alexcrichton commented Feb 5, 2016

Unfortunately I can't seem to coerce travis into restarting one of the failed builds, could you try amending a commit and force-pushing?

@kamalmarhubi kamalmarhubi force-pushed the kamalmarhubi:splice-and-friends branch from 9adaa1f to 0cfc25f Feb 5, 2016

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

Done.

@kamalmarhubi

This comment has been minimized.

Copy link
Contributor

kamalmarhubi commented Feb 5, 2016

@alexcrichton could you restart the mips job? it failed to install Rust. https://travis-ci.org/rust-lang-nursery/libc/jobs/107298557

alexcrichton added a commit that referenced this pull request Feb 5, 2016

Merge pull request #172 from kamalmarhubi/splice-and-friends
linux: Add splice, tee, vmsplice

@alexcrichton alexcrichton merged commit e9db959 into rust-lang:master Feb 5, 2016

2 checks passed

continuous-integration/appveyor/pr AppVeyor build succeeded
Details
continuous-integration/travis-ci/pr The Travis CI build passed
Details
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment