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

Add Directory file descriptor relative syscall. #307

Merged
merged 1 commit into from
Jun 10, 2016
Merged

Add Directory file descriptor relative syscall. #307

merged 1 commit into from
Jun 10, 2016

Conversation

darnuria
Copy link
Contributor

@darnuria darnuria commented May 31, 2016

Add Directory file descriptor relative syscall.

I only added "*at" syscall relative to Posix2008 specification.

At the moment OSX and Android are partially supporting this API.

This include:

  • openat
  • faccessat
  • fchmodat
  • fchownat
  • fstatat
  • linkat
  • mkdirat
  • mknodat [0]
  • readlinkat
  • renameat
  • symlinkat
  • unlinkat
  • mkfifoat [0][1]

[1] Not available on Android at the moment:

  • mkfifo

[1] Not available on OSX at the moment:

  • mkfifoat
  • mknodat

And exclude operating system specific API:

  • renameat2: Linux specific
  • execveat: Linux specific since 3.19
  • futimesat: GNU extension
  • name_to_handle_at: GNU extension
  • scandirat: GNU extension
  • fanotify_mark: belong to fanotify API.

@rust-highfive
Copy link

Thanks for the pull request, and welcome! The Rust team is excited to review your changes, and you should hear from @alexcrichton (or someone else) soon.

If any changes to this PR are deemed necessary, please add them as extra commits. This ensures that the reviewer can see what has changed since they last reviewed the code. Due to the way GitHub handles out-of-date commits, this should also make it reasonably obvious what issues have or haven't been addressed. Large or tricky changes may require several passes of review and changes.

Please see the contribution instructions for more information.

@darnuria
Copy link
Contributor Author

At the moment, I haven't included AT_constant from fcntl.h. And

Some syscall like rename or futimens who are Posix2008 aren't in the binding I can add them.

Whereas I don't know what target I must add or link option. I will need some help about this.

@alexcrichton
Copy link
Member

Looks like a good set of APIs to add to me! The next step is appeasing Travis :)

It looks like the compile is failing on all compilers right now? Some APIs may not be available on all platforms, but those can just be pushed down the module hierarchy into a more specific location.

@darnuria
Copy link
Contributor Author

darnuria commented Jun 1, 2016

About utimensat I made a redefinition. But after a search on the web now it seems available on all Unix except MacOSX.

Should I move the original definition to a more specific place with an appropriate compilation attribute?

@alexcrichton
Copy link
Member

Ah in libc we don't use #[cfg] that much and instead opt for using a hierarchy, so I'd just place it in the appropriate module (may require some duplication)

@darnuria
Copy link
Contributor Author

darnuria commented Jun 2, 2016

So now I managed to get it on all platforms excepted OSX and IOS. How can do it? Moving all syscall in freebsd/netbsd/openbsd and Linux?

@alexcrichton
Copy link
Member

Yeah you'll probably just need to copy them around into the relevant files (which is fine to have duplication)

@darnuria
Copy link
Contributor Author

darnuria commented Jun 5, 2016

I copied the code were needed. Thanks for the help. :)

@alexcrichton
Copy link
Member

Looks like there's an API which also may not be defined on Android?

@darnuria
Copy link
Contributor Author

darnuria commented Jun 7, 2016

I managed to build it on a mac at my university. I get this message fairly different than Travis:

https://gist.github.com/darnuria/345636315461273ad591cc8b075c47cb

Here the kernel and OSX version of the computer:
uname -vrp 14.5.0 Darwin Kernel Version 14.5.0: Thu Apr 21 20:40:54 PDT 2016; root:xnu-2782.50.3~1/RELEASE_X86_64 i386

@alexcrichton
Copy link
Member

Yeah looks like OSX is the only one still failing, and looks like it's just a few functions that aren't defined on OSX?

@darnuria
Copy link
Contributor Author

darnuria commented Jun 8, 2016

Yes, but they appear on my university's OSX version. What is Travis's OSX version?

@alexcrichton
Copy link
Member

Oh I believe it's 10.9 or something like that but we can request a newer version, feel free to either omit the bindings or update .travis.yml to include the newer images as well!

@darnuria
Copy link
Contributor Author

darnuria commented Jun 9, 2016

Is it a relevant idea to support the newer version of OSX? I don't now what is the widespread version of OSX among Rust developers. If it's worth it I can change the version in .travis.yml file.

@kamalmarhubi
Copy link
Contributor

kamalmarhubi commented Jun 9, 2016

@darnuria libc aims to define the most up-to-date versions of APIs; see @alexcrichton's comment: #232 (comment)

I think it makes sense to bump the version in .travis.yml. Also big 👍 for these APIs!

