mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
libzigc: stropts/isastream
`isastream` is an old, deprecated function for the STREAMS framework. Linux doesn't even support this natively, and so the musl implementation just returns 0 (not a STREAMS file) for valid file descriptors or -1 (for bad file descriptors).
This commit is contained in:
committed by
Andrew Kelley
parent
746dd51faf
commit
56507ecf98
@@ -73,6 +73,7 @@ comptime {
|
||||
_ = @import("c/stdlib.zig");
|
||||
_ = @import("c/string.zig");
|
||||
_ = @import("c/strings.zig");
|
||||
_ = @import("c/stropts.zig");
|
||||
|
||||
_ = @import("c/sys/capability.zig");
|
||||
_ = @import("c/sys/file.zig");
|
||||
|
||||
@@ -0,0 +1,17 @@
|
||||
const builtin = @import("builtin");
|
||||
|
||||
const std = @import("std");
|
||||
const linux = std.os.linux;
|
||||
|
||||
const symbol = @import("../c.zig").symbol;
|
||||
const errno = @import("../c.zig").errno;
|
||||
|
||||
comptime {
|
||||
if (builtin.target.isMuslLibC()) {
|
||||
symbol(&isastream, "isastream");
|
||||
}
|
||||
}
|
||||
|
||||
fn isastream(fd: c_int) callconv(.c) c_int {
|
||||
return if (errno(linux.fcntl(fd, linux.F.GETFD, 0)) < 0) -1 else 0;
|
||||
}
|
||||
Vendored
-7
@@ -1,7 +0,0 @@
|
||||
#include <stropts.h>
|
||||
#include <fcntl.h>
|
||||
|
||||
int isastream(int fd)
|
||||
{
|
||||
return fcntl(fd, F_GETFD) < 0 ? -1 : 0;
|
||||
}
|
||||
@@ -691,7 +691,6 @@ const src_files = [_][]const u8{
|
||||
"musl/src/legacy/getpagesize.c",
|
||||
"musl/src/legacy/getpass.c",
|
||||
"musl/src/legacy/getusershell.c",
|
||||
"musl/src/legacy/isastream.c",
|
||||
"musl/src/legacy/lutimes.c",
|
||||
"musl/src/legacy/ulimit.c",
|
||||
"musl/src/legacy/utmpx.c",
|
||||
|
||||
Reference in New Issue
Block a user