Skip to content
Snippets Groups Projects
  1. May 22, 2016
  2. May 15, 2016
    • Fletcher Nichol's avatar
      Fix ioctl constants for musl target envs. · 78d9be21
      Fletcher Nichol authored
      According to musl's source, the `ioctl` [function
      signature][musl-ioctl-h] takes an `int` as the request argument (i.e. an
      `i32`) which is reflected in this crate's [ioctl
      binding][musl-ioctl-rs]. It looks like when the ioctl constants were
      added that [glibc's default][glibc-ioctl-h] of a `c_ulong` type was used
      for the musl values as well, rather than a `c_int` type. This change
      updates these constants to a `c_int` so that they match the expected
      function call type.
      
      Here is a minimal reproduction of the issue. Given this Rust program:
      
      ```rust
      extern crate libc;
      
      use libc::{ioctl, winsize, STDOUT_FILENO, TIOCGWINSZ};
      
      fn main() {
          let mut wsize = winsize {
              ws_row: 0,
              ws_col: 0,
              ws_xpixel: 0,
              ws_ypixel: 0,
          };
          unsafe {
              ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut wsize);
          }
          println!("Sizes: {{ rows: {}, cols: {}, xpixel: {}, ypixel: {} }}",
                   wsize.ws_row,
                   wsize.ws_col,
                   wsize.ws_xpixel,
                   wsize.ws_ypixel);
      }
      ```
      
      When run against the `x86_64-unknwon-linux-gnu` and
      `x86_64-unknown-linux-musl` targets, we see the difference in behavior:
      
      ```
      > cargo clean
      
      > cargo run --target=x86_64-unknown-linux-gnu
         Compiling libc v0.2.11
         Compiling libc-musl-ioctl v0.1.0 (file:///src/libc-musl-ioctl)
           Running `target/x86_64-unknown-linux-gnu/debug/libc-musl-ioctl`
      Sizes: { rows: 28, cols: 211, xpixel: 0, ypixel: 0 }
      
      > cargo clean
      
      > cargo run --target=x86_64-unknown-linux-musl
         Compiling libc v0.2.11
         Compiling libc-musl-ioctl v0.1.0 (file:///src/libc-musl-ioctl)
      src/main.rs:13:30: 13:40 error: mismatched types:
       expected `i32`,
          found `u64` [E0308]
      src/main.rs:13         ioctl(STDOUT_FILENO, TIOCGWINSZ, &mut wsize);
                                                  ^~~~~~~~~~
      src/main.rs:13:30: 13:40 help: run `rustc --explain E0308` to see a detailed explanation
      error: aborting due to previous error
      Could not compile `libc-musl-ioctl`.
      
      To learn more, run the command again with --verbose.
      ```
      
      Working against this fix:
      
      ```
      > cargo clean
      
      > cargo run --target=x86_64-unknown-linux-gnu
          Updating git repository `https://github.com/fnichol/rust-lang-libc.git`
         Compiling libc v0.2.11 (https://github.com/fnichol/rust-lang-libc.git?branch=fix-musl-ioctl-constants#3285f387)
         Compiling libc-musl-ioctl v0.1.0 (file:///src/libc-musl-ioctl)
           Running `target/x86_64-unknown-linux-gnu/debug/libc-musl-ioctl`
      Sizes: { rows: 28, cols: 211, xpixel: 0, ypixel: 0 }
      
      > cargo clean
      
      > cargo run --target=x86_64-unknown-linux-musl
         Compiling libc v0.2.11 (https://github.com/fnichol/rust-lang-libc.git?branch=fix-musl-ioctl-constants#3285f387)
         Compiling libc-musl-ioctl v0.1.0 (file:///src/libc-musl-ioctl)
           Running `target/x86_64-unknown-linux-musl/debug/libc-musl-ioctl`
      Sizes: { rows: 28, cols: 211, xpixel: 0, ypixel: 0 }
      ```
      
      [musl-ioctl-rs]:
      https://doc.rust-lang.org/libc/x86_64-unknown-linux-musl/libc/fn.ioctl.html
      
      [musl-ioctl-h]:
      https://git.musl-libc.org/cgit/musl/tree/include/sys/ioctl.h
      
      [glibc-ioctl-h]:
      http://bazaar.launchpad.net/~vcs-imports/glibc/master/view/head:/include/sys/ioctl.h
      78d9be21
  3. May 13, 2016
  4. May 12, 2016
  5. May 11, 2016
  6. May 10, 2016
    • Raphael Cohn's avatar
      Adding getprogname and setprogname for all BSDs and Solaris. · 893d4d84
      Raphael Cohn authored
      Adding program_invocation_short_name for Linux (Musl and glibc).
      
      Adding __progname for Android. This is a little different, but
      is a safer alternative to using argv[0], which may not exist, and
      includes Android's default application name (currently '<unknown>').
      
      Adding these functions and externs means it is possible for all
      but Windows applications to safely discover their
      name, rather than rely on argv[0] parsing, /proc/self/exe, etc.
      893d4d84
  7. May 08, 2016
  8. May 07, 2016
  9. May 05, 2016
    • Kamal Marhubi's avatar
      unix: Add PIPE_BUF for bsd and notbsd · ce0dc736
      Kamal Marhubi authored
      This is the maximum size of guaranteed-atomic writes to a pipe.
      ce0dc736
    • Raphael Cohn's avatar
      Moved `LOG_NFEATURES` from notbsd to Linux · 1c6c0ca7
      Raphael Cohn authored
      This is because Android bionic doesn't support `LOG_NFEATURES`.
      1c6c0ca7
    • Raphael Cohn's avatar
      Substantial changes to better support Solaris and BSD variants. · 7fc09699
      Raphael Cohn authored
      Removed CODE, as its definition and name varies too wildy and I
      have no current code using it to test permutations with.
      
      Moved LOG_NFACILITIES down, as Mac OS X defines this value
      differently.
      
      Added Mac OS X specific LOG_* facilities.
      
      Added FreeBSD / DragonFly BSD specific LOG_* facilities.
      
      Moved LOG_PERROR down, as all platforms bar Solaris define this.
      
      Moved LOG_CRON down, as Solaris defines this with a different value.
      
      Moved LOG_AUTHPRIV and LOG_FTP down, as all platforms bar Solaris
      define these.
      
      Looks like Solaris is suffering from the bit rot of commercial Unix...
      7fc09699
  10. May 04, 2016
  11. Apr 29, 2016
    • Kamal Marhubi's avatar
      linux: Add prlimit(2) and prlimit64(2) · 95695995
      Kamal Marhubi authored
      As with `getrlimit` and `setrlimit`, the glibc wrappers have a non-`int`
      for the `resource` argument, eg:
      
          extern int prlimit (__pid_t __pid, enum __rlimit_resource __resource,
                              const struct rlimit *__new_limit,
                              struct rlimit *__old_limit) __THROW;
      95695995
  12. Apr 28, 2016
    • Kamal Marhubi's avatar
      notbsd: Deduplicate definitions · b9750b65
      Kamal Marhubi authored
      A bunch of definitions were duplicated across, eg, android and linux.
      This commit pulls these up to higher levels where they can be shared.
      b9750b65
  13. Apr 16, 2016
    • Timon Van Overveldt's avatar
      Add support for arm-unknown-linux-musleabi{,hf} targets. · ad728590
      Timon Van Overveldt authored
      These targets will be similar to the x86_64-unknown-linux-musl
      target, in that they'll use MUSL libc to allow fully static binaries
      to be generated. To remain consistent with the naming of existing
      ARM targets, as well as with the standard naming of MUSL toolchains,
      we'll use `musleabi` and `musleabihf` as the target environment
      names (analogous to `gnueabi` and `gnueabihf`).
      
      Most of these changes just extend the special casing for x86_64 MUSL
      targets to the ARM ones as well.
      ad728590
  14. Apr 15, 2016
  15. Apr 12, 2016
  16. Apr 10, 2016
  17. Apr 05, 2016
    • A.J. Gardner's avatar
      Define xlocale and langinfo interfaces · 24c84f13
      A.J. Gardner authored
      There are many constants defined by langinfo, but we have the
      new types, locale_t and nl_item.
      
      We also have several functions, not all of which exist for every
      platform:
      
      nl_langinfo
      nl_langinfo_l
      newlocale
      duplocale
      freelocale
      uselocale
      querylocale
      24c84f13
  18. Apr 04, 2016
  19. Apr 03, 2016
  20. Apr 02, 2016
  21. Mar 31, 2016
  22. Mar 30, 2016
  23. Mar 18, 2016
    • Kamal Marhubi's avatar
      linux: Add missing Linux-specific fcntls · b43118cb
      Kamal Marhubi authored
      Also move F_DUPFD_CLOEXEC up a level as it is available on Android.
      
      This commit leaves file sealing related fcntls and bitflag constants
      out, as they are defined in `linux/fcntl.h` rather than `fcntl.h`. They
      can be included once an approach for verification has been figured out.
      See #235 for more detail.
      b43118cb
  24. Mar 14, 2016
  25. Mar 13, 2016
  26. Mar 12, 2016
  27. Mar 11, 2016
    • Kamal Marhubi's avatar
      Make cfg_if uses more explicit and consistent · 66c33753
      Kamal Marhubi authored
      This commit changes most uses of cfg_if as follows:
      - fallthrough `else` usage is avoided for architecture or OS specific
        items
      - a comment is added in the final `else` clause to signal intent someone
        modifying
      
      It is safer to omit items than include ones for the wrong platform or
      architecture.
      66c33753
  28. Mar 10, 2016
  29. Mar 07, 2016
  30. Mar 06, 2016
Loading