@kamalmarhubi kamalmarhubi mentioned this pull request Jun 9, 2016
@darnuria
Copy link
Contributor Author

darnuria commented Jun 9, 2016

I still getting the same error on Travis after bumping.
OK Travis still build on default OSX also.

I can run it (with a runtime error on fstatat) on a 10.10 OSX computer at University. Somebody with an OSX computer can reproduce?

The fstatat error I get is really weird: -> Solved

$ RUST_BACKTRACE=1 cargo run --verbose
       Fresh winapi-build v0.1.1
       Fresh rustc-serialize v0.3.19
       Fresh winapi v0.2.6
       Fresh libc v0.2.11 (file:///~/libc)
       Fresh log v0.3.6
       Fresh libc v0.1.12
       Fresh bitflags v0.3.3
       Fresh gcc v0.3.28
       Fresh unicode-xid v0.0.3
       Fresh kernel32-sys v0.2.2
       Fresh term v0.2.14
       Fresh syntex_syntax v0.19.1
       Fresh ctest v0.1.0 (https://github.com/alexcrichton/ctest#a6becb6d)
       Fresh libc-test v0.1.0 (file:///~/libc/libc-test)
     Running `target/debug/libc-test`
RUNNING ALL TESTS
bad fstatat function pointer: rust: 140735556619904 (0x7fff8cdc0e80) != c 140735556619928 (0x7fff8cdc0e98)
thread '<main>' panicked at 'some tests failed', ~/libc/libc-
test/target/debug/build/libc-test-f1568b90912ff980/out/all.rs:11
stack backtrace:
   1:        0x108f15408 - std::sys::backtrace::tracing::imp::write::h4c73fcd3363076f5
   2:        0x108f16975 - std::panicking::default_hook::_$u7b$$u7b$closure$u7d$$u7d$::h0422dbb3077e6747
   3:        0x108f165ae - std::panicking::default_hook::haac48fa641db8fa2
   4:        0x108f0f746 - std::sys_common::unwind::begin_unwind_inner::h39d40f52add53ef7
   5:        0x108dfc2c7 - std::sys_common::unwind::begin_unwind::hd78480d5ec5c51b2
   6:        0x108df9f57 - libc_test::main::h8804cd59879ffe89
   7:        0x108f161a2 - std::sys_common::unwind::try::try_fn::h09ba69fd13531e58
   8:        0x108f147eb - __rust_try
   9:        0x108f15fe4 - std::rt::lang_start::h5b0863080165c75e
  10:        0x108dfc479 - main
error: Process didn't exit successfully: `target/debug/libc-test` (exit code: 101)

There is a differences of between the address returned by C and Rust.

@darnuria
Copy link
Contributor Author

Ok I got it. Some weird thing with OS due to stat structure and 64bits Inodes.

Solved by adding #[cfg_attr(target_os = "macos", link_name = "stat$INODE64")]

I only added "*at" syscall relative to Posix2008 specification.

At the moment OSX and Android are partially supporting this API.

This include:
* `openat`
* `faccessat`
* `fchmodat`
* `fchownat`
* `fstatat`
* `linkat`
* `mkdirat`
* `mknodat` [0]
* `readlinkat`
* `renameat`
* `symlinkat`
* `unlinkat`
* `mkfifoat` [0][1]

[1] Not available on Android at the moment:
* `mkfifo`

[1] Not available on OSX at the moment:
* `mkfifoat`
* `mknodat`

And exclude operating system specific API:
* `renameat2`: Linux specific
* `execveat`: Linux specific since 3.19
* `futimesat`: GNU extension
* `name_to_handle_at`: GNU extension
* `scandirat`: GNU extension
* `fanotify_mark`: belong to fanotify API.
@alexcrichton
Copy link
Member

@bors: r+ 26ee782

Thanks!

@bors
Copy link
Contributor

bors commented Jun 10, 2016

⌛ Testing commit 26ee782 with merge 45489d1...

bors added a commit that referenced this pull request Jun 10, 2016
…xcrichton

Add Directory file descriptor relative syscall.

Add Directory file descriptor relative syscall.

I only added "*at" syscall relative to Posix2008 specification.

At the moment OSX and Android are partially supporting this API.

This include:
* `openat`
* `faccessat`
* `fchmodat`
* `fchownat`
* `fstatat`
* `linkat`
* `mkdirat`
* `mknodat` [0]
* `readlinkat`
* `renameat`
* `symlinkat`
* `unlinkat`
* `mkfifoat` [0][1]

[1] Not available on Android at the moment:
* `mkfifo`

[1] Not available on OSX at the moment:
* `mkfifoat`
* `mknodat`

And exclude operating system specific API:
* `renameat2`: Linux specific
* `execveat`: Linux specific since 3.19
* `futimesat`: GNU extension
* `name_to_handle_at`: GNU extension
* `scandirat`: GNU extension
* `fanotify_mark`: belong to fanotify API.
@bors
Copy link
Contributor

bors commented Jun 10, 2016

💔 Test failed - travis

@alexcrichton
Copy link
Member

@bors: retry

On Fri, Jun 10, 2016 at 11:29 AM, bors notifications@github.com wrote:

💔 Test failed - travis
https://travis-ci.org/rust-lang/libc/builds/136641802


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#307 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAD95GVCL2SaU5JL-3XtzuJvvCepbWj0ks5qKS5hgaJpZM4IrDzz
.

@bors
Copy link
Contributor

bors commented Jun 10, 2016

⌛ Testing commit 26ee782 with merge c9aa92f...

bors added a commit that referenced this pull request Jun 10, 2016
…xcrichton

Add Directory file descriptor relative syscall.

Add Directory file descriptor relative syscall.

I only added "*at" syscall relative to Posix2008 specification.

At the moment OSX and Android are partially supporting this API.

This include:
* `openat`
* `faccessat`
* `fchmodat`
* `fchownat`
* `fstatat`
* `linkat`
* `mkdirat`
* `mknodat` [0]
* `readlinkat`
* `renameat`
* `symlinkat`
* `unlinkat`
* `mkfifoat` [0][1]

[1] Not available on Android at the moment:
* `mkfifo`

[1] Not available on OSX at the moment:
* `mkfifoat`
* `mknodat`

And exclude operating system specific API:
* `renameat2`: Linux specific
* `execveat`: Linux specific since 3.19
* `futimesat`: GNU extension
* `name_to_handle_at`: GNU extension
* `scandirat`: GNU extension
* `fanotify_mark`: belong to fanotify API.
@bors
Copy link
Contributor

bors commented Jun 10, 2016

💔 Test failed - travis

@alexcrichton
Copy link
Member

@bors: retry

shakes fist

On Fri, Jun 10, 2016 at 12:02 PM, bors notifications@github.com wrote:

💔 Test failed - travis
https://travis-ci.org/rust-lang/libc/builds/136649536


You are receiving this because you were mentioned.
Reply to this email directly, view it on GitHub
#307 (comment), or mute
the thread
https://github.com/notifications/unsubscribe/AAD95Gf5UAlEoIkUa05RYIbi7P8xKrzmks5qKTY0gaJpZM4IrDzz
.

@bors
Copy link
Contributor

bors commented Jun 10, 2016

⌛ Testing commit 26ee782 with merge fd30cfd...

bors added a commit that referenced this pull request Jun 10, 2016
…xcrichton

Add Directory file descriptor relative syscall.

Add Directory file descriptor relative syscall.

I only added "*at" syscall relative to Posix2008 specification.

At the moment OSX and Android are partially supporting this API.

This include:
* `openat`
* `faccessat`
* `fchmodat`
* `fchownat`
* `fstatat`
* `linkat`
* `mkdirat`
* `mknodat` [0]
* `readlinkat`
* `renameat`
* `symlinkat`
* `unlinkat`
* `mkfifoat` [0][1]

[1] Not available on Android at the moment:
* `mkfifo`

[1] Not available on OSX at the moment:
* `mkfifoat`
* `mknodat`

And exclude operating system specific API:
* `renameat2`: Linux specific
* `execveat`: Linux specific since 3.19
* `futimesat`: GNU extension
* `name_to_handle_at`: GNU extension
* `scandirat`: GNU extension
* `fanotify_mark`: belong to fanotify API.
@bors
Copy link
Contributor

bors commented Jun 10, 2016

☀️ Test successful - status-appveyor, travis

@bors bors merged commit 26ee782 into rust-lang:master Jun 10, 2016
Susurrus pushed a commit to Susurrus/libc that referenced this pull request Mar 26, 2017
Update signalfd

Update `signalfd` to use types and functions from `libc`.

It is a breaking change, because:
- renamed pub const `CREATE_NEW_FD` to `SIGNALFD_NEW`
- renamed pub const `SIGINFO_SIZE` to `SIGNALFD_SIGINFO_SIZE`
- removed pub const `SIGINFO_PADDING`

Fixes rust-lang#307
danielverkamp pushed a commit to danielverkamp/libc that referenced this pull request Apr 28, 2020
Looks like intrinsics that weren't listing a target feature were accidentally
omitted from the verification logic, so this commit fixes that!

Along the way I've ended up filing rust-lang#307 and rust-lang#308 for detected inconsistencies.
danielverkamp pushed a commit to danielverkamp/libc that referenced this pull request Apr 28, 2020
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.

None yet

5 participants