mirror of
https://codeberg.org/ziglang/zig.git
synced 2026-04-27 19:09:47 +03:00
56507ecf98
`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).
18 lines
398 B
Zig
18 lines
398 B
Zig
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;
|
|
}
|