Skip to content

extract std.posix from std.os #19354

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 3 commits into from
Mar 20, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -286,7 +286,6 @@ set(ZIG_STAGE2_SOURCES
"${CMAKE_SOURCE_DIR}/lib/std/multi_array_list.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/linux.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/errno/generic.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/x86_64.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/linux.zig"
"${CMAKE_SOURCE_DIR}/lib/std/os/linux/IoUring.zig"
Expand Down
2 changes: 1 addition & 1 deletion build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -882,7 +882,7 @@ fn findConfigH(b: *std.Build, config_h_path_option: ?[]const u8) ?[]const u8 {
return path;
} else |_| {
std.log.err("Could not open provided config.h: \"{s}\"", .{path});
std.os.exit(1);
std.process.exit(1);
}
}

Expand Down
2 changes: 1 addition & 1 deletion lib/compiler/objcopy.zig
Original file line number Diff line number Diff line change
Expand Up @@ -1285,7 +1285,7 @@ const ElfFileHelper = struct {
for (consolidated.items) |cmd| {
switch (cmd) {
.write_data => |data| {
var iovec = [_]std.os.iovec_const{.{ .iov_base = data.data.ptr, .iov_len = data.data.len }};
var iovec = [_]std.posix.iovec_const{.{ .iov_base = data.data.ptr, .iov_len = data.data.len }};
try out_file.pwritevAll(&iovec, data.out_offset);
},
.copy_range => |range| {
Expand Down
22 changes: 11 additions & 11 deletions lib/compiler/resinator/main.zig
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ pub fn main() !void {

if (args.len < 2) {
try renderErrorMessage(stderr.writer(), stderr_config, .err, "expected zig lib dir as first argument", .{});
std.os.exit(1);
std.process.exit(1);
}
const zig_lib_dir = args[1];
var cli_args = args[2..];
Expand Down Expand Up @@ -62,7 +62,7 @@ pub fn main() !void {
var options = cli.parse(allocator, cli_args, &cli_diagnostics) catch |err| switch (err) {
error.ParseError => {
try error_handler.emitCliDiagnostics(allocator, cli_args, &cli_diagnostics);
std.os.exit(1);
std.process.exit(1);
},
else => |e| return e,
};
Expand Down Expand Up @@ -117,7 +117,7 @@ pub fn main() !void {
},
}
try error_handler.emitMessage(allocator, .note, "to disable auto includes, use the option /:auto-includes none", .{});
std.os.exit(1);
std.process.exit(1);
},
};

Expand Down Expand Up @@ -153,16 +153,16 @@ pub fn main() !void {
preprocess.preprocess(&comp, preprocessed_buf.writer(), argv.items, maybe_dependencies_list) catch |err| switch (err) {
error.GeneratedSourceError => {
try error_handler.emitAroDiagnostics(allocator, "failed during preprocessor setup (this is always a bug):", &comp);
std.os.exit(1);
std.process.exit(1);
},
// ArgError can occur if e.g. the .rc file is not found
error.ArgError, error.PreprocessError => {
try error_handler.emitAroDiagnostics(allocator, "failed during preprocessing:", &comp);
std.os.exit(1);
std.process.exit(1);
},
error.StreamTooLong => {
try error_handler.emitMessage(allocator, .err, "failed during preprocessing: maximum file size exceeded", .{});
std.os.exit(1);
std.process.exit(1);
},
error.OutOfMemory => |e| return e,
};
Expand All @@ -171,7 +171,7 @@ pub fn main() !void {
} else {
break :full_input std.fs.cwd().readFileAlloc(allocator, options.input_filename, std.math.maxInt(usize)) catch |err| {
try error_handler.emitMessage(allocator, .err, "unable to read input file path '{s}': {s}", .{ options.input_filename, @errorName(err) });
std.os.exit(1);
std.process.exit(1);
};
}
};
Expand All @@ -191,14 +191,14 @@ pub fn main() !void {
const final_input = removeComments(mapping_results.result, mapping_results.result, &mapping_results.mappings) catch |err| switch (err) {
error.InvalidSourceMappingCollapse => {
try error_handler.emitMessage(allocator, .err, "failed during comment removal; this is a known bug", .{});
std.os.exit(1);
std.process.exit(1);
},
else => |e| return e,
};

var output_file = std.fs.cwd().createFile(options.output_filename, .{}) catch |err| {
try error_handler.emitMessage(allocator, .err, "unable to create output file '{s}': {s}", .{ options.output_filename, @errorName(err) });
std.os.exit(1);
std.process.exit(1);
};
var output_file_closed = false;
defer if (!output_file_closed) output_file.close();
Expand Down Expand Up @@ -231,7 +231,7 @@ pub fn main() !void {
output_file_closed = true;
// Failing to delete is not really a big deal, so swallow any errors
std.fs.cwd().deleteFile(options.output_filename) catch {};
std.os.exit(1);
std.process.exit(1);
},
else => |e| return e,
};
Expand All @@ -247,7 +247,7 @@ pub fn main() !void {
if (options.depfile_path) |depfile_path| {
var depfile = std.fs.cwd().createFile(depfile_path, .{}) catch |err| {
try error_handler.emitMessage(allocator, .err, "unable to create depfile '{s}': {s}", .{ depfile_path, @errorName(err) });
std.os.exit(1);
std.process.exit(1);
};
defer depfile.close();

Expand Down
6 changes: 3 additions & 3 deletions lib/std/Random/benchmark.zig
Original file line number Diff line number Diff line change
Expand Up @@ -144,15 +144,15 @@ pub fn main() !void {
i += 1;
if (i == args.len) {
usage();
std.os.exit(1);
std.process.exit(1);
}

filter = args[i];
} else if (std.mem.eql(u8, args[i], "--count")) {
i += 1;
if (i == args.len) {
usage();
std.os.exit(1);
std.process.exit(1);
}

const c = try std.fmt.parseUnsigned(usize, args[i], 10);
Expand All @@ -170,7 +170,7 @@ pub fn main() !void {
return;
} else {
usage();
std.os.exit(1);
std.process.exit(1);
}
}

Expand Down
Loading