Commit Graph

50 Commits

Author SHA1 Message Date
JohnTitor e187543fdd Constify `CMSG_SPACE` for all the targets 2021-03-30 17:37:13 +09:00
Tamir Duberstein b24d95891d
Correctly define SOCK_CLOEXEC on Fuchsia
https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/sys/socket.h;l=60-63;drc=7c5e521391fddb98fd8f6970da7c410899ddf5cf
2021-01-09 14:20:29 -05:00
bors 0a975d9dd2 Auto merge of #2011 - tamird:ip-freebind, r=JohnTitor
Define IP_FREEBIND for Fuchsia

https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/netinet/in.h;l=196;drc=bdf60afa9193c8a9190ee6bb6b5a0a11ad8876b6
2020-12-29 00:41:45 +00:00
Tamir Duberstein a829a10a86
Define IP_FREEBIND for Fuchsia
https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/netinet/in.h;l=196;drc=bdf60afa9193c8a9190ee6bb6b5a0a11ad8876b6
2020-12-26 09:43:51 -05:00
Tamir Duberstein ceb2dffc5e
Define IFNAMSIZ for Fuchsia
https://cs.opensource.google/fuchsia/fuchsia/+/master:zircon/third_party/ulib/musl/include/net/if.h;l=72;drc=bdf60afa9193c8a9190ee6bb6b5a0a11ad8876b6
2020-12-26 09:40:18 -05:00
bors 6e7a919ce3 Auto merge of #2004 - dylni:define-cld-constants-for-more-targets, r=JohnTitor
Define CLD_ constants for more targets

This is an extension of #1860 to support more targets. The values for these constants should be correct, but I'm not familiar with most of the targets, so they should be verified.

