From 00b93727c58cf6d97dc2158edb7748a9740ed3ec Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 30 Oct 2018 13:29:42 -0600 Subject: Add extattr(2) and extattr(3) definitions for FreeBSD and NetBSD DragonflyBSD does define 3 of these 14 functions. But I elected not to add it to the PR because I can't find any evidence that these syscalls are used on Dragonfly, even in the base system. And by themselves, those three are insufficient for the xattr crate. --- src/unix/bsd/freebsdlike/freebsd/mod.rs | 64 +++++++++++++++++++++++++++++++++ src/unix/bsd/netbsdlike/netbsd/mod.rs | 47 ++++++++++++++++++++++++ 2 files changed, 111 insertions(+) diff --git a/src/unix/bsd/freebsdlike/freebsd/mod.rs b/src/unix/bsd/freebsdlike/freebsd/mod.rs index 653cfa5c66..78154927a3 100644 --- a/src/unix/bsd/freebsdlike/freebsd/mod.rs +++ b/src/unix/bsd/freebsdlike/freebsd/mod.rs @@ -186,6 +186,10 @@ s! { pub const SIGEV_THREAD_ID: ::c_int = 4; +pub const EXTATTR_NAMESPACE_EMPTY: ::c_int = 0; +pub const EXTATTR_NAMESPACE_USER: ::c_int = 1; +pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2; + pub const RAND_MAX: ::c_int = 0x7fff_fffd; pub const PTHREAD_STACK_MIN: ::size_t = 2048; pub const PTHREAD_MUTEX_ADAPTIVE_NP: ::c_int = 4; @@ -934,6 +938,58 @@ extern { pub fn clock_gettime(clk_id: ::clockid_t, tp: *mut ::timespec) -> ::c_int; pub fn clock_settime(clk_id: ::clockid_t, tp: *const ::timespec) -> ::c_int; + pub fn extattr_delete_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_get_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_list_fd(fd: ::c_int, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_list_file(path: *const ::c_char, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_list_link(path: *const ::c_char, + attrnamespace: ::c_int, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn jail(jail: *mut ::jail) -> ::c_int; pub fn jail_attach(jid: ::c_int) -> ::c_int; pub fn jail_remove(jid: ::c_int) -> ::c_int; @@ -1060,6 +1116,14 @@ extern { pub fn dup3(src: ::c_int, dst: ::c_int, flags: ::c_int) -> ::c_int; } +#[link(name = "util")] +extern { + pub fn extattr_namespace_to_string(attrnamespace: ::c_int, + string: *mut *mut ::c_char) -> ::c_int; + pub fn extattr_string_to_namespace(string: *const ::c_char, + attrnamespace: *mut ::c_int) -> ::c_int; +} + cfg_if! { if #[cfg(target_arch = "x86")] { mod x86; diff --git a/src/unix/bsd/netbsdlike/netbsd/mod.rs b/src/unix/bsd/netbsdlike/netbsd/mod.rs index 3f735278c0..915505d14b 100644 --- a/src/unix/bsd/netbsdlike/netbsd/mod.rs +++ b/src/unix/bsd/netbsdlike/netbsd/mod.rs @@ -334,6 +334,9 @@ pub const AT_SYMLINK_NOFOLLOW: ::c_int = 0x200; pub const AT_SYMLINK_FOLLOW: ::c_int = 0x400; pub const AT_REMOVEDIR: ::c_int = 0x800; +pub const EXTATTR_NAMESPACE_USER: ::c_int = 1; +pub const EXTATTR_NAMESPACE_SYSTEM: ::c_int = 2; + pub const LC_COLLATE_MASK: ::c_int = (1 << ::LC_COLLATE); pub const LC_CTYPE_MASK: ::c_int = (1 << ::LC_CTYPE); pub const LC_MONETARY_MASK: ::c_int = (1 << ::LC_MONETARY); @@ -1013,6 +1016,46 @@ extern { pub fn lio_listio(mode: ::c_int, aiocb_list: *const *mut aiocb, nitems: ::c_int, sevp: *mut sigevent) -> ::c_int; + pub fn extattr_delete_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_delete_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char) -> ::c_int; + pub fn extattr_get_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_get_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *mut ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_fd(fd: ::c_int, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_file(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + pub fn extattr_set_link(path: *const ::c_char, + attrnamespace: ::c_int, + attrname: *const ::c_char, + data: *const ::c_void, + nbytes: ::size_t) -> ::ssize_t; + #[link_name = "__lutimes50"] pub fn lutimes(file: *const ::c_char, times: *const ::timeval) -> ::c_int; pub fn getnameinfo(sa: *const ::sockaddr, @@ -1112,6 +1155,10 @@ extern { #[link(name = "util")] extern { + pub fn extattr_namespace_to_string(attrnamespace: ::c_int, + string: *mut *mut ::c_char) -> ::c_int; + pub fn extattr_string_to_namespace(string: *const ::c_char, + attrnamespace: *mut ::c_int) -> ::c_int; #[cfg_attr(target_os = "netbsd", link_name = "__getpwent_r50")] pub fn getpwent_r(pwd: *mut ::passwd, buf: *mut ::c_char, -- cgit v1.2.1 From a9c204ccbc37721885a939562138d6950d7b2f6b Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 30 Oct 2018 13:48:23 -0600 Subject: Include during CI --- libc-test/build.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/libc-test/build.rs b/libc-test/build.rs index db6588b802..cb63958543 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -304,6 +304,7 @@ fn main() { cfg.header("pthread_np.h"); cfg.header("sched.h"); cfg.header("ufs/ufs/quota.h"); + cfg.header("sys/extattr.h" cfg.header("sys/jail.h"); cfg.header("sys/ipc.h"); cfg.header("sys/msg.h"); @@ -317,6 +318,7 @@ fn main() { cfg.header("mqueue.h"); cfg.header("ufs/ufs/quota.h"); cfg.header("ufs/ufs/quota1.h"); + cfg.header("sys/extattr.h" cfg.header("sys/ioctl_compat.h"); // DCCP support -- cgit v1.2.1 From cd35cdaafa32eb4ba5648e7107aeaac2f70a740f Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 30 Oct 2018 14:04:04 -0600 Subject: syntax fix --- libc-test/build.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/libc-test/build.rs b/libc-test/build.rs index cb63958543..be148b83fb 100644 --- a/libc-test/build.rs +++ b/libc-test/build.rs @@ -304,7 +304,7 @@ fn main() { cfg.header("pthread_np.h"); cfg.header("sched.h"); cfg.header("ufs/ufs/quota.h"); - cfg.header("sys/extattr.h" + cfg.header("sys/extattr.h"); cfg.header("sys/jail.h"); cfg.header("sys/ipc.h"); cfg.header("sys/msg.h"); @@ -318,7 +318,7 @@ fn main() { cfg.header("mqueue.h"); cfg.header("ufs/ufs/quota.h"); cfg.header("ufs/ufs/quota1.h"); - cfg.header("sys/extattr.h" + cfg.header("sys/extattr.h"); cfg.header("sys/ioctl_compat.h"); // DCCP support -- cgit v1.2.1 From 74d5a9833fcf21d8b356ea1de64f62708e7111d6 Mon Sep 17 00:00:00 2001 From: Alan Somers Date: Tue, 30 Oct 2018 15:06:01 -0600 Subject: Disable the aarch64-unknown-linux-musl workaround for #856 This bug was never diagnosed. Perhaps it's been resolved by a newer compiler. Fixes #856 --- .travis.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.travis.yml b/.travis.yml index 197d8c663b..d5982e6e4d 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,8 +53,6 @@ matrix: - env: TARGET=arm-unknown-linux-musleabihf - env: TARGET=aarch64-unknown-linux-gnu - env: TARGET=aarch64-unknown-linux-musl - # FIXME(#856) - rust: 1.22.1 - env: TARGET=powerpc-unknown-linux-gnu - env: TARGET=powerpc64-unknown-linux-gnu - env: TARGET=powerpc64le-unknown-linux-gnu -- cgit v1.2.1