Commit Graph

138 Commits

Author SHA1 Message Date
Yuki Okushi 3fae7e9ce7 Fix style 2021-04-06 10:10:29 +09:00
JohnTitor e187543fdd Constify `CMSG_SPACE` for all the targets 2021-03-30 17:37:13 +09:00
Alan Somers 51a287b98a Add MAP_GUARD on FreeBSD.
It was added in FreeBSD 11.1.
2021-03-26 20:49:07 -06:00
Torbjørn Birch Moltu 3f62e51d24 Add cr_pid to FreeBSD xucred - an unreleased addition in FreeBSD 13
definition: https://svnweb.freebsd.org/base/head/sys/sys/ucred.h?view=markup#l85
manpage: https://www.freebsd.org/cgi/man.cgi?query=unix&sektion=0&manpath=FreeBSD+13-current&format=html

Continue comparing and hashing __cr_unused1 for backwards compatibility.
2021-03-08 19:37:01 +01:00
Torbjørn Birch Moltu adb0a34c87 Add LOCAL_PEERCRED and related to Dragonfly
https://gitweb.dragonflybsd.org/dragonfly.git/blob/cd4ac48fd186404370e0b8623530b6add4b70400:/sys/sys/ucred.h#l86

None of the other LOCAL_ constants for FreeBSD are available on Dragonfly:
https://gitweb.dragonflybsd.org/dragonfly.git/blob/master:/sys/sys/un.h
2021-03-07 21:44:17 +01:00
Alan Somers e3482c13c1 Refactor freebsd to add a new FreeBSD 13 module 2021-01-29 16:05:51 -07:00
Alan Somers f40f3068a0 aio functions do not require librt on FreeBSD
On FreeBSD, the aio_ functions require librt _only_ if they use
SIGEV_THREAD completion notification.  However, due to Rust's originally
poor support for C unions, libc doesn't even expose some of the fields of
struct sigevent that SIGEV_THREAD requires.  Accordingly, there is no
need to link librt to programs using aio via libc.

This change partially reverts 8c23f77704
from PR #1630 .

While I'm here, fix the linkage of lio_listio on DragonflyBSD.  It
_does_ require librt.
2021-01-03 11:06:05 -07:00
zonyitoo 9578fa1942 Add IPV6_BINDANY on FreeBSD 2020-11-07 12:08:32 +08:00
Lzu Tao 89c90cd298 Add dl_iterate_phdr for freebsd 2020-10-27 09:59:37 +07:00
DarcInc 16e0a0bf5f Adding nmount to freebsd and removing fdatasync from freebsd 10 2020-10-18 21:46:15 -04: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
Daniil Bondarev ce5cb03544 Added clock_getcpuclockid to more targets
Previously clock_getcpuclockid was enabled only on linux, with this
change it is enabled on all linux_like and freebsdlike.
2020-08-21 22:12:48 -07:00
Alan Somers 554ea4b8bd Deprecate CTL_P1003_1B_MAXID
It's been removed in FreeBSD 13 (svn r363622), and never had any
legitimate use outside of the base system anyway.
2020-07-27 14:59:32 -06:00
Simonas Kazlauskas 91fee24f12
Move the SEAL constants to freebsd12 module 2020-07-20 01:16:47 +09:00
Simonas Kazlauskas 6b14cfbf93
Add some missing fcntl flags for freebsd 2020-07-20 01:14:26 +09:00
Simon Wörner fabdb14a0c added ptrace_vm_entry struct 2020-07-10 01:28:40 +02:00
Greg V 962b984773 FreeBSD: new rand()/srand() ABI in 13
https://reviews.freebsd.org/rS357382
2020-07-06 15:31:37 +03:00
Greg V 9fc2574548 FreeBSD: chase CTL_UNSPEC to CTL_SYSCTL, IPPROTO_SEP to IPPROTO_DCCP renames
Plus, add new constants for sysctls that give names to existing magic numbers.

https://reviews.freebsd.org/rS350749
https://reviews.freebsd.org/rS352486
2020-07-06 15:31:37 +03:00
Greg V 45e7b8bef4 FreeBSD: fix SIGSTKSZ on arm/aarch64 / add MINSIGSTKSZ 2020-07-06 15:31:37 +03:00
Yuki Okushi 42393b7d38
FreeBSD: Follow upstream `WIFSIGNALED` change 2020-05-29 04:27:57 +09:00
Valdemar Erk 5fec4c3691 [FreeBSD] Add missing getnameinfo() flag values.
This patchs adds missing flag values for getnameinfo()
on FreeBSD, the following flags have been added from
the FreeBSD tree.

 /*
  * Flag values for getnameinfo()
  */
 #define	NI_NOFQDN	0x00000001
 #define	NI_NUMERICHOST	0x00000002
 #define	NI_NAMEREQD	0x00000004
 #define	NI_NUMERICSERV	0x00000008
 #define	NI_DGRAM	0x00000010
 #define	NI_NUMERICSCOPE	0x00000020