These files should define the constants too, but the targets are closed source, so I don't know their values:
- [src/unix/solarish/mod.rs](https://github.com/rust-lang/libc/blob/master/src/unix/solarish/mod.rs)
- [src/vxworks/mod.rs](https://github.com/rust-lang/libc/blob/master/src/vxworks/mod.rs)
2020-12-24 09:01:49 +00:00
dylni d116ee592d Define CLD_ constants for more targets 2020-12-21 21:31:14 -05:00
Sam Balana a7f09b96e1
Add ip_mreqn for Fuchsia
Adds the ip_mreqn struct for the Fuchsia platform, as defined by ip(7).
Enables joining an IPv4 multicast group by NIC ID rather than by its
assigned IPv4 address.
2020-12-21 16:44:51 -08:00
Daniil Bondarev 773f5562ba Use safe_f! consistently across platforms
The pr #1870 introduced safe_f! macro, which made some functions like
WIFEXITED and WEXITSTATUS const and safe on linux_like platform only,
which causes inconsistency when trying to use those functions in crates
compiled across multiple platforms, as using unsafe on those functions
will generate unused_unsafe warning on linux platforms and lack of
unsafe block will fail compilation on non-linux platforms.

To avoid the inconsistency, this commit applies the same macro for all
the same functions on other platforms too.
2020-09-12 23:38:06 -07:00
amanda-tait 5d116747c3 Fix style in CMSG_* "macros" for fuchsia
This change addresses two style errors found in PR review:
* indent and linebreak in CMSG_NXTHDR
* prefer `0 as *mut cmsghdr` over `core::ptr::nul_mut()`
2020-07-27 22:03:13 -04:00
Amanda Tait 59749267fa Add CMSG_* "macro" support to Fuchsia
This change defines and implements functions for the Fuchsia platform
corresponding to the C library CMSG_* macros, used for processing socket
control messages sent or received using the recv_msg(2)/send_msg(2)
syscalls.
2020-07-27 10:46:05 -04:00
Thomas Hurst 5d8dccc7b7 Add missing AT_ constants
Add AT_EACCESS to Linux, Solaris, and Fuchsia.

Add AT_SYMLINK_FOLLOW, AT_REMOVEDIR, and  _AT_TRIGGER to Solaris.
2020-03-14 17:13:04 +00:00
Yuki Okushi 9b31f772bb
Add `CLOCK_TAI` to linux_like/mod.rs 2020-03-08 20:21:01 +09:00
Yuki Okushi 483bb8171f Replace TODO with FIXME to make grep easy 2020-02-29 13:36:27 +09:00
Lzu Tao 723a2c7d87 add wmemchr to all platforms support memchr 2020-02-21 10:42:15 +07:00
Vickenty Fesunov 9358be36d6 Remove unnecessary parenthesis
This triggers a warning on a recent nightly, which in turn breaks CI due to
`#![deny(warnings)]` in libc-test/build.rs
2020-02-12 10:09:22 +01:00
Artyom Pavlov 7d1907eaae
fuchsia 2019-09-20 06:16:08 +00:00
bors 49c1d138e3 Auto merge of #1513 - mulimoen:master, r=gnzlbg
add isblank

Fixes #1509
2019-09-16 18:15:40 +00:00
Magnus Ulimoen e7f11345d1 add isblank 2019-09-16 17:54:13 +02:00
gnzlbg 939a2e5a3a Formatting 2019-09-12 15:12:33 +02:00
Joe Richey 0a7bbe9050 Remove invalid Fuchsia functions
These fuctions are not present in Fuchsia's libc, so they cannot be
used in a program today. If Fuchsia ever decides to add these functions
to their libc, they can be added back as necessary.
2019-08-15 13:44:38 -07:00
Joe Richey 3b27cb3a13 Remove Linux constants from Fushia
PR #849 just moved all of the Linux structures into `src/fuchsia`.
While this is good for the most part, we really don't want the `SYS_*`
constants exported on Fushia, as these are not Fuchsia's syscalls.

This also removes Linux-specific `GRND_*` constants.
2019-06-13 14:59:27 -07:00
Bryant Mairs 7c265919ec Switch to manual trait impls for sigevent
sigevent structs on most platforms have padding or unused fields. Rather
than display those in the Debug impl by deriving it, manually implement
all extra_traits instead ignoring those fields.
2019-06-09 19:28:32 -07:00
gnzlbg a0865265d4 Replace uses of fixed-width integer aliases with Rust types 2019-05-29 13:17:17 +02:00
gnzlbg 08a4519714 Refactor fixed-width integer types into its own module 2019-05-29 13:05:49 +02:00
Bryant Mairs 0b34501879 Ignore padding for `sockaddr_nl` struct
`nl_pad` field does not contain any actual data, so using it for
comparison or hashing doesn't make sense. Instead manually implement
extra traits ignoring this field.
2019-05-27 08:45:28 -07:00
Bryant Mairs 7d235af8c5 Ignore padding for mq_attr
The `pad` or `__reserved`  fields are not always 0 on some platforms,
so when used in the `PartialEq` implementation being used, fails some
comparisons. This commit manually implements the extra traits to
correct this behavior.
2019-05-27 08:37:48 -07:00
gnzlbg 5e2b0d88d4 Fix locale_t in unix and fuchsia.
Closes #1055.
2019-05-24 14:15:58 +02:00
Charles Lew 1cf0294e2d Fix getgrgid_r to accept gid_t. 2019-04-29 22:12:41 +08:00
Bryant Mairs 7597520dae Add extra traits for haiku datatypes 2019-02-22 20:15:38 -08:00
Bryant Mairs 35280a05f3 Add extra traits for fuchsia datatypes 2019-02-22 20:15:38 -08:00
gnzlbg 7ac0fe53eb Cleanup dox mess 2019-02-13 14:48:50 +01:00
gnzlbg a17a91cdbf Fix build on all platforms
This PR fixes the build on all platforms and all Rust version down to the
minimum Rust version supported by libc: Rust 1.13.0.

The `build.rs` is extended with logic to detect the newer Rust features used by
`libc` since Rust 1.13.0:

* Rust 1.19.0: `untagged_unions`. APIs using untagged unions are gated on
  `cfg(libc_unions)` and not available on older Rust versions.

* Rust 1.25.0: `repr(align)`. Because `repr(align)` cannot be parsed by older
  Rust versions, all uses of `repr(align)` are split into `align.rs` and
  `no_align.rs` modules, which are gated on the `cfg(libc_align)` at the top
  level. These modules sometimes contain macros that are expanded at the top
  level to avoid privacy issues (`pub(crate)` is not available in older Rust
  versions). Closes #1242 .

* Rust : `const` `mem::size_of`. These uses are worked around with hardcoded
  constants on older Rust versions.

Also, `repr(packed)` structs cannot automatically `derive()` some traits like
`Debug`. These have been moved into `s_no_extra_traits!` and the lint of missing
`Debug` implementations on public items is silenced for these. We can manually
implement the `extra_traits` for these in a follow up PR. This is tracked
in #1243. Also, `extra_traits` does not enable `align` manually anymore.

Since `f64::to_bits` is not available in older Rust versions, its usage
has been replaced with a `transmute` to an `u64` which is what that method
does under the hood.

Closes #1232 .
2019-02-07 13:44:32 +01:00
Bryant Mairs f3684584c9 Check for Copy impls for all types 2019-02-02 16:32:00 -08:00
Bryant Mairs fa9cb78b4a Check for Debug impls for all types
This was not compile-tested on all platforms, but instead all `pub enum`
types had a `Debug` impl derived for them.
2019-02-02 16:32:00 -08:00
xd009642 1604cf5802 Added setegid function 2018-12-05 17:46:50 +00:00
gnzlbg 5c1a6b8a6d splice the common libc functions and ctypes throughout the library 2018-11-21 20:58:02 +01:00
Stephen Barber 60ab3041a1 Add support for SIGSYS in signalfd
Linux 4.18 added support for SIGSYS info in signalfd. Add the new
fields to signalfd_siginfo.

While the kernel has support for these new fields now, no libc has
shipped a release with the new signalfd fields.
2018-11-06 16:51:20 -08:00
Taylor Cramer a0a4f8cc04 Undo division of in6_addr on Fuchsia 2018-08-24 11:41:02 -07:00
Taylor Cramer 2f593709ca Fix and cleanup Fuchsia
Remove false support for power and mips.
Fix aarch64 definitions of nlink_t and blksize_t.
2018-08-22 12:32:10 -07:00
Linus Färnstrand 2819634696 Add align feature to pthread structs 2018-07-29 18:54:45 +02:00
Linus Färnstrand 6abe0b5218 Add align feature and use on in6_addr 2018-07-29 18:54:45 +02:00
Jason Longshore 18ff68357d Add sem_getvalue to unix 2018-05-10 11:04:14 -05:00
Raph Levien 709709db15 Add IPV6_UNICAST_HOPS to fuchsia module
Recent change #925 added constants for IPV6 multicast, but seems
to have inadvertently left off IPV6_UNICAST_HOPS from fuchsia.

Fixes #932
2018-02-28 15:41:50 -08:00
Benjamin Fry 7ed5599a64 add IPV6_MULTICAST_IF and IPV6_MULTICAST_HOPS 2018-02-25 10:58:44 -08:00
luozijun 0f4ae0b8f1 Add constants IFF_TUN, IFF_TAP and IFF_NO_PI on linux, android and fuchsia system 2018-02-07 11:12:29 +08:00
Taylor Cramer 5e9c614b9f Fix Fuchsia typos 2017-11-21 15:47:37 -08:00
Taylor Cramer b4cfe883bb Reorganize Fuchsia module 2017-11-15 11:29:01 -08:00
Taylor Cramer 42b57da46b Update Fuchsia open flags 2017-11-15 10:37:05 -08:00
Taylor Cramer f7f9be31c2 Move Fuchsia out of unix and into its own module 2017-11-15 10:22:26 -08:00