From bd287dd1942f0a72e6bd9dc8475bd4e7d34fa5f8 Mon Sep 17 00:00:00 2001
From: Terin Stock
Date: Fri, 10 Jan 2020 02:03:56 -0800
Subject: [PATCH 01/32] std: implement sendfile on linux
This changset adds a `sendfile(2)` syscall bindings to the linux bits
component. Where available, the `sendfile64(2)` syscall will be
transparently called.
A wrapping function has also been added to the std.os to transform
errno returns to Zig errors.
Change-Id: I86769fc4382c0771e3656e7b21137bafd99a4411
---
lib/std/c/freebsd.zig | 8 +++
lib/std/os.zig | 115 ++++++++++++++++++++++++++++++++++++++++++
lib/std/os/linux.zig | 8 +++
3 files changed, 131 insertions(+)
diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig
index 4c6614c978..e7d924ddbf 100644
--- a/lib/std/c/freebsd.zig
+++ b/lib/std/c/freebsd.zig
@@ -8,6 +8,14 @@ pub extern "c" fn getdents(fd: c_int, buf_ptr: [*]u8, nbytes: usize) usize;
pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
+pub const sf_hdtr = extern struct {
+ headers: [*]iovec_const,
+ hdr_cnt: c_int,
+ trailers: [*]iovec_const,
+ trl_cnt: c_int,
+};
+pub extern "c" fn sendfile(fd: c_int, s: c_int, offset: u64, nbytes: usize, sf_hdtr: ?*sf_hdtr, sbytes: ?*u64, flags: c_int) c_int;
+
pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int;
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 127ada8fe5..2015b52d2f 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -3498,6 +3498,121 @@ pub fn send(
return sendto(sockfd, buf, flags, null, 0);
}
+pub const SendFileError = error{
+ /// There was an unspecified error while reading from infd.
+ InputOutput,
+
+ /// There was insufficient resources for processing.
+ SystemResources,
+
+ /// The value provided for count overflows the maximum size of either
+ /// infd or outfd.
+ Overflow,
+
+ /// Offset was provided, but infd is not seekable.
+ Unseekable,
+
+ /// The outfd is marked nonblocking and the requested operation would block, and
+ /// there is no global event loop configured.
+ WouldBlock,
+} || WriteError || UnexpectedError;
+
+pub const sf_hdtr = struct {
+ headers: []iovec_const,
+ trailers: []iovec_const,
+};
+
+/// Transfer data between file descriptors.
+///
+/// The `sendfile` call copies `count` bytes from one file descriptor to another within the kernel. This can
+/// be more performant than transferring data from the kernel to user space and back, such as with
+/// `read` and `write` calls.
+///
+/// The `infd` should be a file descriptor opened for reading, and `outfd` should be a file descriptor
+/// opened for writing. Copying will begin at `offset`, if not null, which will be updated to reflect
+/// the number of bytes read. If `offset` is null, the copying will begin at the current seek position,
+/// and the file position will be updated.
+pub fn sendfile(infd: fd_t, outfd: fd_t, offset: u64, count: usize, optional_hdtr: ?*const sf_hdtr, flags: u32) SendFileError!usize {
+ // XXX: check if offset is > length of file, return 0 bytes written
+ // XXX: document systems where headers are sent atomically.
+ // XXX: compute new offset on EINTR/EAGAIN
+ var rc: usize = undefined;
+ var err: usize = undefined;
+ if (builtin.os == .linux) {
+ while (true) {
+ try lseek_SET(infd, offset);
+
+ if (optional_hdtr) |hdtr| {
+ try writev(outfd, hdtr.headers);
+ }
+
+ rc = system.sendfile(outfd, infd, null, count);
+ err = errno(rc);
+
+ if (optional_hdtr) |hdtr| {
+ try writev(outfd, hdtr.trailers);
+ }
+
+ switch (err) {
+ 0 => return @intCast(usize, rc),
+ else => return unexpectedErrno(err),
+
+ EBADF => unreachable,
+ EINVAL => unreachable,
+ EFAULT => unreachable,
+ EAGAIN => if (std.event.Loop.instance) |loop| {
+ loop.waitUntilFdWritable(outfd);
+ continue;
+ } else {
+ return error.WouldBlock;
+ },
+ EIO => return error.InputOutput,
+ ENOMEM => return error.SystemResources,
+ EOVERFLOW => return error.Overflow,
+ ESPIPE => return error.Unseekable,
+ }
+ }
+ } else if (builtin.os == .freebsd) {
+ while (true) {
+ var rcount: u64 = 0;
+ var hdtr: std.c.sf_hdtr = undefined;
+ if (optional_hdtr) |h| {
+ hdtr = std.c.sf_hdtr{
+ .headers = h.headers.ptr,
+ .hdr_cnt = @intCast(c_int, h.headers.len),
+ .trailers = h.trailers.ptr,
+ .trl_cnt = @intCast(c_int, h.trailers.len),
+ };
+ }
+ err = errno(system.sendfile(infd, outfd, offset, count, &hdtr, &rcount, @intCast(c_int, flags)));
+ switch (err) {
+ 0 => return @intCast(usize, rcount),
+ else => return unexpectedErrno(err),
+
+ EBADF => unreachable,
+ EFAULT => unreachable,
+ EINVAL => unreachable,
+ ENOTCAPABLE => unreachable,
+ ENOTCONN => unreachable,
+ ENOTSOCK => unreachable,
+ EAGAIN => if (std.event.Loop.instance) |loop| {
+ loop.waitUntilFdWritable(outfd);
+ continue;
+ } else {
+ return error.WouldBlock;
+ },
+ EBUSY => return error.DeviceBusy,
+ EINTR => continue,
+ EIO => return error.InputOutput,
+ ENOBUFS => return error.SystemResources,
+ EPIPE => return error.BrokenPipe,
+ }
+ }
+ } else {
+ @compileError("sendfile unimplemented for this target");
+ }
+}
+
pub const PollError = error{
/// The kernel had no space to allocate file descriptor tables.
SystemResources,
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig
index 30dba85e51..95b1018a6b 100644
--- a/lib/std/os/linux.zig
+++ b/lib/std/os/linux.zig
@@ -846,6 +846,14 @@ pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const s
return syscall6(SYS_sendto, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen));
}
+pub fn sendfile(outfd: i32, infd: i32, offset: ?*u64, count: usize) usize {
+ if (@hasDecl(@This(), "SYS_sendfile64")) {
+ return syscall4(SYS_sendfile64, @bitCast(usize, @as(isize, outfd)), @bitCast(usize, @as(isize, infd)), @ptrToInt(offset), count);
+ } else {
+ return syscall4(SYS_sendfile, @bitCast(usize, @as(isize, outfd)), @bitCast(usize, @as(isize, infd)), @ptrToInt(offset), count);
+ }
+}
+
pub fn socketpair(domain: i32, socket_type: i32, protocol: i32, fd: [2]i32) usize {
if (builtin.arch == .i386) {
return socketcall(SC_socketpair, &[4]usize{ @intCast(usize, domain), @intCast(usize, socket_type), @intCast(usize, protocol), @ptrToInt(&fd[0]) });
From c81345c8aec56a108f6f98001666a1552d65ce85 Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 02:03:22 -0500
Subject: [PATCH 02/32] breaking: std.os read/write functions + sendfile
* rework os.sendfile and add macosx support, and a fallback
implementation for any OS.
* fix sendto compile error
* std.os write functions support partial writes. closes #3443.
* std.os pread / pwrite functions can now return `error.Unseekable`.
* std.fs.File read/write functions now have readAll/writeAll variants
which loop to complete operations even when partial reads/writes
happen.
* Audit std.os read/write functions with respect to Linux returning
EINVAL for lengths greater than 0x7fff0000.
* std.os read/write shim functions do not unnecessarily loop. Since
partial reads/writes are part of the API, the caller will be forced
to loop anyway, and so that would just be code bloat.
* Improve doc comments
* Add a non-trivial test for std.os.sendfile
* Fix std.os.pread on 32 bit Linux
* Add missing SYS_sendfile bit on aarch64
---
lib/std/c.zig | 2 +-
lib/std/c/darwin.zig | 16 +
lib/std/c/freebsd.zig | 10 +-
lib/std/c/linux.zig | 7 +
lib/std/event/loop.zig | 22 +-
lib/std/fs.zig | 4 +-
lib/std/fs/file.zig | 144 ++++-
lib/std/io.zig | 42 +-
lib/std/io/c_out_stream.zig | 4 +-
lib/std/io/out_stream.zig | 13 +-
lib/std/io/test.zig | 6 +-
lib/std/os.zig | 754 ++++++++++++++++----------
lib/std/os/bits/linux/arm64.zig | 1 +
lib/std/os/linux.zig | 33 +-
lib/std/os/test.zig | 114 +++-
lib/std/os/windows.zig | 14 +-
lib/std/zig/render.zig | 9 +-
lib/std/zig/system.zig | 1 +
test/standalone/cat/main.zig | 3 +-
test/standalone/hello_world/hello.zig | 5 +-
20 files changed, 834 insertions(+), 370 deletions(-)
diff --git a/lib/std/c.zig b/lib/std/c.zig
index 48a3039f51..4eb271c87c 100644
--- a/lib/std/c.zig
+++ b/lib/std/c.zig
@@ -142,7 +142,7 @@ pub extern "c" fn sendto(
buf: *const c_void,
len: usize,
flags: u32,
- dest_addr: *const sockaddr,
+ dest_addr: ?*const sockaddr,
addrlen: socklen_t,
) isize;
diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig
index 524c82211e..d5ecf6bd81 100644
--- a/lib/std/c/darwin.zig
+++ b/lib/std/c/darwin.zig
@@ -55,6 +55,22 @@ pub extern "c" fn clock_get_time(clock_serv: clock_serv_t, cur_time: *mach_times
pub extern "c" fn host_get_clock_service(host: host_t, clock_id: clock_id_t, clock_serv: ?[*]clock_serv_t) kern_return_t;
pub extern "c" fn mach_port_deallocate(task: ipc_space_t, name: mach_port_name_t) kern_return_t;
+pub const sf_hdtr = extern struct {
+ headers: [*]iovec_const,
+ hdr_cnt: c_int,
+ trailers: [*]iovec_const,
+ trl_cnt: c_int,
+};
+
+pub extern "c" fn sendfile(
+ out_fd: fd_t,
+ in_fd: fd_t,
+ offset: off_t,
+ len: *off_t,
+ sf_hdtr: ?*sf_hdtr,
+ flags: u32,
+) c_int;
+
pub fn sigaddset(set: *sigset_t, signo: u5) void {
set.* |= @as(u32, 1) << (signo - 1);
}
diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig
index e7d924ddbf..dacfa4384d 100644
--- a/lib/std/c/freebsd.zig
+++ b/lib/std/c/freebsd.zig
@@ -14,7 +14,15 @@ pub const sf_hdtr = extern struct {
trailers: [*]iovec_const,
trl_cnt: c_int,
};
-pub extern "c" fn sendfile(fd: c_int, s: c_int, offset: u64, nbytes: usize, sf_hdtr: ?*sf_hdtr, sbytes: ?*u64, flags: c_int) c_int;
+pub extern "c" fn sendfile(
+ out_fd: fd_t,
+ in_fd: fd_t,
+ offset: ?*off_t,
+ nbytes: usize,
+ sf_hdtr: ?*sf_hdtr,
+ sbytes: ?*off_t,
+ flags: u32,
+) c_int;
pub const dl_iterate_phdr_callback = extern fn (info: *dl_phdr_info, size: usize, data: ?*c_void) c_int;
pub extern "c" fn dl_iterate_phdr(callback: dl_iterate_phdr_callback, data: ?*c_void) c_int;
diff --git a/lib/std/c/linux.zig b/lib/std/c/linux.zig
index be32536d6f..7ac5ecd3fe 100644
--- a/lib/std/c/linux.zig
+++ b/lib/std/c/linux.zig
@@ -82,6 +82,13 @@ pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
pub extern "c" fn memfd_create(name: [*:0]const u8, flags: c_uint) c_int;
+pub extern "c" fn sendfile(
+ out_fd: fd_t,
+ in_fd: fd_t,
+ offset: ?*off_t,
+ count: usize,
+) isize;
+
pub const pthread_attr_t = extern struct {
__size: [56]u8,
__align: c_long,
diff --git a/lib/std/event/loop.zig b/lib/std/event/loop.zig
index 80ba5a79b5..e62f15d59a 100644
--- a/lib/std/event/loop.zig
+++ b/lib/std/event/loop.zig
@@ -236,7 +236,8 @@ pub const Loop = struct {
var extra_thread_index: usize = 0;
errdefer {
// writing 8 bytes to an eventfd cannot fail
- noasync os.write(self.os_data.final_eventfd, &wakeup_bytes) catch unreachable;
+ const amt = noasync os.write(self.os_data.final_eventfd, &wakeup_bytes) catch unreachable;
+ assert(amt == wakeup_bytes.len);
while (extra_thread_index != 0) {
extra_thread_index -= 1;
self.extra_threads[extra_thread_index].wait();
@@ -682,7 +683,8 @@ pub const Loop = struct {
.linux => {
self.posixFsRequest(&self.os_data.fs_end_request);
// writing 8 bytes to an eventfd cannot fail
- noasync os.write(self.os_data.final_eventfd, &wakeup_bytes) catch unreachable;
+ const amt = noasync os.write(self.os_data.final_eventfd, &wakeup_bytes) catch unreachable;
+ assert(amt == wakeup_bytes.len);
return;
},
.macosx, .freebsd, .netbsd, .dragonfly => {
@@ -831,7 +833,7 @@ pub const Loop = struct {
/// Performs an async `os.write` using a separate thread.
/// `fd` must block and not return EAGAIN.
- pub fn write(self: *Loop, fd: os.fd_t, bytes: []const u8) os.WriteError!void {
+ pub fn write(self: *Loop, fd: os.fd_t, bytes: []const u8) os.WriteError!usize {
var req_node = Request.Node{
.data = .{
.msg = .{
@@ -852,7 +854,7 @@ pub const Loop = struct {
/// Performs an async `os.writev` using a separate thread.
/// `fd` must block and not return EAGAIN.
- pub fn writev(self: *Loop, fd: os.fd_t, iov: []const os.iovec_const) os.WriteError!void {
+ pub fn writev(self: *Loop, fd: os.fd_t, iov: []const os.iovec_const) os.WriteError!usize {
var req_node = Request.Node{
.data = .{
.msg = .{
@@ -873,7 +875,7 @@ pub const Loop = struct {
/// Performs an async `os.pwritev` using a separate thread.
/// `fd` must block and not return EAGAIN.
- pub fn pwritev(self: *Loop, fd: os.fd_t, iov: []const os.iovec_const, offset: u64) os.WriteError!void {
+ pub fn pwritev(self: *Loop, fd: os.fd_t, iov: []const os.iovec_const, offset: u64) os.WriteError!usize {
var req_node = Request.Node{
.data = .{
.msg = .{
@@ -1137,7 +1139,7 @@ pub const Loop = struct {
pub const Write = struct {
fd: os.fd_t,
bytes: []const u8,
- result: Error!void,
+ result: Error!usize,
pub const Error = os.WriteError;
};
@@ -1145,7 +1147,7 @@ pub const Loop = struct {
pub const WriteV = struct {
fd: os.fd_t,
iov: []const os.iovec_const,
- result: Error!void,
+ result: Error!usize,
pub const Error = os.WriteError;
};
@@ -1154,9 +1156,9 @@ pub const Loop = struct {
fd: os.fd_t,
iov: []const os.iovec_const,
offset: usize,
- result: Error!void,
+ result: Error!usize,
- pub const Error = os.WriteError;
+ pub const Error = os.PWriteError;
};
pub const PReadV = struct {
@@ -1165,7 +1167,7 @@ pub const Loop = struct {
offset: usize,
result: Error!usize,
- pub const Error = os.ReadError;
+ pub const Error = os.PReadError;
};
pub const Open = struct {
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index 5077c52cd9..769d4b395c 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -153,7 +153,7 @@ pub fn updateFileMode(source_path: []const u8, dest_path: []const u8, mode: ?Fil
var buf: [mem.page_size * 6]u8 = undefined;
while (true) {
const amt = try in_stream.readFull(buf[0..]);
- try atomic_file.file.write(buf[0..amt]);
+ try atomic_file.file.writeAll(buf[0..amt]);
if (amt != buf.len) {
try atomic_file.file.updateTimes(src_stat.atime, src_stat.mtime);
try atomic_file.finish();
@@ -1329,7 +1329,7 @@ pub const Dir = struct {
pub fn writeFile(self: Dir, sub_path: []const u8, data: []const u8) !void {
var file = try self.createFile(sub_path, .{});
defer file.close();
- try file.write(data);
+ try file.writeAll(data);
}
pub const AccessError = os.AccessError;
diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig
index c243eeb62c..2715129934 100644
--- a/lib/std/fs/file.zig
+++ b/lib/std/fs/file.zig
@@ -228,63 +228,169 @@ pub const File = struct {
}
pub const ReadError = os.ReadError;
+ pub const PReadError = os.PReadError;
pub fn read(self: File, buffer: []u8) ReadError!usize {
if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
return std.event.Loop.instance.?.read(self.handle, buffer);
+ } else {
+ return os.read(self.handle, buffer);
}
- return os.read(self.handle, buffer);
}
- pub fn pread(self: File, buffer: []u8, offset: u64) ReadError!usize {
- if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
- return std.event.Loop.instance.?.pread(self.handle, buffer);
+ pub fn readAll(self: File, buffer: []u8) ReadError!void {
+ var index: usize = 0;
+ while (index < buffer.len) {
+ index += try self.read(buffer[index..]);
+ }
+ }
+
+ pub fn pread(self: File, buffer: []u8, offset: u64) PReadError!usize {
+ if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
+ return std.event.Loop.instance.?.pread(self.handle, buffer, offset);
+ } else {
+ return os.pread(self.handle, buffer, offset);
+ }
+ }
+
+ pub fn preadAll(self: File, buffer: []u8, offset: u64) PReadError!void {
+ var index: usize = 0;
+ while (index < buffer.len) {
+ index += try self.pread(buffer[index..], offset + index);
}
- return os.pread(self.handle, buffer, offset);
}
pub fn readv(self: File, iovecs: []const os.iovec) ReadError!usize {
if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
return std.event.Loop.instance.?.readv(self.handle, iovecs);
+ } else {
+ return os.readv(self.handle, iovecs);
}
- return os.readv(self.handle, iovecs);
}
- pub fn preadv(self: File, iovecs: []const os.iovec, offset: u64) ReadError!usize {
+ /// The `iovecs` parameter is mutable because this function needs to mutate the fields in
+ /// order to handle partial reads from the underlying OS layer.
+ pub fn readvAll(self: File, iovecs: []os.iovec) ReadError!void {
+ var i: usize = 0;
+ while (true) {
+ var amt = try self.readv(iovecs[i..]);
+ while (amt >= iovecs[i].iov_len) {
+ amt -= iovecs[i].iov_len;
+ i += 1;
+ if (i >= iovecs.len) return;
+ }
+ iovecs[i].iov_base += amt;
+ iovecs[i].iov_len -= amt;
+ }
+ }
+
+ pub fn preadv(self: File, iovecs: []const os.iovec, offset: u64) PReadError!usize {
if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
return std.event.Loop.instance.?.preadv(self.handle, iovecs, offset);
+ } else {
+ return os.preadv(self.handle, iovecs, offset);
+ }
+ }
+
+ /// The `iovecs` parameter is mutable because this function needs to mutate the fields in
+ /// order to handle partial reads from the underlying OS layer.
+ pub fn preadvAll(self: File, iovecs: []const os.iovec, offset: u64) PReadError!void {
+ var i: usize = 0;
+ var off: usize = 0;
+ while (true) {
+ var amt = try self.preadv(iovecs[i..], offset + off);
+ off += amt;
+ while (amt >= iovecs[i].iov_len) {
+ amt -= iovecs[i].iov_len;
+ i += 1;
+ if (i >= iovecs.len) return;
+ }
+ iovecs[i].iov_base += amt;
+ iovecs[i].iov_len -= amt;
}
- return os.preadv(self.handle, iovecs, offset);
}
pub const WriteError = os.WriteError;
+ pub const PWriteError = os.PWriteError;
- pub fn write(self: File, bytes: []const u8) WriteError!void {
+ pub fn write(self: File, bytes: []const u8) WriteError!usize {
if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
return std.event.Loop.instance.?.write(self.handle, bytes);
+ } else {
+ return os.write(self.handle, bytes);
}
- return os.write(self.handle, bytes);
}
- pub fn pwrite(self: File, bytes: []const u8, offset: u64) WriteError!void {
+ pub fn writeAll(self: File, bytes: []const u8) WriteError!void {
+ var index: usize = 0;
+ while (index < bytes.len) {
+ index += try self.write(bytes[index..]);
+ }
+ }
+
+ pub fn pwrite(self: File, bytes: []const u8, offset: u64) PWriteError!usize {
if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
return std.event.Loop.instance.?.pwrite(self.handle, bytes, offset);
+ } else {
+ return os.pwrite(self.handle, bytes, offset);
}
- return os.pwrite(self.handle, bytes, offset);
}
- pub fn writev(self: File, iovecs: []const os.iovec_const) WriteError!void {
+ pub fn pwriteAll(self: File, bytes: []const u8, offset: u64) PWriteError!void {
+ var index: usize = 0;
+ while (index < bytes.len) {
+ index += try self.pwrite(bytes[index..], offset + index);
+ }
+ }
+
+ pub fn writev(self: File, iovecs: []const os.iovec_const) WriteError!usize {
if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
return std.event.Loop.instance.?.writev(self.handle, iovecs);
+ } else {
+ return os.writev(self.handle, iovecs);
}
- return os.writev(self.handle, iovecs);
}
- pub fn pwritev(self: File, iovecs: []const os.iovec_const, offset: usize) WriteError!void {
- if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
- return std.event.Loop.instance.?.pwritev(self.handle, iovecs);
+ /// The `iovecs` parameter is mutable because this function needs to mutate the fields in
+ /// order to handle partial writes from the underlying OS layer.
+ pub fn writevAll(self: File, iovecs: []os.iovec_const) WriteError!void {
+ var i: usize = 0;
+ while (true) {
+ var amt = try self.writev(iovecs[i..]);
+ while (amt >= iovecs[i].iov_len) {
+ amt -= iovecs[i].iov_len;
+ i += 1;
+ if (i >= iovecs.len) return;
+ }
+ iovecs[i].iov_base += amt;
+ iovecs[i].iov_len -= amt;
+ }
+ }
+
+ pub fn pwritev(self: File, iovecs: []os.iovec_const, offset: usize) PWriteError!usize {
+ if (need_async_thread and self.io_mode == .blocking and !self.async_block_allowed) {
+ return std.event.Loop.instance.?.pwritev(self.handle, iovecs, offset);
+ } else {
+ return os.pwritev(self.handle, iovecs, offset);
+ }
+ }
+
+ /// The `iovecs` parameter is mutable because this function needs to mutate the fields in
+ /// order to handle partial writes from the underlying OS layer.
+ pub fn pwritevAll(self: File, iovecs: []os.iovec_const, offset: usize) PWriteError!void {
+ var i: usize = 0;
+ var off: usize = 0;
+ while (true) {
+ var amt = try self.pwritev(iovecs[i..], offset + off);
+ off += amt;
+ while (amt >= iovecs[i].iov_len) {
+ amt -= iovecs[i].iov_len;
+ i += 1;
+ if (i >= iovecs.len) return;
+ }
+ iovecs[i].iov_base += amt;
+ iovecs[i].iov_len -= amt;
}
- return os.pwritev(self.handle, iovecs);
}
pub fn inStream(file: File) InStream {
@@ -335,7 +441,7 @@ pub const File = struct {
pub const Error = WriteError;
pub const Stream = io.OutStream(Error);
- fn writeFn(out_stream: *Stream, bytes: []const u8) Error!void {
+ fn writeFn(out_stream: *Stream, bytes: []const u8) Error!usize {
const self = @fieldParentPtr(OutStream, "stream", out_stream);
return self.file.write(bytes);
}
diff --git a/lib/std/io.zig b/lib/std/io.zig
index d0bf26d548..99e9391f1d 100644
--- a/lib/std/io.zig
+++ b/lib/std/io.zig
@@ -437,10 +437,11 @@ pub fn BitInStream(endian: builtin.Endian, comptime Error: type) type {
};
}
-/// This is a simple OutStream that writes to a fixed buffer, and returns an error
-/// when it runs out of space.
+/// This is a simple OutStream that writes to a fixed buffer. If the returned number
+/// of bytes written is less than requested, the buffer is full.
+/// Returns error.OutOfMemory when no bytes would be written.
pub const SliceOutStream = struct {
- pub const Error = error{OutOfSpace};
+ pub const Error = error{OutOfMemory};
pub const Stream = OutStream(Error);
stream: Stream,
@@ -464,9 +465,11 @@ pub const SliceOutStream = struct {
self.pos = 0;
}
- fn writeFn(out_stream: *Stream, bytes: []const u8) Error!void {
+ fn writeFn(out_stream: *Stream, bytes: []const u8) Error!usize {
const self = @fieldParentPtr(SliceOutStream, "stream", out_stream);
+ if (bytes.len == 0) return 0;
+
assert(self.pos <= self.slice.len);
const n = if (self.pos + bytes.len <= self.slice.len)
@@ -477,9 +480,9 @@ pub const SliceOutStream = struct {
std.mem.copy(u8, self.slice[self.pos .. self.pos + n], bytes[0..n]);
self.pos += n;
- if (n < bytes.len) {
- return Error.OutOfSpace;
- }
+ if (n == 0) return error.OutOfMemory;
+
+ return n;
}
};
@@ -508,7 +511,9 @@ pub const NullOutStream = struct {
};
}
- fn writeFn(out_stream: *Stream, bytes: []const u8) Error!void {}
+ fn writeFn(out_stream: *Stream, bytes: []const u8) Error!usize {
+ return bytes.len;
+ }
};
test "io.NullOutStream" {
@@ -536,10 +541,11 @@ pub fn CountingOutStream(comptime OutStreamError: type) type {
};
}
- fn writeFn(out_stream: *Stream, bytes: []const u8) OutStreamError!void {
+ fn writeFn(out_stream: *Stream, bytes: []const u8) OutStreamError!usize {
const self = @fieldParentPtr(Self, "stream", out_stream);
try self.child_stream.write(bytes);
self.bytes_written += bytes.len;
+ return bytes.len;
}
};
}
@@ -588,13 +594,14 @@ pub fn BufferedOutStreamCustom(comptime buffer_size: usize, comptime OutStreamEr
}
}
- fn writeFn(out_stream: *Stream, bytes: []const u8) Error!void {
+ fn writeFn(out_stream: *Stream, bytes: []const u8) Error!usize {
const self = @fieldParentPtr(Self, "stream", out_stream);
if (bytes.len >= self.fifo.writableLength()) {
try self.flush();
- return self.unbuffered_out_stream.write(bytes);
+ return self.unbuffered_out_stream.writeOnce(bytes);
}
self.fifo.writeAssumeCapacity(bytes);
+ return bytes.len;
}
};
}
@@ -614,9 +621,10 @@ pub const BufferOutStream = struct {
};
}
- fn writeFn(out_stream: *Stream, bytes: []const u8) !void {
+ fn writeFn(out_stream: *Stream, bytes: []const u8) !usize {
const self = @fieldParentPtr(BufferOutStream, "stream", out_stream);
- return self.buffer.append(bytes);
+ try self.buffer.append(bytes);
+ return bytes.len;
}
};
@@ -734,17 +742,17 @@ pub fn BitOutStream(endian: builtin.Endian, comptime Error: type) type {
self.bit_count = 0;
}
- pub fn write(self_stream: *Stream, buffer: []const u8) Error!void {
+ pub fn write(self_stream: *Stream, buffer: []const u8) Error!usize {
var self = @fieldParentPtr(Self, "stream", self_stream);
- //@NOTE: I'm not sure this is a good idea, maybe flushBits should be forced
+ // TODO: I'm not sure this is a good idea, maybe flushBits should be forced
if (self.bit_count > 0) {
for (buffer) |b, i|
try self.writeBits(b, u8_bit_count);
- return;
+ return buffer.len;
}
- return self.out_stream.write(buffer);
+ return self.out_stream.writeOnce(buffer);
}
};
}
diff --git a/lib/std/io/c_out_stream.zig b/lib/std/io/c_out_stream.zig
index 8b341e6937..adaa3fcbaf 100644
--- a/lib/std/io/c_out_stream.zig
+++ b/lib/std/io/c_out_stream.zig
@@ -20,10 +20,10 @@ pub const COutStream = struct {
};
}
- fn writeFn(out_stream: *Stream, bytes: []const u8) Error!void {
+ fn writeFn(out_stream: *Stream, bytes: []const u8) Error!usize {
const self = @fieldParentPtr(COutStream, "stream", out_stream);
const amt_written = std.c.fwrite(bytes.ptr, 1, bytes.len, self.c_file);
- if (amt_written == bytes.len) return;
+ if (amt_written >= 0) return amt_written;
switch (std.c._errno().*) {
0 => unreachable,
os.EINVAL => unreachable,
diff --git a/lib/std/io/out_stream.zig b/lib/std/io/out_stream.zig
index 7f534865f5..cb75b27bf1 100644
--- a/lib/std/io/out_stream.zig
+++ b/lib/std/io/out_stream.zig
@@ -14,13 +14,13 @@ pub fn OutStream(comptime WriteError: type) type {
const Self = @This();
pub const Error = WriteError;
pub const WriteFn = if (std.io.is_async)
- async fn (self: *Self, bytes: []const u8) Error!void
+ async fn (self: *Self, bytes: []const u8) Error!usize
else
- fn (self: *Self, bytes: []const u8) Error!void;
+ fn (self: *Self, bytes: []const u8) Error!usize;
writeFn: WriteFn,
- pub fn write(self: *Self, bytes: []const u8) Error!void {
+ pub fn writeOnce(self: *Self, bytes: []const u8) Error!usize {
if (std.io.is_async) {
// Let's not be writing 0xaa in safe modes for upwards of 4 MiB for every stream write.
@setRuntimeSafety(false);
@@ -31,6 +31,13 @@ pub fn OutStream(comptime WriteError: type) type {
}
}
+ pub fn write(self: *Self, bytes: []const u8) Error!void {
+ var index: usize = 0;
+ while (index != bytes.len) {
+ index += try self.writeOnce(bytes[index..]);
+ }
+ }
+
pub fn print(self: *Self, comptime format: []const u8, args: var) Error!void {
return std.fmt.format(self, Error, write, format, args);
}
diff --git a/lib/std/io/test.zig b/lib/std/io/test.zig
index f1840b49e3..1ab0f82313 100644
--- a/lib/std/io/test.zig
+++ b/lib/std/io/test.zig
@@ -134,13 +134,13 @@ test "SliceOutStream" {
try ss.stream.write("world");
expect(mem.eql(u8, ss.getWritten(), "Helloworld"));
- expectError(error.OutOfSpace, ss.stream.write("!"));
+ expectError(error.OutOfMemory, ss.stream.write("!"));
expect(mem.eql(u8, ss.getWritten(), "Helloworld"));
ss.reset();
expect(ss.getWritten().len == 0);
- expectError(error.OutOfSpace, ss.stream.write("Hello world!"));
+ expectError(error.OutOfMemory, ss.stream.write("Hello world!"));
expect(mem.eql(u8, ss.getWritten(), "Hello worl"));
}
@@ -617,7 +617,7 @@ test "File seek ops" {
fs.cwd().deleteFile(tmp_file_name) catch {};
}
- try file.write(&([_]u8{0x55} ** 8192));
+ try file.writeAll(&([_]u8{0x55} ** 8192));
// Seek to the end
try file.seekFromEnd(0);
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 2015b52d2f..8913a1599f 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -298,6 +298,11 @@ pub const ReadError = error{
/// buf.len. If 0 bytes were read, that means EOF.
/// If the application has a global event loop enabled, EAGAIN is handled
/// via the event loop. Otherwise EAGAIN results in error.WouldBlock.
+///
+/// Linux has a limit on how many bytes may be transferred in one `read` call, which is `0x7ffff000`
+/// on both 64-bit and 32-bit systems. This is due to using a signed C int as the return value, as
+/// well as stuffing the errno codes into the last `4096` values. This is noted on the `read` man page.
+/// For POSIX the limit is `math.maxInt(isize)`.
pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
if (builtin.os.tag == .windows) {
return windows.ReadFile(fd, buf, null);
@@ -316,8 +321,15 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
}
}
+ // Prevents EINVAL.
+ const max_count = switch (std.Target.current.os.tag) {
+ .linux => 0x7ffff000,
+ else => math.maxInt(isize),
+ };
+ const adjusted_len = math.min(max_count, buf.len);
+
while (true) {
- const rc = system.read(fd, buf.ptr, buf.len);
+ const rc = system.read(fd, buf.ptr, adjusted_len);
switch (errno(rc)) {
0 => return @intCast(usize, rc),
EINTR => continue,
@@ -352,32 +364,18 @@ pub fn read(fd: fd_t, buf: []u8) ReadError!usize {
/// * Windows
/// On these systems, the read races with concurrent writes to the same file descriptor.
pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize {
- if (builtin.os.tag == .windows) {
- // TODO batch these into parallel requests
- var off: usize = 0;
- var iov_i: usize = 0;
- var inner_off: usize = 0;
- while (true) {
- const v = iov[iov_i];
- const amt_read = try read(fd, v.iov_base[inner_off .. v.iov_len - inner_off]);
- off += amt_read;
- inner_off += amt_read;
- if (inner_off == v.len) {
- iov_i += 1;
- inner_off = 0;
- if (iov_i == iov.len) {
- return off;
- }
- }
- if (amt_read == 0) return off; // EOF
- } else unreachable; // TODO https://github.com/ziglang/zig/issues/707
+ if (std.Target.current.os.tag == .windows) {
+ // TODO does Windows have a way to read an io vector?
+ if (iov.len == 0) return @as(usize, 0);
+ const first = iov[0];
+ return read(fd, first.iov_base[0..first.iov_len]);
}
while (true) {
// TODO handle the case when iov_len is too large and get rid of this @intCast
- const rc = system.readv(fd, iov.ptr, @intCast(u32, iov.len));
+ const rc = system.readv(fd, iov.ptr, iov_count);
switch (errno(rc)) {
- 0 => return @bitCast(usize, rc),
+ 0 => return @intCast(usize, rc),
EINTR => continue,
EINVAL => unreachable,
EFAULT => unreachable,
@@ -397,6 +395,8 @@ pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize {
}
}
+pub const PReadError = ReadError || error{Unseekable};
+
/// Number of bytes read is returned. Upon reading end-of-file, zero is returned.
///
/// Retries when interrupted by a signal.
@@ -405,7 +405,7 @@ pub fn readv(fd: fd_t, iov: []const iovec) ReadError!usize {
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
-pub fn pread(fd: fd_t, buf: []u8, offset: u64) ReadError!usize {
+pub fn pread(fd: fd_t, buf: []u8, offset: u64) PReadError!usize {
if (builtin.os.tag == .windows) {
return windows.ReadFile(fd, buf, offset);
}
@@ -429,6 +429,9 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) ReadError!usize {
ENOBUFS => return error.SystemResources,
ENOMEM => return error.SystemResources,
ECONNRESET => return error.ConnectionResetByPeer,
+ ENXIO => return error.Unseekable,
+ ESPIPE => return error.Unseekable,
+ EOVERFLOW => return error.Unseekable,
else => |err| return unexpectedErrno(err),
}
}
@@ -448,75 +451,23 @@ pub fn pread(fd: fd_t, buf: []u8, offset: u64) ReadError!usize {
/// * Darwin
/// * Windows
/// On these systems, the read races with concurrent writes to the same file descriptor.
-pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) ReadError!usize {
- if (comptime std.Target.current.isDarwin()) {
- // Darwin does not have preadv but it does have pread.
- var off: usize = 0;
- var iov_i: usize = 0;
- var inner_off: usize = 0;
- while (true) {
- const v = iov[iov_i];
- const rc = darwin.pread(fd, v.iov_base + inner_off, v.iov_len - inner_off, offset + off);
- const err = darwin.getErrno(rc);
- switch (err) {
- 0 => {
- const amt_read = @bitCast(usize, rc);
- off += amt_read;
- inner_off += amt_read;
- if (inner_off == v.iov_len) {
- iov_i += 1;
- inner_off = 0;
- if (iov_i == iov.len) {
- return off;
- }
- }
- if (rc == 0) return off; // EOF
- continue;
- },
- EINTR => continue,
- EINVAL => unreachable,
- EFAULT => unreachable,
- ESPIPE => unreachable, // fd is not seekable
- EAGAIN => if (std.event.Loop.instance) |loop| {
- loop.waitUntilFdReadable(fd);
- continue;
- } else {
- return error.WouldBlock;
- },
- EBADF => unreachable, // always a race condition
- EIO => return error.InputOutput,
- EISDIR => return error.IsDir,
- ENOBUFS => return error.SystemResources,
- ENOMEM => return error.SystemResources,
- else => return unexpectedErrno(err),
- }
- }
+pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) PReadError!usize {
+ const have_pread_but_not_preadv = switch (std.Target.current.os.tag) {
+ .windows, .macosx, .ios, .watchos, .tvos => true,
+ else => false,
+ };
+ if (have_pread_but_not_preadv) {
+ // We could loop here; but proper usage of `preadv` must handle partial reads anyway.
+ // So we simply read into the first vector only.
+ if (iov.len == 0) return @as(usize, 0);
+ const first = iov[0];
+ return pread(fd, first.iov_base[0..first.iov_len], offset);
}
- if (builtin.os.tag == .windows) {
- // TODO batch these into parallel requests
- var off: usize = 0;
- var iov_i: usize = 0;
- var inner_off: usize = 0;
- while (true) {
- const v = iov[iov_i];
- const amt_read = try pread(fd, v.iov_base[inner_off .. v.iov_len - inner_off], offset + off);
- off += amt_read;
- inner_off += amt_read;
- if (inner_off == v.len) {
- iov_i += 1;
- inner_off = 0;
- if (iov_i == iov.len) {
- return off;
- }
- }
- if (amt_read == 0) return off; // EOF
- } else unreachable; // TODO https://github.com/ziglang/zig/issues/707
- }
+ const iov_count = math.cast(u31, iov.len) catch math.maxInt(u31);
while (true) {
- // TODO handle the case when iov_len is too large and get rid of this @intCast
- const rc = system.preadv(fd, iov.ptr, @intCast(u32, iov.len), offset);
+ const rc = system.preadv(fd, iov.ptr, iov_count, offset);
switch (errno(rc)) {
0 => return @bitCast(usize, rc),
EINTR => continue,
@@ -533,6 +484,9 @@ pub fn preadv(fd: fd_t, iov: []const iovec, offset: u64) ReadError!usize {
EISDIR => return error.IsDir,
ENOBUFS => return error.SystemResources,
ENOMEM => return error.SystemResources,
+ ENXIO => return error.Unseekable,
+ ESPIPE => return error.Unseekable,
+ EOVERFLOW => return error.Unseekable,
else => |err| return unexpectedErrno(err),
}
}
@@ -553,10 +507,28 @@ pub const WriteError = error{
WouldBlock,
} || UnexpectedError;
-/// Write to a file descriptor. Keeps trying if it gets interrupted.
-/// If the application has a global event loop enabled, EAGAIN is handled
-/// via the event loop. Otherwise EAGAIN results in error.WouldBlock.
-pub fn write(fd: fd_t, bytes: []const u8) WriteError!void {
+/// Write to a file descriptor.
+/// Retries when interrupted by a signal.
+/// Returns the number of bytes written. If nonzero bytes were supplied, this will be nonzero.
+///
+/// Note that a successful write() may transfer fewer than count bytes. Such partial writes can
+/// occur for various reasons; for example, because there was insufficient space on the disk
+/// device to write all of the requested bytes, or because a blocked write() to a socket, pipe, or
+/// similar was interrupted by a signal handler after it had transferred some, but before it had
+/// transferred all of the requested bytes. In the event of a partial write, the caller can make
+/// another write() call to transfer the remaining bytes. The subsequent call will either
+/// transfer further bytes or may result in an error (e.g., if the disk is now full).
+///
+/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
+/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
+/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
+/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
+///
+/// Linux has a limit on how many bytes may be transferred in one `write` call, which is `0x7ffff000`
+/// on both 64-bit and 32-bit systems. This is due to using a signed C int as the return value, as
+/// well as stuffing the errno codes into the last `4096` values. This is noted on the `write` man page.
+/// The corresponding POSIX limit is `math.maxInt(isize)`.
+pub fn write(fd: fd_t, bytes: []const u8) WriteError!usize {
if (builtin.os.tag == .windows) {
return windows.WriteFile(fd, bytes, null);
}
@@ -568,26 +540,21 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!void {
}};
var nwritten: usize = undefined;
switch (wasi.fd_write(fd, &ciovs, ciovs.len, &nwritten)) {
- 0 => return,
+ 0 => return nwritten,
else => |err| return unexpectedErrno(err),
}
}
- // Linux can return EINVAL when write amount is > 0x7ffff000
- // See https://github.com/ziglang/zig/pull/743#issuecomment-363165856
- // TODO audit this. Shawn Landden says that this is not actually true.
- // if this logic should stay, move it to std.os.linux
- const max_bytes_len = 0x7ffff000;
+ const max_count = switch (std.Target.current.os.tag) {
+ .linux => 0x7ffff000,
+ else => math.maxInt(isize),
+ };
+ const adjusted_len = math.min(max_count, bytes.len);
- var index: usize = 0;
- while (index < bytes.len) {
- const amt_to_write = math.min(bytes.len - index, @as(usize, max_bytes_len));
- const rc = system.write(fd, bytes.ptr + index, amt_to_write);
+ while (true) {
+ const rc = system.write(fd, bytes.ptr, adjusted_len);
switch (errno(rc)) {
- 0 => {
- index += @intCast(usize, rc);
- continue;
- },
+ 0 => return @intCast(usize, rc),
EINTR => continue,
EINVAL => unreachable,
EFAULT => unreachable,
@@ -611,14 +578,36 @@ pub fn write(fd: fd_t, bytes: []const u8) WriteError!void {
}
/// Write multiple buffers to a file descriptor.
-/// If the application has a global event loop enabled, EAGAIN is handled
-/// via the event loop. Otherwise EAGAIN results in error.WouldBlock.
-pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!void {
+/// Retries when interrupted by a signal.
+/// Returns the number of bytes written. If nonzero bytes were supplied, this will be nonzero.
+///
+/// Note that a successful write() may transfer fewer bytes than supplied. Such partial writes can
+/// occur for various reasons; for example, because there was insufficient space on the disk
+/// device to write all of the requested bytes, or because a blocked write() to a socket, pipe, or
+/// similar was interrupted by a signal handler after it had transferred some, but before it had
+/// transferred all of the requested bytes. In the event of a partial write, the caller can make
+/// another write() call to transfer the remaining bytes. The subsequent call will either
+/// transfer further bytes or may result in an error (e.g., if the disk is now full).
+///
+/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
+/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
+/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
+/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
+///
+/// If `iov.len` is larger than will fit in a `u31`, a partial write will occur.
+pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!usize {
+ if (std.Target.current.os.tag == .windows) {
+ // TODO does Windows have a way to write an io vector?
+ if (iov.len == 0) return @as(usize, 0);
+ const first = iov[0];
+ return write(fd, first.iov_base[0..first.iov_len]);
+ }
+
+ const iov_count = math.cast(u31, iov.len) catch math.maxInt(u31);
while (true) {
- // TODO handle the case when iov_len is too large and get rid of this @intCast
- const rc = system.writev(fd, iov.ptr, @intCast(u32, iov.len));
+ const rc = system.writev(fd, iov.ptr, iov_count);
switch (errno(rc)) {
- 0 => return,
+ 0 => return @intCast(usize, rc),
EINTR => continue,
EINVAL => unreachable,
EFAULT => unreachable,
@@ -641,23 +630,45 @@ pub fn writev(fd: fd_t, iov: []const iovec_const) WriteError!void {
}
}
+pub const PWriteError = WriteError || error{Unseekable};
+
/// Write to a file descriptor, with a position offset.
-///
/// Retries when interrupted by a signal.
+/// Returns the number of bytes written. If nonzero bytes were supplied, this will be nonzero.
+///
+/// Note that a successful write() may transfer fewer bytes than supplied. Such partial writes can
+/// occur for various reasons; for example, because there was insufficient space on the disk
+/// device to write all of the requested bytes, or because a blocked write() to a socket, pipe, or
+/// similar was interrupted by a signal handler after it had transferred some, but before it had
+/// transferred all of the requested bytes. In the event of a partial write, the caller can make
+/// another write() call to transfer the remaining bytes. The subsequent call will either
+/// transfer further bytes or may result in an error (e.g., if the disk is now full).
///
/// For POSIX systems, if the application has a global event loop enabled, EAGAIN is handled
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
/// On Windows, if the application has a global event loop enabled, I/O Completion Ports are
/// used to perform the I/O. `error.WouldBlock` is not possible on Windows.
-pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) WriteError!void {
+///
+/// Linux has a limit on how many bytes may be transferred in one `pwrite` call, which is `0x7ffff000`
+/// on both 64-bit and 32-bit systems. This is due to using a signed C int as the return value, as
+/// well as stuffing the errno codes into the last `4096` values. This is noted on the `write` man page.
+/// The corresponding POSIX limit is `math.maxInt(isize)`.
+pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) PWriteError!usize {
if (std.Target.current.os.tag == .windows) {
return windows.WriteFile(fd, bytes, offset);
}
+ // Prevent EINVAL.
+ const max_count = switch (std.Target.current.os.tag) {
+ .linux => 0x7ffff000,
+ else => math.maxInt(isize),
+ };
+ const adjusted_len = math.min(max_count, bytes.len);
+
while (true) {
- const rc = system.pwrite(fd, bytes.ptr, bytes.len, offset);
+ const rc = system.pwrite(fd, bytes.ptr, adjusted_len, offset);
switch (errno(rc)) {
- 0 => return,
+ 0 => return @intCast(usize, rc),
EINTR => continue,
EINVAL => unreachable,
EFAULT => unreachable,
@@ -675,84 +686,54 @@ pub fn pwrite(fd: fd_t, bytes: []const u8, offset: u64) WriteError!void {
ENOSPC => return error.NoSpaceLeft,
EPERM => return error.AccessDenied,
EPIPE => return error.BrokenPipe,
+ ENXIO => return error.Unseekable,
+ ESPIPE => return error.Unseekable,
+ EOVERFLOW => return error.Unseekable,
else => |err| return unexpectedErrno(err),
}
}
}
/// Write multiple buffers to a file descriptor, with a position offset.
-///
/// Retries when interrupted by a signal.
+/// Returns the number of bytes written. If nonzero bytes were supplied, this will be nonzero.
+///
+/// Note that a successful write() may transfer fewer than count bytes. Such partial writes can
+/// occur for various reasons; for example, because there was insufficient space on the disk
+/// device to write all of the requested bytes, or because a blocked write() to a socket, pipe, or
+/// similar was interrupted by a signal handler after it had transferred some, but before it had
+/// transferred all of the requested bytes. In the event of a partial write, the caller can make
+/// another write() call to transfer the remaining bytes. The subsequent call will either
+/// transfer further bytes or may result in an error (e.g., if the disk is now full).
///
/// If the application has a global event loop enabled, EAGAIN is handled
/// via the event loop. Otherwise EAGAIN results in `error.WouldBlock`.
///
-/// This operation is non-atomic on the following systems:
+/// The following systems do not have this syscall, and will return partial writes if more than one
+/// vector is provided:
/// * Darwin
/// * Windows
-/// On these systems, the write races with concurrent writes to the same file descriptor, and
-/// the file can be in a partially written state when an error occurs.
-pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) WriteError!void {
- if (comptime std.Target.current.isDarwin()) {
- // Darwin does not have pwritev but it does have pwrite.
- var off: usize = 0;
- var iov_i: usize = 0;
- var inner_off: usize = 0;
- while (true) {
- const v = iov[iov_i];
- const rc = darwin.pwrite(fd, v.iov_base + inner_off, v.iov_len - inner_off, offset + off);
- const err = darwin.getErrno(rc);
- switch (err) {
- 0 => {
- const amt_written = @bitCast(usize, rc);
- off += amt_written;
- inner_off += amt_written;
- if (inner_off == v.iov_len) {
- iov_i += 1;
- inner_off = 0;
- if (iov_i == iov.len) {
- return;
- }
- }
- continue;
- },
- EINTR => continue,
- ESPIPE => unreachable, // `fd` is not seekable.
- EINVAL => unreachable,
- EFAULT => unreachable,
- EAGAIN => if (std.event.Loop.instance) |loop| {
- loop.waitUntilFdWritable(fd);
- continue;
- } else {
- return error.WouldBlock;
- },
- EBADF => unreachable, // Always a race condition.
- EDESTADDRREQ => unreachable, // `connect` was never called.
- EDQUOT => return error.DiskQuota,
- EFBIG => return error.FileTooBig,
- EIO => return error.InputOutput,
- ENOSPC => return error.NoSpaceLeft,
- EPERM => return error.AccessDenied,
- EPIPE => return error.BrokenPipe,
- else => return unexpectedErrno(err),
- }
- }
- }
-
- if (std.Target.current.os.tag == .windows) {
- var off = offset;
- for (iov) |item| {
- try pwrite(fd, item.iov_base[0..item.iov_len], off);
- off += buf.len;
- }
- return;
+///
+/// If `iov.len` is larger than will fit in a `u31`, a partial write will occur.
+pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) PWriteError!usize {
+ const have_pwrite_but_not_pwritev = switch (std.Target.current.os.tag) {
+ .windows, .macosx, .ios, .watchos, .tvos => true,
+ else => false,
+ };
+
+ if (have_pwrite_but_not_pwritev) {
+ // We could loop here; but proper usage of `pwritev` must handle partial writes anyway.
+ // So we simply write the first vector only.
+ if (iov.len == 0) return @as(usize, 0);
+ const first = iov[0];
+ return pwrite(fd, first.iov_base[0..first.iov_len], offset);
}
+ const iov_count = math.cast(u31, iov.len) catch math.maxInt(u31);
while (true) {
- // TODO handle the case when iov_len is too large and get rid of this @intCast
- const rc = system.pwritev(fd, iov.ptr, @intCast(u32, iov.len), offset);
+ const rc = system.pwritev(fd, iov.ptr, iov_count, offset);
switch (errno(rc)) {
- 0 => return,
+ 0 => return @intCast(usize, rc),
EINTR => continue,
EINVAL => unreachable,
EFAULT => unreachable,
@@ -770,6 +751,9 @@ pub fn pwritev(fd: fd_t, iov: []const iovec_const, offset: u64) WriteError!void
ENOSPC => return error.NoSpaceLeft,
EPERM => return error.AccessDenied,
EPIPE => return error.BrokenPipe,
+ ENXIO => return error.Unseekable,
+ ESPIPE => return error.Unseekable,
+ EOVERFLOW => return error.Unseekable,
else => |err| return unexpectedErrno(err),
}
}
@@ -3389,7 +3373,6 @@ pub const SendError = error{
/// The socket type requires that message be sent atomically, and the size of the message
/// to be sent made this impossible. The message is not transmitted.
- ///
MessageTooBig,
/// The output queue for a network interface was full. This generally indicates that the
@@ -3498,119 +3481,312 @@ pub fn send(
return sendto(sockfd, buf, flags, null, 0);
}
-pub const SendFileError = error{
- /// There was an unspecified error while reading from infd.
- InputOutput,
+pub const SendFileError = PReadError || WriteError || SendError;
- /// There was insufficient resources for processing.
- SystemResources,
-
- /// The value provided for count overflows the maximum size of either
- /// infd or outfd.
- Overflow,
-
- /// Offset was provided, but infd is not seekable.
- Unseekable,
-
- /// The outfd is marked nonblocking and the requested operation would block, and
- /// there is no global event loop configured.
- WouldBlock,
-} || WriteError || UnexpectedError;
-
-pub const sf_hdtr = struct {
- headers: []iovec_const,
- trailers: []iovec_const,
-};
-
-/// Transfer data between file descriptors.
-///
-/// The `sendfile` call copies `count` bytes from one file descriptor to another within the kernel. This can
-/// be more performant than transferring data from the kernel to user space and back, such as with
-/// `read` and `write` calls.
-///
-/// The `infd` should be a file descriptor opened for reading, and `outfd` should be a file descriptor
-/// opened for writing. Copying will begin at `offset`, if not null, which will be updated to reflect
-/// the number of bytes read. If `offset` is null, the copying will begin at the current seek position,
-/// and the file position will be updated.
-pub fn sendfile(infd: fd_t, outfd: fd_t, offset: u64, count: usize, optional_hdtr: ?*const sf_hdtr, flags: u32) SendFileError!usize {
- // XXX: check if offset is > length of file, return 0 bytes written
- // XXX: document systems where headers are sent atomically.
- // XXX: compute new offset on EINTR/EAGAIN
- var rc: usize = undefined;
- var err: usize = undefined;
- if (builtin.os == .linux) {
- while (true) {
- try lseek_SET(infd, offset);
-
- if (optional_hdtr) |hdtr| {
- try writev(outfd, hdtr.headers);
- }
-
- rc = system.sendfile(outfd, infd, null, count);
- err = errno(rc);
-
- if (optional_hdtr) |hdtr| {
- try writev(outfd, hdtr.trailers);
- }
-
- switch (err) {
- 0 => return @intCast(usize, rc),
- else => return unexpectedErrno(err),
-
- EBADF => unreachable,
- EINVAL => unreachable,
- EFAULT => unreachable,
- EAGAIN => if (std.event.Loop.instance) |loop| {
- loop.waitUntilFdWritable(outfd);
- continue;
- } else {
- return error.WouldBlock;
- },
- EIO => return error.InputOutput,
- ENOMEM => return error.SystemResources,
- EOVERFLOW => return error.Overflow,
- ESPIPE => return error.Unseekable,
- }
- }
- } else if (builtin.os == .freebsd) {
- while (true) {
- var rcount: u64 = 0;
- var hdtr: std.c.sf_hdtr = undefined;
- if (optional_hdtr) |h| {
- hdtr = std.c.sf_hdtr{
- .headers = h.headers.ptr,
- .hdr_cnt = @intCast(c_int, h.headers.len),
- .trailers = h.trailers.ptr,
- .trl_cnt = @intCast(c_int, h.trailers.len),
- };
- }
- err = errno(system.sendfile(infd, outfd, offset, count, &hdtr, &rcount, @intCast(c_int, flags)));
- switch (err) {
- 0 => return @intCast(usize, rcount),
- else => return unexpectedErrno(err),
-
- EBADF => unreachable,
- EFAULT => unreachable,
- EINVAL => unreachable,
- ENOTCAPABLE => unreachable,
- ENOTCONN => unreachable,
- ENOTSOCK => unreachable,
- EAGAIN => if (std.event.Loop.instance) |loop| {
- loop.waitUntilFdWritable(outfd);
- continue;
- } else {
- return error.WouldBlock;
- },
- EBUSY => return error.DeviceBusy,
- EINTR => continue,
- EIO => return error.InputOutput,
- ENOBUFS => return error.SystemResources,
- EPIPE => return error.BrokenPipe,
- }
- }
- } else {
- @compileError("sendfile unimplemented for this target");
+fn count_iovec_bytes(iovs: []const iovec_const) usize {
+ var count: usize = 0;
+ for (iovs) |iov| {
+ count += iov.iov_len;
}
+ return count;
+}
+
+/// Transfer data between file descriptors, with optional headers and trailers.
+/// Returns the number of bytes written. This will be zero if `in_offset` falls beyond the end of the file.
+///
+/// The `sendfile` call copies `count` bytes from one file descriptor to another. When possible,
+/// this is done within the operating system kernel, which can provide better performance
+/// characteristics than transferring data from kernel to user space and back, such as with
+/// `read` and `write` calls. When `count` is `0`, it means to copy until the end of the input file has been
+/// reached. Note, however, that partial writes are still possible in this case.
+///
+/// `in_fd` must be a file descriptor opened for reading, and `out_fd` must be a file descriptor
+/// opened for writing. They may be any kind of file descriptor; however, if `in_fd` is not a regular
+/// file system file, it may cause this function to fall back to calling `read` and `write`, in which case
+/// atomicity guarantees no longer apply.
+///
+/// Copying begins reading at `in_offset`. The input file descriptor seek position is ignored and not updated.
+/// If the output file descriptor has a seek position, it is updated as bytes are written.
+///
+/// `flags` has different meanings per operating system; refer to the respective man pages.
+///
+/// These systems support atomically sending everything, including headers and trailers:
+/// * macOS
+/// * FreeBSD
+///
+/// These systems support in-kernel data copying, but headers and trailers are not sent atomically:
+/// * Linux
+///
+/// Other systems fall back to calling `read` / `write`.
+///
+/// Linux has a limit on how many bytes may be transferred in one `sendfile` call, which is `0x7ffff000`
+/// on both 64-bit and 32-bit systems. This is due to using a signed C int as the return value, as
+/// well as stuffing the errno codes into the last `4096` values. This is cited on the `sendfile` man page.
+/// The corresponding POSIX limit on this is `math.maxInt(isize)`.
+pub fn sendfile(
+ out_fd: fd_t,
+ in_fd: fd_t,
+ in_offset: u64,
+ count: usize,
+ headers: []const iovec_const,
+ trailers: []const iovec_const,
+ flags: u32,
+) SendFileError!usize {
+ var header_done = false;
+ var total_written: usize = 0;
+
+ // Prevents EOVERFLOW.
+ const max_count = switch (std.Target.current.os.tag) {
+ .linux => 0x7ffff000,
+ else => math.maxInt(isize),
+ };
+
+ switch (std.Target.current.os.tag) {
+ .linux => sf: {
+ // sendfile() first appeared in Linux 2.2, glibc 2.1.
+ const call_sf = comptime if (builtin.link_libc)
+ std.c.versionCheck(.{ .major = 2, .minor = 1 }).ok
+ else
+ std.Target.current.os.version_range.linux.range.max.order(.{ .major = 2, .minor = 2 }) != .lt;
+ if (!call_sf) break :sf;
+
+ if (headers.len != 0) {
+ const amt = try writev(out_fd, headers);
+ total_written += amt;
+ if (amt < count_iovec_bytes(headers)) return total_written;
+ header_done = true;
+ }
+
+ // Here we match BSD behavior, making a zero count value send as many bytes as possible.
+ const adjusted_count = if (count == 0) max_count else math.min(count, max_count);
+
+ while (true) {
+ var offset: off_t = @bitCast(off_t, in_offset);
+ const rc = system.sendfile(out_fd, in_fd, &offset, adjusted_count);
+ switch (errno(rc)) {
+ 0 => {
+ const amt = @bitCast(usize, rc);
+ total_written += amt;
+ if (count == 0 and amt == 0) {
+ // We have detected EOF from `in_fd`.
+ break;
+ } else if (amt < count) {
+ return total_written;
+ } else {
+ break;
+ }
+ },
+
+ EBADF => unreachable, // Always a race condition.
+ EFAULT => unreachable, // Segmentation fault.
+ EOVERFLOW => unreachable, // We avoid passing too large of a `count`.
+ ENOTCONN => unreachable, // `out_fd` is an unconnected socket.
+
+ EINVAL, ENOSYS => {
+ // EINVAL could be any of the following situations:
+ // * Descriptor is not valid or locked
+ // * an mmap(2)-like operation is not available for in_fd
+ // * count is negative
+ // * out_fd has the O_APPEND flag set
+ // Because of the "mmap(2)-like operation" possibility, we fall back to doing read/write
+ // manually, the same as ENOSYS.
+ break :sf;
+ },
+ EAGAIN => if (std.event.Loop.instance) |loop| {
+ loop.waitUntilFdWritable(out_fd);
+ continue;
+ } else {
+ return error.WouldBlock;
+ },
+ EIO => return error.InputOutput,
+ EPIPE => return error.BrokenPipe,
+ ENOMEM => return error.SystemResources,
+ ENXIO => return error.Unseekable,
+ ESPIPE => return error.Unseekable,
+ else => |err| {
+ const discard = unexpectedErrno(err);
+ break :sf;
+ },
+ }
+ }
+
+ if (trailers.len != 0) {
+ total_written += try writev(out_fd, trailers);
+ }
+
+ return total_written;
+ },
+ .freebsd => sf: {
+ var hdtr_data: std.c.sf_hdtr = undefined;
+ var hdtr: ?*std.c.sf_hdtr = null;
+ if (headers.len != 0 or trailers.len != 0) {
+ // Here we carefully avoid `@intCast` by returning partial writes when
+ // too many io vectors are provided.
+ const hdr_cnt = math.cast(u31, headers.len) catch math.maxInt(u31);
+ if (headers.len > hdr_cnt) return writev(out_fd, headers);
+
+ const trl_cnt = math.cast(u31, trailers.len) catch math.maxInt(u31);
+
+ hdtr_data = std.c.sf_hdtr{
+ .headers = headers.ptr,
+ .hdr_cnt = hdr_cnt,
+ .trailers = trailers.ptr,
+ .trl_cnt = trl_cnt,
+ };
+ hdtr = &hdtr_data;
+ }
+
+ const adjusted_count = math.min(count, max_count);
+
+ while (true) {
+ var sbytes: off_t = undefined;
+ const err = errno(system.sendfile(out_fd, in_fd, in_offset, adjusted_count, hdtr, &sbytes, flags));
+ const amt = @bitCast(usize, sbytes);
+ switch (err) {
+ 0 => return amt,
+
+ EBADF => unreachable, // Always a race condition.
+ EFAULT => unreachable, // Segmentation fault.
+ ENOTCONN => unreachable, // `out_fd` is an unconnected socket.
+
+ EINVAL, EOPNOTSUPP, ENOTSOCK, ENOSYS => {
+ // EINVAL could be any of the following situations:
+ // * The fd argument is not a regular file.
+ // * The s argument is not a SOCK_STREAM type socket.
+ // * The offset argument is negative.
+ // Because of some of these possibilities, we fall back to doing read/write
+ // manually, the same as ENOSYS.
+ break :sf;
+ },
+
+ EINTR => if (amt != 0) return amt else continue,
+
+ EAGAIN => if (amt != 0) {
+ return amt;
+ } else if (std.event.Loop.instance) |loop| {
+ loop.waitUntilFdWritable(out_fd);
+ continue;
+ } else {
+ return error.WouldBlock;
+ },
+
+ EBUSY => if (amt != 0) {
+ return amt;
+ } else if (std.event.Loop.instance) |loop| {
+ loop.waitUntilFdReadable(in_fd);
+ continue;
+ } else {
+ return error.WouldBlock;
+ },
+
+ EIO => return error.InputOutput,
+ ENOBUFS => return error.SystemResources,
+ EPIPE => return error.BrokenPipe,
+
+ else => {
+ const discard = unexpectedErrno(err);
+ if (amt != 0) {
+ return amt;
+ } else {
+ break :sf;
+ }
+ },
+ }
+ }
+ },
+ .macosx, .ios, .tvos, .watchos => sf: {
+ var hdtr_data: std.c.sf_hdtr = undefined;
+ var hdtr: ?*std.c.sf_hdtr = null;
+ if (headers.len != 0 or trailers.len != 0) {
+ // Here we carefully avoid `@intCast` by returning partial writes when
+ // too many io vectors are provided.
+ const hdr_cnt = math.cast(u31, headers.len) catch math.maxInt(u31);
+ if (headers.len > hdr_cnt) return writev(out_fd, headers);
+
+ const trl_cnt = math.cast(u31, trailers.len) catch math.maxInt(u31);
+
+ hdtr_data = std.c.sf_hdtr{
+ .headers = headers.ptr,
+ .hdr_cnt = hdr_cnt,
+ .trailers = trailers.ptr,
+ .trl_cnt = trl_cnt,
+ };
+ hdtr = &hdtr_data;
+ }
+
+ const adjusted_count = math.min(count, max_count);
+
+ while (true) {
+ var sbytes: off_t = adjusted_count;
+ const err = errno(system.sendfile(out_fd, in_fd, in_offset, &sbytes, hdtr, flags));
+ const amt = @bitCast(usize, sbytes);
+ switch (err) {
+ 0 => return amt,
+
+ EBADF => unreachable, // Always a race condition.
+ EFAULT => unreachable, // Segmentation fault.
+ EINVAL => unreachable,
+ ENOTCONN => unreachable, // `out_fd` is an unconnected socket.
+
+ ENOTSUP, ENOTSOCK, ENOSYS => break :sf,
+
+ EINTR => if (amt != 0) return amt else continue,
+
+ EAGAIN => if (amt != 0) {
+ return amt;
+ } else if (std.event.Loop.instance) |loop| {
+ loop.waitUntilFdWritable(out_fd);
+ continue;
+ } else {
+ return error.WouldBlock;
+ },
+
+ EIO => return error.InputOutput,
+ EPIPE => return error.BrokenPipe,
+
+ else => {
+ _ = unexpectedErrno(err);
+ if (amt != 0) {
+ return amt;
+ } else {
+ break :sf;
+ }
+ },
+ }
+ }
+ },
+ else => {}, // fall back to read/write
+ }
+
+ if (headers.len != 0 and !header_done) {
+ const amt = try writev(out_fd, headers);
+ total_written += amt;
+ if (amt < count_iovec_bytes(headers)) return total_written;
+ }
+
+ rw: {
+ var buf: [8 * 4096]u8 = undefined;
+ // Here we match BSD behavior, making a zero count value send as many bytes as possible.
+ const adjusted_count = if (count == 0) buf.len else math.min(buf.len, count);
+ const amt_read = try pread(in_fd, buf[0..adjusted_count], in_offset);
+ if (amt_read == 0) {
+ if (count == 0) {
+ // We have detected EOF from `in_fd`.
+ break :rw;
+ } else {
+ return total_written;
+ }
+ }
+ const amt_written = try write(out_fd, buf[0..amt_read]);
+ total_written += amt_written;
+ if (amt_written < count or count == 0) return total_written;
+ }
+
+ if (trailers.len != 0) {
+ total_written += try writev(out_fd, trailers);
+ }
+
+ return total_written;
}
pub const PollError = error{
diff --git a/lib/std/os/bits/linux/arm64.zig b/lib/std/os/bits/linux/arm64.zig
index 8dcebc5ddf..386e889873 100644
--- a/lib/std/os/bits/linux/arm64.zig
+++ b/lib/std/os/bits/linux/arm64.zig
@@ -82,6 +82,7 @@ pub const SYS_pread64 = 67;
pub const SYS_pwrite64 = 68;
pub const SYS_preadv = 69;
pub const SYS_pwritev = 70;
+pub const SYS_sendfile = 71;
pub const SYS_pselect6 = 72;
pub const SYS_ppoll = 73;
pub const SYS_signalfd4 = 74;
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig
index 95b1018a6b..c2fc06bc9b 100644
--- a/lib/std/os/linux.zig
+++ b/lib/std/os/linux.zig
@@ -316,8 +316,19 @@ pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) us
return syscall3(SYS_symlinkat, @ptrToInt(existing), @bitCast(usize, @as(isize, newfd)), @ptrToInt(newpath));
}
-pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: usize) usize {
- return syscall4(SYS_pread, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), count, offset);
+pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize {
+ if (@hasDecl(@This(), "SYS_pread64")) {
+ return syscall5(
+ SYS_pread64,
+ @bitCast(usize, @as(isize, fd)),
+ @ptrToInt(buf),
+ count,
+ @truncate(usize, offset),
+ @truncate(usize, offset >> 32),
+ );
+ } else {
+ return syscall4(SYS_pread, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), count, offset);
+ }
}
pub fn access(path: [*:0]const u8, mode: u32) usize {
@@ -846,11 +857,23 @@ pub fn sendto(fd: i32, buf: [*]const u8, len: usize, flags: u32, addr: ?*const s
return syscall6(SYS_sendto, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), len, flags, @ptrToInt(addr), @intCast(usize, alen));
}
-pub fn sendfile(outfd: i32, infd: i32, offset: ?*u64, count: usize) usize {
+pub fn sendfile(outfd: i32, infd: i32, offset: ?*i64, count: usize) usize {
if (@hasDecl(@This(), "SYS_sendfile64")) {
- return syscall4(SYS_sendfile64, @bitCast(usize, @as(isize, outfd)), @bitCast(usize, @as(isize, infd)), @ptrToInt(offset), count);
+ return syscall4(
+ SYS_sendfile64,
+ @bitCast(usize, @as(isize, outfd)),
+ @bitCast(usize, @as(isize, infd)),
+ @ptrToInt(offset),
+ count,
+ );
} else {
- return syscall4(SYS_sendfile, @bitCast(usize, @as(isize, outfd)), @bitCast(usize, @as(isize, infd)), @ptrToInt(offset), count);
+ return syscall4(
+ SYS_sendfile,
+ @bitCast(usize, @as(isize, outfd)),
+ @bitCast(usize, @as(isize, infd)),
+ @ptrToInt(offset),
+ count,
+ );
}
}
diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig
index 197edd82c1..717380ea30 100644
--- a/lib/std/os/test.zig
+++ b/lib/std/os/test.zig
@@ -44,6 +44,114 @@ fn testThreadIdFn(thread_id: *Thread.Id) void {
thread_id.* = Thread.getCurrentId();
}
+test "sendfile" {
+ try fs.makePath(a, "os_test_tmp");
+ defer fs.deleteTree("os_test_tmp") catch {};
+
+ var dir = try fs.cwd().openDirList("os_test_tmp");
+ defer dir.close();
+
+ const line1 = "line1\n";
+ const line2 = "second line\n";
+ var vecs = [_]os.iovec_const{
+ .{
+ .iov_base = line1,
+ .iov_len = line1.len,
+ },
+ .{
+ .iov_base = line2,
+ .iov_len = line2.len,
+ },
+ };
+
+ var src_file = try dir.createFileC("sendfile1.txt", .{ .read = true });
+ defer src_file.close();
+
+ try src_file.writevAll(&vecs);
+
+ var dest_file = try dir.createFileC("sendfile2.txt", .{ .read = true });
+ defer dest_file.close();
+
+ const header1 = "header1\n";
+ const header2 = "second header\n";
+ var headers = [_]os.iovec_const{
+ .{
+ .iov_base = header1,
+ .iov_len = header1.len,
+ },
+ .{
+ .iov_base = header2,
+ .iov_len = header2.len,
+ },
+ };
+
+ const trailer1 = "trailer1\n";
+ const trailer2 = "second trailer\n";
+ var trailers = [_]os.iovec_const{
+ .{
+ .iov_base = trailer1,
+ .iov_len = trailer1.len,
+ },
+ .{
+ .iov_base = trailer2,
+ .iov_len = trailer2.len,
+ },
+ };
+
+ var written_buf: [header1.len + header2.len + 10 + trailer1.len + trailer2.len]u8 = undefined;
+ try sendfileAll(dest_file.handle, src_file.handle, 1, 10, &headers, &trailers, 0);
+
+ try dest_file.preadAll(&written_buf, 0);
+ expect(mem.eql(u8, &written_buf, "header1\nsecond header\nine1\nsecontrailer1\nsecond trailer\n"));
+}
+
+fn sendfileAll(
+ out_fd: os.fd_t,
+ in_fd: os.fd_t,
+ offset: u64,
+ count: usize,
+ headers: []os.iovec_const,
+ trailers: []os.iovec_const,
+ flags: u32,
+) os.SendFileError!void {
+ var amt: usize = undefined;
+ hdrs: {
+ var i: usize = 0;
+ while (i < headers.len) {
+ amt = try os.sendfile(out_fd, in_fd, offset, count, headers[i..], trailers, flags);
+ while (amt >= headers[i].iov_len) {
+ amt -= headers[i].iov_len;
+ i += 1;
+ if (i >= headers.len) break :hdrs;
+ }
+ headers[i].iov_base += amt;
+ headers[i].iov_len -= amt;
+ }
+ }
+ var off = amt;
+ while (off < count) {
+ amt = try os.sendfile(out_fd, in_fd, offset + off, count - off, &[0]os.iovec_const{}, trailers, flags);
+ off += amt;
+ }
+ amt = off - count;
+ var i: usize = 0;
+ while (i < trailers.len) {
+ while (amt >= headers[i].iov_len) {
+ amt -= trailers[i].iov_len;
+ i += 1;
+ if (i >= trailers.len) return;
+ }
+ trailers[i].iov_base += amt;
+ trailers[i].iov_len -= amt;
+ if (std.Target.current.os.tag == .windows) {
+ amt = try os.writev(out_fd, trailers[i..]);
+ } else {
+ // Here we must use send because it's the only way to give the flags.
+ amt = try os.send(out_fd, trailers[i].iov_base[0..trailers[i].iov_len], flags);
+ }
+ }
+}
+
test "std.Thread.getCurrentId" {
if (builtin.single_threaded) return error.SkipZigTest;
@@ -103,7 +211,7 @@ test "AtomicFile" {
{
var af = try fs.AtomicFile.init(test_out_file, File.default_mode);
defer af.deinit();
- try af.file.write(test_content);
+ try af.file.writeAll(test_content);
try af.finish();
}
const content = try io.readFileAlloc(testing.allocator, test_out_file);
@@ -226,7 +334,7 @@ test "pipe" {
return error.SkipZigTest;
var fds = try os.pipe();
- try os.write(fds[1], "hello");
+ expect((try os.write(fds[1], "hello")) == 5);
var buf: [16]u8 = undefined;
expect((try os.read(fds[0], buf[0..])) == 5);
testing.expectEqualSlices(u8, buf[0..5], "hello");
@@ -248,7 +356,7 @@ test "memfd_create" {
else => |e| return e,
};
defer std.os.close(fd);
- try std.os.write(fd, "test");
+ expect((try std.os.write(fd, "test")) == 4);
try std.os.lseek_SET(fd, 0);
var buf: [10]u8 = undefined;
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig
index cc0d446b12..92124511bd 100644
--- a/lib/std/os/windows.zig
+++ b/lib/std/os/windows.zig
@@ -424,7 +424,7 @@ pub const WriteFileError = error{
Unexpected,
};
-pub fn WriteFile(handle: HANDLE, bytes: []const u8, offset: ?u64) WriteFileError!void {
+pub fn WriteFile(handle: HANDLE, bytes: []const u8, offset: ?u64) WriteFileError!usize {
if (std.event.Loop.instance) |loop| {
// TODO support async WriteFile with no offset
const off = offset.?;
@@ -445,8 +445,8 @@ pub fn WriteFile(handle: HANDLE, bytes: []const u8, offset: ?u64) WriteFileError
_ = CreateIoCompletionPort(fd, loop.os_data.io_port, undefined, undefined);
loop.beginOneEvent();
suspend {
- // TODO replace this @intCast with a loop that writes all the bytes
- _ = kernel32.WriteFile(fd, bytes.ptr, @intCast(windows.DWORD, bytes.len), null, &resume_node.base.overlapped);
+ const adjusted_len = math.cast(windows.DWORD, bytes.len) catch maxInt(windows.DWORD);
+ _ = kernel32.WriteFile(fd, bytes.ptr, adjusted_len, null, &resume_node.base.overlapped);
}
var bytes_transferred: windows.DWORD = undefined;
if (kernel32.GetOverlappedResult(fd, &resume_node.base.overlapped, &bytes_transferred, FALSE) == 0) {
@@ -460,6 +460,7 @@ pub fn WriteFile(handle: HANDLE, bytes: []const u8, offset: ?u64) WriteFileError
else => |err| return windows.unexpectedError(err),
}
}
+ return bytes_transferred;
} else {
var bytes_written: DWORD = undefined;
var overlapped_data: OVERLAPPED = undefined;
@@ -473,18 +474,19 @@ pub fn WriteFile(handle: HANDLE, bytes: []const u8, offset: ?u64) WriteFileError
};
break :blk &overlapped_data;
} else null;
- // TODO replace this @intCast with a loop that writes all the bytes
- if (kernel32.WriteFile(handle, bytes.ptr, @intCast(u32, bytes.len), &bytes_written, overlapped) == 0) {
+ const adjusted_len = math.cast(u32, bytes.len) catch maxInt(u32);
+ if (kernel32.WriteFile(handle, bytes.ptr, adjusted_len, &bytes_written, overlapped) == 0) {
switch (kernel32.GetLastError()) {
.INVALID_USER_BUFFER => return error.SystemResources,
.NOT_ENOUGH_MEMORY => return error.SystemResources,
.OPERATION_ABORTED => return error.OperationAborted,
.NOT_ENOUGH_QUOTA => return error.SystemResources,
- .IO_PENDING => unreachable, // this function is for blocking files only
+ .IO_PENDING => unreachable,
.BROKEN_PIPE => return error.BrokenPipe,
else => |err| return unexpectedError(err),
}
}
+ return bytes_written;
}
}
diff --git a/lib/std/zig/render.zig b/lib/std/zig/render.zig
index ee6ee37d5d..625aef3131 100644
--- a/lib/std/zig/render.zig
+++ b/lib/std/zig/render.zig
@@ -29,7 +29,7 @@ pub fn render(allocator: *mem.Allocator, stream: var, tree: *ast.Tree) (@TypeOf(
source_index: usize,
source: []const u8,
- fn write(iface_stream: *Stream, bytes: []const u8) StreamError!void {
+ fn write(iface_stream: *Stream, bytes: []const u8) StreamError!usize {
const self = @fieldParentPtr(MyStream, "stream", iface_stream);
if (!self.anything_changed_ptr.*) {
@@ -45,7 +45,7 @@ pub fn render(allocator: *mem.Allocator, stream: var, tree: *ast.Tree) (@TypeOf(
}
}
- try self.child_stream.write(bytes);
+ return self.child_stream.writeOnce(bytes);
}
};
var my_stream = MyStream{
@@ -2443,14 +2443,15 @@ const FindByteOutStream = struct {
};
}
- fn writeFn(out_stream: *Stream, bytes: []const u8) Error!void {
+ fn writeFn(out_stream: *Stream, bytes: []const u8) Error!usize {
const self = @fieldParentPtr(Self, "stream", out_stream);
- if (self.byte_found) return;
+ if (self.byte_found) return bytes.len;
self.byte_found = blk: {
for (bytes) |b|
if (b == self.byte) break :blk true;
break :blk false;
};
+ return bytes.len;
}
};
diff --git a/lib/std/zig/system.zig b/lib/std/zig/system.zig
index 38a90f4c60..7f0609c112 100644
--- a/lib/std/zig/system.zig
+++ b/lib/std/zig/system.zig
@@ -796,6 +796,7 @@ pub const NativeTargetInfo = struct {
error.SystemResources => return error.SystemResources,
error.IsDir => return error.UnableToReadElfFile,
error.BrokenPipe => return error.UnableToReadElfFile,
+ error.Unseekable => return error.UnableToReadElfFile,
error.ConnectionResetByPeer => return error.UnableToReadElfFile,
error.Unexpected => return error.Unexpected,
error.InputOutput => return error.FileSystem,
diff --git a/test/standalone/cat/main.zig b/test/standalone/cat/main.zig
index 34439f9c24..8539a0de0f 100644
--- a/test/standalone/cat/main.zig
+++ b/test/standalone/cat/main.zig
@@ -42,6 +42,7 @@ fn usage(exe: []const u8) !void {
return error.Invalid;
}
+// TODO use copy_file_range
fn cat_file(stdout: fs.File, file: fs.File) !void {
var buf: [1024 * 4]u8 = undefined;
@@ -55,7 +56,7 @@ fn cat_file(stdout: fs.File, file: fs.File) !void {
break;
}
- stdout.write(buf[0..bytes_read]) catch |err| {
+ stdout.writeAll(buf[0..bytes_read]) catch |err| {
warn("Unable to write to stdout: {}\n", .{@errorName(err)});
return err;
};
diff --git a/test/standalone/hello_world/hello.zig b/test/standalone/hello_world/hello.zig
index e3fc5c0e3e..eabb226eb2 100644
--- a/test/standalone/hello_world/hello.zig
+++ b/test/standalone/hello_world/hello.zig
@@ -1,8 +1,5 @@
const std = @import("std");
pub fn main() !void {
- const stdout_file = std.io.getStdOut();
- // If this program encounters pipe failure when printing to stdout, exit
- // with an error.
- try stdout_file.write("Hello, world!\n");
+ try std.io.getStdOut().writeAll("Hello, World!\n");
}
From 859fc856d38860bbd8738d3a09527d8fcb7dcc7b Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 02:57:11 -0500
Subject: [PATCH 03/32] fix macosx and freebsd build failures
---
lib/std/c/darwin.zig | 4 ++--
lib/std/c/freebsd.zig | 4 ++--
lib/std/os/bits/darwin.zig | 3 +++
3 files changed, 7 insertions(+), 4 deletions(-)
diff --git a/lib/std/c/darwin.zig b/lib/std/c/darwin.zig
index d5ecf6bd81..881e52c72c 100644
--- a/lib/std/c/darwin.zig
+++ b/lib/std/c/darwin.zig
@@ -56,9 +56,9 @@ pub extern "c" fn host_get_clock_service(host: host_t, clock_id: clock_id_t, clo
pub extern "c" fn mach_port_deallocate(task: ipc_space_t, name: mach_port_name_t) kern_return_t;
pub const sf_hdtr = extern struct {
- headers: [*]iovec_const,
+ headers: [*]const iovec_const,
hdr_cnt: c_int,
- trailers: [*]iovec_const,
+ trailers: [*]const iovec_const,
trl_cnt: c_int,
};
diff --git a/lib/std/c/freebsd.zig b/lib/std/c/freebsd.zig
index dacfa4384d..2c4820bbe9 100644
--- a/lib/std/c/freebsd.zig
+++ b/lib/std/c/freebsd.zig
@@ -9,9 +9,9 @@ pub extern "c" fn sigaltstack(ss: ?*stack_t, old_ss: ?*stack_t) c_int;
pub extern "c" fn getrandom(buf_ptr: [*]u8, buf_len: usize, flags: c_uint) isize;
pub const sf_hdtr = extern struct {
- headers: [*]iovec_const,
+ headers: [*]const iovec_const,
hdr_cnt: c_int,
- trailers: [*]iovec_const,
+ trailers: [*]const iovec_const,
trl_cnt: c_int,
};
pub extern "c" fn sendfile(
diff --git a/lib/std/os/bits/darwin.zig b/lib/std/os/bits/darwin.zig
index 22897974c2..fb933c6698 100644
--- a/lib/std/os/bits/darwin.zig
+++ b/lib/std/os/bits/darwin.zig
@@ -926,6 +926,9 @@ pub const ESOCKTNOSUPPORT = 44;
/// Operation not supported
pub const ENOTSUP = 45;
+/// Operation not supported. Alias of `ENOTSUP`.
+pub const EOPNOTSUPP = ENOTSUP;
+
/// Protocol family not supported
pub const EPFNOSUPPORT = 46;
From a66c72749a113cc6b2423d96d1f1f7c692d48ff5 Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 03:10:56 -0500
Subject: [PATCH 04/32] more macos fixes
---
lib/std/os.zig | 7 ++++---
1 file changed, 4 insertions(+), 3 deletions(-)
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 8913a1599f..558dea4524 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -3714,11 +3714,12 @@ pub fn sendfile(
hdtr = &hdtr_data;
}
- const adjusted_count = math.min(count, max_count);
+ const adjusted_count = math.min(count, @as(u63, max_count));
while (true) {
var sbytes: off_t = adjusted_count;
- const err = errno(system.sendfile(out_fd, in_fd, in_offset, &sbytes, hdtr, flags));
+ const signed_offset = @bitCast(i64, in_offset);
+ const err = errno(system.sendfile(out_fd, in_fd, signed_offset, &sbytes, hdtr, flags));
const amt = @bitCast(usize, sbytes);
switch (err) {
0 => return amt,
@@ -3745,7 +3746,7 @@ pub fn sendfile(
EPIPE => return error.BrokenPipe,
else => {
- _ = unexpectedErrno(err);
+ const discard = unexpectedErrno(err);
if (amt != 0) {
return amt;
} else {
From 9d6cc75ce3be9ab291614fc0d4361877e9200126 Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 09:49:46 -0500
Subject: [PATCH 05/32] disable sendfile test on mips
---
lib/std/os/test.zig | 4 ++++
1 file changed, 4 insertions(+)
diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig
index 717380ea30..0790f6bd01 100644
--- a/lib/std/os/test.zig
+++ b/lib/std/os/test.zig
@@ -45,6 +45,10 @@ fn testThreadIdFn(thread_id: *Thread.Id) void {
}
test "sendfile" {
+ if (std.Target.current.cpu.arch == .mipsel) {
+ // https://github.com/ziglang/zig/issues/4615
+ return error.SkipZigTest;
+ }
try fs.makePath(a, "os_test_tmp");
defer fs.deleteTree("os_test_tmp") catch {};
From a6fb6dcfc96ad63f9a21110165728da0b8311660 Mon Sep 17 00:00:00 2001
From: LemonBoy
Date: Tue, 3 Mar 2020 17:19:40 +0100
Subject: [PATCH 06/32] linux: Correct pread64 syscall for ARM/MIPS
Closes #4615
---
lib/std/os/linux.zig | 37 ++++++++++++++++++++++++++++---------
lib/std/os/test.zig | 4 ----
2 files changed, 28 insertions(+), 13 deletions(-)
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig
index c2fc06bc9b..238d605360 100644
--- a/lib/std/os/linux.zig
+++ b/lib/std/os/linux.zig
@@ -39,6 +39,13 @@ pub fn getauxval(index: usize) usize {
return 0;
}
+// Some architectures require 64bit parameters for some syscalls to be passed in
+// even-aligned register pair
+const require_aligned_register_pair = //
+ comptime builtin.arch.isMIPS() or
+ comptime builtin.arch.isARM() or
+ comptime builtin.arch.isThumb();
+
/// Get the errno from a syscall return value, or 0 for no error.
pub fn getErrno(r: usize) u12 {
const signed_r = @bitCast(isize, r);
@@ -318,14 +325,26 @@ pub fn symlinkat(existing: [*:0]const u8, newfd: i32, newpath: [*:0]const u8) us
pub fn pread(fd: i32, buf: [*]u8, count: usize, offset: u64) usize {
if (@hasDecl(@This(), "SYS_pread64")) {
- return syscall5(
- SYS_pread64,
- @bitCast(usize, @as(isize, fd)),
- @ptrToInt(buf),
- count,
- @truncate(usize, offset),
- @truncate(usize, offset >> 32),
- );
+ if (require_aligned_register_pair) {
+ return syscall6(
+ SYS_pread64,
+ @bitCast(usize, @as(isize, fd)),
+ @ptrToInt(buf),
+ count,
+ 0,
+ @truncate(usize, offset),
+ @truncate(usize, offset >> 32),
+ );
+ } else {
+ return syscall5(
+ SYS_pread64,
+ @bitCast(usize, @as(isize, fd)),
+ @ptrToInt(buf),
+ count,
+ @truncate(usize, offset),
+ @truncate(usize, offset >> 32),
+ );
+ }
} else {
return syscall4(SYS_pread, @bitCast(usize, @as(isize, fd)), @ptrToInt(buf), count, offset);
}
@@ -344,7 +363,7 @@ pub fn faccessat(dirfd: i32, path: [*:0]const u8, mode: u32, flags: u32) usize {
}
pub fn pipe(fd: *[2]i32) usize {
- if (builtin.arch == .mipsel) {
+ if (comptime builtin.arch.isMIPS()) {
return syscall_pipe(fd);
} else if (@hasDecl(@This(), "SYS_pipe")) {
return syscall1(SYS_pipe, @ptrToInt(fd));
diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig
index 0790f6bd01..717380ea30 100644
--- a/lib/std/os/test.zig
+++ b/lib/std/os/test.zig
@@ -45,10 +45,6 @@ fn testThreadIdFn(thread_id: *Thread.Id) void {
}
test "sendfile" {
- if (std.Target.current.cpu.arch == .mipsel) {
- // https://github.com/ziglang/zig/issues/4615
- return error.SkipZigTest;
- }
try fs.makePath(a, "os_test_tmp");
defer fs.deleteTree("os_test_tmp") catch {};
From 582db68a157520a0cf7777807f466d1f6a2e31e7 Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 12:01:17 -0500
Subject: [PATCH 07/32] remove superfluous comptime keyword
---
lib/std/os/linux.zig | 8 ++++----
1 file changed, 4 insertions(+), 4 deletions(-)
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig
index 238d605360..de2ff5871b 100644
--- a/lib/std/os/linux.zig
+++ b/lib/std/os/linux.zig
@@ -6,7 +6,7 @@
// provide `rename` when only the `renameat` syscall exists.
// * Does not support POSIX thread cancellation.
const std = @import("../std.zig");
-const builtin = @import("builtin");
+const builtin = std.builtin;
const assert = std.debug.assert;
const maxInt = std.math.maxInt;
const elf = std.elf;
@@ -42,9 +42,9 @@ pub fn getauxval(index: usize) usize {
// Some architectures require 64bit parameters for some syscalls to be passed in
// even-aligned register pair
const require_aligned_register_pair = //
- comptime builtin.arch.isMIPS() or
- comptime builtin.arch.isARM() or
- comptime builtin.arch.isThumb();
+ std.Target.current.cpu.arch.isMIPS() or
+ std.Target.current.cpu.arch.isARM() or
+ std.Target.current.cpu.arch.isThumb();
/// Get the errno from a syscall return value, or 0 for no error.
pub fn getErrno(r: usize) u12 {
From 88e27f01c8dbf4bda5726c93d12cc4a1d174989d Mon Sep 17 00:00:00 2001
From: daurnimator
Date: Wed, 15 Jan 2020 18:07:08 +1000
Subject: [PATCH 08/32] std: add mkdirat
---
lib/std/c.zig | 1 +
lib/std/os.zig | 35 +++++++++++++++++++++++++++++++++++
2 files changed, 36 insertions(+)
diff --git a/lib/std/c.zig b/lib/std/c.zig
index 4eb271c87c..79a6c07c02 100644
--- a/lib/std/c.zig
+++ b/lib/std/c.zig
@@ -101,6 +101,7 @@ pub extern "c" fn faccessat(dirfd: fd_t, path: [*:0]const u8, mode: c_uint, flag
pub extern "c" fn pipe(fds: *[2]fd_t) c_int;
pub extern "c" fn pipe2(fds: *[2]fd_t, flags: u32) c_int;
pub extern "c" fn mkdir(path: [*:0]const u8, mode: c_uint) c_int;
+pub extern "c" fn mkdirat(dirfd: fd_t, path: [*:0]const u8, mode: u32) c_int;
pub extern "c" fn symlink(existing: [*:0]const u8, new: [*:0]const u8) c_int;
pub extern "c" fn rename(old: [*:0]const u8, new: [*:0]const u8) c_int;
pub extern "c" fn chdir(path: [*:0]const u8) c_int;
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 969e6407a6..f97676a821 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -1542,6 +1542,41 @@ pub const MakeDirError = error{
BadPathName,
} || UnexpectedError;
+pub fn mkdirat(dir_fd: fd_t, sub_dir_path: []const u8, mode: u32) MakeDirError!void {
+ if (builtin.os == .windows) {
+ const sub_dir_path_w = try windows.sliceToPrefixedFileW(sub_dir_path);
+ @compileError("TODO implement mkdirat for Windows");
+ } else {
+ const sub_dir_path_c = try toPosixPath(sub_dir_path);
+ return mkdiratC(dir_fd, &sub_dir_path_c, mode);
+ }
+}
+
+pub fn mkdiratC(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: u32) MakeDirError!void {
+ if (builtin.os == .windows) {
+ const sub_dir_path_w = try windows.cStrToPrefixedFileW(sub_dir_path);
+ @compileError("TODO implement mkdiratC for Windows");
+ }
+ switch (errno(system.mkdirat(dir_fd, sub_dir_path, mode))) {
+ 0 => return,
+ EACCES => return error.AccessDenied,
+ EBADF => unreachable,
+ EPERM => return error.AccessDenied,
+ EDQUOT => return error.DiskQuota,
+ EEXIST => return error.PathAlreadyExists,
+ EFAULT => unreachable,
+ ELOOP => return error.SymLinkLoop,
+ EMLINK => return error.LinkQuotaExceeded,
+ ENAMETOOLONG => return error.NameTooLong,
+ ENOENT => return error.FileNotFound,
+ ENOMEM => return error.SystemResources,
+ ENOSPC => return error.NoSpaceLeft,
+ ENOTDIR => return error.NotDir,
+ EROFS => return error.ReadOnlyFileSystem,
+ else => |err| return unexpectedErrno(err),
+ }
+}
+
/// Create a directory.
/// `mode` is ignored on Windows.
pub fn mkdir(dir_path: []const u8, mode: u32) MakeDirError!void {
From dfb420e6d779b9b6d60a277401aadba2800e3572 Mon Sep 17 00:00:00 2001
From: daurnimator
Date: Wed, 15 Jan 2020 18:09:10 +1000
Subject: [PATCH 09/32] std: add fs.Dir.makeDir
---
lib/std/fs.zig | 8 ++++++++
1 file changed, 8 insertions(+)
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index 769d4b395c..f245ab348d 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -882,6 +882,14 @@ pub const Dir = struct {
}
}
+ pub fn makeDir(self: Dir, sub_path: []const u8) !void {
+ try os.mkdirat(self.fd, sub_path, default_new_dir_mode);
+ }
+
+ pub fn makeDirC(self: Dir, sub_path: [*:0]const u8) !void {
+ try os.mkdiratC(self.fd, sub_path, default_new_dir_mode);
+ }
+
/// Deprecated; call `openDirList` directly.
pub fn openDir(self: Dir, sub_path: []const u8) OpenError!Dir {
return self.openDirList(sub_path);
From 627618a38d291d9cc76c8e30e33cad60dc26cf11 Mon Sep 17 00:00:00 2001
From: daurnimator
Date: Wed, 15 Jan 2020 18:11:54 +1000
Subject: [PATCH 10/32] std: add Dir.changeDir as wrapper around fchdir
---
lib/std/c.zig | 1 +
lib/std/fs.zig | 4 ++++
lib/std/os.zig | 14 ++++++++++++++
lib/std/os/linux.zig | 4 ++++
4 files changed, 23 insertions(+)
diff --git a/lib/std/c.zig b/lib/std/c.zig
index 79a6c07c02..84a9e92dee 100644
--- a/lib/std/c.zig
+++ b/lib/std/c.zig
@@ -105,6 +105,7 @@ pub extern "c" fn mkdirat(dirfd: fd_t, path: [*:0]const u8, mode: u32) c_int;
pub extern "c" fn symlink(existing: [*:0]const u8, new: [*:0]const u8) c_int;
pub extern "c" fn rename(old: [*:0]const u8, new: [*:0]const u8) c_int;
pub extern "c" fn chdir(path: [*:0]const u8) c_int;
+pub extern "c" fn fchdir(fd: fd_t) c_int;
pub extern "c" fn execve(path: [*:0]const u8, argv: [*:null]const ?[*:0]const u8, envp: [*:null]const ?[*:0]const u8) c_int;
pub extern "c" fn dup(fd: fd_t) c_int;
pub extern "c" fn dup2(old_fd: fd_t, new_fd: fd_t) c_int;
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index f245ab348d..f9c7071abf 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -890,6 +890,10 @@ pub const Dir = struct {
try os.mkdiratC(self.fd, sub_path, default_new_dir_mode);
}
+ pub fn changeTo(self: Dir) !void {
+ try os.fchdir(self.fd);
+ }
+
/// Deprecated; call `openDirList` directly.
pub fn openDir(self: Dir, sub_path: []const u8) OpenError!Dir {
return self.openDirList(sub_path);
diff --git a/lib/std/os.zig b/lib/std/os.zig
index f97676a821..7563a34f21 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -1706,6 +1706,20 @@ pub fn chdirC(dir_path: [*:0]const u8) ChangeCurDirError!void {
}
}
+pub fn fchdir(dirfd: fd_t) ChangeCurDirError!void {
+ while (true) {
+ switch (errno(system.fchdir(dirfd))) {
+ 0 => return,
+ EACCES => return error.AccessDenied,
+ EBADF => unreachable,
+ ENOTDIR => return error.NotDir,
+ EINTR => continue,
+ EIO => return error.FileSystem,
+ else => |err| return unexpectedErrno(err),
+ }
+ }
+}
+
pub const ReadLinkError = error{
AccessDenied,
FileSystem,
diff --git a/lib/std/os/linux.zig b/lib/std/os/linux.zig
index de2ff5871b..719e541846 100644
--- a/lib/std/os/linux.zig
+++ b/lib/std/os/linux.zig
@@ -76,6 +76,10 @@ pub fn chdir(path: [*:0]const u8) usize {
return syscall1(SYS_chdir, @ptrToInt(path));
}
+pub fn fchdir(fd: fd_t) usize {
+ return syscall1(SYS_fchdir, @bitCast(usize, @as(isize, fd)));
+}
+
pub fn chroot(path: [*:0]const u8) usize {
return syscall1(SYS_chroot, @ptrToInt(path));
}
From bfc569bc9877a4f305080bc6cde0e42fed7433e0 Mon Sep 17 00:00:00 2001
From: daurnimator
Date: Wed, 15 Jan 2020 18:15:24 +1000
Subject: [PATCH 11/32] std: add os.fstatat
---
lib/std/c.zig | 1 +
lib/std/os.zig | 23 +++++++++++++++++++++++
2 files changed, 24 insertions(+)
diff --git a/lib/std/c.zig b/lib/std/c.zig
index 84a9e92dee..7c01908540 100644
--- a/lib/std/c.zig
+++ b/lib/std/c.zig
@@ -75,6 +75,7 @@ pub extern "c" fn isatty(fd: fd_t) c_int;
pub extern "c" fn close(fd: fd_t) c_int;
pub extern "c" fn fstat(fd: fd_t, buf: *Stat) c_int;
pub extern "c" fn @"fstat$INODE64"(fd: fd_t, buf: *Stat) c_int;
+pub extern "c" fn fstatat(dirfd: fd_t, path: [*:0]const u8, stat_buf: *Stat, flags: u32) c_int;
pub extern "c" fn lseek(fd: fd_t, offset: off_t, whence: c_int) off_t;
pub extern "c" fn open(path: [*:0]const u8, oflag: c_uint, ...) c_int;
pub extern "c" fn openat(fd: c_int, path: [*:0]const u8, oflag: c_uint, ...) c_int;
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 7563a34f21..a74a2343a6 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -2371,6 +2371,29 @@ pub fn fstat(fd: fd_t) FStatError!Stat {
}
}
+const FStatAtError = FStatError || error{NameTooLong};
+
+pub fn fstatat(dirfd: fd_t, pathname: []const u8, flags: u32) FStatAtError![]Stat {
+ const pathname_c = try toPosixPath(pathname);
+ return fstatatC(dirfd, &pathname_c, flags);
+}
+
+pub fn fstatatC(dirfd: fd_t, pathname: [*:0]const u8, flags: u32) FStatAtError!Stat {
+ var stat: Stat = undefined;
+ switch (errno(system.fstatat(dirfd, pathname, &stat, flags))) {
+ 0 => return stat,
+ EINVAL => unreachable,
+ EBADF => unreachable, // Always a race condition.
+ ENOMEM => return error.SystemResources,
+ EACCES => return error.AccessDenied,
+ EFAULT => unreachable,
+ ENAMETOOLONG => return error.NameTooLong,
+ ENOENT => return error.FileNotFound,
+ ENOTDIR => return error.FileNotFound,
+ else => |err| return unexpectedErrno(err),
+ }
+}
+
pub const KQueueError = error{
/// The per-process limit on the number of open file descriptors has been reached.
ProcessFdQuotaExceeded,
From d8f966a04b09ede06840b5fdd42b7d8e65b0cb25 Mon Sep 17 00:00:00 2001
From: daurnimator
Date: Wed, 15 Jan 2020 18:17:14 +1000
Subject: [PATCH 12/32] std: fix fs.makePath
The previous behaviour of using path.resolve has unexpected behaviour around symlinks.
This more simple implementation is more correct and doesn't require an allocator
---
lib/std/fs.zig | 19 ++++++++-----------
1 file changed, 8 insertions(+), 11 deletions(-)
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index f9c7071abf..11ff0b5022 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -301,35 +301,32 @@ pub fn makeDirW(dir_path: [*:0]const u16) !void {
/// already exists and is a directory.
/// This function is not atomic, and if it returns an error, the file system may
/// have been modified regardless.
-/// TODO determine if we can remove the allocator requirement from this function
-pub fn makePath(allocator: *Allocator, full_path: []const u8) !void {
- const resolved_path = try path.resolve(allocator, &[_][]const u8{full_path});
- defer allocator.free(resolved_path);
-
- var end_index: usize = resolved_path.len;
+pub fn makePath(full_path: []const u8) !void {
+ var end_index: usize = full_path.len;
while (true) {
- makeDir(resolved_path[0..end_index]) catch |err| switch (err) {
+ cwd().makeDir(full_path[0..end_index]) catch |err| switch (err) {
error.PathAlreadyExists => {
// TODO stat the file and return an error if it's not a directory
// this is important because otherwise a dangling symlink
// could cause an infinite loop
- if (end_index == resolved_path.len) return;
+ if (end_index == full_path.len) return;
},
error.FileNotFound => {
+ if (end_index == 0) return err;
// march end_index backward until next path component
while (true) {
end_index -= 1;
- if (path.isSep(resolved_path[end_index])) break;
+ if (path.isSep(full_path[end_index])) break;
}
continue;
},
else => return err,
};
- if (end_index == resolved_path.len) return;
+ if (end_index == full_path.len) return;
// march end_index forward until next path component
while (true) {
end_index += 1;
- if (end_index == resolved_path.len or path.isSep(resolved_path[end_index])) break;
+ if (end_index == full_path.len or path.isSep(full_path[end_index])) break;
}
}
}
From a19a30bb1771f0fc935cd8c17070158d8c379346 Mon Sep 17 00:00:00 2001
From: daurnimator
Date: Wed, 15 Jan 2020 18:17:41 +1000
Subject: [PATCH 13/32] std: move null byte check into toPosixPath
Note that windows NT paths *can* contain nulls
---
lib/std/fs.zig | 6 ------
lib/std/os.zig | 2 +-
2 files changed, 1 insertion(+), 7 deletions(-)
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index 11ff0b5022..83d8f9c26a 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -706,7 +706,6 @@ pub const Dir = struct {
/// Call `File.close` to release the resource.
/// Asserts that the path parameter has no null bytes.
pub fn openFile(self: Dir, sub_path: []const u8, flags: File.OpenFlags) File.OpenError!File {
- if (std.debug.runtime_safety) for (sub_path) |byte| assert(byte != 0);
if (builtin.os.tag == .windows) {
const path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.openFileW(&path_w, flags);
@@ -756,7 +755,6 @@ pub const Dir = struct {
/// Call `File.close` on the result when done.
/// Asserts that the path parameter has no null bytes.
pub fn createFile(self: Dir, sub_path: []const u8, flags: File.CreateFlags) File.OpenError!File {
- if (std.debug.runtime_safety) for (sub_path) |byte| assert(byte != 0);
if (builtin.os.tag == .windows) {
const path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.createFileW(&path_w, flags);
@@ -909,7 +907,6 @@ pub const Dir = struct {
///
/// Asserts that the path parameter has no null bytes.
pub fn openDirTraverse(self: Dir, sub_path: []const u8) OpenError!Dir {
- if (std.debug.runtime_safety) for (sub_path) |byte| assert(byte != 0);
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.openDirTraverseW(&sub_path_w);
@@ -927,7 +924,6 @@ pub const Dir = struct {
///
/// Asserts that the path parameter has no null bytes.
pub fn openDirList(self: Dir, sub_path: []const u8) OpenError!Dir {
- if (std.debug.runtime_safety) for (sub_path) |byte| assert(byte != 0);
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.openDirListW(&sub_path_w);
@@ -1091,7 +1087,6 @@ pub const Dir = struct {
/// To delete a directory recursively, see `deleteTree`.
/// Asserts that the path parameter has no null bytes.
pub fn deleteDir(self: Dir, sub_path: []const u8) DeleteDirError!void {
- if (std.debug.runtime_safety) for (sub_path) |byte| assert(byte != 0);
if (builtin.os.tag == .windows) {
const sub_path_w = try os.windows.sliceToPrefixedFileW(sub_path);
return self.deleteDirW(&sub_path_w);
@@ -1121,7 +1116,6 @@ pub const Dir = struct {
/// The return value is a slice of `buffer`, from index `0`.
/// Asserts that the path parameter has no null bytes.
pub fn readLink(self: Dir, sub_path: []const u8, buffer: *[MAX_PATH_BYTES]u8) ![]u8 {
- if (std.debug.runtime_safety) for (sub_path) |byte| assert(byte != 0);
const sub_path_c = try os.toPosixPath(sub_path);
return self.readLinkC(&sub_path_c, buffer);
}
diff --git a/lib/std/os.zig b/lib/std/os.zig
index a74a2343a6..3ba810445a 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -1355,7 +1355,6 @@ pub const UnlinkatError = UnlinkError || error{
/// Delete a file name and possibly the file it refers to, based on an open directory handle.
/// Asserts that the path parameter has no null bytes.
pub fn unlinkat(dirfd: fd_t, file_path: []const u8, flags: u32) UnlinkatError!void {
- if (std.debug.runtime_safety) for (file_path) |byte| assert(byte != 0);
if (builtin.os.tag == .windows) {
const file_path_w = try windows.sliceToPrefixedFileW(file_path);
return unlinkatW(dirfd, &file_path_w, flags);
@@ -3241,6 +3240,7 @@ pub fn sched_getaffinity(pid: pid_t) SchedGetAffinityError!cpu_set_t {
/// Used to convert a slice to a null terminated slice on the stack.
/// TODO https://github.com/ziglang/zig/issues/287
pub fn toPosixPath(file_path: []const u8) ![PATH_MAX - 1:0]u8 {
+ if (std.debug.runtime_safety) assert(std.mem.indexOfScalar(u8, file_path, 0) == null);
var path_with_null: [PATH_MAX - 1:0]u8 = undefined;
// >= rather than > to make room for the null byte
if (file_path.len >= PATH_MAX) return error.NameTooLong;
From 695b0976c3757325d4b2043151d267bcc7490f7e Mon Sep 17 00:00:00 2001
From: daurnimator
Date: Thu, 16 Jan 2020 10:07:32 +1000
Subject: [PATCH 14/32] std: move makePath to be a Dir method
---
lib/std/fs.zig | 68 +++++++++++++++++++++++++-------------------------
1 file changed, 34 insertions(+), 34 deletions(-)
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index 83d8f9c26a..db3affc490 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -297,40 +297,6 @@ pub fn makeDirW(dir_path: [*:0]const u16) !void {
return os.mkdirW(dir_path, default_new_dir_mode);
}
-/// Calls makeDir recursively to make an entire path. Returns success if the path
-/// already exists and is a directory.
-/// This function is not atomic, and if it returns an error, the file system may
-/// have been modified regardless.
-pub fn makePath(full_path: []const u8) !void {
- var end_index: usize = full_path.len;
- while (true) {
- cwd().makeDir(full_path[0..end_index]) catch |err| switch (err) {
- error.PathAlreadyExists => {
- // TODO stat the file and return an error if it's not a directory
- // this is important because otherwise a dangling symlink
- // could cause an infinite loop
- if (end_index == full_path.len) return;
- },
- error.FileNotFound => {
- if (end_index == 0) return err;
- // march end_index backward until next path component
- while (true) {
- end_index -= 1;
- if (path.isSep(full_path[end_index])) break;
- }
- continue;
- },
- else => return err,
- };
- if (end_index == full_path.len) return;
- // march end_index forward until next path component
- while (true) {
- end_index += 1;
- if (end_index == full_path.len or path.isSep(full_path[end_index])) break;
- }
- }
-}
-
/// Returns `error.DirNotEmpty` if the directory is not empty.
/// To delete a directory recursively, see `deleteTree`.
pub fn deleteDir(dir_path: []const u8) !void {
@@ -885,6 +851,40 @@ pub const Dir = struct {
try os.mkdiratC(self.fd, sub_path, default_new_dir_mode);
}
+ /// Calls makeDir recursively to make an entire path. Returns success if the path
+ /// already exists and is a directory.
+ /// This function is not atomic, and if it returns an error, the file system may
+ /// have been modified regardless.
+ pub fn makePath(self: Dir, sub_path: []const u8) !void {
+ var end_index: usize = sub_path.len;
+ while (true) {
+ self.makeDir(sub_path[0..end_index]) catch |err| switch (err) {
+ error.PathAlreadyExists => {
+ // TODO stat the file and return an error if it's not a directory
+ // this is important because otherwise a dangling symlink
+ // could cause an infinite loop
+ if (end_index == sub_path.len) return;
+ },
+ error.FileNotFound => {
+ if (end_index == 0) return err;
+ // march end_index backward until next path component
+ while (true) {
+ end_index -= 1;
+ if (path.isSep(sub_path[end_index])) break;
+ }
+ continue;
+ },
+ else => return err,
+ };
+ if (end_index == sub_path.len) return;
+ // march end_index forward until next path component
+ while (true) {
+ end_index += 1;
+ if (end_index == sub_path.len or path.isSep(sub_path[end_index])) break;
+ }
+ }
+ }
+
pub fn changeTo(self: Dir) !void {
try os.fchdir(self.fd);
}
From 1ca5f06762401d2e90c8119acb4837571696dd5e Mon Sep 17 00:00:00 2001
From: daurnimator
Date: Thu, 16 Jan 2020 12:21:00 +1000
Subject: [PATCH 15/32] Update callers of fs.makePath
---
lib/std/build.zig | 4 ++--
lib/std/build/write_file.zig | 2 +-
lib/std/fs/watch.zig | 5 ++---
lib/std/os/test.zig | 4 ++--
src-self-hosted/compilation.zig | 2 +-
src-self-hosted/test.zig | 6 +++---
6 files changed, 11 insertions(+), 12 deletions(-)
diff --git a/lib/std/build.zig b/lib/std/build.zig
index ecf3930551..59e6c4e87c 100644
--- a/lib/std/build.zig
+++ b/lib/std/build.zig
@@ -763,7 +763,7 @@ pub const Builder = struct {
}
pub fn makePath(self: *Builder, path: []const u8) !void {
- fs.makePath(self.allocator, self.pathFromRoot(path)) catch |err| {
+ fs.cwd().makePath(self.pathFromRoot(path)) catch |err| {
warn("Unable to create path {}: {}\n", .{ path, @errorName(err) });
return err;
};
@@ -2311,7 +2311,7 @@ pub const InstallDirStep = struct {
const rel_path = entry.path[full_src_dir.len + 1 ..];
const dest_path = try fs.path.join(self.builder.allocator, &[_][]const u8{ dest_prefix, rel_path });
switch (entry.kind) {
- .Directory => try fs.makePath(self.builder.allocator, dest_path),
+ .Directory => try fs.cwd().makePath(dest_path),
.File => try self.builder.updateFile(entry.path, dest_path),
else => continue,
}
diff --git a/lib/std/build/write_file.zig b/lib/std/build/write_file.zig
index 13d131ac61..60c54336e0 100644
--- a/lib/std/build/write_file.zig
+++ b/lib/std/build/write_file.zig
@@ -74,7 +74,7 @@ pub const WriteFileStep = struct {
&hash_basename,
});
// TODO replace with something like fs.makePathAndOpenDir
- fs.makePath(self.builder.allocator, self.output_dir) catch |err| {
+ fs.cwd().makePath(self.output_dir) catch |err| {
warn("unable to make path {}: {}\n", .{ self.output_dir, @errorName(err) });
return err;
};
diff --git a/lib/std/fs/watch.zig b/lib/std/fs/watch.zig
index 1eb5a97ff1..3180240a72 100644
--- a/lib/std/fs/watch.zig
+++ b/lib/std/fs/watch.zig
@@ -618,11 +618,10 @@ test "write a file, watch it, write it again" {
// TODO re-enable this test
if (true) return error.SkipZigTest;
- const allocator = std.heap.page_allocator;
-
- try os.makePath(allocator, test_tmp_dir);
+ try fs.cwd().makePath(test_tmp_dir);
defer os.deleteTree(test_tmp_dir) catch {};
+ const allocator = std.heap.page_allocator;
return testFsWatch(&allocator);
}
diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig
index 717380ea30..a8544c5b83 100644
--- a/lib/std/os/test.zig
+++ b/lib/std/os/test.zig
@@ -16,7 +16,7 @@ const AtomicRmwOp = builtin.AtomicRmwOp;
const AtomicOrder = builtin.AtomicOrder;
test "makePath, put some files in it, deleteTree" {
- try fs.makePath(a, "os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c");
+ try fs.cwd().makePath("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c");
try io.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "c" ++ fs.path.sep_str ++ "file.txt", "nonsense");
try io.writeFile("os_test_tmp" ++ fs.path.sep_str ++ "b" ++ fs.path.sep_str ++ "file2.txt", "blah");
try fs.deleteTree("os_test_tmp");
@@ -28,7 +28,7 @@ test "makePath, put some files in it, deleteTree" {
}
test "access file" {
- try fs.makePath(a, "os_test_tmp");
+ try fs.cwd().makePath("os_test_tmp");
if (fs.cwd().access("os_test_tmp" ++ fs.path.sep_str ++ "file.txt", .{})) |ok| {
@panic("expected error");
} else |err| {
diff --git a/src-self-hosted/compilation.zig b/src-self-hosted/compilation.zig
index 15453fabcc..7a45bb3c37 100644
--- a/src-self-hosted/compilation.zig
+++ b/src-self-hosted/compilation.zig
@@ -1179,7 +1179,7 @@ pub const Compilation = struct {
defer self.gpa().free(zig_dir_path);
const tmp_dir = try fs.path.join(self.arena(), &[_][]const u8{ zig_dir_path, comp_dir_name[0..] });
- try fs.makePath(self.gpa(), tmp_dir);
+ try fs.cwd().makePath(tmp_dir);
return tmp_dir;
}
diff --git a/src-self-hosted/test.zig b/src-self-hosted/test.zig
index 8c322e5fb6..e87164c9fb 100644
--- a/src-self-hosted/test.zig
+++ b/src-self-hosted/test.zig
@@ -56,7 +56,7 @@ pub const TestContext = struct {
self.zig_lib_dir = try introspect.resolveZigLibDir(allocator);
errdefer allocator.free(self.zig_lib_dir);
- try std.fs.makePath(allocator, tmp_dir_name);
+ try std.fs.cwd().makePath(tmp_dir_name);
errdefer std.fs.deleteTree(tmp_dir_name) catch {};
}
@@ -85,7 +85,7 @@ pub const TestContext = struct {
const file1_path = try std.fs.path.join(allocator, [_][]const u8{ tmp_dir_name, file_index, file1 });
if (std.fs.path.dirname(file1_path)) |dirname| {
- try std.fs.makePath(allocator, dirname);
+ try std.fs.cwd().makePath(dirname);
}
// TODO async I/O
@@ -119,7 +119,7 @@ pub const TestContext = struct {
const output_file = try std.fmt.allocPrint(allocator, "{}-out{}", .{ file1_path, (Target{ .Native = {} }).exeFileExt() });
if (std.fs.path.dirname(file1_path)) |dirname| {
- try std.fs.makePath(allocator, dirname);
+ try std.fs.cwd().makePath(dirname);
}
// TODO async I/O
From 4a67dd04c99954af2fd8e38b99704a1faea16267 Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 15:01:08 -0500
Subject: [PATCH 16/32] breaking changes to std.fs, std.os
* improve `std.fs.AtomicFile` to use sendfile()
- also fix AtomicFile cleanup not destroying tmp files under some
error conditions
* improve `std.fs.updateFile` to take advantage of the new `makePath`
which no longer needs an Allocator.
* rename std.fs.makeDir to std.fs.makeDirAbsolute
* rename std.fs.Dir.makeDirC to std.fs.Dir.makeDirZ
* add std.fs.Dir.makeDirW and provide Windows implementation of
std.os.mkdirat. std.os.windows.CreateDirectory is now implemented
by calling ntdll, supports an optional root directory handle,
and returns an open directory handle. Its error set has a few more
errors in it.
* rename std.fs.Dir.changeTo to std.fs.Dir.setAsCwd
* fix std.fs.File.writevAll and related functions when len 0 iovecs
supplied.
* introduce `std.fs.File.writeFileAll`, exposing a convenient
cross-platform API on top of sendfile().
* `NoDevice` added to std.os.MakeDirError error set.
* std.os.fchdir gets a smaller error set.
* std.os.windows.CloseHandle is implemented with ntdll call rather than
kernel32.
---
lib/std/fs.zig | 104 ++++++++++++++++++++---------------------
lib/std/fs/file.zig | 91 ++++++++++++++++++++++++++++++++++++
lib/std/os.zig | 70 +++++++++++++++++----------
lib/std/os/test.zig | 66 ++++----------------------
lib/std/os/windows.zig | 71 ++++++++++++++++++++++++----
5 files changed, 259 insertions(+), 143 deletions(-)
diff --git a/lib/std/fs.zig b/lib/std/fs.zig
index db3affc490..056a2f9def 100644
--- a/lib/std/fs.zig
+++ b/lib/std/fs.zig
@@ -123,47 +123,21 @@ pub fn updateFileMode(source_path: []const u8, dest_path: []const u8, mode: ?Fil
}
const actual_mode = mode orelse src_stat.mode;
- // TODO this logic could be made more efficient by calling makePath, once
- // that API does not require an allocator
- var atomic_file = make_atomic_file: while (true) {
- const af = AtomicFile.init(dest_path, actual_mode) catch |err| switch (err) {
- error.FileNotFound => {
- var p = dest_path;
- while (path.dirname(p)) |dirname| {
- makeDir(dirname) catch |e| switch (e) {
- error.FileNotFound => {
- p = dirname;
- continue;
- },
- else => return e,
- };
- continue :make_atomic_file;
- } else {
- return err;
- }
- },
- else => |e| return e,
- };
- break af;
- } else unreachable;
+ if (path.dirname(dest_path)) |dirname| {
+ try cwd().makePath(dirname);
+ }
+
+ var atomic_file = try AtomicFile.init(dest_path, actual_mode);
defer atomic_file.deinit();
- const in_stream = &src_file.inStream().stream;
-
- var buf: [mem.page_size * 6]u8 = undefined;
- while (true) {
- const amt = try in_stream.readFull(buf[0..]);
- try atomic_file.file.writeAll(buf[0..amt]);
- if (amt != buf.len) {
- try atomic_file.file.updateTimes(src_stat.atime, src_stat.mtime);
- try atomic_file.finish();
- return PrevStatus.stale;
- }
- }
+ try atomic_file.file.writeFileAll(src_file, .{ .in_len = src_stat.size });
+ try atomic_file.file.updateTimes(src_stat.atime, src_stat.mtime);
+ try atomic_file.finish();
+ return PrevStatus.stale;
}
-/// Guaranteed to be atomic. However until https://patchwork.kernel.org/patch/9636735/ is
-/// merged and readily available,
+/// Guaranteed to be atomic.
+/// On Linux, until https://patchwork.kernel.org/patch/9636735/ is merged and readily available,
/// there is a possibility of power loss or application termination leaving temporary files present
/// in the same directory as dest_path.
/// Destination file will have the same mode as the source file.
@@ -207,6 +181,9 @@ pub fn copyFileMode(source_path: []const u8, dest_path: []const u8, mode: File.M
}
}
+/// TODO update this API to avoid a getrandom syscall for every operation. It
+/// should accept a random interface.
+/// TODO rework this to integrate with Dir
pub const AtomicFile = struct {
file: File,
tmp_path_buf: [MAX_PATH_BYTES]u8,
@@ -268,33 +245,42 @@ pub const AtomicFile = struct {
pub fn finish(self: *AtomicFile) !void {
assert(!self.finished);
- self.file.close();
- self.finished = true;
- if (builtin.os.tag == .windows) {
+ if (std.Target.current.os.tag == .windows) {
const dest_path_w = try os.windows.sliceToPrefixedFileW(self.dest_path);
const tmp_path_w = try os.windows.cStrToPrefixedFileW(@ptrCast([*:0]u8, &self.tmp_path_buf));
+ self.file.close();
+ self.finished = true;
return os.renameW(&tmp_path_w, &dest_path_w);
+ } else {
+ const dest_path_c = try os.toPosixPath(self.dest_path);
+ self.file.close();
+ self.finished = true;
+ return os.renameC(@ptrCast([*:0]u8, &self.tmp_path_buf), &dest_path_c);
}
- const dest_path_c = try os.toPosixPath(self.dest_path);
- return os.renameC(@ptrCast([*:0]u8, &self.tmp_path_buf), &dest_path_c);
}
};
const default_new_dir_mode = 0o755;
-/// Create a new directory.
-pub fn makeDir(dir_path: []const u8) !void {
- return os.mkdir(dir_path, default_new_dir_mode);
+/// Create a new directory, based on an absolute path.
+/// Asserts that the path is absolute. See `Dir.makeDir` for a function that operates
+/// on both absolute and relative paths.
+pub fn makeDirAbsolute(absolute_path: []const u8) !void {
+ assert(path.isAbsoluteC(absolute_path));
+ return os.mkdir(absolute_path, default_new_dir_mode);
}
-/// Same as `makeDir` except the parameter is a null-terminated UTF8-encoded string.
-pub fn makeDirC(dir_path: [*:0]const u8) !void {
- return os.mkdirC(dir_path, default_new_dir_mode);
+/// Same as `makeDirAbsolute` except the parameter is a null-terminated UTF8-encoded string.
+pub fn makeDirAbsoluteZ(absolute_path_z: [*:0]const u8) !void {
+ assert(path.isAbsoluteC(absolute_path_z));
+ return os.mkdirZ(absolute_path_z, default_new_dir_mode);
}
-/// Same as `makeDir` except the parameter is a null-terminated UTF16LE-encoded string.
-pub fn makeDirW(dir_path: [*:0]const u16) !void {
- return os.mkdirW(dir_path, default_new_dir_mode);
+/// Same as `makeDirAbsolute` except the parameter is a null-terminated WTF-16 encoded string.
+pub fn makeDirAbsoluteW(absolute_path_w: [*:0]const u16) !void {
+ assert(path.isAbsoluteWindowsW(absolute_path_w));
+ const handle = try os.windows.CreateDirectoryW(null, absolute_path_w, null);
+ os.windows.CloseHandle(handle);
}
/// Returns `error.DirNotEmpty` if the directory is not empty.
@@ -847,10 +833,15 @@ pub const Dir = struct {
try os.mkdirat(self.fd, sub_path, default_new_dir_mode);
}
- pub fn makeDirC(self: Dir, sub_path: [*:0]const u8) !void {
+ pub fn makeDirZ(self: Dir, sub_path: [*:0]const u8) !void {
try os.mkdiratC(self.fd, sub_path, default_new_dir_mode);
}
+ pub fn makeDirW(self: Dir, sub_path: [*:0]const u16) !void {
+ const handle = try os.windows.CreateDirectoryW(self.fd, sub_path, null);
+ os.windows.CloseHandle(handle);
+ }
+
/// Calls makeDir recursively to make an entire path. Returns success if the path
/// already exists and is a directory.
/// This function is not atomic, and if it returns an error, the file system may
@@ -885,7 +876,14 @@ pub const Dir = struct {
}
}
- pub fn changeTo(self: Dir) !void {
+ /// Changes the current working directory to the open directory handle.
+ /// This modifies global state and can have surprising effects in multi-
+ /// threaded applications. Most applications and especially libraries should
+ /// not call this function as a general rule, however it can have use cases
+ /// in, for example, implementing a shell, or child process execution.
+ /// Not all targets support this. For example, WASI does not have the concept
+ /// of a current working directory.
+ pub fn setAsCwd(self: Dir) !void {
try os.fchdir(self.fd);
}
diff --git a/lib/std/fs/file.zig b/lib/std/fs/file.zig
index 2715129934..5b51f19f41 100644
--- a/lib/std/fs/file.zig
+++ b/lib/std/fs/file.zig
@@ -271,6 +271,8 @@ pub const File = struct {
/// The `iovecs` parameter is mutable because this function needs to mutate the fields in
/// order to handle partial reads from the underlying OS layer.
pub fn readvAll(self: File, iovecs: []os.iovec) ReadError!void {
+ if (iovecs.len == 0) return;
+
var i: usize = 0;
while (true) {
var amt = try self.readv(iovecs[i..]);
@@ -295,6 +297,8 @@ pub const File = struct {
/// The `iovecs` parameter is mutable because this function needs to mutate the fields in
/// order to handle partial reads from the underlying OS layer.
pub fn preadvAll(self: File, iovecs: []const os.iovec, offset: u64) PReadError!void {
+ if (iovecs.len == 0) return;
+
var i: usize = 0;
var off: usize = 0;
while (true) {
@@ -354,6 +358,8 @@ pub const File = struct {
/// The `iovecs` parameter is mutable because this function needs to mutate the fields in
/// order to handle partial writes from the underlying OS layer.
pub fn writevAll(self: File, iovecs: []os.iovec_const) WriteError!void {
+ if (iovecs.len == 0) return;
+
var i: usize = 0;
while (true) {
var amt = try self.writev(iovecs[i..]);
@@ -378,6 +384,8 @@ pub const File = struct {
/// The `iovecs` parameter is mutable because this function needs to mutate the fields in
/// order to handle partial writes from the underlying OS layer.
pub fn pwritevAll(self: File, iovecs: []os.iovec_const, offset: usize) PWriteError!void {
+ if (iovecs.len == 0) return;
+
var i: usize = 0;
var off: usize = 0;
while (true) {
@@ -393,6 +401,89 @@ pub const File = struct {
}
}
+ pub const WriteFileOptions = struct {
+ in_offset: u64 = 0,
+
+ /// `null` means the entire file. `0` means no bytes from the file.
+ /// When this is `null`, trailers must be sent in a separate writev() call
+ /// due to a flaw in the BSD sendfile API. Other operating systems, such as
+ /// Linux, already do this anyway due to API limitations.
+ /// If the size of the source file is known, passing the size here will save one syscall.
+ in_len: ?u64 = null,
+
+ headers_and_trailers: []os.iovec_const = &[0]os.iovec_const{},
+
+ /// The trailer count is inferred from `headers_and_trailers.len - header_count`
+ header_count: usize = 0,
+ };
+
+ pub const WriteFileError = os.SendFileError;
+
+ /// TODO integrate with async I/O
+ pub fn writeFileAll(self: File, in_file: File, args: WriteFileOptions) WriteFileError!void {
+ const count = blk: {
+ if (args.in_len) |l| {
+ if (l == 0) {
+ return self.writevAll(args.headers_and_trailers);
+ } else {
+ break :blk l;
+ }
+ } else {
+ break :blk 0;
+ }
+ };
+ const headers = args.headers_and_trailers[0..args.header_count];
+ const trailers = args.headers_and_trailers[args.header_count..];
+ const zero_iovec = &[0]os.iovec_const{};
+ // When reading the whole file, we cannot put the trailers in the sendfile() syscall,
+ // because we have no way to determine whether a partial write is past the end of the file or not.
+ const trls = if (count == 0) zero_iovec else trailers;
+ const offset = args.in_offset;
+ const out_fd = self.handle;
+ const in_fd = in_file.handle;
+ const flags = 0;
+ var amt: usize = 0;
+ hdrs: {
+ var i: usize = 0;
+ while (i < headers.len) {
+ amt = try os.sendfile(out_fd, in_fd, offset, count, headers[i..], trls, flags);
+ while (amt >= headers[i].iov_len) {
+ amt -= headers[i].iov_len;
+ i += 1;
+ if (i >= headers.len) break :hdrs;
+ }
+ headers[i].iov_base += amt;
+ headers[i].iov_len -= amt;
+ }
+ }
+ if (count == 0) {
+ var off: u64 = amt;
+ while (true) {
+ amt = try os.sendfile(out_fd, in_fd, offset + off, 0, zero_iovec, zero_iovec, flags);
+ if (amt == 0) break;
+ off += amt;
+ }
+ } else {
+ var off: u64 = amt;
+ while (off < count) {
+ amt = try os.sendfile(out_fd, in_fd, offset + off, count - off, zero_iovec, trailers, flags);
+ off += amt;
+ }
+ amt = @intCast(usize, off - count);
+ }
+ var i: usize = 0;
+ while (i < trailers.len) {
+ while (amt >= headers[i].iov_len) {
+ amt -= trailers[i].iov_len;
+ i += 1;
+ if (i >= trailers.len) return;
+ }
+ trailers[i].iov_base += amt;
+ trailers[i].iov_len -= amt;
+ amt = try os.writev(self.handle, trailers[i..]);
+ }
+ }
+
pub fn inStream(file: File) InStream {
return InStream{
.file = file,
diff --git a/lib/std/os.zig b/lib/std/os.zig
index 3ba810445a..b530ac94ab 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -1539,12 +1539,13 @@ pub const MakeDirError = error{
ReadOnlyFileSystem,
InvalidUtf8,
BadPathName,
+ NoDevice,
} || UnexpectedError;
pub fn mkdirat(dir_fd: fd_t, sub_dir_path: []const u8, mode: u32) MakeDirError!void {
- if (builtin.os == .windows) {
+ if (builtin.os.tag == .windows) {
const sub_dir_path_w = try windows.sliceToPrefixedFileW(sub_dir_path);
- @compileError("TODO implement mkdirat for Windows");
+ return mkdiratW(dir_fd, &sub_dir_path_w, mode);
} else {
const sub_dir_path_c = try toPosixPath(sub_dir_path);
return mkdiratC(dir_fd, &sub_dir_path_c, mode);
@@ -1552,9 +1553,9 @@ pub fn mkdirat(dir_fd: fd_t, sub_dir_path: []const u8, mode: u32) MakeDirError!v
}
pub fn mkdiratC(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: u32) MakeDirError!void {
- if (builtin.os == .windows) {
+ if (builtin.os.tag == .windows) {
const sub_dir_path_w = try windows.cStrToPrefixedFileW(sub_dir_path);
- @compileError("TODO implement mkdiratC for Windows");
+ return mkdiratW(dir_fd, &sub_dir_path_w, mode);
}
switch (errno(system.mkdirat(dir_fd, sub_dir_path, mode))) {
0 => return,
@@ -1576,23 +1577,31 @@ pub fn mkdiratC(dir_fd: fd_t, sub_dir_path: [*:0]const u8, mode: u32) MakeDirErr
}
}
+pub fn mkdiratW(dir_fd: fd_t, sub_path_w: [*:0]const u16, mode: u32) MakeDirError!void {
+ const sub_dir_handle = try windows.CreateDirectoryW(dir_fd, sub_path_w, null);
+ windows.CloseHandle(sub_dir_handle);
+}
+
/// Create a directory.
/// `mode` is ignored on Windows.
pub fn mkdir(dir_path: []const u8, mode: u32) MakeDirError!void {
if (builtin.os.tag == .windows) {
- const dir_path_w = try windows.sliceToPrefixedFileW(dir_path);
- return windows.CreateDirectoryW(&dir_path_w, null);
+ const sub_dir_handle = try windows.CreateDirectory(null, dir_path, null);
+ windows.CloseHandle(sub_dir_handle);
+ return;
} else {
const dir_path_c = try toPosixPath(dir_path);
- return mkdirC(&dir_path_c, mode);
+ return mkdirZ(&dir_path_c, mode);
}
}
/// Same as `mkdir` but the parameter is a null-terminated UTF8-encoded string.
-pub fn mkdirC(dir_path: [*:0]const u8, mode: u32) MakeDirError!void {
+pub fn mkdirZ(dir_path: [*:0]const u8, mode: u32) MakeDirError!void {
if (builtin.os.tag == .windows) {
const dir_path_w = try windows.cStrToPrefixedFileW(dir_path);
- return windows.CreateDirectoryW(&dir_path_w, null);
+ const sub_dir_handle = try windows.CreateDirectoryW(null, &dir_path_w, null);
+ windows.CloseHandle(sub_dir_handle);
+ return;
}
switch (errno(system.mkdir(dir_path, mode))) {
0 => return,
@@ -1705,7 +1714,13 @@ pub fn chdirC(dir_path: [*:0]const u8) ChangeCurDirError!void {
}
}
-pub fn fchdir(dirfd: fd_t) ChangeCurDirError!void {
+pub const FchdirError = error{
+ AccessDenied,
+ NotDir,
+ FileSystem,
+} || UnexpectedError;
+
+pub fn fchdir(dirfd: fd_t) FchdirError!void {
while (true) {
switch (errno(system.fchdir(dirfd))) {
0 => return,
@@ -3564,12 +3579,12 @@ fn count_iovec_bytes(iovs: []const iovec_const) usize {
}
/// Transfer data between file descriptors, with optional headers and trailers.
-/// Returns the number of bytes written. This will be zero if `in_offset` falls beyond the end of the file.
+/// Returns the number of bytes written, which can be zero.
///
-/// The `sendfile` call copies `count` bytes from one file descriptor to another. When possible,
+/// The `sendfile` call copies `in_len` bytes from one file descriptor to another. When possible,
/// this is done within the operating system kernel, which can provide better performance
/// characteristics than transferring data from kernel to user space and back, such as with
-/// `read` and `write` calls. When `count` is `0`, it means to copy until the end of the input file has been
+/// `read` and `write` calls. When `in_len` is `0`, it means to copy until the end of the input file has been
/// reached. Note, however, that partial writes are still possible in this case.
///
/// `in_fd` must be a file descriptor opened for reading, and `out_fd` must be a file descriptor
@@ -3578,7 +3593,8 @@ fn count_iovec_bytes(iovs: []const iovec_const) usize {
/// atomicity guarantees no longer apply.
///
/// Copying begins reading at `in_offset`. The input file descriptor seek position is ignored and not updated.
-/// If the output file descriptor has a seek position, it is updated as bytes are written.
+/// If the output file descriptor has a seek position, it is updated as bytes are written. When
+/// `in_offset` is past the end of the input file, it successfully reads 0 bytes.
///
/// `flags` has different meanings per operating system; refer to the respective man pages.
///
@@ -3599,7 +3615,7 @@ pub fn sendfile(
out_fd: fd_t,
in_fd: fd_t,
in_offset: u64,
- count: usize,
+ in_len: u64,
headers: []const iovec_const,
trailers: []const iovec_const,
flags: u32,
@@ -3608,9 +3624,15 @@ pub fn sendfile(
var total_written: usize = 0;
// Prevents EOVERFLOW.
+ const size_t = @Type(std.builtin.TypeInfo{
+ .Int = .{
+ .is_signed = false,
+ .bits = @typeInfo(usize).Int.bits - 1,
+ },
+ });
const max_count = switch (std.Target.current.os.tag) {
.linux => 0x7ffff000,
- else => math.maxInt(isize),
+ else => math.maxInt(size_t),
};
switch (std.Target.current.os.tag) {
@@ -3630,7 +3652,7 @@ pub fn sendfile(
}
// Here we match BSD behavior, making a zero count value send as many bytes as possible.
- const adjusted_count = if (count == 0) max_count else math.min(count, max_count);
+ const adjusted_count = if (in_len == 0) max_count else math.min(in_len, @as(size_t, max_count));
while (true) {
var offset: off_t = @bitCast(off_t, in_offset);
@@ -3639,10 +3661,10 @@ pub fn sendfile(
0 => {
const amt = @bitCast(usize, rc);
total_written += amt;
- if (count == 0 and amt == 0) {
+ if (in_len == 0 and amt == 0) {
// We have detected EOF from `in_fd`.
break;
- } else if (amt < count) {
+ } else if (amt < in_len) {
return total_written;
} else {
break;
@@ -3708,7 +3730,7 @@ pub fn sendfile(
hdtr = &hdtr_data;
}
- const adjusted_count = math.min(count, max_count);
+ const adjusted_count = math.min(in_len, max_count);
while (true) {
var sbytes: off_t = undefined;
@@ -3786,7 +3808,7 @@ pub fn sendfile(
hdtr = &hdtr_data;
}
- const adjusted_count = math.min(count, @as(u63, max_count));
+ const adjusted_count = math.min(in_len, @as(u63, max_count));
while (true) {
var sbytes: off_t = adjusted_count;
@@ -3840,10 +3862,10 @@ pub fn sendfile(
rw: {
var buf: [8 * 4096]u8 = undefined;
// Here we match BSD behavior, making a zero count value send as many bytes as possible.
- const adjusted_count = if (count == 0) buf.len else math.min(buf.len, count);
+ const adjusted_count = if (in_len == 0) buf.len else math.min(buf.len, in_len);
const amt_read = try pread(in_fd, buf[0..adjusted_count], in_offset);
if (amt_read == 0) {
- if (count == 0) {
+ if (in_len == 0) {
// We have detected EOF from `in_fd`.
break :rw;
} else {
@@ -3852,7 +3874,7 @@ pub fn sendfile(
}
const amt_written = try write(out_fd, buf[0..amt_read]);
total_written += amt_written;
- if (amt_written < count or count == 0) return total_written;
+ if (amt_written < in_len or in_len == 0) return total_written;
}
if (trailers.len != 0) {
diff --git a/lib/std/os/test.zig b/lib/std/os/test.zig
index a8544c5b83..5f97597537 100644
--- a/lib/std/os/test.zig
+++ b/lib/std/os/test.zig
@@ -45,7 +45,7 @@ fn testThreadIdFn(thread_id: *Thread.Id) void {
}
test "sendfile" {
- try fs.makePath(a, "os_test_tmp");
+ try fs.cwd().makePath("os_test_tmp");
defer fs.deleteTree("os_test_tmp") catch {};
var dir = try fs.cwd().openDirList("os_test_tmp");
@@ -74,7 +74,9 @@ test "sendfile" {
const header1 = "header1\n";
const header2 = "second header\n";
- var headers = [_]os.iovec_const{
+ const trailer1 = "trailer1\n";
+ const trailer2 = "second trailer\n";
+ var hdtr = [_]os.iovec_const{
.{
.iov_base = header1,
.iov_len = header1.len,
@@ -83,11 +85,6 @@ test "sendfile" {
.iov_base = header2,
.iov_len = header2.len,
},
- };
-
- const trailer1 = "trailer1\n";
- const trailer2 = "second trailer\n";
- var trailers = [_]os.iovec_const{
.{
.iov_base = trailer1,
.iov_len = trailer1.len,
@@ -99,59 +96,16 @@ test "sendfile" {
};
var written_buf: [header1.len + header2.len + 10 + trailer1.len + trailer2.len]u8 = undefined;
- try sendfileAll(dest_file.handle, src_file.handle, 1, 10, &headers, &trailers, 0);
-
+ try dest_file.writeFileAll(src_file, .{
+ .in_offset = 1,
+ .in_len = 10,
+ .headers_and_trailers = &hdtr,
+ .header_count = 2,
+ });
try dest_file.preadAll(&written_buf, 0);
expect(mem.eql(u8, &written_buf, "header1\nsecond header\nine1\nsecontrailer1\nsecond trailer\n"));
}
-fn sendfileAll(
- out_fd: os.fd_t,
- in_fd: os.fd_t,
- offset: u64,
- count: usize,
- headers: []os.iovec_const,
- trailers: []os.iovec_const,
- flags: u32,
-) os.SendFileError!void {
- var amt: usize = undefined;
- hdrs: {
- var i: usize = 0;
- while (i < headers.len) {
- amt = try os.sendfile(out_fd, in_fd, offset, count, headers[i..], trailers, flags);
- while (amt >= headers[i].iov_len) {
- amt -= headers[i].iov_len;
- i += 1;
- if (i >= headers.len) break :hdrs;
- }
- headers[i].iov_base += amt;
- headers[i].iov_len -= amt;
- }
- }
- var off = amt;
- while (off < count) {
- amt = try os.sendfile(out_fd, in_fd, offset + off, count - off, &[0]os.iovec_const{}, trailers, flags);
- off += amt;
- }
- amt = off - count;
- var i: usize = 0;
- while (i < trailers.len) {
- while (amt >= headers[i].iov_len) {
- amt -= trailers[i].iov_len;
- i += 1;
- if (i >= trailers.len) return;
- }
- trailers[i].iov_base += amt;
- trailers[i].iov_len -= amt;
- if (std.Target.current.os.tag == .windows) {
- amt = try os.writev(out_fd, trailers[i..]);
- } else {
- // Here we must use send because it's the only way to give the flags.
- amt = try os.send(out_fd, trailers[i].iov_base[0..trailers[i].iov_len], flags);
- }
- }
-}
-
test "std.Thread.getCurrentId" {
if (builtin.single_threaded) return error.SkipZigTest;
diff --git a/lib/std/os/windows.zig b/lib/std/os/windows.zig
index 92124511bd..b8e14a220d 100644
--- a/lib/std/os/windows.zig
+++ b/lib/std/os/windows.zig
@@ -337,7 +337,7 @@ pub fn GetQueuedCompletionStatus(
}
pub fn CloseHandle(hObject: HANDLE) void {
- assert(kernel32.CloseHandle(hObject) != 0);
+ assert(ntdll.NtClose(hObject) == .SUCCESS);
}
pub fn FindClose(hFindFile: HANDLE) void {
@@ -586,23 +586,74 @@ pub fn MoveFileExW(old_path: [*:0]const u16, new_path: [*:0]const u16, flags: DW
}
pub const CreateDirectoryError = error{
+ NameTooLong,
PathAlreadyExists,
FileNotFound,
+ NoDevice,
+ AccessDenied,
Unexpected,
};
-pub fn CreateDirectory(pathname: []const u8, attrs: ?*SECURITY_ATTRIBUTES) CreateDirectoryError!void {
+/// Returns an open directory handle which the caller is responsible for closing with `CloseHandle`.
+pub fn CreateDirectory(dir: ?HANDLE, pathname: []const u8, sa: ?*SECURITY_ATTRIBUTES) CreateDirectoryError!HANDLE {
const pathname_w = try sliceToPrefixedFileW(pathname);
- return CreateDirectoryW(&pathname_w, attrs);
+ return CreateDirectoryW(dir, &pathname_w, sa);
}
-pub fn CreateDirectoryW(pathname: [*:0]const u16, attrs: ?*SECURITY_ATTRIBUTES) CreateDirectoryError!void {
- if (kernel32.CreateDirectoryW(pathname, attrs) == 0) {
- switch (kernel32.GetLastError()) {
- .ALREADY_EXISTS => return error.PathAlreadyExists,
- .PATH_NOT_FOUND => return error.FileNotFound,
- else => |err| return unexpectedError(err),
- }
+/// Same as `CreateDirectory` except takes a WTF-16 encoded path.
+pub fn CreateDirectoryW(
+ dir: ?HANDLE,
+ sub_path_w: [*:0]const u16,
+ sa: ?*SECURITY_ATTRIBUTES,
+) CreateDirectoryError!HANDLE {
+ const path_len_bytes = math.cast(u16, mem.toSliceConst(u16, sub_path_w).len * 2) catch |err| switch (err) {
+ error.Overflow => return error.NameTooLong,
+ };
+ var nt_name = UNICODE_STRING{
+ .Length = path_len_bytes,
+ .MaximumLength = path_len_bytes,
+ .Buffer = @intToPtr([*]u16, @ptrToInt(sub_path_w)),
+ };
+
+ if (sub_path_w[0] == '.' and sub_path_w[1] == 0) {
+ // Windows does not recognize this, but it does work with empty string.
+ nt_name.Length = 0;
+ }
+
+ var attr = OBJECT_ATTRIBUTES{
+ .Length = @sizeOf(OBJECT_ATTRIBUTES),
+ .RootDirectory = if (std.fs.path.isAbsoluteWindowsW(sub_path_w)) null else dir,
+ .Attributes = 0, // Note we do not use OBJ_CASE_INSENSITIVE here.
+ .ObjectName = &nt_name,
+ .SecurityDescriptor = if (sa) |ptr| ptr.lpSecurityDescriptor else null,
+ .SecurityQualityOfService = null,
+ };
+ var io: IO_STATUS_BLOCK = undefined;
+ var result_handle: HANDLE = undefined;
+ const rc = ntdll.NtCreateFile(
+ &result_handle,
+ GENERIC_READ | SYNCHRONIZE,
+ &attr,
+ &io,
+ null,
+ FILE_ATTRIBUTE_NORMAL,
+ FILE_SHARE_READ,
+ FILE_CREATE,
+ FILE_DIRECTORY_FILE | FILE_SYNCHRONOUS_IO_NONALERT,
+ null,
+ 0,
+ );
+ switch (rc) {
+ .SUCCESS => return result_handle,
+ .OBJECT_NAME_INVALID => unreachable,
+ .OBJECT_NAME_NOT_FOUND => return error.FileNotFound,
+ .OBJECT_PATH_NOT_FOUND => return error.FileNotFound,
+ .NO_MEDIA_IN_DEVICE => return error.NoDevice,
+ .INVALID_PARAMETER => unreachable,
+ .ACCESS_DENIED => return error.AccessDenied,
+ .OBJECT_PATH_SYNTAX_BAD => unreachable,
+ .OBJECT_NAME_COLLISION => return error.PathAlreadyExists,
+ else => return unexpectedStatus(rc),
}
}
From 55dfedff42db3cedd12d5385bd4df4bc7676d3af Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 15:58:14 -0500
Subject: [PATCH 17/32] update cli test to new std.fs API
---
test/cli.zig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/test/cli.zig b/test/cli.zig
index 117c714a29..9bc4a21c90 100644
--- a/test/cli.zig
+++ b/test/cli.zig
@@ -37,7 +37,7 @@ pub fn main() !void {
};
for (test_fns) |testFn| {
try fs.deleteTree(dir_path);
- try fs.makeDir(dir_path);
+ try fs.cwd().makeDir(dir_path);
try testFn(zig_exe, dir_path);
}
}
From c4f81586f1212dfae8d647ad390676b1fda7bf89 Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 16:01:09 -0500
Subject: [PATCH 18/32] update docgen to new std.fs API
---
doc/docgen.zig | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/doc/docgen.zig b/doc/docgen.zig
index 5d7f2b7b38..319d9e0035 100644
--- a/doc/docgen.zig
+++ b/doc/docgen.zig
@@ -50,7 +50,7 @@ pub fn main() !void {
var tokenizer = Tokenizer.init(in_file_name, input_file_bytes);
var toc = try genToc(allocator, &tokenizer);
- try fs.makePath(allocator, tmp_dir_name);
+ try fs.cwd().makePath(tmp_dir_name);
defer fs.deleteTree(tmp_dir_name) catch {};
try genHtml(allocator, &tokenizer, &toc, &buffered_out_stream.stream, zig_exe);
From 1141bfb21b82f8d3fc353e968a591f2ad9aaa571 Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 16:52:32 -0500
Subject: [PATCH 19/32] Darwin can return EBADF for sendfile on non-files
---
lib/std/os.zig | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)
diff --git a/lib/std/os.zig b/lib/std/os.zig
index b530ac94ab..90ad3e03a9 100644
--- a/lib/std/os.zig
+++ b/lib/std/os.zig
@@ -3818,12 +3818,14 @@ pub fn sendfile(
switch (err) {
0 => return amt,
- EBADF => unreachable, // Always a race condition.
EFAULT => unreachable, // Segmentation fault.
EINVAL => unreachable,
ENOTCONN => unreachable, // `out_fd` is an unconnected socket.
- ENOTSUP, ENOTSOCK, ENOSYS => break :sf,
+ // On macOS version 10.14.6, I observed Darwin return EBADF when
+ // using sendfile on a valid open file descriptor of a file
+ // system file.
+ ENOTSUP, ENOTSOCK, ENOSYS, EBADF => break :sf,
EINTR => if (amt != 0) return amt else continue,
From 3b235cfa807451ee17067ae8a34596b88bbc2eaf Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 21:09:32 -0500
Subject: [PATCH 20/32] std.zig.CrossTarget: fix compile errors
closes #4620
---
lib/std/zig/cross_target.zig | 8 +++++---
1 file changed, 5 insertions(+), 3 deletions(-)
diff --git a/lib/std/zig/cross_target.zig b/lib/std/zig/cross_target.zig
index 38ce6549f3..f69146bd5f 100644
--- a/lib/std/zig/cross_target.zig
+++ b/lib/std/zig/cross_target.zig
@@ -355,8 +355,10 @@ pub const CrossTarget = struct {
}
pub fn getCpuModel(self: CrossTarget) *const Target.Cpu.Model {
- if (self.cpu_model) |cpu_model| return cpu_model;
- return self.getCpu().model;
+ return switch (self.cpu_model) {
+ .explicit => |cpu_model| cpu_model,
+ else => self.getCpu().model,
+ };
}
pub fn getCpuFeatures(self: CrossTarget) Target.Cpu.Feature.Set {
@@ -645,7 +647,7 @@ pub const CrossTarget = struct {
self.glibc_version = SemVer{ .major = major, .minor = minor, .patch = patch };
}
- pub fn getObjectFormat(self: CrossTarget) ObjectFormat {
+ pub fn getObjectFormat(self: CrossTarget) Target.ObjectFormat {
return Target.getObjectFormatSimple(self.getOsTag(), self.getCpuArch());
}
From c0c9303bd63468afe146ad729cf963ee06a1777f Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 21:32:01 -0500
Subject: [PATCH 21/32] put FreeBSD CI in timeout for misbehavior
FreeBSD is dealing with some weird upstream bug right now. We can try to
re-enable this when it is fixed.
https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244549
very naughty
---
ci/srht/update_download_page | 15 ++++++++++-----
1 file changed, 10 insertions(+), 5 deletions(-)
diff --git a/ci/srht/update_download_page b/ci/srht/update_download_page
index 1a721bec80..cd289713db 100755
--- a/ci/srht/update_download_page
+++ b/ci/srht/update_download_page
@@ -21,7 +21,10 @@ curl --fail -I "$AARCH64_LINUX_JSON_URL" >/dev/null || exit 0
curl --fail -I "$X86_64_LINUX_JSON_URL" >/dev/null || exit 0
curl --fail -I "$X86_64_WINDOWS_JSON_URL" >/dev/null || exit 0
curl --fail -I "$X86_64_MACOS_JSON_URL" >/dev/null || exit 0
-curl --fail -I "$X86_64_FREEBSD_JSON_URL" >/dev/null || exit 0
+
+# FreeBSD is dealing with some weird upstream bug right now
+# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244549
+#curl --fail -I "$X86_64_FREEBSD_JSON_URL" >/dev/null || exit 0
# Without --user, this gave me:
# ERROR: Could not install packages due to an EnvironmentError: [Errno 13] Permission denied
@@ -63,10 +66,12 @@ export AARCH64_LINUX_TARBALL="$(echo "$AARCH64_LINUX_JSON" | jq .tarball -r)"
export AARCH64_LINUX_BYTESIZE="$(echo "$AARCH64_LINUX_JSON" | jq .size -r)"
export AARCH64_LINUX_SHASUM="$(echo "$AARCH64_LINUX_JSON" | jq .shasum -r)"
-X86_64_FREEBSD_JSON=$(curl --fail "$X86_64_FREEBSD_JSON_URL" || exit 1)
-export X86_64_FREEBSD_TARBALL="$(echo "$X86_64_FREEBSD_JSON" | jq .tarball -r)"
-export X86_64_FREEBSD_BYTESIZE="$(echo "$X86_64_FREEBSD_JSON" | jq .size -r)"
-export X86_64_FREEBSD_SHASUM="$(echo "$X86_64_FREEBSD_JSON" | jq .shasum -r)"
+# FreeBSD is dealing with some weird upstream bug right now
+# https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=244549
+#X86_64_FREEBSD_JSON=$(curl --fail "$X86_64_FREEBSD_JSON_URL" || exit 1)
+#export X86_64_FREEBSD_TARBALL="$(echo "$X86_64_FREEBSD_JSON" | jq .tarball -r)"
+#export X86_64_FREEBSD_BYTESIZE="$(echo "$X86_64_FREEBSD_JSON" | jq .size -r)"
+#export X86_64_FREEBSD_SHASUM="$(echo "$X86_64_FREEBSD_JSON" | jq .shasum -r)"
git clone https://github.com/ziglang/www.ziglang.org --depth 1
cd www.ziglang.org
From 8aaab75af05c6066d8f952259d0d540f92c4772e Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 22:14:29 -0500
Subject: [PATCH 22/32] docs: remove reference to deprecated builtins
closes #3959
---
doc/langref.html.in | 17 ++++++++++-------
1 file changed, 10 insertions(+), 7 deletions(-)
diff --git a/doc/langref.html.in b/doc/langref.html.in
index c10fc3ed30..16d16718a9 100644
--- a/doc/langref.html.in
+++ b/doc/langref.html.in
@@ -6019,13 +6019,16 @@ pub fn printf(self: *OutStream, arg0: i32, arg1: []const u8) !void {
{#code_begin|syntax#}
pub fn printValue(self: *OutStream, value: var) !void {
- const T = @TypeOf(value);
- if (@isInteger(T)) {
- return self.printInt(T, value);
- } else if (@isFloat(T)) {
- return self.printFloat(T, value);
- } else {
- @compileError("Unable to print type '" ++ @typeName(T) ++ "'");
+ switch (@typeInfo(@TypeOf(value))) {
+ .Int => {
+ return self.printInt(T, value);
+ },
+ .Float => {
+ return self.printFloat(T, value);
+ },
+ else => {
+ @compileError("Unable to print type '" ++ @typeName(T) ++ "'");
+ },
}
}
{#code_end#}
From 3841acf7ef54afd6f315fe79cf51ffd33726d36d Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 22:40:41 -0500
Subject: [PATCH 23/32] update process_headers tool to latest zig
---
tools/process_headers.zig | 40 ++++++++++++++++++++-------------------
1 file changed, 21 insertions(+), 19 deletions(-)
diff --git a/tools/process_headers.zig b/tools/process_headers.zig
index 9952147aac..b118f8535f 100644
--- a/tools/process_headers.zig
+++ b/tools/process_headers.zig
@@ -11,10 +11,10 @@
// You'll then have to manually update Zig source repo with these new files.
const std = @import("std");
-const builtin = @import("builtin");
-const Arch = builtin.Arch;
-const Abi = builtin.Abi;
-const Os = builtin.Os;
+const builtin = std.builtin;
+const Arch = std.Target.Cpu.Arch;
+const Abi = std.Target.Abi;
+const OsTag = std.Target.Os.Tag;
const assert = std.debug.assert;
const LibCTarget = struct {
@@ -29,12 +29,12 @@ const MultiArch = union(enum) {
mips,
mips64,
powerpc64,
- specific: @TagType(Arch),
+ specific: Arch,
fn eql(a: MultiArch, b: MultiArch) bool {
if (@enumToInt(a) != @enumToInt(b))
return false;
- if (@TagType(MultiArch)(a) != .specific)
+ if (a != .specific)
return true;
return a.specific == b.specific;
}
@@ -221,7 +221,7 @@ const musl_targets = [_]LibCTarget{
const DestTarget = struct {
arch: MultiArch,
- os: Os,
+ os: OsTag,
abi: Abi,
fn hash(a: DestTarget) u32 {
@@ -305,8 +305,8 @@ pub fn main() !void {
// TODO compiler crashed when I wrote this the canonical way
var libc_targets: []const LibCTarget = undefined;
switch (vendor) {
- .musl => libc_targets = musl_targets,
- .glibc => libc_targets = glibc_targets,
+ .musl => libc_targets = &musl_targets,
+ .glibc => libc_targets = &glibc_targets,
}
var path_table = PathTable.init(allocator);
@@ -340,15 +340,17 @@ pub fn main() !void {
try dir_stack.append(target_include_dir);
while (dir_stack.popOrNull()) |full_dir_name| {
- var dir = std.fs.Dir.cwd().openDirList(full_dir_name) catch |err| switch (err) {
+ var dir = std.fs.cwd().openDirList(full_dir_name) catch |err| switch (err) {
error.FileNotFound => continue :search,
error.AccessDenied => continue :search,
else => return err,
};
defer dir.close();
- while (try dir.next()) |entry| {
- const full_path = try std.fs.path.join(allocator, [_][]const u8{ full_dir_name, entry.name });
+ var dir_it = dir.iterate();
+
+ while (try dir_it.next()) |entry| {
+ const full_path = try std.fs.path.join(allocator, &[_][]const u8{ full_dir_name, entry.name });
switch (entry.kind) {
.Directory => try dir_stack.append(full_path),
.File => {
@@ -396,8 +398,8 @@ pub fn main() !void {
std.debug.warn("warning: libc target not found: {}\n", .{libc_target.name});
}
}
- std.debug.warn("summary: {Bi:2} could be reduced to {Bi:2}\n", .{total_bytes, total_bytes - max_bytes_saved});
- try std.fs.makePath(allocator, out_dir);
+ std.debug.warn("summary: {Bi:2} could be reduced to {Bi:2}\n", .{ total_bytes, total_bytes - max_bytes_saved });
+ try std.fs.cwd().makePath(out_dir);
var missed_opportunity_bytes: usize = 0;
// iterate path_table. for each path, put all the hashes into a list. sort by hit_count.
@@ -417,15 +419,15 @@ pub fn main() !void {
var best_contents = contents_list.popOrNull().?;
if (best_contents.hit_count > 1) {
// worth it to make it generic
- const full_path = try std.fs.path.join(allocator, [_][]const u8{ out_dir, generic_name, path_kv.key });
- try std.fs.makePath(allocator, std.fs.path.dirname(full_path).?);
+ const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, generic_name, path_kv.key });
+ try std.fs.cwd().makePath(std.fs.path.dirname(full_path).?);
try std.io.writeFile(full_path, best_contents.bytes);
best_contents.is_generic = true;
while (contents_list.popOrNull()) |contender| {
if (contender.hit_count > 1) {
const this_missed_bytes = contender.hit_count * contender.bytes.len;
missed_opportunity_bytes += this_missed_bytes;
- std.debug.warn("Missed opportunity ({Bi:2}): {}\n", .{this_missed_bytes, path_kv.key});
+ std.debug.warn("Missed opportunity ({Bi:2}): {}\n", .{ this_missed_bytes, path_kv.key });
} else break;
}
}
@@ -444,8 +446,8 @@ pub fn main() !void {
@tagName(dest_target.os),
@tagName(dest_target.abi),
});
- const full_path = try std.fs.path.join(allocator, [_][]const u8{ out_dir, out_subpath, path_kv.key });
- try std.fs.makePath(allocator, std.fs.path.dirname(full_path).?);
+ const full_path = try std.fs.path.join(allocator, &[_][]const u8{ out_dir, out_subpath, path_kv.key });
+ try std.fs.cwd().makePath(std.fs.path.dirname(full_path).?);
try std.io.writeFile(full_path, contents.bytes);
}
}
From 67480cd5157fbea664fa392b1d8a0911579be5a3 Mon Sep 17 00:00:00 2001
From: Andrew Kelley
Date: Tue, 3 Mar 2020 22:46:57 -0500
Subject: [PATCH 24/32] update glibc headers to 2.31
---
.../include/aarch64-linux-gnu/bits/endian.h | 30 ---
.../aarch64-linux-gnu/bits/endianness.h | 15 ++
.../include/aarch64-linux-gnu/bits/fcntl.h | 4 +-
.../include/aarch64-linux-gnu/bits/fenv.h | 6 +-
.../include/aarch64-linux-gnu/bits/floatn.h | 4 +-
.../include/aarch64-linux-gnu/bits/fp-fast.h | 4 +-
.../include/aarch64-linux-gnu/bits/hwcap.h | 4 +-
lib/libc/include/aarch64-linux-gnu/bits/ipc.h | 54 ----
.../include/aarch64-linux-gnu/bits/link.h | 4 +-
.../aarch64-linux-gnu/bits/local_lim.h | 4 +-
.../aarch64-linux-gnu/bits/long-double.h | 7 +-
.../include/aarch64-linux-gnu/bits/procfs.h | 4 +-
.../bits/pthreadtypes-arch.h | 30 +--
.../aarch64-linux-gnu/bits/semaphore.h | 4 +-
.../include/aarch64-linux-gnu/bits/setjmp.h | 4 +-
.../include/aarch64-linux-gnu/bits/sigstack.h | 4 +-
.../include/aarch64-linux-gnu/bits/stat.h | 11 +-
.../include/aarch64-linux-gnu/bits/statfs.h | 8 +-
.../bits/struct_rwlock.h} | 39 +--
.../aarch64-linux-gnu/bits/typesizes.h | 10 +-
.../include/aarch64-linux-gnu/bits/wordsize.h | 4 +-
.../include/aarch64-linux-gnu/fpu_control.h | 4 +-
lib/libc/include/aarch64-linux-gnu/ieee754.h | 8 +-
lib/libc/include/aarch64-linux-gnu/sys/elf.h | 4 +-
.../include/aarch64-linux-gnu/sys/ptrace.h | 10 +-
.../include/aarch64-linux-gnu/sys/ucontext.h | 4 +-
lib/libc/include/aarch64-linux-gnu/sys/user.h | 4 +-
.../aarch64_be-linux-gnu/bits/endian.h | 30 ---
.../aarch64_be-linux-gnu/bits/endianness.h | 15 ++
.../include/aarch64_be-linux-gnu/bits/fcntl.h | 4 +-
.../include/aarch64_be-linux-gnu/bits/fenv.h | 6 +-
.../aarch64_be-linux-gnu/bits/floatn.h | 4 +-
.../aarch64_be-linux-gnu/bits/fp-fast.h | 4 +-
.../include/aarch64_be-linux-gnu/bits/hwcap.h | 4 +-
.../include/aarch64_be-linux-gnu/bits/ipc.h | 54 ----
.../include/aarch64_be-linux-gnu/bits/link.h | 4 +-
.../aarch64_be-linux-gnu/bits/local_lim.h | 4 +-
.../aarch64_be-linux-gnu/bits/long-double.h | 7 +-
.../aarch64_be-linux-gnu/bits/procfs.h | 4 +-
.../bits/pthreadtypes-arch.h | 30 +--
.../aarch64_be-linux-gnu/bits/semaphore.h | 4 +-
.../aarch64_be-linux-gnu/bits/setjmp.h | 4 +-
.../aarch64_be-linux-gnu/bits/sigstack.h | 4 +-
.../include/aarch64_be-linux-gnu/bits/stat.h | 11 +-
.../aarch64_be-linux-gnu/bits/statfs.h | 8 +-
.../bits/struct_rwlock.h} | 39 +--
.../aarch64_be-linux-gnu/bits/typesizes.h | 10 +-
.../aarch64_be-linux-gnu/bits/wordsize.h | 4 +-
.../aarch64_be-linux-gnu/fpu_control.h | 4 +-
.../include/aarch64_be-linux-gnu/ieee754.h | 8 +-
.../include/aarch64_be-linux-gnu/sys/elf.h | 4 +-
.../include/aarch64_be-linux-gnu/sys/ptrace.h | 10 +-
.../aarch64_be-linux-gnu/sys/ucontext.h | 4 +-
.../include/aarch64_be-linux-gnu/sys/user.h | 4 +-
.../include/arm-linux-gnueabi/bits/endian.h | 10 -
.../arm-linux-gnueabi/bits/endianness.h | 15 ++
.../include/arm-linux-gnueabi/bits/fcntl.h | 4 +-
.../include/arm-linux-gnueabi/bits/fenv.h | 6 +-
.../include/arm-linux-gnueabi/bits/floatn.h | 4 +-
.../include/arm-linux-gnueabi/bits/hwcap.h | 4 +-
.../include/arm-linux-gnueabi/bits/link.h | 4 +-
.../arm-linux-gnueabi/bits/long-double.h | 7 +-
.../arm-linux-gnueabi/bits/procfs-id.h | 4 +-
.../include/arm-linux-gnueabi/bits/procfs.h | 4 +-
.../arm-linux-gnueabi/bits/semaphore.h | 4 +-
.../include/arm-linux-gnueabi/bits/setjmp.h | 4 +-
.../include/arm-linux-gnueabi/bits/shmlba.h | 4 +-
.../include/arm-linux-gnueabi/bits/stat.h | 4 +-
.../arm-linux-gnueabi/bits/struct_rwlock.h | 61 +++++
.../include/arm-linux-gnueabi/bits/wordsize.h | 4 +-
.../include/arm-linux-gnueabi/fpu_control.h | 4 +-
.../include/arm-linux-gnueabi/sys/ptrace.h | 8 +-
.../include/arm-linux-gnueabi/sys/ucontext.h | 4 +-
lib/libc/include/arm-linux-gnueabi/sys/user.h | 4 +-
.../include/arm-linux-gnueabihf/bits/endian.h | 10 -
.../arm-linux-gnueabihf/bits/endianness.h | 15 ++
.../include/arm-linux-gnueabihf/bits/fcntl.h | 4 +-
.../include/arm-linux-gnueabihf/bits/fenv.h | 6 +-
.../include/arm-linux-gnueabihf/bits/floatn.h | 4 +-
.../include/arm-linux-gnueabihf/bits/hwcap.h | 4 +-
.../include/arm-linux-gnueabihf/bits/link.h | 4 +-
.../arm-linux-gnueabihf/bits/long-double.h | 7 +-
.../arm-linux-gnueabihf/bits/procfs-id.h | 4 +-
.../include/arm-linux-gnueabihf/bits/procfs.h | 4 +-
.../arm-linux-gnueabihf/bits/semaphore.h | 4 +-
.../include/arm-linux-gnueabihf/bits/setjmp.h | 4 +-
.../include/arm-linux-gnueabihf/bits/shmlba.h | 4 +-
.../include/arm-linux-gnueabihf/bits/stat.h | 4 +-
.../arm-linux-gnueabihf/bits/struct_rwlock.h | 61 +++++
.../arm-linux-gnueabihf/bits/wordsize.h | 4 +-
.../include/arm-linux-gnueabihf/fpu_control.h | 4 +-
.../include/arm-linux-gnueabihf/sys/ptrace.h | 8 +-
.../arm-linux-gnueabihf/sys/ucontext.h | 4 +-
.../include/arm-linux-gnueabihf/sys/user.h | 4 +-
.../include/armeb-linux-gnueabi/bits/endian.h | 10 -
.../armeb-linux-gnueabi/bits/endianness.h | 15 ++
.../include/armeb-linux-gnueabi/bits/fcntl.h | 4 +-
.../include/armeb-linux-gnueabi/bits/fenv.h | 6 +-
.../include/armeb-linux-gnueabi/bits/floatn.h | 4 +-
.../include/armeb-linux-gnueabi/bits/hwcap.h | 4 +-
.../include/armeb-linux-gnueabi/bits/link.h | 4 +-
.../armeb-linux-gnueabi/bits/long-double.h | 7 +-
.../armeb-linux-gnueabi/bits/procfs-id.h | 4 +-
.../include/armeb-linux-gnueabi/bits/procfs.h | 4 +-
.../armeb-linux-gnueabi/bits/semaphore.h | 4 +-
.../include/armeb-linux-gnueabi/bits/setjmp.h | 4 +-
.../include/armeb-linux-gnueabi/bits/shmlba.h | 4 +-
.../include/armeb-linux-gnueabi/bits/stat.h | 4 +-
.../armeb-linux-gnueabi/bits/struct_rwlock.h | 61 +++++
.../armeb-linux-gnueabi/bits/wordsize.h | 4 +-
.../include/armeb-linux-gnueabi/fpu_control.h | 4 +-
.../include/armeb-linux-gnueabi/sys/ptrace.h | 8 +-
.../armeb-linux-gnueabi/sys/ucontext.h | 4 +-
.../include/armeb-linux-gnueabi/sys/user.h | 4 +-
.../armeb-linux-gnueabihf/bits/endian.h | 10 -
.../armeb-linux-gnueabihf/bits/endianness.h | 15 ++
.../armeb-linux-gnueabihf/bits/fcntl.h | 4 +-
.../include/armeb-linux-gnueabihf/bits/fenv.h | 6 +-
.../armeb-linux-gnueabihf/bits/floatn.h | 4 +-
.../armeb-linux-gnueabihf/bits/hwcap.h | 4 +-
.../include/armeb-linux-gnueabihf/bits/link.h | 4 +-
.../armeb-linux-gnueabihf/bits/long-double.h | 7 +-
.../armeb-linux-gnueabihf/bits/procfs-id.h | 4 +-
.../armeb-linux-gnueabihf/bits/procfs.h | 4 +-
.../armeb-linux-gnueabihf/bits/semaphore.h | 4 +-
.../armeb-linux-gnueabihf/bits/setjmp.h | 4 +-
.../armeb-linux-gnueabihf/bits/shmlba.h | 4 +-
.../include/armeb-linux-gnueabihf/bits/stat.h | 4 +-
.../bits/struct_rwlock.h | 61 +++++
.../armeb-linux-gnueabihf/bits/wordsize.h | 4 +-
.../armeb-linux-gnueabihf/fpu_control.h | 4 +-
.../armeb-linux-gnueabihf/sys/ptrace.h | 8 +-
.../armeb-linux-gnueabihf/sys/ucontext.h | 4 +-
.../include/armeb-linux-gnueabihf/sys/user.h | 4 +-
lib/libc/include/generic-glibc/aio.h | 4 +-
lib/libc/include/generic-glibc/aliases.h | 4 +-
lib/libc/include/generic-glibc/alloca.h | 4 +-
lib/libc/include/generic-glibc/ar.h | 4 +-
lib/libc/include/generic-glibc/argp.h | 4 +-
lib/libc/include/generic-glibc/argz.h | 4 +-
lib/libc/include/generic-glibc/arpa/inet.h | 4 +-
lib/libc/include/generic-glibc/assert.h | 4 +-
.../include/generic-glibc/bits/argp-ldbl.h | 4 +-
.../include/generic-glibc/bits/byteswap.h | 4 +-
.../include/generic-glibc/bits/cmathcalls.h | 4 +-
.../include/generic-glibc/bits/confname.h | 4 +-
lib/libc/include/generic-glibc/bits/cpu-set.h | 4 +-
lib/libc/include/generic-glibc/bits/dirent.h | 4 +-
.../include/generic-glibc/bits/dirent_ext.h | 4 +-
lib/libc/include/generic-glibc/bits/dlfcn.h | 4 +-
lib/libc/include/generic-glibc/bits/endian.h | 56 ++++-
.../include/generic-glibc/bits/endianness.h | 16 ++
.../include/generic-glibc/bits/environments.h | 4 +-
lib/libc/include/generic-glibc/bits/epoll.h | 4 +-
.../include/generic-glibc/bits/err-ldbl.h | 4 +-
lib/libc/include/generic-glibc/bits/errno.h | 4 +-
.../include/generic-glibc/bits/error-ldbl.h | 4 +-
lib/libc/include/generic-glibc/bits/error.h | 4 +-
lib/libc/include/generic-glibc/bits/eventfd.h | 4 +-
.../include/generic-glibc/bits/fcntl-linux.h | 9 +-
lib/libc/include/generic-glibc/bits/fcntl.h | 4 +-
lib/libc/include/generic-glibc/bits/fcntl2.h | 4 +-
lib/libc/include/generic-glibc/bits/fenv.h | 6 +-
.../generic-glibc/bits/floatn-common.h | 4 +-
lib/libc/include/generic-glibc/bits/floatn.h | 4 +-
.../generic-glibc/bits/flt-eval-method.h | 4 +-
lib/libc/include/generic-glibc/bits/fp-fast.h | 4 +-
lib/libc/include/generic-glibc/bits/fp-logb.h | 4 +-
.../include/generic-glibc/bits/getopt_core.h | 4 +-
.../include/generic-glibc/bits/getopt_ext.h | 4 +-
.../include/generic-glibc/bits/getopt_posix.h | 4 +-
lib/libc/include/generic-glibc/bits/hwcap.h | 4 +-
lib/libc/include/generic-glibc/bits/in.h | 4 +-
.../generic-glibc/bits/indirect-return.h | 4 +-
lib/libc/include/generic-glibc/bits/inotify.h | 4 +-
.../include/generic-glibc/bits/ioctl-types.h | 4 +-
lib/libc/include/generic-glibc/bits/ioctls.h | 4 +-
.../include/generic-glibc/bits/ipc-perm.h | 40 +++
lib/libc/include/generic-glibc/bits/ipc.h | 21 +-
.../include/generic-glibc/bits/ipctypes.h | 4 +-
.../include/generic-glibc/bits/iscanonical.h | 4 +-
.../generic-glibc/bits/libc-header-start.h | 24 +-
.../generic-glibc/bits/libm-simd-decl-stubs.h | 4 +-
lib/libc/include/generic-glibc/bits/link.h | 4 +-
.../include/generic-glibc/bits/local_lim.h | 4 +-
lib/libc/include/generic-glibc/bits/locale.h | 4 +-
.../include/generic-glibc/bits/long-double.h | 7 +-
.../include/generic-glibc/bits/math-finite.h | 197 ---------------
.../include/generic-glibc/bits/math-vector.h | 4 +-
.../bits/mathcalls-helper-functions.h | 4 +-
.../generic-glibc/bits/mathcalls-narrow.h | 4 +-
.../include/generic-glibc/bits/mathcalls.h | 32 +--
lib/libc/include/generic-glibc/bits/mathdef.h | 4 +-
.../include/generic-glibc/bits/mman-linux.h | 6 +-
.../bits/mman-map-flags-generic.h | 4 +-
.../include/generic-glibc/bits/mman-shared.h | 4 +-
lib/libc/include/generic-glibc/bits/mman.h | 4 +-
.../generic-glibc/bits/monetary-ldbl.h | 4 +-
lib/libc/include/generic-glibc/bits/mqueue.h | 4 +-
lib/libc/include/generic-glibc/bits/mqueue2.h | 4 +-
lib/libc/include/generic-glibc/bits/msq-pad.h | 4 +-
lib/libc/include/generic-glibc/bits/msq.h | 4 +-
lib/libc/include/generic-glibc/bits/netdb.h | 4 +-
lib/libc/include/generic-glibc/bits/param.h | 4 +-
lib/libc/include/generic-glibc/bits/poll.h | 4 +-
lib/libc/include/generic-glibc/bits/poll2.h | 4 +-
.../include/generic-glibc/bits/posix1_lim.h | 4 +-
.../include/generic-glibc/bits/posix2_lim.h | 4 +-
.../include/generic-glibc/bits/posix_opt.h | 4 +-
lib/libc/include/generic-glibc/bits/ppc.h | 4 +-
.../include/generic-glibc/bits/printf-ldbl.h | 4 +-
.../include/generic-glibc/bits/procfs-extra.h | 4 +-
.../include/generic-glibc/bits/procfs-id.h | 4 +-
.../generic-glibc/bits/procfs-prregset.h | 4 +-
lib/libc/include/generic-glibc/bits/procfs.h | 4 +-
.../generic-glibc/bits/pthreadtypes-arch.h | 82 ++----
.../include/generic-glibc/bits/pthreadtypes.h | 4 +-
.../generic-glibc/bits/ptrace-shared.h | 51 +++-
.../include/generic-glibc/bits/resource.h | 4 +-
lib/libc/include/generic-glibc/bits/sched.h | 6 +-
lib/libc/include/generic-glibc/bits/select.h | 4 +-
lib/libc/include/generic-glibc/bits/select2.h | 4 +-
lib/libc/include/generic-glibc/bits/sem-pad.h | 4 +-
lib/libc/include/generic-glibc/bits/sem.h | 4 +-
.../include/generic-glibc/bits/semaphore.h | 4 +-
lib/libc/include/generic-glibc/bits/setjmp.h | 4 +-
lib/libc/include/generic-glibc/bits/setjmp2.h | 4 +-
lib/libc/include/generic-glibc/bits/shm-pad.h | 4 +-
lib/libc/include/generic-glibc/bits/shm.h | 4 +-
lib/libc/include/generic-glibc/bits/shmlba.h | 4 +-
.../include/generic-glibc/bits/sigaction.h | 4 +-
.../include/generic-glibc/bits/sigcontext.h | 4 +-
.../generic-glibc/bits/sigevent-consts.h | 4 +-
.../generic-glibc/bits/siginfo-consts.h | 4 +-
.../include/generic-glibc/bits/signal_ext.h | 4 +-
.../include/generic-glibc/bits/signalfd.h | 4 +-
.../generic-glibc/bits/signum-generic.h | 4 +-
lib/libc/include/generic-glibc/bits/signum.h | 4 +-
.../include/generic-glibc/bits/sigstack.h | 4 +-
.../include/generic-glibc/bits/sigthread.h | 4 +-
.../include/generic-glibc/bits/sockaddr.h | 4 +-
.../generic-glibc/bits/socket-constants.h | 4 +-
lib/libc/include/generic-glibc/bits/socket.h | 6 +-
lib/libc/include/generic-glibc/bits/socket2.h | 4 +-
.../include/generic-glibc/bits/socket_type.h | 4 +-
.../include/generic-glibc/bits/ss_flags.h | 4 +-
lib/libc/include/generic-glibc/bits/stab.def | 4 +-
lib/libc/include/generic-glibc/bits/stat.h | 4 +-
lib/libc/include/generic-glibc/bits/statfs.h | 4 +-
lib/libc/include/generic-glibc/bits/statvfs.h | 4 +-
.../generic-glibc/bits/statx-generic.h | 4 +-
lib/libc/include/generic-glibc/bits/statx.h | 16 +-
.../include/generic-glibc/bits/stdint-intn.h | 4 +-
.../include/generic-glibc/bits/stdint-uintn.h | 4 +-
.../include/generic-glibc/bits/stdio-ldbl.h | 4 +-
lib/libc/include/generic-glibc/bits/stdio.h | 4 +-
lib/libc/include/generic-glibc/bits/stdio2.h | 4 +-
.../include/generic-glibc/bits/stdio_lim.h | 4 +-
.../generic-glibc/bits/stdlib-bsearch.h | 4 +-
.../include/generic-glibc/bits/stdlib-float.h | 4 +-
.../include/generic-glibc/bits/stdlib-ldbl.h | 6 +-
lib/libc/include/generic-glibc/bits/stdlib.h | 4 +-
.../generic-glibc/bits/string_fortified.h | 4 +-
.../generic-glibc/bits/strings_fortified.h | 4 +-
.../include/generic-glibc/bits/struct_mutex.h | 84 +++++++
.../bits/struct_rwlock.h} | 86 +++----
.../include/generic-glibc/bits/sys_errlist.h | 4 +-
lib/libc/include/generic-glibc/bits/syscall.h | 12 +-
.../include/generic-glibc/bits/syslog-ldbl.h | 4 +-
.../include/generic-glibc/bits/syslog-path.h | 4 +-
lib/libc/include/generic-glibc/bits/syslog.h | 4 +-
.../include/generic-glibc/bits/sysmacros.h | 4 +-
.../include/generic-glibc/bits/termios-baud.h | 4 +-
.../include/generic-glibc/bits/termios-c_cc.h | 4 +-
.../generic-glibc/bits/termios-c_cflag.h | 4 +-
.../generic-glibc/bits/termios-c_iflag.h | 4 +-
.../generic-glibc/bits/termios-c_lflag.h | 4 +-
.../generic-glibc/bits/termios-c_oflag.h | 4 +-
.../include/generic-glibc/bits/termios-misc.h | 4 +-
.../generic-glibc/bits/termios-struct.h | 4 +-
.../generic-glibc/bits/termios-tcflow.h | 4 +-
lib/libc/include/generic-glibc/bits/termios.h | 4 +-
.../generic-glibc/bits/thread-shared-types.h | 137 +++-------
lib/libc/include/generic-glibc/bits/time.h | 4 +-
lib/libc/include/generic-glibc/bits/time64.h | 4 +-
lib/libc/include/generic-glibc/bits/timerfd.h | 4 +-
.../include/generic-glibc/bits/timesize.h | 4 +-
lib/libc/include/generic-glibc/bits/timex.h | 4 +-
lib/libc/include/generic-glibc/bits/types.h | 4 +-
.../generic-glibc/bits/types/__locale_t.h | 4 +-
.../generic-glibc/bits/types/__sigval_t.h | 4 +-
.../bits/types/cookie_io_functions_t.h | 4 +-
.../generic-glibc/bits/types/error_t.h | 4 +-
.../generic-glibc/bits/types/locale_t.h | 4 +-
.../generic-glibc/bits/types/stack_t.h | 4 +-
.../generic-glibc/bits/types/struct_FILE.h | 4 +-
.../generic-glibc/bits/types/struct_iovec.h | 4 +-
.../generic-glibc/bits/types/struct_rusage.h | 4 +-
.../bits/types/struct_sched_param.h | 4 +-
.../bits/types/struct_sigstack.h | 4 +-
.../generic-glibc/bits/types/struct_statx.h | 4 +-
.../bits/types/struct_statx_timestamp.h | 4 +-
.../bits/types/struct_timespec.h | 13 +
.../include/generic-glibc/bits/typesizes.h | 9 +-
.../generic-glibc/bits/uintn-identity.h | 4 +-
lib/libc/include/generic-glibc/bits/uio-ext.h | 4 +-
lib/libc/include/generic-glibc/bits/uio_lim.h | 4 +-
lib/libc/include/generic-glibc/bits/unistd.h | 4 +-
.../include/generic-glibc/bits/unistd_ext.h | 4 +-
lib/libc/include/generic-glibc/bits/utmp.h | 9 +-
lib/libc/include/generic-glibc/bits/utmpx.h | 16 +-
lib/libc/include/generic-glibc/bits/utsname.h | 4 +-
.../include/generic-glibc/bits/waitflags.h | 4 +-
.../include/generic-glibc/bits/waitstatus.h | 4 +-
.../include/generic-glibc/bits/wchar-ldbl.h | 4 +-
lib/libc/include/generic-glibc/bits/wchar.h | 4 +-
lib/libc/include/generic-glibc/bits/wchar2.h | 4 +-
.../include/generic-glibc/bits/wctype-wchar.h | 6 +-
.../include/generic-glibc/bits/wordsize.h | 4 +-
.../include/generic-glibc/bits/xopen_lim.h | 4 +-
lib/libc/include/generic-glibc/byteswap.h | 4 +-
lib/libc/include/generic-glibc/complex.h | 4 +-
lib/libc/include/generic-glibc/cpio.h | 4 +-
lib/libc/include/generic-glibc/crypt.h | 4 +-
lib/libc/include/generic-glibc/ctype.h | 6 +-
lib/libc/include/generic-glibc/dirent.h | 4 +-
lib/libc/include/generic-glibc/dlfcn.h | 4 +-
lib/libc/include/generic-glibc/elf.h | 9 +-
lib/libc/include/generic-glibc/endian.h | 33 +--
lib/libc/include/generic-glibc/envz.h | 4 +-
lib/libc/include/generic-glibc/err.h | 4 +-
lib/libc/include/generic-glibc/errno.h | 4 +-
lib/libc/include/generic-glibc/error.h | 4 +-
lib/libc/include/generic-glibc/execinfo.h | 4 +-
lib/libc/include/generic-glibc/fcntl.h | 5 +-
lib/libc/include/generic-glibc/features.h | 27 +-
lib/libc/include/generic-glibc/fenv.h | 12 +-
.../finclude/math-vector-fortran.h | 4 +-
lib/libc/include/generic-glibc/fmtmsg.h | 4 +-
lib/libc/include/generic-glibc/fnmatch.h | 4 +-
lib/libc/include/generic-glibc/fpregdef.h | 4 +-
lib/libc/include/generic-glibc/fpu_control.h | 5 +-
lib/libc/include/generic-glibc/fts.h | 4 +-
lib/libc/include/generic-glibc/ftw.h | 4 +-
lib/libc/include/generic-glibc/gconv.h | 4 +-
lib/libc/include/generic-glibc/getopt.h | 4 +-
lib/libc/include/generic-glibc/glob.h | 4 +-
lib/libc/include/generic-glibc/gnu-versions.h | 4 +-
.../include/generic-glibc/gnu/libc-version.h | 4 +-
lib/libc/include/generic-glibc/grp.h | 4 +-
lib/libc/include/generic-glibc/gshadow.h | 4 +-
lib/libc/include/generic-glibc/iconv.h | 4 +-
lib/libc/include/generic-glibc/ieee754.h | 8 +-
lib/libc/include/generic-glibc/ifaddrs.h | 4 +-
lib/libc/include/generic-glibc/inttypes.h | 4 +-
lib/libc/include/generic-glibc/langinfo.h | 4 +-
lib/libc/include/generic-glibc/libgen.h | 4 +-
lib/libc/include/generic-glibc/libintl.h | 4 +-
lib/libc/include/generic-glibc/limits.h | 6 +-
lib/libc/include/generic-glibc/link.h | 4 +-
lib/libc/include/generic-glibc/locale.h | 4 +-
lib/libc/include/generic-glibc/malloc.h | 7 +-
lib/libc/include/generic-glibc/math.h | 236 +-----------------
lib/libc/include/generic-glibc/mcheck.h | 4 +-
lib/libc/include/generic-glibc/memory.h | 4 +-
lib/libc/include/generic-glibc/mntent.h | 4 +-
lib/libc/include/generic-glibc/monetary.h | 4 +-
lib/libc/include/generic-glibc/mqueue.h | 4 +-
lib/libc/include/generic-glibc/net/ethernet.h | 4 +-
lib/libc/include/generic-glibc/net/if.h | 4 +-
lib/libc/include/generic-glibc/net/if_arp.h | 4 +-
.../include/generic-glibc/net/if_packet.h | 4 +-
.../include/generic-glibc/net/if_shaper.h | 4 +-
lib/libc/include/generic-glibc/net/if_slip.h | 4 +-
lib/libc/include/generic-glibc/net/route.h | 4 +-
lib/libc/include/generic-glibc/netash/ash.h | 4 +-
lib/libc/include/generic-glibc/netatalk/at.h | 4 +-
lib/libc/include/generic-glibc/netax25/ax25.h | 4 +-
lib/libc/include/generic-glibc/netdb.h | 4 +-
lib/libc/include/generic-glibc/neteconet/ec.h | 4 +-
.../include/generic-glibc/netinet/ether.h | 4 +-
.../include/generic-glibc/netinet/icmp6.h | 4 +-
.../include/generic-glibc/netinet/if_ether.h | 4 +-
.../include/generic-glibc/netinet/if_fddi.h | 4 +-
.../include/generic-glibc/netinet/if_tr.h | 4 +-
lib/libc/include/generic-glibc/netinet/igmp.h | 4 +-
lib/libc/include/generic-glibc/netinet/in.h | 4 +-
.../include/generic-glibc/netinet/in_systm.h | 4 +-
lib/libc/include/generic-glibc/netinet/ip.h | 4 +-
lib/libc/include/generic-glibc/netinet/ip6.h | 4 +-
.../include/generic-glibc/netinet/ip_icmp.h | 4 +-
lib/libc/include/generic-glibc/netinet/tcp.h | 1 +
lib/libc/include/generic-glibc/netinet/udp.h | 4 +-
lib/libc/include/generic-glibc/netipx/ipx.h | 4 +-
lib/libc/include/generic-glibc/netiucv/iucv.h | 4 +-
.../include/generic-glibc/netpacket/packet.h | 4 +-
.../include/generic-glibc/netrom/netrom.h | 4 +-
lib/libc/include/generic-glibc/netrose/rose.h | 4 +-
lib/libc/include/generic-glibc/nl_types.h | 4 +-
lib/libc/include/generic-glibc/nss.h | 4 +-
lib/libc/include/generic-glibc/obstack.h | 4 +-
lib/libc/include/generic-glibc/printf.h | 4 +-
lib/libc/include/generic-glibc/proc_service.h | 4 +-
lib/libc/include/generic-glibc/pthread.h | 77 ++----
lib/libc/include/generic-glibc/pty.h | 4 +-
lib/libc/include/generic-glibc/pwd.h | 4 +-
lib/libc/include/generic-glibc/re_comp.h | 4 +-
lib/libc/include/generic-glibc/regdef.h | 5 +-
lib/libc/include/generic-glibc/regex.h | 2 +-
lib/libc/include/generic-glibc/regexp.h | 4 +-
lib/libc/include/generic-glibc/resolv.h | 1 +
lib/libc/include/generic-glibc/sched.h | 4 +-
lib/libc/include/generic-glibc/scsi/scsi.h | 4 +-
.../include/generic-glibc/scsi/scsi_ioctl.h | 4 +-
lib/libc/include/generic-glibc/scsi/sg.h | 4 +-
lib/libc/include/generic-glibc/search.h | 4 +-
lib/libc/include/generic-glibc/semaphore.h | 4 +-
lib/libc/include/generic-glibc/setjmp.h | 4 +-
lib/libc/include/generic-glibc/sgidefs.h | 5 +-
lib/libc/include/generic-glibc/sgtty.h | 4 +-
lib/libc/include/generic-glibc/shadow.h | 4 +-
lib/libc/include/generic-glibc/signal.h | 4 +-
lib/libc/include/generic-glibc/spawn.h | 4 +-
lib/libc/include/generic-glibc/stdc-predef.h | 4 +-
lib/libc/include/generic-glibc/stdint.h | 6 +-
lib/libc/include/generic-glibc/stdio.h | 4 +-
lib/libc/include/generic-glibc/stdio_ext.h | 4 +-
lib/libc/include/generic-glibc/stdlib.h | 6 +-
lib/libc/include/generic-glibc/string.h | 13 +-
lib/libc/include/generic-glibc/strings.h | 4 +-
lib/libc/include/generic-glibc/sys/acct.h | 6 +-
lib/libc/include/generic-glibc/sys/asm.h | 5 +-
lib/libc/include/generic-glibc/sys/auxv.h | 4 +-
lib/libc/include/generic-glibc/sys/cachectl.h | 4 +-
lib/libc/include/generic-glibc/sys/cdefs.h | 12 +-
lib/libc/include/generic-glibc/sys/debugreg.h | 4 +-
lib/libc/include/generic-glibc/sys/dir.h | 4 +-
lib/libc/include/generic-glibc/sys/elf.h | 4 +-
lib/libc/include/generic-glibc/sys/epoll.h | 4 +-
lib/libc/include/generic-glibc/sys/eventfd.h | 4 +-
lib/libc/include/generic-glibc/sys/fanotify.h | 4 +-
lib/libc/include/generic-glibc/sys/file.h | 4 +-
lib/libc/include/generic-glibc/sys/fpregdef.h | 4 +-
lib/libc/include/generic-glibc/sys/fsuid.h | 4 +-
lib/libc/include/generic-glibc/sys/gmon_out.h | 4 +-
lib/libc/include/generic-glibc/sys/ifunc.h | 4 +-
lib/libc/include/generic-glibc/sys/inotify.h | 4 +-
lib/libc/include/generic-glibc/sys/io.h | 4 +-
lib/libc/include/generic-glibc/sys/ioctl.h | 4 +-
lib/libc/include/generic-glibc/sys/ipc.h | 4 +-
lib/libc/include/generic-glibc/sys/kd.h | 4 +-
lib/libc/include/generic-glibc/sys/klog.h | 4 +-
lib/libc/include/generic-glibc/sys/mman.h | 4 +-
lib/libc/include/generic-glibc/sys/mount.h | 4 +-
lib/libc/include/generic-glibc/sys/msg.h | 4 +-
lib/libc/include/generic-glibc/sys/mtio.h | 4 +-
lib/libc/include/generic-glibc/sys/param.h | 4 +-
lib/libc/include/generic-glibc/sys/pci.h | 4 +-
lib/libc/include/generic-glibc/sys/perm.h | 4 +-
.../include/generic-glibc/sys/personality.h | 4 +-
.../include/generic-glibc/sys/platform/ppc.h | 4 +-
lib/libc/include/generic-glibc/sys/poll.h | 4 +-
lib/libc/include/generic-glibc/sys/prctl.h | 4 +-
lib/libc/include/generic-glibc/sys/procfs.h | 4 +-
lib/libc/include/generic-glibc/sys/profil.h | 4 +-
lib/libc/include/generic-glibc/sys/ptrace.h | 10 +-
lib/libc/include/generic-glibc/sys/quota.h | 4 +-
lib/libc/include/generic-glibc/sys/random.h | 4 +-
lib/libc/include/generic-glibc/sys/raw.h | 4 +-
lib/libc/include/generic-glibc/sys/reboot.h | 4 +-
lib/libc/include/generic-glibc/sys/reg.h | 4 +-
lib/libc/include/generic-glibc/sys/regdef.h | 5 +-
lib/libc/include/generic-glibc/sys/resource.h | 4 +-
lib/libc/include/generic-glibc/sys/select.h | 4 +-
lib/libc/include/generic-glibc/sys/sem.h | 4 +-
lib/libc/include/generic-glibc/sys/sendfile.h | 4 +-
lib/libc/include/generic-glibc/sys/shm.h | 4 +-
lib/libc/include/generic-glibc/sys/signalfd.h | 4 +-
lib/libc/include/generic-glibc/sys/socket.h | 4 +-
lib/libc/include/generic-glibc/sys/stat.h | 4 +-
lib/libc/include/generic-glibc/sys/statfs.h | 4 +-
lib/libc/include/generic-glibc/sys/statvfs.h | 4 +-
lib/libc/include/generic-glibc/sys/swap.h | 4 +-
lib/libc/include/generic-glibc/sys/syscall.h | 15 +-
lib/libc/include/generic-glibc/sys/sysctl.h | 4 +-
lib/libc/include/generic-glibc/sys/sysinfo.h | 4 +-
.../include/generic-glibc/sys/sysmacros.h | 4 +-
lib/libc/include/generic-glibc/sys/sysmips.h | 4 +-
lib/libc/include/generic-glibc/sys/tas.h | 4 +-
lib/libc/include/generic-glibc/sys/time.h | 27 +-
lib/libc/include/generic-glibc/sys/timeb.h | 7 +-
lib/libc/include/generic-glibc/sys/timerfd.h | 4 +-
lib/libc/include/generic-glibc/sys/times.h | 4 +-
lib/libc/include/generic-glibc/sys/timex.h | 4 +-
lib/libc/include/generic-glibc/sys/types.h | 4 +-
lib/libc/include/generic-glibc/sys/ucontext.h | 4 +-
lib/libc/include/generic-glibc/sys/uio.h | 4 +-
lib/libc/include/generic-glibc/sys/un.h | 4 +-
lib/libc/include/generic-glibc/sys/user.h | 4 +-
lib/libc/include/generic-glibc/sys/utsname.h | 4 +-
lib/libc/include/generic-glibc/sys/vlimit.h | 4 +-
lib/libc/include/generic-glibc/sys/vm86.h | 4 +-
lib/libc/include/generic-glibc/sys/vtimes.h | 4 +-
lib/libc/include/generic-glibc/sys/wait.h | 4 +-
lib/libc/include/generic-glibc/sys/xattr.h | 4 +-
lib/libc/include/generic-glibc/tar.h | 4 +-
lib/libc/include/generic-glibc/termios.h | 4 +-
lib/libc/include/generic-glibc/tgmath.h | 197 +++++++++++++--
lib/libc/include/generic-glibc/thread_db.h | 4 +-
lib/libc/include/generic-glibc/threads.h | 4 +-
lib/libc/include/generic-glibc/time.h | 18 +-
lib/libc/include/generic-glibc/uchar.h | 4 +-
lib/libc/include/generic-glibc/ucontext.h | 4 +-
lib/libc/include/generic-glibc/ulimit.h | 4 +-
lib/libc/include/generic-glibc/unistd.h | 4 +-
lib/libc/include/generic-glibc/utime.h | 4 +-
lib/libc/include/generic-glibc/utmp.h | 4 +-
lib/libc/include/generic-glibc/utmpx.h | 4 +-
lib/libc/include/generic-glibc/values.h | 4 +-
lib/libc/include/generic-glibc/wchar.h | 7 +-
lib/libc/include/generic-glibc/wctype.h | 4 +-
lib/libc/include/generic-glibc/wordexp.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/endian.h | 7 -
.../include/i386-linux-gnu/bits/endianness.h | 11 +
.../i386-linux-gnu/bits/environments.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/epoll.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/fcntl.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/fenv.h | 6 +-
lib/libc/include/i386-linux-gnu/bits/floatn.h | 4 +-
.../i386-linux-gnu/bits/flt-eval-method.h | 4 +-
.../include/i386-linux-gnu/bits/fp-logb.h | 4 +-
.../i386-linux-gnu/bits/indirect-return.h | 4 +-
.../include/i386-linux-gnu/bits/ipctypes.h | 4 +-
.../include/i386-linux-gnu/bits/iscanonical.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/link.h | 4 +-
.../include/i386-linux-gnu/bits/long-double.h | 7 +-
.../include/i386-linux-gnu/bits/math-vector.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/mman.h | 4 +-
.../include/i386-linux-gnu/bits/procfs-id.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/procfs.h | 4 +-
.../i386-linux-gnu/bits/pthreadtypes-arch.h | 55 +---
lib/libc/include/i386-linux-gnu/bits/select.h | 4 +-
.../include/i386-linux-gnu/bits/sem-pad.h | 4 +-
.../include/i386-linux-gnu/bits/semaphore.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/setjmp.h | 4 +-
.../include/i386-linux-gnu/bits/sigcontext.h | 4 +-
lib/libc/include/i386-linux-gnu/bits/stat.h | 4 +-
.../i386-linux-gnu/bits/struct_mutex.h | 63 +++++
.../bits/struct_rwlock.h} | 80 +++---
lib/libc/include/i386-linux-gnu/bits/sysctl.h | 4 +-
.../include/i386-linux-gnu/bits/timesize.h | 4 +-
.../include/i386-linux-gnu/bits/typesizes.h | 9 +-
.../finclude/math-vector-fortran.h | 4 +-
lib/libc/include/i386-linux-gnu/fpu_control.h | 4 +-
lib/libc/include/i386-linux-gnu/sys/elf.h | 4 +-
lib/libc/include/i386-linux-gnu/sys/ptrace.h | 10 +-
.../include/i386-linux-gnu/sys/ucontext.h | 4 +-
lib/libc/include/i386-linux-gnu/sys/user.h | 4 +-
lib/libc/include/mips-linux-gnu/bits/dlfcn.h | 4 +-
lib/libc/include/mips-linux-gnu/bits/errno.h | 4 +-
.../include/mips-linux-gnu/bits/eventfd.h | 4 +-
.../include/mips-linux-gnu/bits/inotify.h | 4 +-
.../include/mips-linux-gnu/bits/ioctl-types.h | 4 +-
lib/libc/include/mips-linux-gnu/bits/ipc.h | 54 ----
.../include/mips-linux-gnu/bits/ipctypes.h | 4 +-
.../include/mips-linux-gnu/bits/local_lim.h | 4 +-
lib/libc/include/mips-linux-gnu/bits/mman.h | 4 +-
.../include/mips-linux-gnu/bits/msq-pad.h | 4 +-
lib/libc/include/mips-linux-gnu/bits/poll.h | 4 +-
.../mips-linux-gnu/bits/pthreadtypes-arch.h | 44 ++++
.../include/mips-linux-gnu/bits/resource.h | 4 +-
.../include/mips-linux-gnu/bits/sem-pad.h | 4 +-
.../include/mips-linux-gnu/bits/shm-pad.h | 4 +-
lib/libc/include/mips-linux-gnu/bits/shmlba.h | 4 +-
.../include/mips-linux-gnu/bits/sigaction.h | 4 +-
.../include/mips-linux-gnu/bits/sigcontext.h | 4 +-
.../include/mips-linux-gnu/bits/signalfd.h | 4 +-
lib/libc/include/mips-linux-gnu/bits/signum.h | 4 +-
.../mips-linux-gnu/bits/socket-constants.h | 4 +-
.../include/mips-linux-gnu/bits/socket_type.h | 4 +-
lib/libc/include/mips-linux-gnu/bits/statfs.h | 4 +-
.../mips-linux-gnu/bits/struct_mutex.h | 56 +++++
.../mips-linux-gnu/bits/termios-c_cc.h | 4 +-
.../mips-linux-gnu/bits/termios-c_lflag.h | 4 +-
.../mips-linux-gnu/bits/termios-struct.h | 4 +-
.../mips-linux-gnu/bits/termios-tcflow.h | 4 +-
.../include/mips-linux-gnu/bits/timerfd.h | 4 +-
.../mips-linux-gnu/bits/types/stack_t.h | 4 +-
lib/libc/include/mips-linux-gnu/ieee754.h | 21 +-
.../mips64-linux-gnuabi64/bits/dlfcn.h | 4 +-
.../mips64-linux-gnuabi64/bits/errno.h | 4 +-
.../mips64-linux-gnuabi64/bits/eventfd.h | 4 +-
.../mips64-linux-gnuabi64/bits/inotify.h | 4 +-
.../mips64-linux-gnuabi64/bits/ioctl-types.h | 4 +-
.../include/mips64-linux-gnuabi64/bits/ipc.h | 54 ----
.../mips64-linux-gnuabi64/bits/ipctypes.h | 4 +-
.../mips64-linux-gnuabi64/bits/local_lim.h | 4 +-
.../include/mips64-linux-gnuabi64/bits/mman.h | 4 +-
.../mips64-linux-gnuabi64/bits/msq-pad.h | 4 +-
.../include/mips64-linux-gnuabi64/bits/poll.h | 4 +-
.../bits/pthreadtypes-arch.h | 44 ++++
.../mips64-linux-gnuabi64/bits/resource.h | 4 +-
.../mips64-linux-gnuabi64/bits/sem-pad.h | 4 +-
.../mips64-linux-gnuabi64/bits/shm-pad.h | 4 +-
.../mips64-linux-gnuabi64/bits/shmlba.h | 4 +-
.../mips64-linux-gnuabi64/bits/sigaction.h | 4 +-
.../mips64-linux-gnuabi64/bits/sigcontext.h | 4 +-
.../mips64-linux-gnuabi64/bits/signalfd.h | 4 +-
.../mips64-linux-gnuabi64/bits/signum.h | 4 +-
.../bits/socket-constants.h | 4 +-
.../mips64-linux-gnuabi64/bits/socket_type.h | 4 +-
.../mips64-linux-gnuabi64/bits/statfs.h | 4 +-
.../mips64-linux-gnuabi64/bits/struct_mutex.h | 56 +++++
.../mips64-linux-gnuabi64/bits/termios-c_cc.h | 4 +-
.../bits/termios-c_lflag.h | 4 +-
.../bits/termios-struct.h | 4 +-
.../bits/termios-tcflow.h | 4 +-
.../mips64-linux-gnuabi64/bits/timerfd.h | 4 +-
.../bits/types/stack_t.h | 4 +-
.../include/mips64-linux-gnuabi64/ieee754.h | 21 +-
.../mips64-linux-gnuabin32/bits/dlfcn.h | 4 +-
.../mips64-linux-gnuabin32/bits/errno.h | 4 +-
.../mips64-linux-gnuabin32/bits/eventfd.h | 4 +-
.../mips64-linux-gnuabin32/bits/inotify.h | 4 +-
.../mips64-linux-gnuabin32/bits/ioctl-types.h | 4 +-
.../include/mips64-linux-gnuabin32/bits/ipc.h | 54 ----
.../mips64-linux-gnuabin32/bits/ipctypes.h | 4 +-
.../mips64-linux-gnuabin32/bits/local_lim.h | 4 +-
.../mips64-linux-gnuabin32/bits/mman.h | 4 +-
.../mips64-linux-gnuabin32/bits/msq-pad.h | 4 +-
.../mips64-linux-gnuabin32/bits/poll.h | 4 +-
.../bits/pthreadtypes-arch.h | 44 ++++
.../mips64-linux-gnuabin32/bits/resource.h | 4 +-
.../mips64-linux-gnuabin32/bits/sem-pad.h | 4 +-
.../mips64-linux-gnuabin32/bits/shm-pad.h | 4 +-
.../mips64-linux-gnuabin32/bits/shmlba.h | 4 +-
.../mips64-linux-gnuabin32/bits/sigaction.h | 4 +-
.../mips64-linux-gnuabin32/bits/sigcontext.h | 4 +-
.../mips64-linux-gnuabin32/bits/signalfd.h | 4 +-
.../mips64-linux-gnuabin32/bits/signum.h | 4 +-
.../bits/socket-constants.h | 4 +-
.../mips64-linux-gnuabin32/bits/socket_type.h | 4 +-
.../mips64-linux-gnuabin32/bits/statfs.h | 4 +-
.../bits/struct_mutex.h | 56 +++++
.../bits/termios-c_cc.h | 4 +-
.../bits/termios-c_lflag.h | 4 +-
.../bits/termios-struct.h | 4 +-
.../bits/termios-tcflow.h | 4 +-
.../mips64-linux-gnuabin32/bits/timerfd.h | 4 +-
.../bits/types/stack_t.h | 4 +-
.../include/mips64-linux-gnuabin32/ieee754.h | 21 +-
.../mips64el-linux-gnuabi64/bits/dlfcn.h | 4 +-
.../mips64el-linux-gnuabi64/bits/errno.h | 4 +-
.../mips64el-linux-gnuabi64/bits/eventfd.h | 4 +-
.../mips64el-linux-gnuabi64/bits/inotify.h | 4 +-
.../bits/ioctl-types.h | 4 +-
.../mips64el-linux-gnuabi64/bits/ipc.h | 54 ----
.../mips64el-linux-gnuabi64/bits/ipctypes.h | 4 +-
.../mips64el-linux-gnuabi64/bits/local_lim.h | 4 +-
.../mips64el-linux-gnuabi64/bits/mman.h | 4 +-
.../mips64el-linux-gnuabi64/bits/msq-pad.h | 4 +-
.../mips64el-linux-gnuabi64/bits/poll.h | 4 +-
.../bits/pthreadtypes-arch.h | 44 ++++
.../mips64el-linux-gnuabi64/bits/resource.h | 4 +-
.../mips64el-linux-gnuabi64/bits/sem-pad.h | 4 +-
.../mips64el-linux-gnuabi64/bits/shm-pad.h | 4 +-
.../mips64el-linux-gnuabi64/bits/shmlba.h | 4 +-
.../mips64el-linux-gnuabi64/bits/sigaction.h | 4 +-
.../mips64el-linux-gnuabi64/bits/sigcontext.h | 4 +-
.../mips64el-linux-gnuabi64/bits/signalfd.h | 4 +-
.../mips64el-linux-gnuabi64/bits/signum.h | 4 +-
.../bits/socket-constants.h | 4 +-
.../bits/socket_type.h | 4 +-
.../mips64el-linux-gnuabi64/bits/statfs.h | 4 +-
.../bits/struct_mutex.h | 56 +++++
.../bits/termios-c_cc.h | 4 +-
.../bits/termios-c_lflag.h | 4 +-
.../bits/termios-struct.h | 4 +-
.../bits/termios-tcflow.h | 4 +-
.../mips64el-linux-gnuabi64/bits/timerfd.h | 4 +-
.../bits/types/stack_t.h | 4 +-
.../include/mips64el-linux-gnuabi64/ieee754.h | 21 +-
.../mips64el-linux-gnuabin32/bits/dlfcn.h | 4 +-
.../mips64el-linux-gnuabin32/bits/errno.h | 4 +-
.../mips64el-linux-gnuabin32/bits/eventfd.h | 4 +-
.../mips64el-linux-gnuabin32/bits/inotify.h | 4 +-
.../bits/ioctl-types.h | 4 +-
.../mips64el-linux-gnuabin32/bits/ipc.h | 54 ----
.../mips64el-linux-gnuabin32/bits/ipctypes.h | 4 +-
.../mips64el-linux-gnuabin32/bits/local_lim.h | 4 +-
.../mips64el-linux-gnuabin32/bits/mman.h | 4 +-
.../mips64el-linux-gnuabin32/bits/msq-pad.h | 4 +-
.../mips64el-linux-gnuabin32/bits/poll.h | 4 +-
.../bits/pthreadtypes-arch.h | 44 ++++
.../mips64el-linux-gnuabin32/bits/resource.h | 4 +-
.../mips64el-linux-gnuabin32/bits/sem-pad.h | 4 +-
.../mips64el-linux-gnuabin32/bits/shm-pad.h | 4 +-
.../mips64el-linux-gnuabin32/bits/shmlba.h | 4 +-
.../mips64el-linux-gnuabin32/bits/sigaction.h | 4 +-
.../bits/sigcontext.h | 4 +-
.../mips64el-linux-gnuabin32/bits/signalfd.h | 4 +-
.../mips64el-linux-gnuabin32/bits/signum.h | 4 +-
.../bits/socket-constants.h | 4 +-
.../bits/socket_type.h | 4 +-
.../mips64el-linux-gnuabin32/bits/statfs.h | 4 +-
.../bits/struct_mutex.h | 56 +++++
.../bits/termios-c_cc.h | 4 +-
.../bits/termios-c_lflag.h | 4 +-
.../bits/termios-struct.h | 4 +-
.../bits/termios-tcflow.h | 4 +-
.../mips64el-linux-gnuabin32/bits/timerfd.h | 4 +-
.../bits/types/stack_t.h | 4 +-
.../mips64el-linux-gnuabin32/ieee754.h | 21 +-
.../include/mipsel-linux-gnu/bits/dlfcn.h | 4 +-
.../include/mipsel-linux-gnu/bits/errno.h | 4 +-
.../include/mipsel-linux-gnu/bits/eventfd.h | 4 +-
.../include/mipsel-linux-gnu/bits/inotify.h | 4 +-
.../mipsel-linux-gnu/bits/ioctl-types.h | 4 +-
lib/libc/include/mipsel-linux-gnu/bits/ipc.h | 54 ----
.../include/mipsel-linux-gnu/bits/ipctypes.h | 4 +-
.../include/mipsel-linux-gnu/bits/local_lim.h | 4 +-
lib/libc/include/mipsel-linux-gnu/bits/mman.h | 4 +-
.../include/mipsel-linux-gnu/bits/msq-pad.h | 4 +-
lib/libc/include/mipsel-linux-gnu/bits/poll.h | 4 +-
.../mipsel-linux-gnu/bits/pthreadtypes-arch.h | 44 ++++
.../include/mipsel-linux-gnu/bits/resource.h | 4 +-
.../include/mipsel-linux-gnu/bits/sem-pad.h | 4 +-
.../include/mipsel-linux-gnu/bits/shm-pad.h | 4 +-
.../include/mipsel-linux-gnu/bits/shmlba.h | 4 +-
.../include/mipsel-linux-gnu/bits/sigaction.h | 4 +-
.../mipsel-linux-gnu/bits/sigcontext.h | 4 +-
.../include/mipsel-linux-gnu/bits/signalfd.h | 4 +-
.../include/mipsel-linux-gnu/bits/signum.h | 4 +-
.../mipsel-linux-gnu/bits/socket-constants.h | 4 +-
.../mipsel-linux-gnu/bits/socket_type.h | 4 +-
.../include/mipsel-linux-gnu/bits/statfs.h | 4 +-
.../mipsel-linux-gnu/bits/struct_mutex.h | 56 +++++
.../mipsel-linux-gnu/bits/termios-c_cc.h | 4 +-
.../mipsel-linux-gnu/bits/termios-c_lflag.h | 4 +-
.../mipsel-linux-gnu/bits/termios-struct.h | 4 +-
.../mipsel-linux-gnu/bits/termios-tcflow.h | 4 +-
.../include/mipsel-linux-gnu/bits/timerfd.h | 4 +-
.../mipsel-linux-gnu/bits/types/stack_t.h | 4 +-
lib/libc/include/mipsel-linux-gnu/ieee754.h | 21 +-
.../powerpc-linux-gnu/bits/endianness.h | 16 ++
.../powerpc-linux-gnu/bits/environments.h | 4 +-
.../include/powerpc-linux-gnu/bits/fcntl.h | 4 +-
.../include/powerpc-linux-gnu/bits/fenv.h | 6 +-
.../powerpc-linux-gnu/bits/fenvinline.h | 4 +-
.../include/powerpc-linux-gnu/bits/floatn.h | 4 +-
.../include/powerpc-linux-gnu/bits/fp-fast.h | 4 +-
.../include/powerpc-linux-gnu/bits/hwcap.h | 4 +-
.../powerpc-linux-gnu/bits/ioctl-types.h | 4 +-
.../bits/ipc-perm.h} | 26 +-
.../powerpc-linux-gnu/bits/iscanonical.h | 4 +-
.../include/powerpc-linux-gnu/bits/link.h | 4 +-
.../powerpc-linux-gnu/bits/local_lim.h | 4 +-
.../powerpc-linux-gnu/bits/long-double.h | 7 +-
.../include/powerpc-linux-gnu/bits/mman.h | 6 +-
.../include/powerpc-linux-gnu/bits/msq-pad.h | 4 +-
.../include/powerpc-linux-gnu/bits/procfs.h | 4 +-
.../include/powerpc-linux-gnu/bits/sem-pad.h | 4 +-
.../powerpc-linux-gnu/bits/semaphore.h | 4 +-
.../include/powerpc-linux-gnu/bits/setjmp.h | 4 +-
.../include/powerpc-linux-gnu/bits/shm-pad.h | 4 +-
.../include/powerpc-linux-gnu/bits/sigstack.h | 4 +-
.../powerpc-linux-gnu/bits/socket-constants.h | 4 +-
.../include/powerpc-linux-gnu/bits/stat.h | 4 +-
.../powerpc-linux-gnu/bits/struct_mutex.h | 63 +++++
.../{pthreadtypes-arch.h => struct_rwlock.h} | 48 ++--
.../powerpc-linux-gnu/bits/termios-baud.h | 4 +-
.../powerpc-linux-gnu/bits/termios-c_cc.h | 4 +-
.../powerpc-linux-gnu/bits/termios-c_cflag.h | 4 +-
.../powerpc-linux-gnu/bits/termios-c_iflag.h | 4 +-
.../powerpc-linux-gnu/bits/termios-c_lflag.h | 4 +-
.../powerpc-linux-gnu/bits/termios-c_oflag.h | 4 +-
.../powerpc-linux-gnu/bits/termios-misc.h | 4 +-
.../include/powerpc-linux-gnu/fpu_control.h | 4 +-
lib/libc/include/powerpc-linux-gnu/ieee754.h | 8 +-
.../include/powerpc-linux-gnu/sys/ptrace.h | 15 +-
.../include/powerpc-linux-gnu/sys/ucontext.h | 12 +-
lib/libc/include/powerpc-linux-gnu/sys/user.h | 4 +-
.../powerpc64-linux-gnu/bits/endianness.h | 16 ++
.../powerpc64-linux-gnu/bits/environments.h | 4 +-
.../include/powerpc64-linux-gnu/bits/fcntl.h | 4 +-
.../include/powerpc64-linux-gnu/bits/fenv.h | 6 +-
.../powerpc64-linux-gnu/bits/fenvinline.h | 4 +-
.../include/powerpc64-linux-gnu/bits/floatn.h | 4 +-
.../powerpc64-linux-gnu/bits/fp-fast.h | 4 +-
.../include/powerpc64-linux-gnu/bits/hwcap.h | 4 +-
.../powerpc64-linux-gnu/bits/ioctl-types.h | 4 +-
.../bits/ipc-perm.h} | 26 +-
.../powerpc64-linux-gnu/bits/iscanonical.h | 4 +-
.../include/powerpc64-linux-gnu/bits/link.h | 4 +-
.../powerpc64-linux-gnu/bits/local_lim.h | 4 +-
.../powerpc64-linux-gnu/bits/long-double.h | 7 +-
.../include/powerpc64-linux-gnu/bits/mman.h | 6 +-
.../powerpc64-linux-gnu/bits/msq-pad.h | 4 +-
.../include/powerpc64-linux-gnu/bits/procfs.h | 4 +-
.../powerpc64-linux-gnu/bits/sem-pad.h | 4 +-
.../powerpc64-linux-gnu/bits/semaphore.h | 4 +-
.../include/powerpc64-linux-gnu/bits/setjmp.h | 4 +-
.../powerpc64-linux-gnu/bits/shm-pad.h | 4 +-
.../powerpc64-linux-gnu/bits/sigstack.h | 4 +-
.../bits/socket-constants.h | 4 +-
.../include/powerpc64-linux-gnu/bits/stat.h | 4 +-
.../powerpc64-linux-gnu/bits/struct_mutex.h | 63 +++++
.../{pthreadtypes-arch.h => struct_rwlock.h} | 48 ++--
.../powerpc64-linux-gnu/bits/termios-baud.h | 4 +-
.../powerpc64-linux-gnu/bits/termios-c_cc.h | 4 +-
.../bits/termios-c_cflag.h | 4 +-
.../bits/termios-c_iflag.h | 4 +-
.../bits/termios-c_lflag.h | 4 +-
.../bits/termios-c_oflag.h | 4 +-
.../powerpc64-linux-gnu/bits/termios-misc.h | 4 +-
.../include/powerpc64-linux-gnu/fpu_control.h | 4 +-
.../include/powerpc64-linux-gnu/ieee754.h | 8 +-
.../include/powerpc64-linux-gnu/sys/ptrace.h | 15 +-
.../powerpc64-linux-gnu/sys/ucontext.h | 12 +-
.../include/powerpc64-linux-gnu/sys/user.h | 4 +-
.../powerpc64le-linux-gnu/bits/endian.h | 36 ---
.../powerpc64le-linux-gnu/bits/endianness.h | 16 ++
.../powerpc64le-linux-gnu/bits/environments.h | 4 +-
.../powerpc64le-linux-gnu/bits/fcntl.h | 4 +-
.../include/powerpc64le-linux-gnu/bits/fenv.h | 6 +-
.../powerpc64le-linux-gnu/bits/fenvinline.h | 4 +-
.../powerpc64le-linux-gnu/bits/floatn.h | 4 +-
.../powerpc64le-linux-gnu/bits/fp-fast.h | 4 +-
.../powerpc64le-linux-gnu/bits/hwcap.h | 4 +-
.../powerpc64le-linux-gnu/bits/ioctl-types.h | 4 +-
.../bits/ipc-perm.h} | 26 +-
.../powerpc64le-linux-gnu/bits/iscanonical.h | 4 +-
.../include/powerpc64le-linux-gnu/bits/link.h | 4 +-
.../powerpc64le-linux-gnu/bits/local_lim.h | 4 +-
.../powerpc64le-linux-gnu/bits/long-double.h | 7 +-
.../include/powerpc64le-linux-gnu/bits/mman.h | 6 +-
.../powerpc64le-linux-gnu/bits/msq-pad.h | 4 +-
.../powerpc64le-linux-gnu/bits/procfs.h | 4 +-
.../powerpc64le-linux-gnu/bits/sem-pad.h | 4 +-
.../powerpc64le-linux-gnu/bits/semaphore.h | 4 +-
.../powerpc64le-linux-gnu/bits/setjmp.h | 4 +-
.../powerpc64le-linux-gnu/bits/shm-pad.h | 4 +-
.../powerpc64le-linux-gnu/bits/sigstack.h | 4 +-
.../bits/socket-constants.h | 4 +-
.../include/powerpc64le-linux-gnu/bits/stat.h | 4 +-
.../powerpc64le-linux-gnu/bits/struct_mutex.h | 63 +++++
.../{pthreadtypes-arch.h => struct_rwlock.h} | 48 ++--
.../powerpc64le-linux-gnu/bits/termios-baud.h | 4 +-
.../powerpc64le-linux-gnu/bits/termios-c_cc.h | 4 +-
.../bits/termios-c_cflag.h | 4 +-
.../bits/termios-c_iflag.h | 4 +-
.../bits/termios-c_lflag.h | 4 +-
.../bits/termios-c_oflag.h | 4 +-
.../powerpc64le-linux-gnu/bits/termios-misc.h | 4 +-
.../powerpc64le-linux-gnu/fpu_control.h | 4 +-
.../include/powerpc64le-linux-gnu/ieee754.h | 8 +-
.../powerpc64le-linux-gnu/sys/ptrace.h | 15 +-
.../powerpc64le-linux-gnu/sys/ucontext.h | 12 +-
.../include/powerpc64le-linux-gnu/sys/user.h | 4 +-
.../include/riscv64-linux-gnu/bits/endian.h | 5 -
.../riscv64-linux-gnu/bits/endianness.h | 11 +
.../include/riscv64-linux-gnu/bits/fcntl.h | 4 +-
.../include/riscv64-linux-gnu/bits/fenv.h | 6 +-
.../include/riscv64-linux-gnu/bits/floatn.h | 4 +-
.../include/riscv64-linux-gnu/bits/link.h | 4 +-
.../riscv64-linux-gnu/bits/long-double.h | 7 +-
.../include/riscv64-linux-gnu/bits/procfs.h | 4 +-
.../bits/pthreadtypes-arch.h | 33 +--
.../riscv64-linux-gnu/bits/semaphore.h | 4 +-
.../include/riscv64-linux-gnu/bits/setjmp.h | 4 +-
.../riscv64-linux-gnu/bits/sigcontext.h | 4 +-
.../include/riscv64-linux-gnu/bits/stat.h | 11 +-
.../include/riscv64-linux-gnu/bits/statfs.h | 8 +-
.../riscv64-linux-gnu/bits/struct_rwlock.h | 45 ++++
.../riscv64-linux-gnu/bits/typesizes.h | 10 +-
.../include/riscv64-linux-gnu/bits/wordsize.h | 4 +-
.../include/riscv64-linux-gnu/fpu_control.h | 4 +-
lib/libc/include/riscv64-linux-gnu/ieee754.h | 8 +-
lib/libc/include/riscv64-linux-gnu/sys/asm.h | 4 +-
.../include/riscv64-linux-gnu/sys/cachectl.h | 4 +-
.../include/riscv64-linux-gnu/sys/ucontext.h | 4 +-
lib/libc/include/riscv64-linux-gnu/sys/user.h | 4 +-
.../include/s390x-linux-gnu/bits/elfclass.h | 4 +-
.../include/s390x-linux-gnu/bits/endian.h | 7 -
.../include/s390x-linux-gnu/bits/endianness.h | 11 +
.../s390x-linux-gnu/bits/environments.h | 4 +-
lib/libc/include/s390x-linux-gnu/bits/fcntl.h | 4 +-
lib/libc/include/s390x-linux-gnu/bits/fenv.h | 6 +-
.../include/s390x-linux-gnu/bits/floatn.h | 4 +-
.../s390x-linux-gnu/bits/flt-eval-method.h | 4 +-
lib/libc/include/s390x-linux-gnu/bits/hwcap.h | 4 +-
lib/libc/include/s390x-linux-gnu/bits/ipc.h | 60 -----
lib/libc/include/s390x-linux-gnu/bits/link.h | 4 +-
.../s390x-linux-gnu/bits/long-double.h | 7 +-
.../s390x-linux-gnu/bits/procfs-extra.h | 4 +-
.../include/s390x-linux-gnu/bits/procfs-id.h | 4 +-
.../include/s390x-linux-gnu/bits/procfs.h | 4 +-
.../include/s390x-linux-gnu/bits/semaphore.h | 4 +-
.../include/s390x-linux-gnu/bits/setjmp.h | 4 +-
.../include/s390x-linux-gnu/bits/sigaction.h | 4 +-
lib/libc/include/s390x-linux-gnu/bits/stat.h | 4 +-
.../include/s390x-linux-gnu/bits/statfs.h | 4 +-
.../s390x-linux-gnu/bits/struct_mutex.h | 63 +++++
.../{pthreadtypes-arch.h => struct_rwlock.h} | 47 +---
.../include/s390x-linux-gnu/bits/typesizes.h | 9 +-
lib/libc/include/s390x-linux-gnu/bits/utmp.h | 7 +-
lib/libc/include/s390x-linux-gnu/bits/utmpx.h | 16 +-
.../include/s390x-linux-gnu/fpu_control.h | 4 +-
lib/libc/include/s390x-linux-gnu/ieee754.h | 8 +-
lib/libc/include/s390x-linux-gnu/sys/elf.h | 4 +-
lib/libc/include/s390x-linux-gnu/sys/ptrace.h | 13 +-
.../include/s390x-linux-gnu/sys/ucontext.h | 4 +-
lib/libc/include/s390x-linux-gnu/sys/user.h | 4 +-
.../bits/{endian.h => endianness.h} | 14 +-
.../sparc-linux-gnu/bits/environments.h | 4 +-
lib/libc/include/sparc-linux-gnu/bits/epoll.h | 4 +-
lib/libc/include/sparc-linux-gnu/bits/errno.h | 4 +-
.../include/sparc-linux-gnu/bits/eventfd.h | 4 +-
lib/libc/include/sparc-linux-gnu/bits/fcntl.h | 4 +-
lib/libc/include/sparc-linux-gnu/bits/fenv.h | 6 +-
.../include/sparc-linux-gnu/bits/floatn.h | 4 +-
lib/libc/include/sparc-linux-gnu/bits/hwcap.h | 4 +-
.../include/sparc-linux-gnu/bits/inotify.h | 4 +-
.../include/sparc-linux-gnu/bits/ioctls.h | 4 +-
.../ipc.h => sparc-linux-gnu/bits/ipc-perm.h} | 33 +--
lib/libc/include/sparc-linux-gnu/bits/link.h | 4 +-
.../include/sparc-linux-gnu/bits/local_lim.h | 4 +-
.../sparc-linux-gnu/bits/long-double.h | 7 +-
lib/libc/include/sparc-linux-gnu/bits/mman.h | 6 +-
.../include/sparc-linux-gnu/bits/msq-pad.h | 4 +-
lib/libc/include/sparc-linux-gnu/bits/poll.h | 4 +-
.../sparc-linux-gnu/bits/procfs-extra.h | 4 +-
.../include/sparc-linux-gnu/bits/procfs-id.h | 4 +-
.../include/sparc-linux-gnu/bits/procfs.h | 4 +-
.../include/sparc-linux-gnu/bits/resource.h | 4 +-
.../include/sparc-linux-gnu/bits/sem-pad.h | 4 +-
.../include/sparc-linux-gnu/bits/semaphore.h | 4 +-
.../include/sparc-linux-gnu/bits/setjmp.h | 4 +-
.../include/sparc-linux-gnu/bits/shm-pad.h | 4 +-
.../include/sparc-linux-gnu/bits/shmlba.h | 4 +-
.../include/sparc-linux-gnu/bits/sigaction.h | 4 +-
.../include/sparc-linux-gnu/bits/sigcontext.h | 4 +-
.../include/sparc-linux-gnu/bits/signalfd.h | 4 +-
.../include/sparc-linux-gnu/bits/signum.h | 4 +-
.../include/sparc-linux-gnu/bits/sigstack.h | 4 +-
.../sparc-linux-gnu/bits/socket-constants.h | 4 +-
.../sparc-linux-gnu/bits/socket_type.h | 4 +-
lib/libc/include/sparc-linux-gnu/bits/stat.h | 4 +-
.../{pthreadtypes-arch.h => struct_rwlock.h} | 49 +---
.../sparc-linux-gnu/bits/termios-baud.h | 4 +-
.../sparc-linux-gnu/bits/termios-c_cc.h | 4 +-
.../sparc-linux-gnu/bits/termios-c_oflag.h | 4 +-
.../sparc-linux-gnu/bits/termios-struct.h | 4 +-
.../include/sparc-linux-gnu/bits/timerfd.h | 4 +-
.../include/sparc-linux-gnu/bits/typesizes.h | 9 +-
.../include/sparc-linux-gnu/fpu_control.h | 4 +-
lib/libc/include/sparc-linux-gnu/ieee754.h | 8 +-
lib/libc/include/sparc-linux-gnu/sys/ptrace.h | 10 +-
.../include/sparc-linux-gnu/sys/ucontext.h | 4 +-
lib/libc/include/sparc-linux-gnu/sys/user.h | 4 +-
.../bits/{endian.h => endianness.h} | 14 +-
.../sparcv9-linux-gnu/bits/environments.h | 4 +-
.../include/sparcv9-linux-gnu/bits/epoll.h | 4 +-
.../include/sparcv9-linux-gnu/bits/errno.h | 4 +-
.../include/sparcv9-linux-gnu/bits/eventfd.h | 4 +-
.../include/sparcv9-linux-gnu/bits/fcntl.h | 4 +-
.../include/sparcv9-linux-gnu/bits/fenv.h | 6 +-
.../include/sparcv9-linux-gnu/bits/floatn.h | 4 +-
.../include/sparcv9-linux-gnu/bits/hwcap.h | 4 +-
.../include/sparcv9-linux-gnu/bits/inotify.h | 4 +-
.../include/sparcv9-linux-gnu/bits/ioctls.h | 4 +-
.../bits/ipc-perm.h} | 33 +--
.../include/sparcv9-linux-gnu/bits/link.h | 4 +-
.../sparcv9-linux-gnu/bits/local_lim.h | 4 +-
.../sparcv9-linux-gnu/bits/long-double.h | 7 +-
.../include/sparcv9-linux-gnu/bits/mman.h | 6 +-
.../include/sparcv9-linux-gnu/bits/msq-pad.h | 4 +-
.../include/sparcv9-linux-gnu/bits/poll.h | 4 +-
.../sparcv9-linux-gnu/bits/procfs-extra.h | 4 +-
.../sparcv9-linux-gnu/bits/procfs-id.h | 4 +-
.../include/sparcv9-linux-gnu/bits/procfs.h | 4 +-
.../include/sparcv9-linux-gnu/bits/resource.h | 4 +-
.../include/sparcv9-linux-gnu/bits/sem-pad.h | 4 +-
.../sparcv9-linux-gnu/bits/semaphore.h | 4 +-
.../include/sparcv9-linux-gnu/bits/setjmp.h | 4 +-
.../include/sparcv9-linux-gnu/bits/shm-pad.h | 4 +-
.../include/sparcv9-linux-gnu/bits/shmlba.h | 4 +-
.../sparcv9-linux-gnu/bits/sigaction.h | 4 +-
.../sparcv9-linux-gnu/bits/sigcontext.h | 4 +-
.../include/sparcv9-linux-gnu/bits/signalfd.h | 4 +-
.../include/sparcv9-linux-gnu/bits/signum.h | 4 +-
.../include/sparcv9-linux-gnu/bits/sigstack.h | 4 +-
.../sparcv9-linux-gnu/bits/socket-constants.h | 4 +-
.../sparcv9-linux-gnu/bits/socket_type.h | 4 +-
.../include/sparcv9-linux-gnu/bits/stat.h | 4 +-
.../{pthreadtypes-arch.h => struct_rwlock.h} | 49 +---
.../sparcv9-linux-gnu/bits/termios-baud.h | 4 +-
.../sparcv9-linux-gnu/bits/termios-c_cc.h | 4 +-
.../sparcv9-linux-gnu/bits/termios-c_oflag.h | 4 +-
.../sparcv9-linux-gnu/bits/termios-struct.h | 4 +-
.../include/sparcv9-linux-gnu/bits/timerfd.h | 4 +-
.../sparcv9-linux-gnu/bits/typesizes.h | 9 +-
.../include/sparcv9-linux-gnu/fpu_control.h | 4 +-
lib/libc/include/sparcv9-linux-gnu/ieee754.h | 8 +-
.../include/sparcv9-linux-gnu/sys/ptrace.h | 10 +-
.../include/sparcv9-linux-gnu/sys/ucontext.h | 4 +-
lib/libc/include/sparcv9-linux-gnu/sys/user.h | 4 +-
.../include/x86_64-linux-gnu/bits/endian.h | 7 -
.../x86_64-linux-gnu/bits/endianness.h | 11 +
.../x86_64-linux-gnu/bits/environments.h | 4 +-
.../include/x86_64-linux-gnu/bits/epoll.h | 4 +-
.../include/x86_64-linux-gnu/bits/fcntl.h | 4 +-
lib/libc/include/x86_64-linux-gnu/bits/fenv.h | 6 +-
.../include/x86_64-linux-gnu/bits/floatn.h | 4 +-
.../x86_64-linux-gnu/bits/flt-eval-method.h | 4 +-
.../include/x86_64-linux-gnu/bits/fp-logb.h | 4 +-
.../x86_64-linux-gnu/bits/indirect-return.h | 4 +-
.../include/x86_64-linux-gnu/bits/ipctypes.h | 4 +-
.../x86_64-linux-gnu/bits/iscanonical.h | 4 +-
lib/libc/include/x86_64-linux-gnu/bits/link.h | 4 +-
.../x86_64-linux-gnu/bits/long-double.h | 7 +-
.../x86_64-linux-gnu/bits/math-vector.h | 4 +-
lib/libc/include/x86_64-linux-gnu/bits/mman.h | 4 +-
.../include/x86_64-linux-gnu/bits/procfs-id.h | 4 +-
.../include/x86_64-linux-gnu/bits/procfs.h | 4 +-
.../x86_64-linux-gnu/bits/pthreadtypes-arch.h | 55 +---
.../include/x86_64-linux-gnu/bits/select.h | 4 +-
.../include/x86_64-linux-gnu/bits/sem-pad.h | 4 +-
.../include/x86_64-linux-gnu/bits/semaphore.h | 4 +-
.../include/x86_64-linux-gnu/bits/setjmp.h | 4 +-
.../x86_64-linux-gnu/bits/sigcontext.h | 4 +-
lib/libc/include/x86_64-linux-gnu/bits/stat.h | 4 +-
.../x86_64-linux-gnu/bits/struct_mutex.h | 63 +++++
.../bits/struct_rwlock.h} | 80 +++---
.../include/x86_64-linux-gnu/bits/sysctl.h | 4 +-
.../include/x86_64-linux-gnu/bits/timesize.h | 4 +-
.../include/x86_64-linux-gnu/bits/typesizes.h | 9 +-
.../finclude/math-vector-fortran.h | 4 +-
.../include/x86_64-linux-gnu/fpu_control.h | 4 +-
lib/libc/include/x86_64-linux-gnu/sys/elf.h | 4 +-
.../include/x86_64-linux-gnu/sys/ptrace.h | 10 +-
.../include/x86_64-linux-gnu/sys/ucontext.h | 4 +-
lib/libc/include/x86_64-linux-gnu/sys/user.h | 4 +-
.../include/x86_64-linux-gnux32/bits/endian.h | 7 -
.../x86_64-linux-gnux32/bits/endianness.h | 11 +
.../x86_64-linux-gnux32/bits/environments.h | 4 +-
.../include/x86_64-linux-gnux32/bits/epoll.h | 4 +-
.../include/x86_64-linux-gnux32/bits/fcntl.h | 4 +-
.../include/x86_64-linux-gnux32/bits/fenv.h | 6 +-
.../include/x86_64-linux-gnux32/bits/floatn.h | 4 +-
.../bits/flt-eval-method.h | 4 +-
.../x86_64-linux-gnux32/bits/fp-logb.h | 4 +-
.../bits/indirect-return.h | 4 +-
.../x86_64-linux-gnux32/bits/ipctypes.h | 4 +-
.../x86_64-linux-gnux32/bits/iscanonical.h | 4 +-
.../include/x86_64-linux-gnux32/bits/link.h | 4 +-
.../x86_64-linux-gnux32/bits/long-double.h | 7 +-
.../x86_64-linux-gnux32/bits/math-vector.h | 4 +-
.../include/x86_64-linux-gnux32/bits/mman.h | 4 +-
.../x86_64-linux-gnux32/bits/procfs-id.h | 4 +-
.../include/x86_64-linux-gnux32/bits/procfs.h | 4 +-
.../bits/pthreadtypes-arch.h | 55 +---
.../include/x86_64-linux-gnux32/bits/select.h | 4 +-
.../x86_64-linux-gnux32/bits/sem-pad.h | 4 +-
.../x86_64-linux-gnux32/bits/semaphore.h | 4 +-
.../include/x86_64-linux-gnux32/bits/setjmp.h | 4 +-
.../x86_64-linux-gnux32/bits/sigcontext.h | 4 +-
.../include/x86_64-linux-gnux32/bits/stat.h | 4 +-
.../x86_64-linux-gnux32/bits/struct_mutex.h | 63 +++++
.../bits/struct_rwlock.h} | 80 +++---
.../include/x86_64-linux-gnux32/bits/sysctl.h | 4 +-
.../x86_64-linux-gnux32/bits/timesize.h | 4 +-
.../x86_64-linux-gnux32/bits/typesizes.h | 9 +-
.../finclude/math-vector-fortran.h | 4 +-
.../include/x86_64-linux-gnux32/fpu_control.h | 4 +-
.../include/x86_64-linux-gnux32/sys/elf.h | 4 +-
.../include/x86_64-linux-gnux32/sys/ptrace.h | 10 +-
.../x86_64-linux-gnux32/sys/ucontext.h | 4 +-
.../include/x86_64-linux-gnux32/sys/user.h | 4 +-
1079 files changed, 4785 insertions(+), 4372 deletions(-)
delete mode 100644 lib/libc/include/aarch64-linux-gnu/bits/endian.h
create mode 100644 lib/libc/include/aarch64-linux-gnu/bits/endianness.h
delete mode 100644 lib/libc/include/aarch64-linux-gnu/bits/ipc.h
rename lib/libc/include/{powerpc-linux-gnu/bits/endian.h => aarch64-linux-gnu/bits/struct_rwlock.h} (53%)
delete mode 100644 lib/libc/include/aarch64_be-linux-gnu/bits/endian.h
create mode 100644 lib/libc/include/aarch64_be-linux-gnu/bits/endianness.h
delete mode 100644 lib/libc/include/aarch64_be-linux-gnu/bits/ipc.h
rename lib/libc/include/{powerpc64-linux-gnu/bits/endian.h => aarch64_be-linux-gnu/bits/struct_rwlock.h} (53%)
delete mode 100644 lib/libc/include/arm-linux-gnueabi/bits/endian.h
create mode 100644 lib/libc/include/arm-linux-gnueabi/bits/endianness.h
create mode 100644 lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h
delete mode 100644 lib/libc/include/arm-linux-gnueabihf/bits/endian.h
create mode 100644 lib/libc/include/arm-linux-gnueabihf/bits/endianness.h
create mode 100644 lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h
delete mode 100644 lib/libc/include/armeb-linux-gnueabi/bits/endian.h
create mode 100644 lib/libc/include/armeb-linux-gnueabi/bits/endianness.h
create mode 100644 lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h
delete mode 100644 lib/libc/include/armeb-linux-gnueabihf/bits/endian.h
create mode 100644 lib/libc/include/armeb-linux-gnueabihf/bits/endianness.h
create mode 100644 lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h
create mode 100644 lib/libc/include/generic-glibc/bits/endianness.h
create mode 100644 lib/libc/include/generic-glibc/bits/ipc-perm.h
delete mode 100644 lib/libc/include/generic-glibc/bits/math-finite.h
create mode 100644 lib/libc/include/generic-glibc/bits/struct_mutex.h
rename lib/libc/include/{arm-linux-gnueabi/bits/pthreadtypes-arch.h => generic-glibc/bits/struct_rwlock.h} (57%)
delete mode 100644 lib/libc/include/i386-linux-gnu/bits/endian.h
create mode 100644 lib/libc/include/i386-linux-gnu/bits/endianness.h
create mode 100644 lib/libc/include/i386-linux-gnu/bits/struct_mutex.h
rename lib/libc/include/{armeb-linux-gnueabi/bits/pthreadtypes-arch.h => i386-linux-gnu/bits/struct_rwlock.h} (52%)
delete mode 100644 lib/libc/include/mips-linux-gnu/bits/ipc.h
create mode 100644 lib/libc/include/mips-linux-gnu/bits/pthreadtypes-arch.h
create mode 100644 lib/libc/include/mips-linux-gnu/bits/struct_mutex.h
delete mode 100644 lib/libc/include/mips64-linux-gnuabi64/bits/ipc.h
create mode 100644 lib/libc/include/mips64-linux-gnuabi64/bits/pthreadtypes-arch.h
create mode 100644 lib/libc/include/mips64-linux-gnuabi64/bits/struct_mutex.h
delete mode 100644 lib/libc/include/mips64-linux-gnuabin32/bits/ipc.h
create mode 100644 lib/libc/include/mips64-linux-gnuabin32/bits/pthreadtypes-arch.h
create mode 100644 lib/libc/include/mips64-linux-gnuabin32/bits/struct_mutex.h
delete mode 100644 lib/libc/include/mips64el-linux-gnuabi64/bits/ipc.h
create mode 100644 lib/libc/include/mips64el-linux-gnuabi64/bits/pthreadtypes-arch.h
create mode 100644 lib/libc/include/mips64el-linux-gnuabi64/bits/struct_mutex.h
delete mode 100644 lib/libc/include/mips64el-linux-gnuabin32/bits/ipc.h
create mode 100644 lib/libc/include/mips64el-linux-gnuabin32/bits/pthreadtypes-arch.h
create mode 100644 lib/libc/include/mips64el-linux-gnuabin32/bits/struct_mutex.h
delete mode 100644 lib/libc/include/mipsel-linux-gnu/bits/ipc.h
create mode 100644 lib/libc/include/mipsel-linux-gnu/bits/pthreadtypes-arch.h
create mode 100644 lib/libc/include/mipsel-linux-gnu/bits/struct_mutex.h
create mode 100644 lib/libc/include/powerpc-linux-gnu/bits/endianness.h
rename lib/libc/include/{powerpc64le-linux-gnu/bits/ipc.h => powerpc-linux-gnu/bits/ipc-perm.h} (61%)
create mode 100644 lib/libc/include/powerpc-linux-gnu/bits/struct_mutex.h
rename lib/libc/include/powerpc-linux-gnu/bits/{pthreadtypes-arch.h => struct_rwlock.h} (59%)
create mode 100644 lib/libc/include/powerpc64-linux-gnu/bits/endianness.h
rename lib/libc/include/{powerpc-linux-gnu/bits/ipc.h => powerpc64-linux-gnu/bits/ipc-perm.h} (61%)
create mode 100644 lib/libc/include/powerpc64-linux-gnu/bits/struct_mutex.h
rename lib/libc/include/powerpc64-linux-gnu/bits/{pthreadtypes-arch.h => struct_rwlock.h} (59%)
delete mode 100644 lib/libc/include/powerpc64le-linux-gnu/bits/endian.h
create mode 100644 lib/libc/include/powerpc64le-linux-gnu/bits/endianness.h
rename lib/libc/include/{powerpc64-linux-gnu/bits/ipc.h => powerpc64le-linux-gnu/bits/ipc-perm.h} (61%)
create mode 100644 lib/libc/include/powerpc64le-linux-gnu/bits/struct_mutex.h
rename lib/libc/include/powerpc64le-linux-gnu/bits/{pthreadtypes-arch.h => struct_rwlock.h} (59%)
delete mode 100644 lib/libc/include/riscv64-linux-gnu/bits/endian.h
create mode 100644 lib/libc/include/riscv64-linux-gnu/bits/endianness.h
create mode 100644 lib/libc/include/riscv64-linux-gnu/bits/struct_rwlock.h
delete mode 100644 lib/libc/include/s390x-linux-gnu/bits/endian.h
create mode 100644 lib/libc/include/s390x-linux-gnu/bits/endianness.h
delete mode 100644 lib/libc/include/s390x-linux-gnu/bits/ipc.h
create mode 100644 lib/libc/include/s390x-linux-gnu/bits/struct_mutex.h
rename lib/libc/include/s390x-linux-gnu/bits/{pthreadtypes-arch.h => struct_rwlock.h} (57%)
rename lib/libc/include/sparc-linux-gnu/bits/{endian.h => endianness.h} (54%)
rename lib/libc/include/{sparcv9-linux-gnu/bits/ipc.h => sparc-linux-gnu/bits/ipc-perm.h} (57%)
rename lib/libc/include/sparc-linux-gnu/bits/{pthreadtypes-arch.h => struct_rwlock.h} (55%)
rename lib/libc/include/sparcv9-linux-gnu/bits/{endian.h => endianness.h} (54%)
rename lib/libc/include/{sparc-linux-gnu/bits/ipc.h => sparcv9-linux-gnu/bits/ipc-perm.h} (57%)
rename lib/libc/include/sparcv9-linux-gnu/bits/{pthreadtypes-arch.h => struct_rwlock.h} (55%)
delete mode 100644 lib/libc/include/x86_64-linux-gnu/bits/endian.h
create mode 100644 lib/libc/include/x86_64-linux-gnu/bits/endianness.h
create mode 100644 lib/libc/include/x86_64-linux-gnu/bits/struct_mutex.h
rename lib/libc/include/{arm-linux-gnueabihf/bits/pthreadtypes-arch.h => x86_64-linux-gnu/bits/struct_rwlock.h} (52%)
delete mode 100644 lib/libc/include/x86_64-linux-gnux32/bits/endian.h
create mode 100644 lib/libc/include/x86_64-linux-gnux32/bits/endianness.h
create mode 100644 lib/libc/include/x86_64-linux-gnux32/bits/struct_mutex.h
rename lib/libc/include/{armeb-linux-gnueabihf/bits/pthreadtypes-arch.h => x86_64-linux-gnux32/bits/struct_rwlock.h} (52%)
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/endian.h b/lib/libc/include/aarch64-linux-gnu/bits/endian.h
deleted file mode 100644
index b62d37d773..0000000000
--- a/lib/libc/include/aarch64-linux-gnu/bits/endian.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- . */
-
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
-#endif
-
-/* AArch64 can be either big or little endian. */
-#ifdef __AARCH64EB__
-# define __BYTE_ORDER __BIG_ENDIAN
-#else
-# define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
-
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
\ No newline at end of file
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/endianness.h b/lib/libc/include/aarch64-linux-gnu/bits/endianness.h
new file mode 100644
index 0000000000..5db8061829
--- /dev/null
+++ b/lib/libc/include/aarch64-linux-gnu/bits/endianness.h
@@ -0,0 +1,15 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* AArch64 has selectable endianness. */
+#ifdef __AARCH64EB__
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* bits/endianness.h */
\ No newline at end of file
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h b/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h
index d2dd7e88aa..ccf39f29d3 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for the AArch64 Linux ABI.
- Copyright (C) 2011-2019 Free Software Foundation, Inc.
+ Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/fenv.h b/lib/libc/include/aarch64-linux-gnu/bits/fenv.h
index 2e080ee28d..de4e9fb758 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/fenv.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _FENV_H
# error "Never use directly; include instead."
@@ -73,7 +73,7 @@ fenv_t;
# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif
-#if __GLIBC_USE (IEC_60559_BFP_EXT)
+#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
/* Type representing floating-point control modes. */
typedef unsigned int femode_t;
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/floatn.h b/lib/libc/include/aarch64-linux-gnu/bits/floatn.h
index 5e7e3f4d2e..a4045e43a3 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/floatn.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/floatn.h
@@ -1,5 +1,5 @@
/* Macros to control TS 18661-3 glibc features on ldbl-128 platforms.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_FLOATN_H
#define _BITS_FLOATN_H
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/fp-fast.h b/lib/libc/include/aarch64-linux-gnu/bits/fp-fast.h
index c502e67c75..0cf198e478 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/fp-fast.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/fp-fast.h
@@ -1,5 +1,5 @@
/* Define FP_FAST_* macros. AArch64 version.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _MATH_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/hwcap.h b/lib/libc/include/aarch64-linux-gnu/bits/hwcap.h
index 629784d923..cf38b9d8b7 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/hwcap.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/hwcap.h
@@ -1,5 +1,5 @@
/* Defines for bits in AT_HWCAP. AArch64 Linux version.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined (_SYS_AUXV_H)
# error "Never include directly; use instead."
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/ipc.h b/lib/libc/include/aarch64-linux-gnu/bits/ipc.h
deleted file mode 100644
index 6edd48ba78..0000000000
--- a/lib/libc/include/aarch64-linux-gnu/bits/ipc.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#ifndef _SYS_IPC_H
-# error "Never use directly; include instead."
-#endif
-
-#include
-
-/* Mode bits for `msgget', `semget', and `shmget'. */
-#define IPC_CREAT 01000 /* Create key if key does not exist. */
-#define IPC_EXCL 02000 /* Fail if key exists. */
-#define IPC_NOWAIT 04000 /* Return error on wait. */
-
-/* Control commands for `msgctl', `semctl', and `shmctl'. */
-#define IPC_RMID 0 /* Remove identifier. */
-#define IPC_SET 1 /* Set `ipc_perm' options. */
-#define IPC_STAT 2 /* Get `ipc_perm' options. */
-#ifdef __USE_GNU
-# define IPC_INFO 3 /* See ipcs. */
-#endif
-
-/* Special key values. */
-#define IPC_PRIVATE ((__key_t) 0) /* Private key. */
-
-
-/* Data structure used to pass permission information to IPC operations. */
-struct ipc_perm
- {
- __key_t __key; /* Key. */
- __uid_t uid; /* Owner's user ID. */
- __gid_t gid; /* Owner's group ID. */
- __uid_t cuid; /* Creator's user ID. */
- __gid_t cgid; /* Creator's group ID. */
- unsigned int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
- unsigned short int __pad1;
- __syscall_ulong_t __glibc_reserved1;
- __syscall_ulong_t __glibc_reserved2;
- };
\ No newline at end of file
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/link.h b/lib/libc/include/aarch64-linux-gnu/bits/link.h
index 71f99857bc..bf9953595f 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/link.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/link.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _LINK_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h b/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h
index 738c65bc5a..155d60e416 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/local_lim.h
@@ -1,5 +1,5 @@
/* Minimum guaranteed maximum values for system limits. Linux version.
- Copyright (C) 1993-2019 Free Software Foundation, Inc.
+ Copyright (C) 1993-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* The kernel header pollutes the namespace with the NR_OPEN symbol
and defines LINK_MAX although filesystems have different maxima. A
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/long-double.h b/lib/libc/include/aarch64-linux-gnu/bits/long-double.h
index 12e30804a4..ce06962796 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/long-double.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/long-double.h
@@ -1,5 +1,5 @@
/* Properties of long double type. ldbl-128 version.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,8 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* long double is distinct from double, so there is nothing to
- define here. */
\ No newline at end of file
+ define here. */
+#define __LONG_DOUBLE_USES_FLOAT128 0
\ No newline at end of file
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/procfs.h b/lib/libc/include/aarch64-linux-gnu/bits/procfs.h
index cdc07b27d9..efb589274b 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/procfs.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/procfs.h
@@ -1,5 +1,5 @@
/* Types for registers for sys/procfs.h. AArch64 version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h
index ef00f65b66..e64b19346e 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/pthreadtypes-arch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,12 +14,12 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_PTHREADTYPES_ARCH_H
#define _BITS_PTHREADTYPES_ARCH_H 1
-#include
+#include
#ifdef __ILP32__
# define __SIZEOF_PTHREAD_ATTR_T 32
@@ -41,31 +41,7 @@
#define __SIZEOF_PTHREAD_COND_T 48
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
-#define __PTHREAD_MUTEX_USE_UNION 0
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
- int __cur_writer;
- int __shared;
- unsigned long int __pad1;
- unsigned long int __pad2;
- unsigned int __flags;
-};
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
#endif /* bits/pthreadtypes.h */
\ No newline at end of file
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h b/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h
index a15f480bd0..64a56cc2f9 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/semaphore.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SEMAPHORE_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/setjmp.h b/lib/libc/include/aarch64-linux-gnu/bits/setjmp.h
index 407f86adc1..2b63e21916 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/setjmp.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_SETJMP_H
#define _BITS_SETJMP_H 1
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/sigstack.h b/lib/libc/include/aarch64-linux-gnu/bits/sigstack.h
index 8921d2a88b..7294db7d4c 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/sigstack.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/sigstack.h
@@ -1,5 +1,5 @@
/* sigstack, sigaltstack definitions.
- Copyright (C) 2015-2019 Free Software Foundation, Inc.
+ Copyright (C) 2015-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_SIGSTACK_H
#define _BITS_SIGSTACK_H 1
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/stat.h b/lib/libc/include/aarch64-linux-gnu/bits/stat.h
index 4f23077263..2df73d11e3 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/stat.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf , 2011.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include directly; use instead."
@@ -23,7 +23,7 @@
#ifndef _BITS_STAT_H
#define _BITS_STAT_H 1
-#include
+#include
#include
/* 64-bit libc uses the kernel's 'struct stat', accessed via the
@@ -42,7 +42,10 @@
#if defined __USE_FILE_OFFSET64
# define __field64(type, type64, name) type64 name
-#elif __WORDSIZE == 64
+#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
+# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
+# error "ino_t and off_t must both be the same type"
+# endif
# define __field64(type, type64, name) type name
#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define __field64(type, type64, name) \
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/statfs.h b/lib/libc/include/aarch64-linux-gnu/bits/statfs.h
index 8da970d4a9..61c27388e9 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/statfs.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/statfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf , 2011.
@@ -14,13 +14,13 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_STATFS_H
# error "Never include directly; use instead."
#endif
-#include
+#include
#include
#include
@@ -34,7 +34,7 @@
#if defined __USE_FILE_OFFSET64
# define __field64(type, type64, name) type64 name
-#elif __WORDSIZE == 64
+#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64
# define __field64(type, type64, name) type name
#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define __field64(type, type64, name) \
diff --git a/lib/libc/include/powerpc-linux-gnu/bits/endian.h b/lib/libc/include/aarch64-linux-gnu/bits/struct_rwlock.h
similarity index 53%
rename from lib/libc/include/powerpc-linux-gnu/bits/endian.h
rename to lib/libc/include/aarch64-linux-gnu/bits/struct_rwlock.h
index f643beb3b5..1f6f86e910 100644
--- a/lib/libc/include/powerpc-linux-gnu/bits/endian.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/struct_rwlock.h
@@ -1,4 +1,6 @@
-/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
+/* AArch64 internal rwlock struct definitions.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,22 +17,25 @@
License along with the GNU C Library; if not, see
. */
-/* PowerPC can be little or big endian. Hopefully gcc will know... */
+#ifndef _RWLOCK_INTERNAL_H
+#define _RWLOCK_INTERNAL_H
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
-#endif
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags
-#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
-# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
-# error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
-# endif
-# define __BYTE_ORDER __BIG_ENDIAN
-#else
-# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
-# define __BYTE_ORDER __LITTLE_ENDIAN
-# else
-# warning Cannot determine current byte order, assuming big-endian.
-# define __BYTE_ORDER __BIG_ENDIAN
-# endif
#endif
\ No newline at end of file
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/typesizes.h b/lib/libc/include/aarch64-linux-gnu/bits/typesizes.h
index 8cfcacef57..d9e9b274ac 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/typesizes.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/typesizes.h
@@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.
- Copyright (C) 2011-2019 Free Software Foundation, Inc.
+ Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf , 2011.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _BITS_TYPES_H
# error "Never include directly; use instead."
@@ -73,10 +73,14 @@
/* And for __rlim_t and __rlim64_t. */
# define __RLIM_T_MATCHES_RLIM64_T 1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
+# define __STATFS_MATCHES_STATFS64 1
#else
# define __RLIM_T_MATCHES_RLIM64_T 0
-#endif
+# define __STATFS_MATCHES_STATFS64 0
+#endif
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
diff --git a/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h b/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h
index 52f24f0980..68b28bf2d7 100644
--- a/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h
+++ b/lib/libc/include/aarch64-linux-gnu/bits/wordsize.h
@@ -1,6 +1,6 @@
/* Determine the wordsize from the preprocessor defines.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifdef __LP64__
# define __WORDSIZE 64
diff --git a/lib/libc/include/aarch64-linux-gnu/fpu_control.h b/lib/libc/include/aarch64-linux-gnu/fpu_control.h
index eac02cfe26..ba2e530b10 100644
--- a/lib/libc/include/aarch64-linux-gnu/fpu_control.h
+++ b/lib/libc/include/aarch64-linux-gnu/fpu_control.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _AARCH64_FPU_CONTROL_H
#define _AARCH64_FPU_CONTROL_H
diff --git a/lib/libc/include/aarch64-linux-gnu/ieee754.h b/lib/libc/include/aarch64-linux-gnu/ieee754.h
index e347e4a6e5..63fa9c5fce 100644
--- a/lib/libc/include/aarch64-linux-gnu/ieee754.h
+++ b/lib/libc/include/aarch64-linux-gnu/ieee754.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,14 +13,14 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _IEEE754_H
-
#define _IEEE754_H 1
+
#include
-#include
+#include
__BEGIN_DECLS
diff --git a/lib/libc/include/aarch64-linux-gnu/sys/elf.h b/lib/libc/include/aarch64-linux-gnu/sys/elf.h
index d7062a3a91..e3e2bac7b2 100644
--- a/lib/libc/include/aarch64-linux-gnu/sys/elf.h
+++ b/lib/libc/include/aarch64-linux-gnu/sys/elf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_ELF_H
#define _SYS_ELF_H 1
diff --git a/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h b/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h
index 59b06682a9..ce7f6bf7c0 100644
--- a/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h
+++ b/lib/libc/include/aarch64-linux-gnu/sys/ptrace.h
@@ -1,5 +1,5 @@
/* `ptrace' debugger support interface. Linux/AArch64 version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_PTRACE_H
#define _SYS_PTRACE_H 1
@@ -136,8 +136,12 @@ enum __ptrace_request
#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
/* Get seccomp BPF filter metadata. */
- PTRACE_SECCOMP_GET_METADATA = 0x420d
+ PTRACE_SECCOMP_GET_METADATA = 0x420d,
#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
+
+ /* Get information about system call. */
+ PTRACE_GET_SYSCALL_INFO = 0x420e
+#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
};
diff --git a/lib/libc/include/aarch64-linux-gnu/sys/ucontext.h b/lib/libc/include/aarch64-linux-gnu/sys/ucontext.h
index 273ba806dd..a3ede3eb97 100644
--- a/lib/libc/include/aarch64-linux-gnu/sys/ucontext.h
+++ b/lib/libc/include/aarch64-linux-gnu/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* System V/AArch64 ABI compliant context switching support. */
diff --git a/lib/libc/include/aarch64-linux-gnu/sys/user.h b/lib/libc/include/aarch64-linux-gnu/sys/user.h
index 8daa97548a..ce78f80471 100644
--- a/lib/libc/include/aarch64-linux-gnu/sys/user.h
+++ b/lib/libc/include/aarch64-linux-gnu/sys/user.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/endian.h b/lib/libc/include/aarch64_be-linux-gnu/bits/endian.h
deleted file mode 100644
index b62d37d773..0000000000
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/endian.h
+++ /dev/null
@@ -1,30 +0,0 @@
-/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
-
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public License as
- published by the Free Software Foundation; either version 2.1 of the
- License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library. If not, see
- . */
-
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
-#endif
-
-/* AArch64 can be either big or little endian. */
-#ifdef __AARCH64EB__
-# define __BYTE_ORDER __BIG_ENDIAN
-#else
-# define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
-
-#define __FLOAT_WORD_ORDER __BYTE_ORDER
\ No newline at end of file
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/endianness.h b/lib/libc/include/aarch64_be-linux-gnu/bits/endianness.h
new file mode 100644
index 0000000000..5db8061829
--- /dev/null
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/endianness.h
@@ -0,0 +1,15 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* AArch64 has selectable endianness. */
+#ifdef __AARCH64EB__
+# define __BYTE_ORDER __BIG_ENDIAN
+#else
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* bits/endianness.h */
\ No newline at end of file
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/fcntl.h b/lib/libc/include/aarch64_be-linux-gnu/bits/fcntl.h
index d2dd7e88aa..ccf39f29d3 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/fcntl.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for the AArch64 Linux ABI.
- Copyright (C) 2011-2019 Free Software Foundation, Inc.
+ Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/fenv.h b/lib/libc/include/aarch64_be-linux-gnu/bits/fenv.h
index 2e080ee28d..de4e9fb758 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/fenv.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _FENV_H
# error "Never use directly; include instead."
@@ -73,7 +73,7 @@ fenv_t;
# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif
-#if __GLIBC_USE (IEC_60559_BFP_EXT)
+#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
/* Type representing floating-point control modes. */
typedef unsigned int femode_t;
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/floatn.h b/lib/libc/include/aarch64_be-linux-gnu/bits/floatn.h
index 5e7e3f4d2e..a4045e43a3 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/floatn.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/floatn.h
@@ -1,5 +1,5 @@
/* Macros to control TS 18661-3 glibc features on ldbl-128 platforms.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_FLOATN_H
#define _BITS_FLOATN_H
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/fp-fast.h b/lib/libc/include/aarch64_be-linux-gnu/bits/fp-fast.h
index c502e67c75..0cf198e478 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/fp-fast.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/fp-fast.h
@@ -1,5 +1,5 @@
/* Define FP_FAST_* macros. AArch64 version.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _MATH_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h b/lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h
index 629784d923..cf38b9d8b7 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/hwcap.h
@@ -1,5 +1,5 @@
/* Defines for bits in AT_HWCAP. AArch64 Linux version.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined (_SYS_AUXV_H)
# error "Never include directly; use instead."
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/ipc.h b/lib/libc/include/aarch64_be-linux-gnu/bits/ipc.h
deleted file mode 100644
index 6edd48ba78..0000000000
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/ipc.h
+++ /dev/null
@@ -1,54 +0,0 @@
-/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
- This file is part of the GNU C Library.
-
- The GNU C Library is free software; you can redistribute it and/or
- modify it under the terms of the GNU Lesser General Public
- License as published by the Free Software Foundation; either
- version 2.1 of the License, or (at your option) any later version.
-
- The GNU C Library is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- Lesser General Public License for more details.
-
- You should have received a copy of the GNU Lesser General Public
- License along with the GNU C Library; if not, see
- . */
-
-#ifndef _SYS_IPC_H
-# error "Never use directly; include instead."
-#endif
-
-#include
-
-/* Mode bits for `msgget', `semget', and `shmget'. */
-#define IPC_CREAT 01000 /* Create key if key does not exist. */
-#define IPC_EXCL 02000 /* Fail if key exists. */
-#define IPC_NOWAIT 04000 /* Return error on wait. */
-
-/* Control commands for `msgctl', `semctl', and `shmctl'. */
-#define IPC_RMID 0 /* Remove identifier. */
-#define IPC_SET 1 /* Set `ipc_perm' options. */
-#define IPC_STAT 2 /* Get `ipc_perm' options. */
-#ifdef __USE_GNU
-# define IPC_INFO 3 /* See ipcs. */
-#endif
-
-/* Special key values. */
-#define IPC_PRIVATE ((__key_t) 0) /* Private key. */
-
-
-/* Data structure used to pass permission information to IPC operations. */
-struct ipc_perm
- {
- __key_t __key; /* Key. */
- __uid_t uid; /* Owner's user ID. */
- __gid_t gid; /* Owner's group ID. */
- __uid_t cuid; /* Creator's user ID. */
- __gid_t cgid; /* Creator's group ID. */
- unsigned int mode; /* Read/write permission. */
- unsigned short int __seq; /* Sequence number. */
- unsigned short int __pad1;
- __syscall_ulong_t __glibc_reserved1;
- __syscall_ulong_t __glibc_reserved2;
- };
\ No newline at end of file
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/link.h b/lib/libc/include/aarch64_be-linux-gnu/bits/link.h
index 71f99857bc..bf9953595f 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/link.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/link.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _LINK_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h b/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h
index 738c65bc5a..155d60e416 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/local_lim.h
@@ -1,5 +1,5 @@
/* Minimum guaranteed maximum values for system limits. Linux version.
- Copyright (C) 1993-2019 Free Software Foundation, Inc.
+ Copyright (C) 1993-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* The kernel header pollutes the namespace with the NR_OPEN symbol
and defines LINK_MAX although filesystems have different maxima. A
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/long-double.h b/lib/libc/include/aarch64_be-linux-gnu/bits/long-double.h
index 12e30804a4..ce06962796 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/long-double.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/long-double.h
@@ -1,5 +1,5 @@
/* Properties of long double type. ldbl-128 version.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,8 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* long double is distinct from double, so there is nothing to
- define here. */
\ No newline at end of file
+ define here. */
+#define __LONG_DOUBLE_USES_FLOAT128 0
\ No newline at end of file
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/procfs.h b/lib/libc/include/aarch64_be-linux-gnu/bits/procfs.h
index cdc07b27d9..efb589274b 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/procfs.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/procfs.h
@@ -1,5 +1,5 @@
/* Types for registers for sys/procfs.h. AArch64 version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/pthreadtypes-arch.h b/lib/libc/include/aarch64_be-linux-gnu/bits/pthreadtypes-arch.h
index ef00f65b66..e64b19346e 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/pthreadtypes-arch.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/pthreadtypes-arch.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,12 +14,12 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_PTHREADTYPES_ARCH_H
#define _BITS_PTHREADTYPES_ARCH_H 1
-#include
+#include
#ifdef __ILP32__
# define __SIZEOF_PTHREAD_ATTR_T 32
@@ -41,31 +41,7 @@
#define __SIZEOF_PTHREAD_COND_T 48
#define __SIZEOF_PTHREAD_RWLOCKATTR_T 8
-/* Definitions for internal mutex struct. */
-#define __PTHREAD_COMPAT_PADDING_MID
-#define __PTHREAD_COMPAT_PADDING_END
-#define __PTHREAD_MUTEX_LOCK_ELISION 0
-#define __PTHREAD_MUTEX_NUSERS_AFTER_KIND 0
-#define __PTHREAD_MUTEX_USE_UNION 0
-
#define __LOCK_ALIGNMENT
#define __ONCE_ALIGNMENT
-struct __pthread_rwlock_arch_t
-{
- unsigned int __readers;
- unsigned int __writers;
- unsigned int __wrphase_futex;
- unsigned int __writers_futex;
- unsigned int __pad3;
- unsigned int __pad4;
- int __cur_writer;
- int __shared;
- unsigned long int __pad1;
- unsigned long int __pad2;
- unsigned int __flags;
-};
-
-#define __PTHREAD_RWLOCK_ELISION_EXTRA 0
-
#endif /* bits/pthreadtypes.h */
\ No newline at end of file
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/semaphore.h b/lib/libc/include/aarch64_be-linux-gnu/bits/semaphore.h
index a15f480bd0..64a56cc2f9 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/semaphore.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/semaphore.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SEMAPHORE_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/setjmp.h b/lib/libc/include/aarch64_be-linux-gnu/bits/setjmp.h
index 407f86adc1..2b63e21916 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/setjmp.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_SETJMP_H
#define _BITS_SETJMP_H 1
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/sigstack.h b/lib/libc/include/aarch64_be-linux-gnu/bits/sigstack.h
index 8921d2a88b..7294db7d4c 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/sigstack.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/sigstack.h
@@ -1,5 +1,5 @@
/* sigstack, sigaltstack definitions.
- Copyright (C) 2015-2019 Free Software Foundation, Inc.
+ Copyright (C) 2015-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_SIGSTACK_H
#define _BITS_SIGSTACK_H 1
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/stat.h b/lib/libc/include/aarch64_be-linux-gnu/bits/stat.h
index 4f23077263..2df73d11e3 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/stat.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf , 2011.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include directly; use instead."
@@ -23,7 +23,7 @@
#ifndef _BITS_STAT_H
#define _BITS_STAT_H 1
-#include
+#include
#include
/* 64-bit libc uses the kernel's 'struct stat', accessed via the
@@ -42,7 +42,10 @@
#if defined __USE_FILE_OFFSET64
# define __field64(type, type64, name) type64 name
-#elif __WORDSIZE == 64
+#elif __WORDSIZE == 64 || defined __INO_T_MATCHES_INO64_T
+# if defined __INO_T_MATCHES_INO64_T && !defined __OFF_T_MATCHES_OFF64_T
+# error "ino_t and off_t must both be the same type"
+# endif
# define __field64(type, type64, name) type name
#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define __field64(type, type64, name) \
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h b/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h
index 8da970d4a9..61c27388e9 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/statfs.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2011-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf , 2011.
@@ -14,13 +14,13 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_STATFS_H
# error "Never include directly; use instead."
#endif
-#include
+#include
#include
#include
@@ -34,7 +34,7 @@
#if defined __USE_FILE_OFFSET64
# define __field64(type, type64, name) type64 name
-#elif __WORDSIZE == 64
+#elif __WORDSIZE == 64 || __STATFS_MATCHES_STATFS64
# define __field64(type, type64, name) type name
#elif __BYTE_ORDER == __LITTLE_ENDIAN
# define __field64(type, type64, name) \
diff --git a/lib/libc/include/powerpc64-linux-gnu/bits/endian.h b/lib/libc/include/aarch64_be-linux-gnu/bits/struct_rwlock.h
similarity index 53%
rename from lib/libc/include/powerpc64-linux-gnu/bits/endian.h
rename to lib/libc/include/aarch64_be-linux-gnu/bits/struct_rwlock.h
index f643beb3b5..1f6f86e910 100644
--- a/lib/libc/include/powerpc64-linux-gnu/bits/endian.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/struct_rwlock.h
@@ -1,4 +1,6 @@
-/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
+/* AArch64 internal rwlock struct definitions.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,22 +17,25 @@
License along with the GNU C Library; if not, see
. */
-/* PowerPC can be little or big endian. Hopefully gcc will know... */
+#ifndef _RWLOCK_INTERNAL_H
+#define _RWLOCK_INTERNAL_H
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
-#endif
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ int __cur_writer;
+ int __shared;
+ unsigned long int __pad1;
+ unsigned long int __pad2;
+ unsigned int __flags;
+};
+
+#define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags
-#if defined __BIG_ENDIAN__ || defined _BIG_ENDIAN
-# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
-# error Both BIG_ENDIAN and LITTLE_ENDIAN defined!
-# endif
-# define __BYTE_ORDER __BIG_ENDIAN
-#else
-# if defined __LITTLE_ENDIAN__ || defined _LITTLE_ENDIAN
-# define __BYTE_ORDER __LITTLE_ENDIAN
-# else
-# warning Cannot determine current byte order, assuming big-endian.
-# define __BYTE_ORDER __BIG_ENDIAN
-# endif
#endif
\ No newline at end of file
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/typesizes.h b/lib/libc/include/aarch64_be-linux-gnu/bits/typesizes.h
index 8cfcacef57..d9e9b274ac 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/typesizes.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/typesizes.h
@@ -1,5 +1,5 @@
/* bits/typesizes.h -- underlying types for *_t. For the generic Linux ABI.
- Copyright (C) 2011-2019 Free Software Foundation, Inc.
+ Copyright (C) 2011-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Contributed by Chris Metcalf , 2011.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _BITS_TYPES_H
# error "Never include directly; use instead."
@@ -73,10 +73,14 @@
/* And for __rlim_t and __rlim64_t. */
# define __RLIM_T_MATCHES_RLIM64_T 1
+
+/* And for fsblkcnt_t, fsblkcnt64_t, fsfilcnt_t and fsfilcnt64_t. */
+# define __STATFS_MATCHES_STATFS64 1
#else
# define __RLIM_T_MATCHES_RLIM64_T 0
-#endif
+# define __STATFS_MATCHES_STATFS64 0
+#endif
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
diff --git a/lib/libc/include/aarch64_be-linux-gnu/bits/wordsize.h b/lib/libc/include/aarch64_be-linux-gnu/bits/wordsize.h
index 52f24f0980..68b28bf2d7 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/bits/wordsize.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/bits/wordsize.h
@@ -1,6 +1,6 @@
/* Determine the wordsize from the preprocessor defines.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifdef __LP64__
# define __WORDSIZE 64
diff --git a/lib/libc/include/aarch64_be-linux-gnu/fpu_control.h b/lib/libc/include/aarch64_be-linux-gnu/fpu_control.h
index eac02cfe26..ba2e530b10 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/fpu_control.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/fpu_control.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _AARCH64_FPU_CONTROL_H
#define _AARCH64_FPU_CONTROL_H
diff --git a/lib/libc/include/aarch64_be-linux-gnu/ieee754.h b/lib/libc/include/aarch64_be-linux-gnu/ieee754.h
index e347e4a6e5..63fa9c5fce 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/ieee754.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/ieee754.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,14 +13,14 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _IEEE754_H
-
#define _IEEE754_H 1
+
#include
-#include
+#include
__BEGIN_DECLS
diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/elf.h b/lib/libc/include/aarch64_be-linux-gnu/sys/elf.h
index d7062a3a91..e3e2bac7b2 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/sys/elf.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/sys/elf.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_ELF_H
#define _SYS_ELF_H 1
diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h b/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h
index 59b06682a9..ce7f6bf7c0 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/sys/ptrace.h
@@ -1,5 +1,5 @@
/* `ptrace' debugger support interface. Linux/AArch64 version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_PTRACE_H
#define _SYS_PTRACE_H 1
@@ -136,8 +136,12 @@ enum __ptrace_request
#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
/* Get seccomp BPF filter metadata. */
- PTRACE_SECCOMP_GET_METADATA = 0x420d
+ PTRACE_SECCOMP_GET_METADATA = 0x420d,
#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
+
+ /* Get information about system call. */
+ PTRACE_GET_SYSCALL_INFO = 0x420e
+#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
};
diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/ucontext.h b/lib/libc/include/aarch64_be-linux-gnu/sys/ucontext.h
index 273ba806dd..a3ede3eb97 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/sys/ucontext.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* System V/AArch64 ABI compliant context switching support. */
diff --git a/lib/libc/include/aarch64_be-linux-gnu/sys/user.h b/lib/libc/include/aarch64_be-linux-gnu/sys/user.h
index 8daa97548a..ce78f80471 100644
--- a/lib/libc/include/aarch64_be-linux-gnu/sys/user.h
+++ b/lib/libc/include/aarch64_be-linux-gnu/sys/user.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2009-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2009-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/endian.h b/lib/libc/include/arm-linux-gnueabi/bits/endian.h
deleted file mode 100644
index 8325d51253..0000000000
--- a/lib/libc/include/arm-linux-gnueabi/bits/endian.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
-#endif
-
-/* ARM can be either big or little endian. */
-#ifdef __ARMEB__
-#define __BYTE_ORDER __BIG_ENDIAN
-#else
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
\ No newline at end of file
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/endianness.h b/lib/libc/include/arm-linux-gnueabi/bits/endianness.h
new file mode 100644
index 0000000000..8e938abfb9
--- /dev/null
+++ b/lib/libc/include/arm-linux-gnueabi/bits/endianness.h
@@ -0,0 +1,15 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* ARM has selectable endianness. */
+#ifdef __ARMEB__
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* bits/endianness.h */
\ No newline at end of file
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/fcntl.h b/lib/libc/include/arm-linux-gnueabi/bits/fcntl.h
index 77edfb78fb..fdb169449b 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/fcntl.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-2019 Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/fenv.h b/lib/libc/include/arm-linux-gnueabi/bits/fenv.h
index b8fbba6258..654776420e 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/fenv.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FENV_H
# error "Never use directly; include instead."
@@ -81,7 +81,7 @@ fenv_t;
# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif
-#if __GLIBC_USE (IEC_60559_BFP_EXT)
+#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
/* Type representing floating-point control modes. */
typedef unsigned int femode_t;
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/floatn.h b/lib/libc/include/arm-linux-gnueabi/bits/floatn.h
index 24852b6800..2900001e82 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/floatn.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/floatn.h
@@ -1,5 +1,5 @@
/* Macros to control TS 18661-3 glibc features.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the IEEE 754 binary128 format, and this glibc
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/hwcap.h b/lib/libc/include/arm-linux-gnueabi/bits/hwcap.h
index a31befca4e..b626008612 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/hwcap.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/hwcap.h
@@ -1,5 +1,5 @@
/* Defines for bits in AT_HWCAP. ARM Linux version.
- Copyright (C) 2012-2019 Free Software Foundation, Inc.
+ Copyright (C) 2012-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined (_SYS_AUXV_H) && !defined (_LINUX_ARM_SYSDEP_H)
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/link.h b/lib/libc/include/arm-linux-gnueabi/bits/link.h
index 5dee177ce6..7ebb2785d6 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/link.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/link.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _LINK_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/long-double.h b/lib/libc/include/arm-linux-gnueabi/bits/long-double.h
index 125807d07a..13e74241e1 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/long-double.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/long-double.h
@@ -1,5 +1,5 @@
/* Properties of long double type.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* This header is included by .
@@ -36,4 +36,5 @@
ABI-compatible with double. */
#ifndef __NO_LONG_DOUBLE_MATH
# define __NO_LONG_DOUBLE_MATH 1
-#endif
\ No newline at end of file
+#endif
+#define __LONG_DOUBLE_USES_FLOAT128 0
\ No newline at end of file
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/procfs-id.h b/lib/libc/include/arm-linux-gnueabi/bits/procfs-id.h
index 35582db16f..48da66726b 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/procfs-id.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/procfs-id.h
@@ -1,5 +1,5 @@
/* Types of pr_uid and pr_gid in struct elf_prpsinfo. Arm version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/procfs.h b/lib/libc/include/arm-linux-gnueabi/bits/procfs.h
index 3e91a588d8..8a92b69bd4 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/procfs.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/procfs.h
@@ -1,5 +1,5 @@
/* Types for registers for sys/procfs.h. Arm version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/semaphore.h b/lib/libc/include/arm-linux-gnueabi/bits/semaphore.h
index acde20be36..3dd94baf34 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/semaphore.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/semaphore.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SEMAPHORE_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/setjmp.h b/lib/libc/include/arm-linux-gnueabi/bits/setjmp.h
index 2b50cca982..0912578792 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/setjmp.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* Define the machine-dependent type `jmp_buf'. ARM EABI version. */
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/shmlba.h b/lib/libc/include/arm-linux-gnueabi/bits/shmlba.h
index 53ceb23b31..75efb7ce50 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/shmlba.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/shmlba.h
@@ -1,5 +1,5 @@
/* Define SHMLBA. ARM version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_SHM_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/stat.h b/lib/libc/include/arm-linux-gnueabi/bits/stat.h
index 16336f5ec1..f6c3b7a3fa 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/stat.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h b/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h
new file mode 100644
index 0000000000..f6c7499dab
--- /dev/null
+++ b/lib/libc/include/arm-linux-gnueabi/bits/struct_rwlock.h
@@ -0,0 +1,61 @@
+/* Default read-write lock implementation struct definitions.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#ifndef __RWLOCK_INTERNAL_H
+#define __RWLOCK_INTERNAL_H
+
+#include
+
+/* Generic struct for both POSIX read-write lock. New ports are expected
+ to use the default layout, however archictetures can redefine it to add
+ arch-specific extensions (such as lock-elision). The struct have a size
+ of 32 bytes on both LP32 and LP64 architectures. */
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ /* FLAGS must stay at its position in the structure to maintain
+ binary compatibility. */
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ unsigned char __flags;
+#else
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
+ int __cur_writer;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0
+#else
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0
+#endif
+
+#endif
\ No newline at end of file
diff --git a/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h b/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h
index 3485a5acf2..f0838f9108 100644
--- a/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h
+++ b/lib/libc/include/arm-linux-gnueabi/bits/wordsize.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#define __WORDSIZE 32
#define __WORDSIZE_TIME64_COMPAT32 0
diff --git a/lib/libc/include/arm-linux-gnueabi/fpu_control.h b/lib/libc/include/arm-linux-gnueabi/fpu_control.h
index 9d6c65112e..ad74992218 100644
--- a/lib/libc/include/arm-linux-gnueabi/fpu_control.h
+++ b/lib/libc/include/arm-linux-gnueabi/fpu_control.h
@@ -1,5 +1,5 @@
/* FPU control word definitions. ARM VFP version.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
+ Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H
diff --git a/lib/libc/include/arm-linux-gnueabi/sys/ptrace.h b/lib/libc/include/arm-linux-gnueabi/sys/ptrace.h
index 22d2bb12d4..34be509f32 100644
--- a/lib/libc/include/arm-linux-gnueabi/sys/ptrace.h
+++ b/lib/libc/include/arm-linux-gnueabi/sys/ptrace.h
@@ -1,5 +1,5 @@
/* `ptrace' debugger support interface. Linux/ARM version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -196,8 +196,12 @@ enum __ptrace_request
#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
/* Get seccomp BPF filter metadata. */
- PTRACE_SECCOMP_GET_METADATA = 0x420d
+ PTRACE_SECCOMP_GET_METADATA = 0x420d,
#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
+
+ /* Get information about system call. */
+ PTRACE_GET_SYSCALL_INFO = 0x420e
+#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
};
diff --git a/lib/libc/include/arm-linux-gnueabi/sys/ucontext.h b/lib/libc/include/arm-linux-gnueabi/sys/ucontext.h
index 79b51c3f94..53ffc36a6c 100644
--- a/lib/libc/include/arm-linux-gnueabi/sys/ucontext.h
+++ b/lib/libc/include/arm-linux-gnueabi/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* System V/ARM ABI compliant context switching support. */
diff --git a/lib/libc/include/arm-linux-gnueabi/sys/user.h b/lib/libc/include/arm-linux-gnueabi/sys/user.h
index 4916f5c018..2b901bfba3 100644
--- a/lib/libc/include/arm-linux-gnueabi/sys/user.h
+++ b/lib/libc/include/arm-linux-gnueabi/sys/user.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/endian.h b/lib/libc/include/arm-linux-gnueabihf/bits/endian.h
deleted file mode 100644
index 8325d51253..0000000000
--- a/lib/libc/include/arm-linux-gnueabihf/bits/endian.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
-#endif
-
-/* ARM can be either big or little endian. */
-#ifdef __ARMEB__
-#define __BYTE_ORDER __BIG_ENDIAN
-#else
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
\ No newline at end of file
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/endianness.h b/lib/libc/include/arm-linux-gnueabihf/bits/endianness.h
new file mode 100644
index 0000000000..8e938abfb9
--- /dev/null
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/endianness.h
@@ -0,0 +1,15 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* ARM has selectable endianness. */
+#ifdef __ARMEB__
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* bits/endianness.h */
\ No newline at end of file
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/fcntl.h b/lib/libc/include/arm-linux-gnueabihf/bits/fcntl.h
index 77edfb78fb..fdb169449b 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/fcntl.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-2019 Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/fenv.h b/lib/libc/include/arm-linux-gnueabihf/bits/fenv.h
index b8fbba6258..654776420e 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/fenv.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FENV_H
# error "Never use directly; include instead."
@@ -81,7 +81,7 @@ fenv_t;
# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif
-#if __GLIBC_USE (IEC_60559_BFP_EXT)
+#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
/* Type representing floating-point control modes. */
typedef unsigned int femode_t;
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h b/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h
index 24852b6800..2900001e82 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/floatn.h
@@ -1,5 +1,5 @@
/* Macros to control TS 18661-3 glibc features.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the IEEE 754 binary128 format, and this glibc
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/hwcap.h b/lib/libc/include/arm-linux-gnueabihf/bits/hwcap.h
index a31befca4e..b626008612 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/hwcap.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/hwcap.h
@@ -1,5 +1,5 @@
/* Defines for bits in AT_HWCAP. ARM Linux version.
- Copyright (C) 2012-2019 Free Software Foundation, Inc.
+ Copyright (C) 2012-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined (_SYS_AUXV_H) && !defined (_LINUX_ARM_SYSDEP_H)
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/link.h b/lib/libc/include/arm-linux-gnueabihf/bits/link.h
index 5dee177ce6..7ebb2785d6 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/link.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/link.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _LINK_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/long-double.h b/lib/libc/include/arm-linux-gnueabihf/bits/long-double.h
index 125807d07a..13e74241e1 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/long-double.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/long-double.h
@@ -1,5 +1,5 @@
/* Properties of long double type.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* This header is included by .
@@ -36,4 +36,5 @@
ABI-compatible with double. */
#ifndef __NO_LONG_DOUBLE_MATH
# define __NO_LONG_DOUBLE_MATH 1
-#endif
\ No newline at end of file
+#endif
+#define __LONG_DOUBLE_USES_FLOAT128 0
\ No newline at end of file
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/procfs-id.h b/lib/libc/include/arm-linux-gnueabihf/bits/procfs-id.h
index 35582db16f..48da66726b 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/procfs-id.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/procfs-id.h
@@ -1,5 +1,5 @@
/* Types of pr_uid and pr_gid in struct elf_prpsinfo. Arm version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/procfs.h b/lib/libc/include/arm-linux-gnueabihf/bits/procfs.h
index 3e91a588d8..8a92b69bd4 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/procfs.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/procfs.h
@@ -1,5 +1,5 @@
/* Types for registers for sys/procfs.h. Arm version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/semaphore.h b/lib/libc/include/arm-linux-gnueabihf/bits/semaphore.h
index acde20be36..3dd94baf34 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/semaphore.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/semaphore.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SEMAPHORE_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/setjmp.h b/lib/libc/include/arm-linux-gnueabihf/bits/setjmp.h
index 2b50cca982..0912578792 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/setjmp.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* Define the machine-dependent type `jmp_buf'. ARM EABI version. */
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/shmlba.h b/lib/libc/include/arm-linux-gnueabihf/bits/shmlba.h
index 53ceb23b31..75efb7ce50 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/shmlba.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/shmlba.h
@@ -1,5 +1,5 @@
/* Define SHMLBA. ARM version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_SHM_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/stat.h b/lib/libc/include/arm-linux-gnueabihf/bits/stat.h
index 16336f5ec1..f6c3b7a3fa 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/stat.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h b/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h
new file mode 100644
index 0000000000..f6c7499dab
--- /dev/null
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/struct_rwlock.h
@@ -0,0 +1,61 @@
+/* Default read-write lock implementation struct definitions.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#ifndef __RWLOCK_INTERNAL_H
+#define __RWLOCK_INTERNAL_H
+
+#include
+
+/* Generic struct for both POSIX read-write lock. New ports are expected
+ to use the default layout, however archictetures can redefine it to add
+ arch-specific extensions (such as lock-elision). The struct have a size
+ of 32 bytes on both LP32 and LP64 architectures. */
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ /* FLAGS must stay at its position in the structure to maintain
+ binary compatibility. */
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ unsigned char __flags;
+#else
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
+ int __cur_writer;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0
+#else
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0
+#endif
+
+#endif
\ No newline at end of file
diff --git a/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h
index 3485a5acf2..f0838f9108 100644
--- a/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h
+++ b/lib/libc/include/arm-linux-gnueabihf/bits/wordsize.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#define __WORDSIZE 32
#define __WORDSIZE_TIME64_COMPAT32 0
diff --git a/lib/libc/include/arm-linux-gnueabihf/fpu_control.h b/lib/libc/include/arm-linux-gnueabihf/fpu_control.h
index 9d6c65112e..ad74992218 100644
--- a/lib/libc/include/arm-linux-gnueabihf/fpu_control.h
+++ b/lib/libc/include/arm-linux-gnueabihf/fpu_control.h
@@ -1,5 +1,5 @@
/* FPU control word definitions. ARM VFP version.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
+ Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H
diff --git a/lib/libc/include/arm-linux-gnueabihf/sys/ptrace.h b/lib/libc/include/arm-linux-gnueabihf/sys/ptrace.h
index 22d2bb12d4..34be509f32 100644
--- a/lib/libc/include/arm-linux-gnueabihf/sys/ptrace.h
+++ b/lib/libc/include/arm-linux-gnueabihf/sys/ptrace.h
@@ -1,5 +1,5 @@
/* `ptrace' debugger support interface. Linux/ARM version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -196,8 +196,12 @@ enum __ptrace_request
#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
/* Get seccomp BPF filter metadata. */
- PTRACE_SECCOMP_GET_METADATA = 0x420d
+ PTRACE_SECCOMP_GET_METADATA = 0x420d,
#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
+
+ /* Get information about system call. */
+ PTRACE_GET_SYSCALL_INFO = 0x420e
+#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
};
diff --git a/lib/libc/include/arm-linux-gnueabihf/sys/ucontext.h b/lib/libc/include/arm-linux-gnueabihf/sys/ucontext.h
index 79b51c3f94..53ffc36a6c 100644
--- a/lib/libc/include/arm-linux-gnueabihf/sys/ucontext.h
+++ b/lib/libc/include/arm-linux-gnueabihf/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* System V/ARM ABI compliant context switching support. */
diff --git a/lib/libc/include/arm-linux-gnueabihf/sys/user.h b/lib/libc/include/arm-linux-gnueabihf/sys/user.h
index 4916f5c018..2b901bfba3 100644
--- a/lib/libc/include/arm-linux-gnueabihf/sys/user.h
+++ b/lib/libc/include/arm-linux-gnueabihf/sys/user.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/endian.h b/lib/libc/include/armeb-linux-gnueabi/bits/endian.h
deleted file mode 100644
index 8325d51253..0000000000
--- a/lib/libc/include/armeb-linux-gnueabi/bits/endian.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
-#endif
-
-/* ARM can be either big or little endian. */
-#ifdef __ARMEB__
-#define __BYTE_ORDER __BIG_ENDIAN
-#else
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
\ No newline at end of file
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/endianness.h b/lib/libc/include/armeb-linux-gnueabi/bits/endianness.h
new file mode 100644
index 0000000000..8e938abfb9
--- /dev/null
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/endianness.h
@@ -0,0 +1,15 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* ARM has selectable endianness. */
+#ifdef __ARMEB__
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* bits/endianness.h */
\ No newline at end of file
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/fcntl.h b/lib/libc/include/armeb-linux-gnueabi/bits/fcntl.h
index 77edfb78fb..fdb169449b 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/fcntl.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-2019 Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/fenv.h b/lib/libc/include/armeb-linux-gnueabi/bits/fenv.h
index b8fbba6258..654776420e 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/fenv.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FENV_H
# error "Never use directly; include instead."
@@ -81,7 +81,7 @@ fenv_t;
# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif
-#if __GLIBC_USE (IEC_60559_BFP_EXT)
+#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
/* Type representing floating-point control modes. */
typedef unsigned int femode_t;
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h b/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h
index 24852b6800..2900001e82 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/floatn.h
@@ -1,5 +1,5 @@
/* Macros to control TS 18661-3 glibc features.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the IEEE 754 binary128 format, and this glibc
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/hwcap.h b/lib/libc/include/armeb-linux-gnueabi/bits/hwcap.h
index a31befca4e..b626008612 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/hwcap.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/hwcap.h
@@ -1,5 +1,5 @@
/* Defines for bits in AT_HWCAP. ARM Linux version.
- Copyright (C) 2012-2019 Free Software Foundation, Inc.
+ Copyright (C) 2012-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined (_SYS_AUXV_H) && !defined (_LINUX_ARM_SYSDEP_H)
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/link.h b/lib/libc/include/armeb-linux-gnueabi/bits/link.h
index 5dee177ce6..7ebb2785d6 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/link.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/link.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _LINK_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/long-double.h b/lib/libc/include/armeb-linux-gnueabi/bits/long-double.h
index 125807d07a..13e74241e1 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/long-double.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/long-double.h
@@ -1,5 +1,5 @@
/* Properties of long double type.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* This header is included by .
@@ -36,4 +36,5 @@
ABI-compatible with double. */
#ifndef __NO_LONG_DOUBLE_MATH
# define __NO_LONG_DOUBLE_MATH 1
-#endif
\ No newline at end of file
+#endif
+#define __LONG_DOUBLE_USES_FLOAT128 0
\ No newline at end of file
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/procfs-id.h b/lib/libc/include/armeb-linux-gnueabi/bits/procfs-id.h
index 35582db16f..48da66726b 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/procfs-id.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/procfs-id.h
@@ -1,5 +1,5 @@
/* Types of pr_uid and pr_gid in struct elf_prpsinfo. Arm version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/procfs.h b/lib/libc/include/armeb-linux-gnueabi/bits/procfs.h
index 3e91a588d8..8a92b69bd4 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/procfs.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/procfs.h
@@ -1,5 +1,5 @@
/* Types for registers for sys/procfs.h. Arm version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/semaphore.h b/lib/libc/include/armeb-linux-gnueabi/bits/semaphore.h
index acde20be36..3dd94baf34 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/semaphore.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/semaphore.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SEMAPHORE_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/setjmp.h b/lib/libc/include/armeb-linux-gnueabi/bits/setjmp.h
index 2b50cca982..0912578792 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/setjmp.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* Define the machine-dependent type `jmp_buf'. ARM EABI version. */
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/shmlba.h b/lib/libc/include/armeb-linux-gnueabi/bits/shmlba.h
index 53ceb23b31..75efb7ce50 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/shmlba.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/shmlba.h
@@ -1,5 +1,5 @@
/* Define SHMLBA. ARM version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_SHM_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/stat.h b/lib/libc/include/armeb-linux-gnueabi/bits/stat.h
index 16336f5ec1..f6c3b7a3fa 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/stat.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h b/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h
new file mode 100644
index 0000000000..f6c7499dab
--- /dev/null
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/struct_rwlock.h
@@ -0,0 +1,61 @@
+/* Default read-write lock implementation struct definitions.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#ifndef __RWLOCK_INTERNAL_H
+#define __RWLOCK_INTERNAL_H
+
+#include
+
+/* Generic struct for both POSIX read-write lock. New ports are expected
+ to use the default layout, however archictetures can redefine it to add
+ arch-specific extensions (such as lock-elision). The struct have a size
+ of 32 bytes on both LP32 and LP64 architectures. */
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ /* FLAGS must stay at its position in the structure to maintain
+ binary compatibility. */
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ unsigned char __flags;
+#else
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
+ int __cur_writer;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0
+#else
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0
+#endif
+
+#endif
\ No newline at end of file
diff --git a/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h b/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h
index 3485a5acf2..f0838f9108 100644
--- a/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h
+++ b/lib/libc/include/armeb-linux-gnueabi/bits/wordsize.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#define __WORDSIZE 32
#define __WORDSIZE_TIME64_COMPAT32 0
diff --git a/lib/libc/include/armeb-linux-gnueabi/fpu_control.h b/lib/libc/include/armeb-linux-gnueabi/fpu_control.h
index 9d6c65112e..ad74992218 100644
--- a/lib/libc/include/armeb-linux-gnueabi/fpu_control.h
+++ b/lib/libc/include/armeb-linux-gnueabi/fpu_control.h
@@ -1,5 +1,5 @@
/* FPU control word definitions. ARM VFP version.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
+ Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H
diff --git a/lib/libc/include/armeb-linux-gnueabi/sys/ptrace.h b/lib/libc/include/armeb-linux-gnueabi/sys/ptrace.h
index 22d2bb12d4..34be509f32 100644
--- a/lib/libc/include/armeb-linux-gnueabi/sys/ptrace.h
+++ b/lib/libc/include/armeb-linux-gnueabi/sys/ptrace.h
@@ -1,5 +1,5 @@
/* `ptrace' debugger support interface. Linux/ARM version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -196,8 +196,12 @@ enum __ptrace_request
#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
/* Get seccomp BPF filter metadata. */
- PTRACE_SECCOMP_GET_METADATA = 0x420d
+ PTRACE_SECCOMP_GET_METADATA = 0x420d,
#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
+
+ /* Get information about system call. */
+ PTRACE_GET_SYSCALL_INFO = 0x420e
+#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
};
diff --git a/lib/libc/include/armeb-linux-gnueabi/sys/ucontext.h b/lib/libc/include/armeb-linux-gnueabi/sys/ucontext.h
index 79b51c3f94..53ffc36a6c 100644
--- a/lib/libc/include/armeb-linux-gnueabi/sys/ucontext.h
+++ b/lib/libc/include/armeb-linux-gnueabi/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* System V/ARM ABI compliant context switching support. */
diff --git a/lib/libc/include/armeb-linux-gnueabi/sys/user.h b/lib/libc/include/armeb-linux-gnueabi/sys/user.h
index 4916f5c018..2b901bfba3 100644
--- a/lib/libc/include/armeb-linux-gnueabi/sys/user.h
+++ b/lib/libc/include/armeb-linux-gnueabi/sys/user.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/endian.h b/lib/libc/include/armeb-linux-gnueabihf/bits/endian.h
deleted file mode 100644
index 8325d51253..0000000000
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/endian.h
+++ /dev/null
@@ -1,10 +0,0 @@
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
-#endif
-
-/* ARM can be either big or little endian. */
-#ifdef __ARMEB__
-#define __BYTE_ORDER __BIG_ENDIAN
-#else
-#define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
\ No newline at end of file
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/endianness.h b/lib/libc/include/armeb-linux-gnueabihf/bits/endianness.h
new file mode 100644
index 0000000000..8e938abfb9
--- /dev/null
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/endianness.h
@@ -0,0 +1,15 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* ARM has selectable endianness. */
+#ifdef __ARMEB__
+#define __BYTE_ORDER __BIG_ENDIAN
+#else
+#define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* bits/endianness.h */
\ No newline at end of file
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/fcntl.h b/lib/libc/include/armeb-linux-gnueabihf/bits/fcntl.h
index 77edfb78fb..fdb169449b 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/fcntl.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-2019 Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/fenv.h b/lib/libc/include/armeb-linux-gnueabihf/bits/fenv.h
index b8fbba6258..654776420e 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/fenv.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FENV_H
# error "Never use directly; include instead."
@@ -81,7 +81,7 @@ fenv_t;
# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif
-#if __GLIBC_USE (IEC_60559_BFP_EXT)
+#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
/* Type representing floating-point control modes. */
typedef unsigned int femode_t;
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h b/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h
index 24852b6800..2900001e82 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/floatn.h
@@ -1,5 +1,5 @@
/* Macros to control TS 18661-3 glibc features.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the IEEE 754 binary128 format, and this glibc
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/hwcap.h b/lib/libc/include/armeb-linux-gnueabihf/bits/hwcap.h
index a31befca4e..b626008612 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/hwcap.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/hwcap.h
@@ -1,5 +1,5 @@
/* Defines for bits in AT_HWCAP. ARM Linux version.
- Copyright (C) 2012-2019 Free Software Foundation, Inc.
+ Copyright (C) 2012-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined (_SYS_AUXV_H) && !defined (_LINUX_ARM_SYSDEP_H)
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/link.h b/lib/libc/include/armeb-linux-gnueabihf/bits/link.h
index 5dee177ce6..7ebb2785d6 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/link.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/link.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _LINK_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/long-double.h b/lib/libc/include/armeb-linux-gnueabihf/bits/long-double.h
index 125807d07a..13e74241e1 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/long-double.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/long-double.h
@@ -1,5 +1,5 @@
/* Properties of long double type.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* This header is included by .
@@ -36,4 +36,5 @@
ABI-compatible with double. */
#ifndef __NO_LONG_DOUBLE_MATH
# define __NO_LONG_DOUBLE_MATH 1
-#endif
\ No newline at end of file
+#endif
+#define __LONG_DOUBLE_USES_FLOAT128 0
\ No newline at end of file
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/procfs-id.h b/lib/libc/include/armeb-linux-gnueabihf/bits/procfs-id.h
index 35582db16f..48da66726b 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/procfs-id.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/procfs-id.h
@@ -1,5 +1,5 @@
/* Types of pr_uid and pr_gid in struct elf_prpsinfo. Arm version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/procfs.h b/lib/libc/include/armeb-linux-gnueabihf/bits/procfs.h
index 3e91a588d8..8a92b69bd4 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/procfs.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/procfs.h
@@ -1,5 +1,5 @@
/* Types for registers for sys/procfs.h. Arm version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_PROCFS_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/semaphore.h b/lib/libc/include/armeb-linux-gnueabihf/bits/semaphore.h
index acde20be36..3dd94baf34 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/semaphore.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/semaphore.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SEMAPHORE_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/setjmp.h b/lib/libc/include/armeb-linux-gnueabihf/bits/setjmp.h
index 2b50cca982..0912578792 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/setjmp.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/setjmp.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2004-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* Define the machine-dependent type `jmp_buf'. ARM EABI version. */
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/shmlba.h b/lib/libc/include/armeb-linux-gnueabihf/bits/shmlba.h
index 53ceb23b31..75efb7ce50 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/shmlba.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/shmlba.h
@@ -1,5 +1,5 @@
/* Define SHMLBA. ARM version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_SHM_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/stat.h b/lib/libc/include/armeb-linux-gnueabihf/bits/stat.h
index 16336f5ec1..f6c3b7a3fa 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/stat.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/stat.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h
new file mode 100644
index 0000000000..f6c7499dab
--- /dev/null
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/struct_rwlock.h
@@ -0,0 +1,61 @@
+/* Default read-write lock implementation struct definitions.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#ifndef __RWLOCK_INTERNAL_H
+#define __RWLOCK_INTERNAL_H
+
+#include
+
+/* Generic struct for both POSIX read-write lock. New ports are expected
+ to use the default layout, however archictetures can redefine it to add
+ arch-specific extensions (such as lock-elision). The struct have a size
+ of 32 bytes on both LP32 and LP64 architectures. */
+
+struct __pthread_rwlock_arch_t
+{
+ unsigned int __readers;
+ unsigned int __writers;
+ unsigned int __wrphase_futex;
+ unsigned int __writers_futex;
+ unsigned int __pad3;
+ unsigned int __pad4;
+ /* FLAGS must stay at its position in the structure to maintain
+ binary compatibility. */
+#if __BYTE_ORDER == __BIG_ENDIAN
+ unsigned char __pad1;
+ unsigned char __pad2;
+ unsigned char __shared;
+ unsigned char __flags;
+#else
+ unsigned char __flags;
+ unsigned char __shared;
+ unsigned char __pad1;
+ unsigned char __pad2;
+#endif
+ int __cur_writer;
+};
+
+#if __BYTE_ORDER == __BIG_ENDIAN
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, 0, 0, 0, __flags, 0
+#else
+# define __PTHREAD_RWLOCK_INITIALIZER(__flags) \
+ 0, 0, 0, 0, 0, 0, __flags, 0, 0, 0, 0
+#endif
+
+#endif
\ No newline at end of file
diff --git a/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h b/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h
index 3485a5acf2..f0838f9108 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/bits/wordsize.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#define __WORDSIZE 32
#define __WORDSIZE_TIME64_COMPAT32 0
diff --git a/lib/libc/include/armeb-linux-gnueabihf/fpu_control.h b/lib/libc/include/armeb-linux-gnueabihf/fpu_control.h
index 9d6c65112e..ad74992218 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/fpu_control.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/fpu_control.h
@@ -1,5 +1,5 @@
/* FPU control word definitions. ARM VFP version.
- Copyright (C) 2004-2019 Free Software Foundation, Inc.
+ Copyright (C) 2004-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FPU_CONTROL_H
#define _FPU_CONTROL_H
diff --git a/lib/libc/include/armeb-linux-gnueabihf/sys/ptrace.h b/lib/libc/include/armeb-linux-gnueabihf/sys/ptrace.h
index 22d2bb12d4..34be509f32 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/sys/ptrace.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/sys/ptrace.h
@@ -1,5 +1,5 @@
/* `ptrace' debugger support interface. Linux/ARM version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
@@ -196,8 +196,12 @@ enum __ptrace_request
#define PTRACE_SECCOMP_GET_FILTER PTRACE_SECCOMP_GET_FILTER
/* Get seccomp BPF filter metadata. */
- PTRACE_SECCOMP_GET_METADATA = 0x420d
+ PTRACE_SECCOMP_GET_METADATA = 0x420d,
#define PTRACE_SECCOMP_GET_METADATA PTRACE_SECCOMP_GET_METADATA
+
+ /* Get information about system call. */
+ PTRACE_GET_SYSCALL_INFO = 0x420e
+#define PTRACE_GET_SYSCALL_INFO PTRACE_GET_SYSCALL_INFO
};
diff --git a/lib/libc/include/armeb-linux-gnueabihf/sys/ucontext.h b/lib/libc/include/armeb-linux-gnueabihf/sys/ucontext.h
index 79b51c3f94..53ffc36a6c 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/sys/ucontext.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/sys/ucontext.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
/* System V/ARM ABI compliant context switching support. */
diff --git a/lib/libc/include/armeb-linux-gnueabihf/sys/user.h b/lib/libc/include/armeb-linux-gnueabihf/sys/user.h
index 4916f5c018..2b901bfba3 100644
--- a/lib/libc/include/armeb-linux-gnueabihf/sys/user.h
+++ b/lib/libc/include/armeb-linux-gnueabihf/sys/user.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _SYS_USER_H
#define _SYS_USER_H 1
diff --git a/lib/libc/include/generic-glibc/aio.h b/lib/libc/include/generic-glibc/aio.h
index ed7b8bb86f..7028917727 100644
--- a/lib/libc/include/generic-glibc/aio.h
+++ b/lib/libc/include/generic-glibc/aio.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/*
* ISO/IEC 9945-1:1996 6.7: Asynchronous Input and Output
diff --git a/lib/libc/include/generic-glibc/aliases.h b/lib/libc/include/generic-glibc/aliases.h
index a671290051..ead8562ace 100644
--- a/lib/libc/include/generic-glibc/aliases.h
+++ b/lib/libc/include/generic-glibc/aliases.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ALIASES_H
#define _ALIASES_H 1
diff --git a/lib/libc/include/generic-glibc/alloca.h b/lib/libc/include/generic-glibc/alloca.h
index a1b60a3dbd..9e8a986743 100644
--- a/lib/libc/include/generic-glibc/alloca.h
+++ b/lib/libc/include/generic-glibc/alloca.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1992-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1992-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ALLOCA_H
#define _ALLOCA_H 1
diff --git a/lib/libc/include/generic-glibc/ar.h b/lib/libc/include/generic-glibc/ar.h
index d9aa7daad6..5accd0cf2d 100644
--- a/lib/libc/include/generic-glibc/ar.h
+++ b/lib/libc/include/generic-glibc/ar.h
@@ -1,5 +1,5 @@
/* Header describing `ar' archive file format.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _AR_H
#define _AR_H 1
diff --git a/lib/libc/include/generic-glibc/argp.h b/lib/libc/include/generic-glibc/argp.h
index ce61b300f4..0bb8d732f5 100644
--- a/lib/libc/include/generic-glibc/argp.h
+++ b/lib/libc/include/generic-glibc/argp.h
@@ -1,5 +1,5 @@
/* Hierarchial argument parsing, layered over getopt.
- Copyright (C) 1995-2019 Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
Written by Miles Bader .
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ARGP_H
#define _ARGP_H
diff --git a/lib/libc/include/generic-glibc/argz.h b/lib/libc/include/generic-glibc/argz.h
index c880c8bded..d7a265c2a5 100644
--- a/lib/libc/include/generic-glibc/argz.h
+++ b/lib/libc/include/generic-glibc/argz.h
@@ -1,5 +1,5 @@
/* Routines for dealing with '\0' separated arg vectors.
- Copyright (C) 1995-2019 Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ARGZ_H
#define _ARGZ_H 1
diff --git a/lib/libc/include/generic-glibc/arpa/inet.h b/lib/libc/include/generic-glibc/arpa/inet.h
index 580ec2e668..7b83e763cc 100644
--- a/lib/libc/include/generic-glibc/arpa/inet.h
+++ b/lib/libc/include/generic-glibc/arpa/inet.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1997-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1997-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ARPA_INET_H
#define _ARPA_INET_H 1
diff --git a/lib/libc/include/generic-glibc/assert.h b/lib/libc/include/generic-glibc/assert.h
index 0a249c7d7c..14aa2f9e21 100644
--- a/lib/libc/include/generic-glibc/assert.h
+++ b/lib/libc/include/generic-glibc/assert.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/*
* ISO C99 Standard: 7.2 Diagnostics
diff --git a/lib/libc/include/generic-glibc/bits/argp-ldbl.h b/lib/libc/include/generic-glibc/bits/argp-ldbl.h
index 2dc1602b62..2cf222648f 100644
--- a/lib/libc/include/generic-glibc/bits/argp-ldbl.h
+++ b/lib/libc/include/generic-glibc/bits/argp-ldbl.h
@@ -1,5 +1,5 @@
/* Redirections for argp functions for -mlong-double-64.
- Copyright (C) 2019 Free Software Foundation, Inc.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ARGP_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/generic-glibc/bits/byteswap.h b/lib/libc/include/generic-glibc/bits/byteswap.h
index a4052e4506..2c854c625a 100644
--- a/lib/libc/include/generic-glibc/bits/byteswap.h
+++ b/lib/libc/include/generic-glibc/bits/byteswap.h
@@ -1,5 +1,5 @@
/* Macros and inline functions to swap the order of bytes in integer values.
- Copyright (C) 1997-2019 Free Software Foundation, Inc.
+ Copyright (C) 1997-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/cmathcalls.h b/lib/libc/include/generic-glibc/bits/cmathcalls.h
index 2904cff060..ed604e0fda 100644
--- a/lib/libc/include/generic-glibc/bits/cmathcalls.h
+++ b/lib/libc/include/generic-glibc/bits/cmathcalls.h
@@ -1,6 +1,6 @@
/* Prototype declarations for complex math functions;
helper file for .
- Copyright (C) 1997-2019 Free Software Foundation, Inc.
+ Copyright (C) 1997-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* NOTE: Because of the special way this file is used by , this
file must NOT be protected from multiple inclusion as header files
diff --git a/lib/libc/include/generic-glibc/bits/confname.h b/lib/libc/include/generic-glibc/bits/confname.h
index 620c912e25..710a92730f 100644
--- a/lib/libc/include/generic-glibc/bits/confname.h
+++ b/lib/libc/include/generic-glibc/bits/confname.h
@@ -1,5 +1,5 @@
/* `sysconf', `pathconf', and `confstr' NAME values. Generic version.
- Copyright (C) 1993-2019 Free Software Foundation, Inc.
+ Copyright (C) 1993-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _UNISTD_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/cpu-set.h b/lib/libc/include/generic-glibc/bits/cpu-set.h
index 155f967827..a8bd65bae1 100644
--- a/lib/libc/include/generic-glibc/bits/cpu-set.h
+++ b/lib/libc/include/generic-glibc/bits/cpu-set.h
@@ -1,6 +1,6 @@
/* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993
scheduling interface.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_CPU_SET_H
#define _BITS_CPU_SET_H 1
diff --git a/lib/libc/include/generic-glibc/bits/dirent.h b/lib/libc/include/generic-glibc/bits/dirent.h
index d35853ce22..a18b453fd3 100644
--- a/lib/libc/include/generic-glibc/bits/dirent.h
+++ b/lib/libc/include/generic-glibc/bits/dirent.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _DIRENT_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/dirent_ext.h b/lib/libc/include/generic-glibc/bits/dirent_ext.h
index fd2a6ebfde..f5c3fb34fd 100644
--- a/lib/libc/include/generic-glibc/bits/dirent_ext.h
+++ b/lib/libc/include/generic-glibc/bits/dirent_ext.h
@@ -1,5 +1,5 @@
/* System-specific extensions of . Linux version.
- Copyright (C) 2019 Free Software Foundation, Inc.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _DIRENT_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/generic-glibc/bits/dlfcn.h b/lib/libc/include/generic-glibc/bits/dlfcn.h
index 8a4e679bf5..8339ace845 100644
--- a/lib/libc/include/generic-glibc/bits/dlfcn.h
+++ b/lib/libc/include/generic-glibc/bits/dlfcn.h
@@ -1,5 +1,5 @@
/* System dependent definitions for run-time dynamic loading.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _DLFCN_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/endian.h b/lib/libc/include/generic-glibc/bits/endian.h
index 44b05652f1..dae5221e81 100644
--- a/lib/libc/include/generic-glibc/bits/endian.h
+++ b/lib/libc/include/generic-glibc/bits/endian.h
@@ -1,15 +1,49 @@
-/* The MIPS architecture has selectable endianness.
- It exists in both little and big endian flavours and we
- want to be able to share the installed header files between
- both, so we define __BYTE_ORDER based on GCC's predefines. */
+/* Endian macros for string.h functions
+ Copyright (C) 1992-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
-#ifndef _ENDIAN_H
-# error "Never use directly; include instead."
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#ifndef _BITS_ENDIAN_H
+#define _BITS_ENDIAN_H 1
+
+/* Definitions for byte order, according to significance of bytes,
+ from low addresses to high addresses. The value is what you get by
+ putting '4' in the most significant byte, '3' in the second most
+ significant byte, '2' in the second least significant byte, and '1'
+ in the least significant byte, and then writing down one digit for
+ each byte, starting with the byte at the lowest address at the left,
+ and proceeding to the byte with the highest address at the right. */
+
+#define __LITTLE_ENDIAN 1234
+#define __BIG_ENDIAN 4321
+#define __PDP_ENDIAN 3412
+
+/* This file defines `__BYTE_ORDER' for the particular machine. */
+#include
+
+/* Some machines may need to use a different endianness for floating point
+ values. */
+#ifndef __FLOAT_WORD_ORDER
+# define __FLOAT_WORD_ORDER __BYTE_ORDER
#endif
-#ifdef __MIPSEB
-# define __BYTE_ORDER __BIG_ENDIAN
+#if __BYTE_ORDER == __LITTLE_ENDIAN
+# define __LONG_LONG_PAIR(HI, LO) LO, HI
+#elif __BYTE_ORDER == __BIG_ENDIAN
+# define __LONG_LONG_PAIR(HI, LO) HI, LO
#endif
-#ifdef __MIPSEL
-# define __BYTE_ORDER __LITTLE_ENDIAN
-#endif
\ No newline at end of file
+
+#endif /* bits/endian.h */
\ No newline at end of file
diff --git a/lib/libc/include/generic-glibc/bits/endianness.h b/lib/libc/include/generic-glibc/bits/endianness.h
new file mode 100644
index 0000000000..5a0a871460
--- /dev/null
+++ b/lib/libc/include/generic-glibc/bits/endianness.h
@@ -0,0 +1,16 @@
+#ifndef _BITS_ENDIANNESS_H
+#define _BITS_ENDIANNESS_H 1
+
+#ifndef _BITS_ENDIAN_H
+# error "Never use directly; include instead."
+#endif
+
+/* MIPS has selectable endianness. */
+#ifdef __MIPSEB
+# define __BYTE_ORDER __BIG_ENDIAN
+#endif
+#ifdef __MIPSEL
+# define __BYTE_ORDER __LITTLE_ENDIAN
+#endif
+
+#endif /* bits/endianness.h */
\ No newline at end of file
diff --git a/lib/libc/include/generic-glibc/bits/environments.h b/lib/libc/include/generic-glibc/bits/environments.h
index 28a2f5f220..1b5e74a08e 100644
--- a/lib/libc/include/generic-glibc/bits/environments.h
+++ b/lib/libc/include/generic-glibc/bits/environments.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1999-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1999-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _UNISTD_H
# error "Never include this file directly. Use instead"
diff --git a/lib/libc/include/generic-glibc/bits/epoll.h b/lib/libc/include/generic-glibc/bits/epoll.h
index d20c2e4c0f..6d92d7ce11 100644
--- a/lib/libc/include/generic-glibc/bits/epoll.h
+++ b/lib/libc/include/generic-glibc/bits/epoll.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2002-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_EPOLL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/err-ldbl.h b/lib/libc/include/generic-glibc/bits/err-ldbl.h
index 3f962597a3..7c928e438b 100644
--- a/lib/libc/include/generic-glibc/bits/err-ldbl.h
+++ b/lib/libc/include/generic-glibc/bits/err-ldbl.h
@@ -1,5 +1,5 @@
/* Redirections for err.h functions for -mlong-double-64.
- Copyright (C) 2019 Free Software Foundation, Inc.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ERR_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/generic-glibc/bits/errno.h b/lib/libc/include/generic-glibc/bits/errno.h
index 301cd0e35e..1bee63136a 100644
--- a/lib/libc/include/generic-glibc/bits/errno.h
+++ b/lib/libc/include/generic-glibc/bits/errno.h
@@ -1,5 +1,5 @@
/* Error constants. Linux specific version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_ERRNO_H
#define _BITS_ERRNO_H 1
diff --git a/lib/libc/include/generic-glibc/bits/error-ldbl.h b/lib/libc/include/generic-glibc/bits/error-ldbl.h
index 601c708686..9962b3226e 100644
--- a/lib/libc/include/generic-glibc/bits/error-ldbl.h
+++ b/lib/libc/include/generic-glibc/bits/error-ldbl.h
@@ -1,5 +1,5 @@
/* Redirections for error.h functions for -mlong-double-64.
- Copyright (C) 2019 Free Software Foundation, Inc.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ERROR_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/generic-glibc/bits/error.h b/lib/libc/include/generic-glibc/bits/error.h
index cf3ef0b0de..3189e24da8 100644
--- a/lib/libc/include/generic-glibc/bits/error.h
+++ b/lib/libc/include/generic-glibc/bits/error.h
@@ -1,5 +1,5 @@
/* Specializations for error functions.
- Copyright (C) 2007-2019 Free Software Foundation, Inc.
+ Copyright (C) 2007-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _ERROR_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/generic-glibc/bits/eventfd.h b/lib/libc/include/generic-glibc/bits/eventfd.h
index 9922a3d99d..0fb055c37c 100644
--- a/lib/libc/include/generic-glibc/bits/eventfd.h
+++ b/lib/libc/include/generic-glibc/bits/eventfd.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2007-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2007-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_EVENTFD_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/fcntl-linux.h b/lib/libc/include/generic-glibc/bits/fcntl-linux.h
index 869be9f8ab..4e3813d8c4 100644
--- a/lib/libc/include/generic-glibc/bits/fcntl-linux.h
+++ b/lib/libc/include/generic-glibc/bits/fcntl-linux.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 2001-2019 Free Software Foundation, Inc.
+ Copyright (C) 2001-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never use directly; include instead."
@@ -334,6 +334,11 @@ struct f_owner_ex
# define SYNC_FILE_RANGE_WAIT_AFTER 4 /* Wait upon writeout of all pages in
the range after performing the
write. */
+/* SYNC_FILE_RANGE_WRITE_AND_WAIT ensures all pages in the range are
+ written to disk before returning. */
+# define SYNC_FILE_RANGE_WRITE_AND_WAIT (SYNC_FILE_RANGE_WRITE \
+ | SYNC_FILE_RANGE_WAIT_BEFORE \
+ | SYNC_FILE_RANGE_WAIT_AFTER)
/* Flags for SPLICE and VMSPLICE. */
# define SPLICE_F_MOVE 1 /* Move pages instead of copying. */
diff --git a/lib/libc/include/generic-glibc/bits/fcntl.h b/lib/libc/include/generic-glibc/bits/fcntl.h
index 9a0318a81a..b9fa29e200 100644
--- a/lib/libc/include/generic-glibc/bits/fcntl.h
+++ b/lib/libc/include/generic-glibc/bits/fcntl.h
@@ -1,5 +1,5 @@
/* O_*, F_*, FD_* bit values for Linux.
- Copyright (C) 1995-2019 Free Software Foundation, Inc.
+ Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/fcntl2.h b/lib/libc/include/generic-glibc/bits/fcntl2.h
index a152158a74..800012c354 100644
--- a/lib/libc/include/generic-glibc/bits/fcntl2.h
+++ b/lib/libc/include/generic-glibc/bits/fcntl2.h
@@ -1,5 +1,5 @@
/* Checking macros for fcntl functions.
- Copyright (C) 2007-2019 Free Software Foundation, Inc.
+ Copyright (C) 2007-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _FCNTL_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/generic-glibc/bits/fenv.h b/lib/libc/include/generic-glibc/bits/fenv.h
index ea132417bf..cdf79211de 100644
--- a/lib/libc/include/generic-glibc/bits/fenv.h
+++ b/lib/libc/include/generic-glibc/bits/fenv.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1998-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1998-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _FENV_H
# error "Never use directly; include instead."
@@ -104,7 +104,7 @@ fenv_t;
# define FE_NOMASK_ENV ((const fenv_t *) -2)
#endif
-#if __GLIBC_USE (IEC_60559_BFP_EXT)
+#if __GLIBC_USE (IEC_60559_BFP_EXT_C2X)
/* Type representing floating-point control modes. */
typedef unsigned int femode_t;
diff --git a/lib/libc/include/generic-glibc/bits/floatn-common.h b/lib/libc/include/generic-glibc/bits/floatn-common.h
index 9ad81abbfb..9cccf45064 100644
--- a/lib/libc/include/generic-glibc/bits/floatn-common.h
+++ b/lib/libc/include/generic-glibc/bits/floatn-common.h
@@ -1,6 +1,6 @@
/* Macros to control TS 18661-3 glibc features where the same
definitions are appropriate for all platforms.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_FLOATN_COMMON_H
#define _BITS_FLOATN_COMMON_H
diff --git a/lib/libc/include/generic-glibc/bits/floatn.h b/lib/libc/include/generic-glibc/bits/floatn.h
index 10e11d2573..68a17ab2c7 100644
--- a/lib/libc/include/generic-glibc/bits/floatn.h
+++ b/lib/libc/include/generic-glibc/bits/floatn.h
@@ -1,5 +1,5 @@
/* Macros to control TS 18661-3 glibc features on MIPS platforms.
- Copyright (C) 2017-2019 Free Software Foundation, Inc.
+ Copyright (C) 2017-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _BITS_FLOATN_H
#define _BITS_FLOATN_H
diff --git a/lib/libc/include/generic-glibc/bits/flt-eval-method.h b/lib/libc/include/generic-glibc/bits/flt-eval-method.h
index 62def2881d..11297d9c17 100644
--- a/lib/libc/include/generic-glibc/bits/flt-eval-method.h
+++ b/lib/libc/include/generic-glibc/bits/flt-eval-method.h
@@ -1,5 +1,5 @@
/* Define __GLIBC_FLT_EVAL_METHOD.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _MATH_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/fp-fast.h b/lib/libc/include/generic-glibc/bits/fp-fast.h
index 6d7cddf1d2..5fceb7e29a 100644
--- a/lib/libc/include/generic-glibc/bits/fp-fast.h
+++ b/lib/libc/include/generic-glibc/bits/fp-fast.h
@@ -1,5 +1,5 @@
/* Define FP_FAST_* macros.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _MATH_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/fp-logb.h b/lib/libc/include/generic-glibc/bits/fp-logb.h
index ffbdcb2edc..efc488bc27 100644
--- a/lib/libc/include/generic-glibc/bits/fp-logb.h
+++ b/lib/libc/include/generic-glibc/bits/fp-logb.h
@@ -1,5 +1,5 @@
/* Define __FP_LOGB0_IS_MIN and __FP_LOGBNAN_IS_MIN.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _MATH_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/getopt_core.h b/lib/libc/include/generic-glibc/bits/getopt_core.h
index 5973daf49b..c509e0e328 100644
--- a/lib/libc/include/generic-glibc/bits/getopt_core.h
+++ b/lib/libc/include/generic-glibc/bits/getopt_core.h
@@ -1,5 +1,5 @@
/* Declarations for getopt (basic, portable features only).
- Copyright (C) 1989-2019 Free Software Foundation, Inc.
+ Copyright (C) 1989-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _GETOPT_CORE_H
#define _GETOPT_CORE_H 1
diff --git a/lib/libc/include/generic-glibc/bits/getopt_ext.h b/lib/libc/include/generic-glibc/bits/getopt_ext.h
index 648b6004bc..7d6a578db9 100644
--- a/lib/libc/include/generic-glibc/bits/getopt_ext.h
+++ b/lib/libc/include/generic-glibc/bits/getopt_ext.h
@@ -1,5 +1,5 @@
/* Declarations for getopt (GNU extensions).
- Copyright (C) 1989-2019 Free Software Foundation, Inc.
+ Copyright (C) 1989-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library and is also part of gnulib.
Patches to this file should be submitted to both projects.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _GETOPT_EXT_H
#define _GETOPT_EXT_H 1
diff --git a/lib/libc/include/generic-glibc/bits/getopt_posix.h b/lib/libc/include/generic-glibc/bits/getopt_posix.h
index 197a48e4fd..322dc96daf 100644
--- a/lib/libc/include/generic-glibc/bits/getopt_posix.h
+++ b/lib/libc/include/generic-glibc/bits/getopt_posix.h
@@ -1,5 +1,5 @@
/* Declarations for getopt (POSIX compatibility shim).
- Copyright (C) 1989-2019 Free Software Foundation, Inc.
+ Copyright (C) 1989-2020 Free Software Foundation, Inc.
Unlike the bulk of the getopt implementation, this file is NOT part
of gnulib.
@@ -15,7 +15,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _GETOPT_POSIX_H
#define _GETOPT_POSIX_H 1
diff --git a/lib/libc/include/generic-glibc/bits/hwcap.h b/lib/libc/include/generic-glibc/bits/hwcap.h
index 8be095a364..0d01bf6514 100644
--- a/lib/libc/include/generic-glibc/bits/hwcap.h
+++ b/lib/libc/include/generic-glibc/bits/hwcap.h
@@ -1,5 +1,5 @@
/* Defines for bits in AT_HWCAP.
- Copyright (C) 2012-2019 Free Software Foundation, Inc.
+ Copyright (C) 2012-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_AUXV_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/generic-glibc/bits/in.h b/lib/libc/include/generic-glibc/bits/in.h
index 08757c8eab..654c5adabe 100644
--- a/lib/libc/include/generic-glibc/bits/in.h
+++ b/lib/libc/include/generic-glibc/bits/in.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1991-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1991-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* Linux version. */
diff --git a/lib/libc/include/generic-glibc/bits/indirect-return.h b/lib/libc/include/generic-glibc/bits/indirect-return.h
index 5557372427..5a7beddda9 100644
--- a/lib/libc/include/generic-glibc/bits/indirect-return.h
+++ b/lib/libc/include/generic-glibc/bits/indirect-return.h
@@ -1,5 +1,5 @@
/* Definition of __INDIRECT_RETURN. Generic version.
- Copyright (C) 2018-2019 Free Software Foundation, Inc.
+ Copyright (C) 2018-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _UCONTEXT_H
# error "Never include directly; use instead."
diff --git a/lib/libc/include/generic-glibc/bits/inotify.h b/lib/libc/include/generic-glibc/bits/inotify.h
index 76cd436251..e019e25212 100644
--- a/lib/libc/include/generic-glibc/bits/inotify.h
+++ b/lib/libc/include/generic-glibc/bits/inotify.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_INOTIFY_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/ioctl-types.h b/lib/libc/include/generic-glibc/bits/ioctl-types.h
index 4ac9ac39ed..876311a6ce 100644
--- a/lib/libc/include/generic-glibc/bits/ioctl-types.h
+++ b/lib/libc/include/generic-glibc/bits/ioctl-types.h
@@ -1,5 +1,5 @@
/* Structure types for pre-termios terminal ioctls. Linux version.
- Copyright (C) 1996-2019 Free Software Foundation, Inc.
+ Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_IOCTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/ioctls.h b/lib/libc/include/generic-glibc/bits/ioctls.h
index 31b6ea7939..790e50b7fa 100644
--- a/lib/libc/include/generic-glibc/bits/ioctls.h
+++ b/lib/libc/include/generic-glibc/bits/ioctls.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1996-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1996-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_IOCTL_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/ipc-perm.h b/lib/libc/include/generic-glibc/bits/ipc-perm.h
new file mode 100644
index 0000000000..295a0ea3cf
--- /dev/null
+++ b/lib/libc/include/generic-glibc/bits/ipc-perm.h
@@ -0,0 +1,40 @@
+/* struct ipc_perm definition.
+ Copyright (C) 2019-2020 Free Software Foundation, Inc.
+ This file is part of the GNU C Library.
+
+ The GNU C Library is free software; you can redistribute it and/or
+ modify it under the terms of the GNU Lesser General Public
+ License as published by the Free Software Foundation; either
+ version 2.1 of the License, or (at your option) any later version.
+
+ The GNU C Library is distributed in the hope that it will be useful,
+ but WITHOUT ANY WARRANTY; without even the implied warranty of
+ MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
+ Lesser General Public License for more details.
+
+ You should have received a copy of the GNU Lesser General Public
+ License along with the GNU C Library; if not, see
+ . */
+
+#ifndef _SYS_IPC_H
+# error "Never use directly; include instead."
+#endif
+
+/* Data structure used to pass permission information to IPC operations.
+ It follows the kernel ipc64_perm size so the syscall can be made directly
+ without temporary buffer copy. However, since glibc defines the MODE
+ field as mode_t per POSIX definition (BZ#18231), it omits the __PAD1 field
+ (since glibc does not export mode_t as 16-bit for any architecture). */
+struct ipc_perm
+{
+ __key_t __key; /* Key. */
+ __uid_t uid; /* Owner's user ID. */
+ __gid_t gid; /* Owner's group ID. */
+ __uid_t cuid; /* Creator's user ID. */
+ __gid_t cgid; /* Creator's group ID. */
+ __mode_t mode; /* Read/write permission. */
+ unsigned short int __seq; /* Sequence number. */
+ unsigned short int __pad2;
+ __syscall_ulong_t __glibc_reserved1;
+ __syscall_ulong_t __glibc_reserved2;
+};
\ No newline at end of file
diff --git a/lib/libc/include/generic-glibc/bits/ipc.h b/lib/libc/include/generic-glibc/bits/ipc.h
index e133bcfa70..714f766b29 100644
--- a/lib/libc/include/generic-glibc/bits/ipc.h
+++ b/lib/libc/include/generic-glibc/bits/ipc.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 1995-2019 Free Software Foundation, Inc.
+/* Copyright (C) 1995-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _SYS_IPC_H
# error "Never use directly; include instead."
@@ -37,19 +37,4 @@
/* Special key values. */
#define IPC_PRIVATE ((__key_t) 0) /* Private key. */
-
-/* Data structure used to pass permission information to IPC operations. */
-struct ipc_perm
- {
- __key_t __key; /* Key. */
- __uid_t uid; /* Owner's user ID. */
- __gid_t gid; /* Owner's group ID. */
- __uid_t cuid; /* Creator's user ID. */
- __gid_t cgid; /* Creator's group ID. */
- unsigned short int mode; /* Read/write permission. */
- unsigned short int __pad1;
- unsigned short int __seq; /* Sequence number. */
- unsigned short int __pad2;
- __syscall_ulong_t __glibc_reserved1;
- __syscall_ulong_t __glibc_reserved2;
- };
\ No newline at end of file
+#include
\ No newline at end of file
diff --git a/lib/libc/include/generic-glibc/bits/ipctypes.h b/lib/libc/include/generic-glibc/bits/ipctypes.h
index 1b09d14f83..2fce70dab0 100644
--- a/lib/libc/include/generic-glibc/bits/ipctypes.h
+++ b/lib/libc/include/generic-glibc/bits/ipctypes.h
@@ -1,5 +1,5 @@
/* bits/ipctypes.h -- Define some types used by SysV IPC/MSG/SHM. Generic.
- Copyright (C) 2002-2019 Free Software Foundation, Inc.
+ Copyright (C) 2002-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/*
* Never include directly.
diff --git a/lib/libc/include/generic-glibc/bits/iscanonical.h b/lib/libc/include/generic-glibc/bits/iscanonical.h
index 3e73628588..446a24d01b 100644
--- a/lib/libc/include/generic-glibc/bits/iscanonical.h
+++ b/lib/libc/include/generic-glibc/bits/iscanonical.h
@@ -1,5 +1,5 @@
/* Define iscanonical macro.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _MATH_H
# error "Never use directly; include instead."
diff --git a/lib/libc/include/generic-glibc/bits/libc-header-start.h b/lib/libc/include/generic-glibc/bits/libc-header-start.h
index 5b216b35c2..ddc705f0f2 100644
--- a/lib/libc/include/generic-glibc/bits/libc-header-start.h
+++ b/lib/libc/include/generic-glibc/bits/libc-header-start.h
@@ -1,5 +1,5 @@
/* Handle feature test macros at the start of a header.
- Copyright (C) 2016-2019 Free Software Foundation, Inc.
+ Copyright (C) 2016-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
/* This header is internal to glibc and should not be included outside
of glibc headers. Headers including it must define
@@ -43,22 +43,38 @@
#endif
/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
- macro. */
+ macro. Most but not all symbols enabled by that macro in TS
+ 18661-1 are enabled unconditionally in C2X; the symbols in Annex F
+ still require that macro in C2X. */
#undef __GLIBC_USE_IEC_60559_BFP_EXT
#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_BFP_EXT__
# define __GLIBC_USE_IEC_60559_BFP_EXT 1
#else
# define __GLIBC_USE_IEC_60559_BFP_EXT 0
#endif
+#undef __GLIBC_USE_IEC_60559_BFP_EXT_C2X
+#if __GLIBC_USE (IEC_60559_BFP_EXT) || __GLIBC_USE (ISOC2X)
+# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 1
+#else
+# define __GLIBC_USE_IEC_60559_BFP_EXT_C2X 0
+#endif
/* ISO/IEC TS 18661-4:2015 defines the
- __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. */
+ __STDC_WANT_IEC_60559_FUNCS_EXT__ macro. Other than the reduction
+ functions, the symbols from this TS are enabled unconditionally in
+ C2X. */
#undef __GLIBC_USE_IEC_60559_FUNCS_EXT
#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_FUNCS_EXT__
# define __GLIBC_USE_IEC_60559_FUNCS_EXT 1
#else
# define __GLIBC_USE_IEC_60559_FUNCS_EXT 0
#endif
+#undef __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X
+#if __GLIBC_USE (IEC_60559_FUNCS_EXT) || __GLIBC_USE (ISOC2X)
+# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 1
+#else
+# define __GLIBC_USE_IEC_60559_FUNCS_EXT_C2X 0
+#endif
/* ISO/IEC TS 18661-3:2015 defines the
__STDC_WANT_IEC_60559_TYPES_EXT__ macro. */
diff --git a/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h b/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h
index 8fef08aaa4..f49d3ddb62 100644
--- a/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h
+++ b/lib/libc/include/generic-glibc/bits/libm-simd-decl-stubs.h
@@ -1,5 +1,5 @@
/* Empty definitions required for __MATHCALL_VEC unfolding in mathcalls.h.
- Copyright (C) 2014-2019 Free Software Foundation, Inc.
+ Copyright (C) 2014-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -14,7 +14,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library; if not, see
- . */
+ . */
#ifndef _MATH_H
# error "Never include directly;\
diff --git a/lib/libc/include/generic-glibc/bits/link.h b/lib/libc/include/generic-glibc/bits/link.h
index a497f46212..9fc3255bf9 100644
--- a/lib/libc/include/generic-glibc/bits/link.h
+++ b/lib/libc/include/generic-glibc/bits/link.h
@@ -1,4 +1,4 @@
-/* Copyright (C) 2005-2019 Free Software Foundation, Inc.
+/* Copyright (C) 2005-2020 Free Software Foundation, Inc.
This file is part of the GNU C Library.
The GNU C Library is free software; you can redistribute it and/or
@@ -13,7 +13,7 @@
You should have received a copy of the GNU Lesser General Public
License along with the GNU C Library. If not, see
- . */
+ . */
#ifndef _LINK_H
# error "Never include directly; use