Signed-off-by: Valdemar Erk <valdemar@erk.io>
2020-05-21 14:38:13 +02:00
Greg V d8764e8b78 freebsd: add sockcred/SOCKCREDSIZE
Like on NetBSD, but without a pid field in the struct.
2020-04-15 14:55:55 +03:00
Vickenty Fesunov 1c012aec18 Add memmem
memmem is a non-standard extension, first added in GNU libc and later
ported to other systems. Support for it is non-uniform, thus it was only
added to platforms that seem to support it.
2020-02-19 10:32:33 +01: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
gnzlbg 3843c7dba1 Add FreeBSD10 support
This adds libc-test support for Freebsd10 and a CI build job that tests
FreeBSD10 with LIBC_CI only.
2019-09-16 20:50:55 +02:00
bors 36566a7720 Auto merge of #1493 - lucab:ups/bsd-utmpx, r=gnzlbg
freebsdlike: add several utmpx constants

This adds several `utmpx.h` constants for FreeBSD and DragonflyBSD.

Ref: a1d2b51873/include/utmpx.h
Ref: http://gitweb.dragonflybsd.org/dragonfly.git/blob/HEAD:/include/utmpx.h
2019-09-13 20:01:35 +00:00
gnzlbg 939a2e5a3a Formatting 2019-09-12 15:12:33 +02:00
Alan Somers ac1e12409e Deprecate RLIM_NLIMITS
This constant is not stable across OS versions, so it cannot be used in
any backwards- or forwards- compatible way.  It's typically used to size
arrays in the kernel and in debugging utilities that are closely tied to
the OS version.  Since libc is ignorant about OS versions, we shouldn't
even be defining it.
2019-09-02 10:21:57 -06:00
Alan Somers f7245fedcc Fix the link_name for fstat and fstatfs on FreeBSD 2019-09-01 11:45:33 -06:00
Luca Bruno a5aa78dda4
freebsd: add utmpx constants
This adds a few missing constants from FreeBSD `utmpx.h`.

Ref: a1d2b51873/include/utmpx.h
2019-09-01 13:52:38 +00:00
bors 38750521a6 Auto merge of #1474 - lpetre:add_utime_constants, r=gnzlbg
Adding UTIME_NOW and UTIME_OMIT to OSes which support utimensat

I've managed to verify a handful of these:

- [FreeBSD](1d6e424741/tools/build/stat.h (L35))
- [NetBSD](64b8a48e12/sys/sys/stat.h (L235))
 - [Apple](https://opensource.apple.com/source/xnu/xnu-4903.221.2/bsd/sys/stat.h.auto.html)

I'm less confident in these:
 - [Haiku](abb59d7351/headers/posix/sys/stat.h (L105))
   - I could be wrong on this one: https://github.com/haiku/haiku/search?q=UTIME_NOW&unscoped_q=UTIME_NOW
 - [WASI](24792713d7/libc-top-half/musl/include/sys/stat.h (L71))
  - I could be wrong on this one: https://github.com/CraneStation/wasi-libc/search?q=UTIME_NOW&unscoped_q=UTIME_NOW
 - [Solarish](4e0c5eff9a/usr/src/uts/common/sys/stat.h (L478))
2019-08-20 09:45:52 +00:00
Luke Petre 2b158cefc2 Adding UTIME_NOW and UTIME_OMIT to OSes which support utimensat 2019-08-17 06:37:25 +01:00
equal-l2 c1fd075fbc Add ioctl() constants for BPF 2019-08-16 15:17:06 +09:00
gnzlbg 9db561f04e Remove catch all for FreeBSD11 2019-08-14 15:22:20 +02:00
Luca Pizzamiglio 4a74f1e0df Add support for FreeBSD CURRENT (aka freebsd13)
Currently, libc supports and detects freebsd11 and freebsd13
Unknown versions, like freebsd13, is treated as freebsd11.
This patch solve the issues, detecting freebsd13 and treating it like
freebsd12.
Inverting the logic not(freebsd12) -> freebsd11 where possible
2019-07-28 23:00:53 +02:00
Bryant Mairs 215f095601 Remove AF_MAX, PF_MAX, NET_MAXID constants
These constants have already been deprecated for a few releases with
a deprecation notice, so they can finally be removed.

Closes rust-lang/libc#665
2019-07-05 07:39:00 -07:00
bors e0ff1e68b9 Auto merge of #1387 - tormol:fionclex, r=gnzlbg
Add FIONCLEX and other FIO* constants for Linux, DragonFly and OpenBSD

[OpenBSD header](https://cvsweb.openbsd.org/cgi-bin/cvsweb/src/sys/sys/filio.h?annotate=1.5) | [DragonFly header](http://gitweb.dragonflybsd.org/dragonfly.git/blame/refs/heads/master:/sys/sys/filio.h) | [Linux search](https://github.com/torvalds/linux/search?q=FIONCLEX+FIOQSIZE&unscoped_q=FIONCLEX+FIOQSIZE&type=Code)
For Linux I've used [godbolt compiler explorer](https://godbolt.org/z/h-C7qM) to get final values where possible.

Wile this crate has FIOCLEX for Fuchsia, Emscripten and Redox, I've not added FIONCLEX for them because those targets appear to support neither.
I started adding FIOASYNC, FIOSETOWN and FIOGETOWN for all the Linux architectures, but gave up when I realized FIOASYNC is kind of deprecated and the other two useless without more symbols. If anybody is interested I have a [branch with how far I got](https://github.com/tormol/rust-libc/tree/sigio).
2019-06-11 18:05:33 +00: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
Torbjørn Birch Moltu 2293748dfe Add FIODTYPE, FIGETLBA and FIODGNAME for DragonFly 2019-06-07 20:00:55 +02:00
Torbjørn Birch Moltu a319b62fbd Generalize some FIO* constants to all BSDs
* Change the type of FIONCLEX on apple platforms from c_uint to c_ulong
* Add FIONCLEX, FIONREAD, FIOASYNC, FIOSETOWN and FIOGETOWN
  for DragonFly and OpenBSD
2019-06-07 20:00:55 +02:00
bors 0e702c1b4e Auto merge of #1379 - gnzlbg:deprecate_fixed_width_ints, r=gnzlbg
Deprecate fixed width integer type aliases

cc @emilio - I think it makes sense to ensure that the latest released version of bindgen works properly with this change. That is, that even when asked to use C types from, e.g., `libc::`, it does not use aliases for the fixed-width integer C types (e.g. `libc::int64_t`) but uses Rust primitive types instead (e.g. `u64`).

Closes #1304 .
2019-05-29 18:13:57 +00:00
gnzlbg a0865265d4 Replace uses of fixed-width integer aliases with Rust types 2019-05-29 13:17:17 +02:00
gnzlbg a74b588ad2 Deprecate AF_MAX and PF_MAX 2019-05-29 12:24:47 +02: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 7437d0a6f1 Add a FreeBSD 12 build job and test FreeBSD12 APIs
This commits adds a second FreeBSD 12 build job,
and splits the implementation of the FreeBSD module
into two modules, one for FreeBSD 11, and one for FreeBSD 12.

The FreeBSD 11 module is compiled always by default, and is
mostly forward compatible with FreeBSD 12 systems.

The FreeBSD 12 module is only built for now in libc's CI,
and uses FreeBSD 12 data types and APIs, linking to symbols
that are only available in FreeBSD 12.

Basically, when LIBC_CI env variable is defined, and the host
system is a FreeBSD 12 system, then the FreeBSD 12 module is
automatically built and tested. Conditional compilation is done
using a `cfg(freebsd12)` flag.

This commit also re-enables many tests, and documents why
some remain disabled.
2019-05-24 20:04:17 +02:00
Torbjørn Birch Moltu 652b8323d0 Correct mqd_t on DragonFlyBSD 2019-03-27 15:09:57 +01:00
Torbjørn Birch Moltu 75c71f9963 Add mq_getfd_np() for FreeBSD 2019-03-27 15:09:49 +01:00
Bryant Mairs c3ddeaeed3 Add extra traits for freebsd datatypes 2019-02-23 15:03:52 -08:00
bors 315e600acd Auto merge of #1231 - dholroyd:mmsg-support, r=gnzlbg
Broader sendmmsg() / recvmmsg() support

As a prerequisite for getting `sendmmsg()` / `recvmmsg()` into nix ( https://github.com/nix-rust/nix/pull/1017 ), support for non-linux platforms needs to be added in libc.

The initial commits in this PR will just be to test out target support via CI.
2019-02-18 17:22:08 +00:00
bors 0e1fbe33e9 Auto merge of #1257 - vi:ORIGDSTADDR, r=gnzlbg
Add IP_ORIGDSTADDR and others on FreeBSD.

A follow-up from #1252.

CC @asomers.

r? @gnzlbg
2019-02-18 16:00:56 +00:00