Merge pull request #109 from birth-software/modernize-api-v2

Modernize std API
This commit is contained in:
David 2024-03-08 16:37:33 -06:00 committed by GitHub
commit 4baca74f5e
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6822 changed files with 4793 additions and 826115 deletions

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@ -59,6 +59,7 @@ pub extern fn NativityLLVMContextGetConstantInt(context: *LLVM.Context, bit_coun
pub extern fn NativityLLVMContextGetConstantString(context: *LLVM.Context, name_ptr: [*]const u8, name_len: usize, null_terminate: bool) ?*LLVM.Value.Constant;
pub extern fn NativityLLVMGetConstantArray(array_type: *LLVM.Type.Array, value_ptr: [*]const *LLVM.Value.Constant, value_count: usize) ?*LLVM.Value.Constant;
pub extern fn NativityLLVMGetConstantStruct(struct_type: *LLVM.Type.Struct, constant_ptr: [*]const *LLVM.Value.Constant, constant_len: usize) ?*LLVM.Value.Constant;
pub extern fn NativityLLVMConstantToInt(constant: *LLVM.Value.Constant) ?*LLVM.Value.Constant.Int;
pub extern fn NativityLLVMBuilderCreateICmp(builder: *LLVM.Builder, integer_comparison: LLVM.Value.Instruction.ICmp.Kind, left: *LLVM.Value, right: *LLVM.Value, name_ptr: [*]const u8, name_len: usize) ?*LLVM.Value;
pub extern fn NativityLLVMBuilderCreateLoad(builder: *LLVM.Builder, type: *LLVM.Type, value: *LLVM.Value, is_volatile: bool, name_ptr: [*]const u8, name_len: usize) ?*LLVM.Value.Instruction.Load;
pub extern fn NativityLLVMBuilderCreateRet(builder: *LLVM.Builder, value: ?*LLVM.Value) ?*LLVM.Value.Instruction.Ret;
@ -89,6 +90,7 @@ pub extern fn NativityLLVMBuilderCreateGEP(builder: *LLVM.Builder, type: *LLVM.T
pub extern fn NativityLLVMBuilderCreateStructGEP(builder: *LLVM.Builder, type: *LLVM.Type, pointer: *LLVM.Value, index: c_uint, name_ptr: [*]const u8, name_len: usize) ?*LLVM.Value;
pub extern fn NativityLLVMBuilderCreateBranch(builder: *LLVM.Builder, basic_block: *LLVM.Value.BasicBlock) ?*LLVM.Value.Instruction.Branch;
pub extern fn NativityLLVMBuilderCreateConditionalBranch(builder: *LLVM.Builder, condition: *LLVM.Value, true_block: *LLVM.Value.BasicBlock, false_block: *LLVM.Value.BasicBlock, branch_weights: ?*LLVM.Metadata.Node, unpredictable: ?*LLVM.Metadata.Node) ?*LLVM.Value.Instruction.Branch;
pub extern fn NativityLLVMBuilderCreateSwitch(builder: *LLVM.Builder, condition: *LLVM.Value, default_block: ?*LLVM.Value.BasicBlock, case_ptr: [*]const *LLVM.Value.Constant.Int, case_block_ptr: [*]const *LLVM.Value.BasicBlock, case_count: c_uint, branch_weights: ?*LLVM.Metadata.Node, unpredictable: ?*LLVM.Metadata.Node) *LLVM.Value.Instruction.Switch;
pub extern fn NativityLLVMVerifyFunction(function: *LLVM.Value.Constant.Function, message_ptr: *[*]const u8, message_len: *usize) bool;
pub extern fn NativityLLVMVerifyModule(module: *LLVM.Module, message_ptr: *[*]const u8, message_len: *usize) bool;

View File

@ -6,6 +6,7 @@ const log = std.log;
const data_structures = @import("../library.zig");
const enumFromString = data_structures.enumFromString;
const MyAllocator = data_structures.MyAllocator;
const UnpinnedArray = data_structures.UnpinnedArray;
const Compilation = @import("../Compilation.zig");
const File = Compilation.File;
@ -109,7 +110,7 @@ pub fn analyze(allocator: *MyAllocator, text: []const u8, token_buffer: *Token.B
const string = text[start_index..][0 .. index - start_index];
break :blk if (enumFromString(Compilation.FixedKeyword, string)) |fixed_keyword| switch (fixed_keyword) {
inline else => |comptime_fixed_keyword| @field(Token.Id, "fixed_keyword_" ++ @tagName(comptime_fixed_keyword)),
} else if (data_structures.byte_equal( string, "_")) .discard else .identifier;
} else if (data_structures.byte_equal(string, "_")) .discard else .identifier;
},
'0'...'9' => blk: {
// Detect other non-decimal literals
@ -333,6 +334,13 @@ pub fn analyze(allocator: *MyAllocator, text: []const u8, token_buffer: *Token.B
index += 1;
break :b .operator_div_assign;
},
'/' => {
while (text[index] != '\n') {
index += 1;
}
continue;
},
else => .operator_div,
};
@ -396,6 +404,124 @@ pub fn analyze(allocator: *MyAllocator, text: []const u8, token_buffer: *Token.B
break :blk .operator_dollar;
},
// Asm statement (special treatment)
'`' => {
token_buffer.append_with_capacity(.{
.id = .operator_backtick,
.line = line_index,
.offset = start_index,
.length = 1,
});
index += 1;
while (text[index] != '`') {
const start_i = index;
const start_ch = text[start_i];
switch (start_ch) {
'\n' => {
index += 1;
line_index += 1;
},
' ' => index += 1,
'A'...'Z', 'a'...'z' => {
while (true) {
switch (text[index]) {
'A'...'Z', 'a'...'z' => index += 1,
else => break,
}
}
token_buffer.append_with_capacity(.{
.id = .identifier,
.offset = start_i,
.length = index - start_i,
.line = line_index,
});
},
',' => {
token_buffer.append_with_capacity(.{
.id = .operator_comma,
.line = line_index,
.offset = start_i,
.length = 1,
});
index += 1;
},
';' => {
token_buffer.append_with_capacity(.{
.id = .operator_semicolon,
.line = line_index,
.offset = start_i,
.length = 1,
});
index += 1;
},
'{' => {
token_buffer.append_with_capacity(.{
.id = .operator_left_brace,
.line = line_index,
.offset = start_i,
.length = 1,
});
index += 1;
},
'}' => {
token_buffer.append_with_capacity(.{
.id = .operator_right_brace,
.line = line_index,
.offset = start_i,
.length = 1,
});
index += 1;
},
'0' => {
index += 1;
const Representation = enum {
hex,
bin,
octal,
};
const representation: Representation = switch (text[index]) {
'x' => .hex,
else => unreachable,
};
index += 1;
switch (representation) {
.hex => {
while (true) {
switch (text[index]) {
'a'...'f', 'A'...'F', '0'...'9' => index += 1,
else => break,
}
}
token_buffer.append_with_capacity(.{
.id = .number_literal,
.line = line_index,
.offset = start_i,
.length = index - start_i,
});
},
else => unreachable,
}
},
else => unreachable,
}
}
token_buffer.append_with_capacity(.{
.id = .operator_backtick,
.line = line_index,
.length = 1,
.offset = index,
});
index += 1;
continue;
},
else => |ch| {
const ch_arr = [1]u8{ch};
@panic(&ch_arr);

View File

@ -10,7 +10,7 @@ const enumFromString = data_structures.enumFromString;
const lexer = @import("lexer.zig");
const Compilation = @import("../Compilation.zig");
// const log = Compilation.log;
const write = Compilation.write;
const logln = Compilation.logln;
const Token = Compilation.Token;
@ -104,7 +104,7 @@ pub const Node = struct {
void_type,
call,
pointer_type,
enum_literal,
dot_literal,
address_of,
pointer_dereference,
keyword_false,
@ -187,6 +187,15 @@ pub const Node = struct {
catch_expression,
try_expression,
error_type,
error_field,
assembly_code_expression,
assembly_instruction,
assembly_code_block,
bool_and,
bool_or,
payload,
catch_payload,
bitfield_type,
};
};
@ -216,8 +225,16 @@ const Analyzer = struct {
const result = token_i;
return result;
} else {
// const file_offset = analyzer.getTokenOffset(token_i);
// const file_chunk = analyzer.source_file[file_offset..];
const file_offset = analyzer.getTokenOffset(token_i);
const file_chunk = analyzer.source_file[file_offset..];
try write(.panic, "Unexpected token ");
try write(.panic, @tagName(token_id));
try write(.panic, " when expected ");
try write(.panic, @tagName(expected_token_id));
try write(.panic, "\n");
try write(.panic, "File chunk:\n\n```\n");
try write(.panic, file_chunk);
try write(.panic, "\n```\n");
// std.debug.print("Unexpected token {s} when expected {s}\n| |\n v \n```\n{s}\n```", .{ @tagName(token_id), @tagName(expected_token_id), file_chunk });
@breakpoint();
return error.unexpected_token;
@ -233,7 +250,7 @@ const Analyzer = struct {
fn peekTokenAhead(analyzer: *Analyzer, ahead_offset: u32) Token.Id {
const token_index = Token.addInt(analyzer.token_i, ahead_offset);
const index =Token.unwrap(token_index);
const index = Token.unwrap(token_index);
assert(index < analyzer.token_buffer.length);
const token = analyzer.token_buffer.ids[index];
return token;
@ -485,16 +502,6 @@ const Analyzer = struct {
// logln(.parser, .block, "First statement token: {s}", .{@tagName(first_statement_token)});
const statement_index = switch (first_statement_token) {
else => try analyzer.assignExpressionStatement(),
// .identifier => switch (analyzer.peekTokenAhead(1)) {
// .operator_colon => {
// unreachable;
// },
// else => try analyzer.assignExpressionStatement(),
// },
// .fixed_keyword_unreachable,
// .fixed_keyword_return,
// .discard,
// => try analyzer.assignExpressionStatement(),
.fixed_keyword_while => try analyzer.whileExpression(),
.fixed_keyword_switch => try analyzer.switchExpression(),
@ -503,17 +510,8 @@ const Analyzer = struct {
.fixed_keyword_const,
.fixed_keyword_var,
=> try analyzer.symbolDeclaration(),
// .intrinsic => blk: {
// const intrinsic = try analyzer.compilerIntrinsic();
// _ = try analyzer.expectToken(.operator_semicolon);
// break :blk intrinsic;
// },
// else => |t| @panic(@tagName(t)),
};
// const node = analyzer.nodes.get(statement_index);
// logln(.parser, .block, "Adding statement: {s}", .{@tagName(node.id)});
try list.append(analyzer.my_allocator, statement_index);
}
@ -614,6 +612,26 @@ const Analyzer = struct {
});
}
fn parsePayload(analyzer: *Analyzer) !Node.Index {
_ = try analyzer.expectToken(.operator_bar);
const main_token = analyzer.token_i;
switch (analyzer.peekToken()) {
.identifier,
.discard,
=> analyzer.consumeToken(),
else => |t| @panic(@tagName(t)),
}
_ = try analyzer.expectToken(.operator_bar);
return try analyzer.addNode(.{
.id = .payload,
.token = main_token,
.left = .null,
.right = .null,
});
}
fn ifExpression(analyzer: *Analyzer) anyerror!Node.Index {
const if_token = analyzer.token_i;
analyzer.consumeToken();
@ -622,16 +640,7 @@ const Analyzer = struct {
const if_condition = try analyzer.expression();
_ = try analyzer.expectToken(.operator_right_parenthesis);
const payload = if (analyzer.peekToken() == .operator_bar) blk: {
analyzer.consumeToken();
const payload_node = switch (analyzer.peekToken()) {
.identifier => try analyzer.identifierNode(),
.discard => try analyzer.discardNode(),
else => unreachable,
};
_ = try analyzer.expectToken(.operator_bar);
break :blk payload_node;
} else Node.Index.null;
const payload = if (analyzer.peekToken() == .operator_bar) try analyzer.parsePayload() else Node.Index.null;
const if_taken_expression = try analyzer.expression();
@ -811,32 +820,6 @@ const Analyzer = struct {
// logln(.parser, .assign, "assign:\nleft: {}.\nright: {}", .{ node.left, node.right });
return try analyzer.addNode(node);
// .operator_equal => .operator_assign,
// .operator_add => switch (analyzer.peekTokenAhead(1)) {
// .operator_equal => blk: {
// analyzer.consumeToken();
// break :blk .operator_add_assign;
// },
// else => |t| @panic(@tagName(t)),
// },
// .operator_sub => switch (analyzer.peekTokenAhead(1)) {
// .equal => blk: {
// analyzer.consumeToken();
// break :blk .operator_sub_assign;
// },
// else => |t| @panic(@tagName(t)),
// },
// .operator_div => switch (analyzer.peekTokenAhead(1)) {
// .operator_equal => blk: {
// analyzer.consumeToken();
// break :blk .operator_div_assign;
// },
// else => |t| @panic(@tagName(t)),
// },
// else => |t| @panic(@tagName(t)),
// };
//
//
}
fn parseAsmOperand(analyzer: *Analyzer) !Node.Index {
@ -885,34 +868,89 @@ const Analyzer = struct {
var list = UnpinnedArray(Node.Index){};
if (intrinsic_id == .@"asm") {
_ = try analyzer.expectToken(.operator_left_brace);
const backtick = try analyzer.expectToken(.operator_backtick);
var instruction_list = UnpinnedArray(Node.Index){};
while (analyzer.peekToken() != .operator_backtick) {
const instruction_token = analyzer.token_i;
const instruction_name = try analyzer.identifierNode();
while (analyzer.peekToken() != .operator_right_brace) {
const instruction_token = try analyzer.expectToken(.identifier);
var operand_list = UnpinnedArray(Node.Index){};
while (analyzer.peekToken() != .operator_semicolon) {
const asm_operand = try analyzer.parseAsmOperand();
const node = switch (analyzer.peekToken()) {
.identifier => try analyzer.addNode(.{
.id = .assembly_register,
.token = b: {
const t = analyzer.token_i;
analyzer.consumeToken();
break :b t;
},
.left = .null,
.right = .null,
}),
.number_literal => try analyzer.addNode(.{
.id = .number_literal,
.token = b: {
const t = analyzer.token_i;
analyzer.consumeToken();
break :b t;
},
.left = Node.Index.null,
.right = Node.Index.null,
}),
.operator_left_brace => b: {
const left_brace = try analyzer.expectToken(.operator_left_brace);
const code_expression = try analyzer.expression();
_ = try analyzer.expectToken(.operator_right_brace);
break :b try analyzer.addNode(.{
.id = .assembly_code_expression,
.token = left_brace,
.left = code_expression,
.right = .null,
});
},
else => |t| @panic(@tagName(t)),
};
switch (analyzer.peekToken()) {
.operator_semicolon => {},
.operator_comma => analyzer.consumeToken(),
.operator_semicolon => {},
else => |t| @panic(@tagName(t)),
}
try operand_list.append(analyzer.my_allocator, asm_operand);
try operand_list.append(analyzer.my_allocator, node);
}
_ = try analyzer.expectToken(.operator_semicolon);
analyzer.consumeToken();
try list.append(analyzer.my_allocator, try analyzer.addNode(.{
.id = .assembly_statement,
const instruction = try analyzer.addNode(.{
.id = .assembly_instruction,
.token = instruction_token,
.left = try analyzer.nodeList(operand_list),
.right = Node.Index.null,
}));
.left = instruction_name,
.right = try analyzer.nodeList(operand_list),
});
try instruction_list.append(analyzer.my_allocator, instruction);
}
_ = try analyzer.expectToken(.operator_right_brace);
_ = try analyzer.expectToken(.operator_backtick);
_ = try analyzer.expectToken(.operator_right_parenthesis);
const assembly_block = try analyzer.addNode(.{
.id = .assembly_code_block,
.token = backtick,
.left = try analyzer.nodeList(instruction_list),
.right = .null,
});
try list.append(analyzer.my_allocator, assembly_block);
const intrinsic = try analyzer.addNode(.{
.id = .intrinsic,
.token = intrinsic_token,
.left = try analyzer.nodeList(list),
.right = @enumFromInt(@intFromEnum(intrinsic_id)),
});
return intrinsic;
} else {
while (analyzer.peekToken() != .operator_right_parenthesis) {
const parameter = try analyzer.expression();
@ -956,6 +994,8 @@ const Analyzer = struct {
bit_and,
bit_xor,
bit_or,
bool_and,
bool_or,
shift_left,
shift_right,
@"catch",
@ -976,6 +1016,8 @@ const Analyzer = struct {
.bit_and = 40,
.bit_xor = 40,
.bit_or = 40,
.bool_or = 10,
.bool_and = 20,
.shift_left = 50,
.shift_right = 50,
.@"catch" = 40,
@ -993,6 +1035,8 @@ const Analyzer = struct {
.bit_and = .left,
.bit_xor = .left,
.bit_or = .left,
.bool_and = .left,
.bool_or = .left,
.mul = .left,
.div = .left,
.mod = .left,
@ -1013,6 +1057,8 @@ const Analyzer = struct {
.bit_and = .bit_and,
.bit_xor = .bit_xor,
.bit_or = .bit_or,
.bool_and = .bool_and,
.bool_or = .bool_or,
.mul = .mul,
.div = .div,
.mod = .mod,
@ -1025,8 +1071,8 @@ const Analyzer = struct {
assert(minimum_precedence >= 0);
var result = try analyzer.prefixExpression();
// if (result != .null) {
// const prefix_node = analyzer.nodes.get(result);
// logln(.parser, .precedence, "Prefix: {s}", .{@tagName(prefix_node.id)});
// const prefix_node = analyzer.nodes.get(result);
// logln(.parser, .precedence, "Prefix: {s}", .{@tagName(prefix_node.id)});
// }
var banned_precedence: i32 = -1;
@ -1071,6 +1117,8 @@ const Analyzer = struct {
.operator_ampersand => .bit_and,
.operator_bar => .bit_or,
.operator_xor => .bit_xor,
.fixed_keyword_and => .bool_and,
.fixed_keyword_or => .bool_or,
.operator_shift_left => .shift_left,
.operator_shift_right => .shift_right,
.fixed_keyword_catch => .@"catch",
@ -1085,17 +1133,23 @@ const Analyzer = struct {
break;
}
if (precedence < banned_precedence) {
// logln(.parser, .precedence, "Breaking for banned_precedence", .{});
break;
if (precedence == banned_precedence) {
unreachable;
}
const operator_token = analyzer.token_i;
analyzer.consumeToken();
// TODO: fix this
// logln(.parser, .precedence, "Going for right in expressionPrecedence with operator {s}", .{@tagName(operator)});
const right = try analyzer.expressionPrecedence(precedence + 1);
const right = if (token == .fixed_keyword_catch and analyzer.peekToken() == .operator_bar) b: {
const payload = try analyzer.parsePayload();
const r_node = try analyzer.expressionPrecedence(precedence + 1);
break :b try analyzer.addNode(.{
.id = .catch_payload,
.token = operator_token,
.left = payload,
.right = r_node,
});
} else try analyzer.expressionPrecedence(precedence + 1);
const node_id = operator_node_id.get(operator);
@ -1187,8 +1241,8 @@ const Analyzer = struct {
// todo:?
.operator_left_brace => try analyzer.block(),
.fixed_keyword_if => try analyzer.ifExpression(),
.fixed_keyword_bitfield => try analyzer.processContainerType(.fixed_keyword_bitfield),
else => |id| @panic(@tagName(id)),
//else => |id| std.debug.panic("WARN: By default, calling curlySuffixExpression with {s}", .{@tagName(id)}),
};
return result;
@ -1358,8 +1412,8 @@ const Analyzer = struct {
// logln(.parser, .pointer_like_type_expression, "ARRAY START\n===========", .{});
// for (list.slice()) |ni| {
// const n = analyzer.nodes.get(ni);
// logln(.parser, .pointer_like_type_expression, "{s} node element: {s}", .{ @tagName(expression_type), @tagName(n.id) });
// const n = analyzer.nodes.get(ni);
// logln(.parser, .pointer_like_type_expression, "{s} node element: {s}", .{ @tagName(expression_type), @tagName(n.id) });
// }
// logln(.parser, .pointer_like_type_expression, "ARRAY END\n=========", .{});
@ -1629,12 +1683,14 @@ const Analyzer = struct {
const container_type: Compilation.ContainerType = switch (token_id) {
.fixed_keyword_struct => .@"struct",
.fixed_keyword_enum => .@"enum",
.fixed_keyword_bitfield => .bitfield,
else => unreachable,
};
const node_id: Node.Id = switch (token_id) {
.fixed_keyword_struct => .struct_type,
.fixed_keyword_enum => .enum_type,
.fixed_keyword_bitfield => .bitfield_type,
else => unreachable,
};
@ -1671,7 +1727,9 @@ const Analyzer = struct {
analyzer.consumeToken();
switch (container_type) {
.@"struct" => {
.@"struct",
.bitfield,
=> {
_ = try analyzer.expectToken(.operator_colon);
const field_type = try analyzer.typeExpression();
@ -1899,30 +1957,51 @@ const Analyzer = struct {
},
.fixed_keyword_error => blk: {
analyzer.consumeToken();
if (analyzer.peekToken() == .operator_left_brace) {
const backing_type: Node.Index = if (analyzer.peekToken() == .operator_left_parenthesis) b: {
analyzer.consumeToken();
var list = UnpinnedArray(Node.Index){};
const type_node = try analyzer.typeExpression();
_ = try analyzer.expectToken(.operator_right_parenthesis);
break :b type_node;
} else Node.Index.null;
while (analyzer.peekToken() != .operator_right_brace) {
const identifier = try analyzer.identifierNode();
try list.append(analyzer.my_allocator, identifier);
const comma = try analyzer.expectToken(.operator_comma);
_ = comma; // autofix
}
_ = try analyzer.expectToken(.operator_left_brace);
var list = UnpinnedArray(Node.Index){};
analyzer.consumeToken();
while (analyzer.peekToken() != .operator_right_brace) {
const tok_i = analyzer.token_i;
const t_id = analyzer.peekToken();
const identifier = switch (t_id) {
.identifier => try analyzer.identifierNode(),
else => |t| @panic(@tagName(t)),
};
break :blk try analyzer.addNode(.{
.id = .error_type,
.token = token_i,
.left = try analyzer.nodeList(list),
.right = .null,
const value_associated = switch (analyzer.peekToken()) {
.operator_comma => Node.Index.null,
else => value: {
analyzer.consumeToken();
break :value try analyzer.expression();
},
};
_ = try analyzer.expectToken(.operator_comma);
const error_field_node = try analyzer.addNode(.{
.id = .error_field,
.token = tok_i,
.left = identifier,
.right = value_associated,
});
} else {
const t = analyzer.peekToken();
_ = t; // autofix
unreachable;
try list.append(analyzer.my_allocator, error_field_node);
}
analyzer.consumeToken();
break :blk try analyzer.addNode(.{
.id = .error_type,
.token = token_i,
.left = try analyzer.nodeList(list),
.right = backing_type,
});
},
else => |t| switch (t) {
.identifier => @panic(analyzer.bytes(token_i)),
@ -1936,7 +2015,7 @@ const Analyzer = struct {
_ = try analyzer.expectToken(.operator_dot);
return switch (analyzer.peekToken()) {
.identifier => try analyzer.addNode(.{
.id = .enum_literal,
.id = .dot_literal,
.token = blk: {
analyzer.consumeToken();
break :blk token_i;
@ -2083,7 +2162,8 @@ const Analyzer = struct {
fn identifierNode(analyzer: *Analyzer) !Node.Index {
const identifier_token = analyzer.token_i;
assert(analyzer.peekToken() == .identifier);
const t = analyzer.peekToken();
assert(t == .identifier);
analyzer.consumeToken();
return try analyzer.addNode(.{
.id = .identifier,

View File

@ -210,7 +210,7 @@ pub fn byte_equal_terminated(a: [*:0]const u8, b: [*:0]const u8) bool {
return byte_equal(a_slice, b_slice);
}
const MapResult = struct{
const MapResult = struct {
key_pointer: *anyopaque,
value_pointer: *anyopaque,
capacity: IndexType,
@ -223,8 +223,8 @@ fn ensure_capacity_hashmap(allocator: *MyAllocator, current_capacity: IndexType,
}
if (new_capacity > current_capacity) {
const old_key_slice = key_pointer[0..length * key_size];
const old_value_slice = value_pointer[0..length * value_size];
const old_key_slice = key_pointer[0 .. length * key_size];
const old_value_slice = value_pointer[0 .. length * value_size];
const new_key_slice = try allocator.reallocate(old_key_slice, new_capacity * key_size, key_alignment);
const new_value_slice = try allocator.reallocate(old_value_slice, new_capacity * value_size, value_alignment);
@ -308,11 +308,11 @@ pub fn MyHashMap(comptime K: type, comptime V: type) type {
map.value_pointer = @ptrCast(@alignCast(result.value_pointer));
}
pub fn keys(map: *@This()) []K{
pub fn keys(map: *@This()) []K {
return map.key_pointer[0..map.length];
}
pub fn values(map: *@This()) []V{
pub fn values(map: *@This()) []V {
return map.value_pointer[0..map.length];
}
};
@ -372,7 +372,7 @@ pub fn allocate_virtual_memory(size: usize, flags: packed struct {
};
}
pub fn free_virtual_memory(slice: []const align(0x1000) u8) void {
pub fn free_virtual_memory(slice: []align(0x1000) const u8) void {
switch (os) {
.windows => {
std.os.windows.VirtualFree(slice.ptr, slice.len, std.os.windows.MEM_RELEASE);
@ -383,8 +383,8 @@ pub fn free_virtual_memory(slice: []const align(0x1000) u8) void {
}
}
pub const MyAllocator = struct{
handler: *const fn(allocator: *MyAllocator, old_ptr: ?[*]u8, old_size: usize, new_size: usize, alignment: u16) Error![*]u8,
pub const MyAllocator = struct {
handler: *const fn (allocator: *MyAllocator, old_ptr: ?[*]u8, old_size: usize, new_size: usize, alignment: u16) Error![*]u8,
pub fn allocate_one(allocator: *MyAllocator, comptime T: type) !*T {
const slice = try allocator.allocate(@sizeOf(T), @alignOf(T));
@ -417,7 +417,7 @@ pub const MyAllocator = struct{
};
};
pub const PageAllocator = struct{
pub const PageAllocator = struct {
allocator: MyAllocator = .{ .handler = handler },
fn handler(allocator: *MyAllocator, maybe_old_ptr: ?[*]u8, old_size: usize, new_size: usize, alignment: u16) MyAllocator.Error![*]u8 {
@ -442,7 +442,7 @@ pub const PageAllocator = struct{
pub const IndexType = if (@sizeOf(usize) >= 8) u32 else usize;
const ArrayCapacity = struct{
const ArrayCapacity = struct {
pointer: *anyopaque,
capacity: IndexType,
};
@ -453,7 +453,7 @@ fn ensure_capacity_array(allocator: *MyAllocator, current_capacity: IndexType, d
new_capacity *= factor;
}
if (new_capacity > current_capacity) {
const old_byte_slice = pointer[0..length * element_size];
const old_byte_slice = pointer[0 .. length * element_size];
const new_byte_capacity = new_capacity * element_size;
const new_slice = try allocator.reallocate(old_byte_slice, new_byte_capacity, element_alignment);
return .{
@ -472,14 +472,13 @@ const initial_item_count = 16;
const factor = 2;
pub fn UnpinnedArray(comptime T: type) type {
return struct {
pointer: [*]T = undefined,
length: IndexType = 0,
capacity: IndexType = 0,
pub fn initialize_with_capacity(allocator: *MyAllocator, item_count: IndexType) !@This() {
var array = @This() {};
var array = @This(){};
try array.ensure_capacity(allocator, item_count);
return array;
}
@ -515,15 +514,15 @@ pub fn UnpinnedArray(comptime T: type) type {
assert(index < array.length);
if (array.length + 1 >= array.capacity) {
const after_count = array.length - index;
copy_backwards(T, array.pointer[index + 1..][0..after_count], array.pointer[index..][0..after_count]);
copy_backwards(T, array.pointer[index + 1 ..][0..after_count], array.pointer[index..][0..after_count]);
} else {
const new_capacity = array.capacity * 2;
const new_slice = try allocator.allocate(new_capacity * @sizeOf(T), @alignOf(T));
const new_typed_slice: []T = @as([*]T, @ptrCast(@alignCast(new_slice.ptr)))[0..new_capacity];
@memcpy(new_typed_slice[0..index], array.pointer[0..index]);
const after_count = array.length - index;
@memcpy(new_typed_slice[index + 1..][0..after_count], array.pointer[index..][0..after_count]);
try allocator.free(@as([*]u8, @ptrCast(@alignCast(array.slice().ptr)))[0.. array.capacity * @sizeOf(T)]);
@memcpy(new_typed_slice[index + 1 ..][0..after_count], array.pointer[index..][0..after_count]);
try allocator.free(@as([*]u8, @ptrCast(@alignCast(array.slice().ptr)))[0 .. array.capacity * @sizeOf(T)]);
array.pointer = new_typed_slice.ptr;
array.capacity = new_capacity;
}
@ -722,5 +721,5 @@ pub fn span(ptr: [*:0]const u8) [:0]const u8 {
while (ptr[len] != 0) {
len += 1;
}
return ptr[0..len:0];
return ptr[0..len :0];
}

View File

@ -30,9 +30,9 @@ pub export fn main(c_argc: c_int, c_argv: [*][*:0]c_char, c_envp: [*:null]?[*:0]
return 0;
} else |err| {
const error_name: []const u8 = @errorName(err);
std.io.getStdOut().writeAll("Error: ") catch {};
std.io.getStdOut().writeAll(error_name) catch {};
std.io.getStdOut().writeAll("\n") catch {};
Compilation.write(.panic, "Error: ") catch {};
Compilation.write(.panic, error_name) catch {};
Compilation.write(.panic, "\n") catch {};
return 1;
}
}
@ -81,4 +81,3 @@ pub fn entry_point(arguments: [][*:0]u8) !void {
todo();
}
}

View File

@ -409,6 +409,7 @@ pub fn build(b: *std.Build) !void {
.optimize = optimization,
.single_threaded = true,
});
b.default_step.dependOn(&test_runner.step);
const test_command = b.addRunArtifact(test_runner);
test_command.step.dependOn(&compiler.step);

View File

@ -1 +0,0 @@
{"MinimalDisplayName":"14.0"}

File diff suppressed because it is too large Load Diff

View File

@ -1,391 +0,0 @@
This file contains the copying permission notices for various files in the
GNU C Library distribution that have copyright owners other than the Free
Software Foundation. These notices all require that a copy of the notice
be included in the accompanying documentation and be distributed with
binary distributions of the code, so be sure to include this file along
with any binary distributions derived from the GNU C Library.
All code incorporated from 4.4 BSD is distributed under the following
license:
Copyright (C) 1991 Regents of the University of California.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. [This condition was removed.]
4. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE REGENTS AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE REGENTS OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The DNS resolver code, taken from BIND 4.9.5, is copyrighted by UC
Berkeley, by Digital Equipment Corporation and by Internet Software
Consortium. The DEC portions are under the following license:
Portions Copyright (C) 1993 by Digital Equipment Corporation.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies, and
that the name of Digital Equipment Corporation not be used in
advertising or publicity pertaining to distribution of the document or
software without specific, written prior permission.
THE SOFTWARE IS PROVIDED ``AS IS'' AND DIGITAL EQUIPMENT CORP.
DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE, INCLUDING ALL
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL
DIGITAL EQUIPMENT CORPORATION BE LIABLE FOR ANY SPECIAL, DIRECT,
INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING
FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT,
NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION
WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
The ISC portions are under the following license:
Portions Copyright (c) 1996-1999 by Internet Software Consortium.
Permission to use, copy, modify, and distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND INTERNET SOFTWARE CONSORTIUM DISCLAIMS
ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES
OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL INTERNET SOFTWARE
CONSORTIUM BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL
DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR
PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS
ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS
SOFTWARE.
The Sun RPC support (from rpcsrc-4.0) is covered by the following
license:
Copyright (c) 2010, Oracle America, Inc.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above
copyright notice, this list of conditions and the following
disclaimer in the documentation and/or other materials
provided with the distribution.
* Neither the name of the "Oracle America, Inc." nor the names of its
contributors may be used to endorse or promote products derived
from this software without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT,
INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The following CMU license covers some of the support code for Mach,
derived from Mach 3.0:
Mach Operating System
Copyright (C) 1991,1990,1989 Carnegie Mellon University
All Rights Reserved.
Permission to use, copy, modify and distribute this software and its
documentation is hereby granted, provided that both the copyright
notice and this permission notice appear in all copies of the
software, derivative works or modified versions, and any portions
thereof, and that both notices appear in supporting documentation.
CARNEGIE MELLON ALLOWS FREE USE OF THIS SOFTWARE IN ITS ``AS IS''
CONDITION. CARNEGIE MELLON DISCLAIMS ANY LIABILITY OF ANY KIND FOR
ANY DAMAGES WHATSOEVER RESULTING FROM THE USE OF THIS SOFTWARE.
Carnegie Mellon requests users of this software to return to
Software Distribution Coordinator
School of Computer Science
Carnegie Mellon University
Pittsburgh PA 15213-3890
or Software.Distribution@CS.CMU.EDU any improvements or
extensions that they make and grant Carnegie Mellon the rights to
redistribute these changes.
The file if_ppp.h is under the following CMU license:
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the University nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY CARNEGIE MELLON UNIVERSITY AND
CONTRIBUTORS ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
IN NO EVENT SHALL THE UNIVERSITY OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER
IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN
IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The following license covers the files from Intel's "Highly Optimized
Mathematical Functions for Itanium" collection:
Intel License Agreement
Copyright (c) 2000, Intel Corporation
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are
met:
* Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
* Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
* The name of Intel Corporation may not be used to endorse or promote
products derived from this software without specific prior written
permission.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
"AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL INTEL OR
CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
The files inet/getnameinfo.c and sysdeps/posix/getaddrinfo.c are copyright
(C) by Craig Metz and are distributed under the following license:
/* The Inner Net License, Version 2.00
The author(s) grant permission for redistribution and use in source and
binary forms, with or without modification, of the software and documentation
provided that the following conditions are met:
0. If you receive a version of the software that is specifically labelled
as not being for redistribution (check the version message and/or README),
you are not permitted to redistribute that version of the software in any
way or form.
1. All terms of the all other applicable copyrights and licenses must be
followed.
2. Redistributions of source code must retain the authors' copyright
notice(s), this list of conditions, and the following disclaimer.
3. Redistributions in binary form must reproduce the authors' copyright
notice(s), this list of conditions, and the following disclaimer in the
documentation and/or other materials provided with the distribution.
4. [The copyright holder has authorized the removal of this clause.]
5. Neither the name(s) of the author(s) nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY ITS AUTHORS AND CONTRIBUTORS ``AS IS'' AND ANY
EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE AUTHORS OR CONTRIBUTORS BE LIABLE FOR ANY
DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
If these license terms cause you a real problem, contact the author. */
The file sunrpc/des_impl.c is copyright Eric Young:
Copyright (C) 1992 Eric Young
Collected from libdes and modified for SECURE RPC by Martin Kuck 1994
This file is distributed under the terms of the GNU Lesser General
Public License, version 2.1 or later - see the file COPYING.LIB for details.
If you did not receive a copy of the license with this program, please
see <https://www.gnu.org/licenses/> to obtain a copy.
The file inet/rcmd.c is under a UCB copyright and the following:
Copyright (C) 1998 WIDE Project.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions
are met:
1. Redistributions of source code must retain the above copyright
notice, this list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright
notice, this list of conditions and the following disclaimer in the
documentation and/or other materials provided with the distribution.
3. Neither the name of the project nor the names of its contributors
may be used to endorse or promote products derived from this software
without specific prior written permission.
THIS SOFTWARE IS PROVIDED BY THE PROJECT AND CONTRIBUTORS ``AS IS'' AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
ARE DISCLAIMED. IN NO EVENT SHALL THE PROJECT OR CONTRIBUTORS BE LIABLE
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS
OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY
OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
SUCH DAMAGE.
The file posix/runtests.c is copyright Tom Lord:
Copyright 1995 by Tom Lord
All Rights Reserved
Permission to use, copy, modify, and distribute this software and its
documentation for any purpose and without fee is hereby granted,
provided that the above copyright notice appear in all copies and that
both that copyright notice and this permission notice appear in
supporting documentation, and that the name of the copyright holder not be
used in advertising or publicity pertaining to distribution of the
software without specific, written prior permission.
Tom Lord DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE,
INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS, IN NO
EVENT SHALL TOM LORD BE LIABLE FOR ANY SPECIAL, INDIRECT OR
CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF
USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR
OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR
PERFORMANCE OF THIS SOFTWARE.
The posix/rxspencer tests are copyright Henry Spencer:
Copyright 1992, 1993, 1994, 1997 Henry Spencer. All rights reserved.
This software is not subject to any license of the American Telephone
and Telegraph Company or of the Regents of the University of California.
Permission is granted to anyone to use this software for any purpose on
any computer system, and to alter it and redistribute it, subject
to the following restrictions:
1. The author is not responsible for the consequences of use of this
software, no matter how awful, even if they arise from flaws in it.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. Since few users ever read sources,
credits must appear in the documentation.
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software. Since few users
ever read sources, credits must appear in the documentation.
4. This notice may not be removed or altered.
The file posix/PCRE.tests is copyright University of Cambridge:
Copyright (c) 1997-2003 University of Cambridge
Permission is granted to anyone to use this software for any purpose on any
computer system, and to redistribute it freely, subject to the following
restrictions:
1. This software 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.
2. The origin of this software must not be misrepresented, either by
explicit claim or by omission. In practice, this means that if you use
PCRE in software that you distribute to others, commercially or
otherwise, you must put a sentence like this
Regular expression support is provided by the PCRE library package,
which is open source software, written by Philip Hazel, and copyright
by the University of Cambridge, England.
somewhere reasonably visible in your documentation and in any relevant
files or online help data or similar. A reference to the ftp site for
the source, that is, to
ftp://ftp.csx.cam.ac.uk/pub/software/programming/pcre/
should also be given in the documentation. However, this condition is not
intended to apply to whole chains of software. If package A includes PCRE,
it must acknowledge it, but if package B is software that includes package
A, the condition is not imposed on package B (unless it uses PCRE
independently).
3. Altered versions must be plainly marked as such, and must not be
misrepresented as being the original software.
4. If PCRE is embedded in any software that is released under the GNU
General Purpose Licence (GPL), or Lesser General Purpose Licence (LGPL),
then the terms of that licence shall supersede any condition above with
which it is incompatible.
Files from Sun fdlibm are copyright Sun Microsystems, Inc.:
Copyright (C) 1993 by Sun Microsystems, Inc. All rights reserved.
Developed at SunPro, a Sun Microsystems, Inc. business.
Permission to use, copy, modify, and distribute this
software is freely granted, provided that this notice
is preserved.
Various long double libm functions are copyright Stephen L. Moshier:
Copyright 2001 by Stephen L. Moshier <moshier@na-net.ornl.gov>
This 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.
This 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 this library; if not, see
<https://www.gnu.org/licenses/>. */

View File

@ -1,83 +0,0 @@
# Zig GNU C Library ("glibc") Support
Zig supports building binaries that will dynamically link against the
[GNU C Library ("glibc")](https://www.gnu.org/software/libc/) when run.
This support extends across a range of glibc versions.
By default, Zig binaries will not depend on any external C library, but
they can be linked against one with the `-lc` option. The target ABI defines
which C library: `musl` for the [musl C library](https://musl.libc.org/) or
`gnu` for the GNU C library.
A specific GNU C library version can be chosen with an appropriate
`-target`. For example, `-target native-native-gnu.2.19` will use the
default CPU and OS targets, but will link in a run-time dependency on
glibc v2.19 (or later). Use `zig env` to show the default target and
version.
Glibc symbols are defined in the `std.c.` namespace in Zig, though the
`std.os.` namespace is generally what should be used to access C-library
APIs in Zig code (it is defined depending on the linked C library).
See `src/glibc.zig` for how Zig will build the glibc components. The
generated shared object files are sufficient only for compile-time
linking. They are stub libraries that only indicate that which symbols
will be present at run-time, along with their type and size. The symbols
do not reference an actual implementation.
## Targets
The GNU C Library supports a very wide set of platforms and architectures.
The current Zig support for glibc only includes Linux.
Zig supports glibc versions back to v2.17 (2012) as the Zig standard
library depends on symbols that were introduced in 2.17.
## Glibc stubs
The file `lib/libc/glibc/abilist` is a Zig-specific binary blob that
defines the supported glibc versions and the set of symbols each version
must define. See https://github.com/ziglang/glibc-abi-tool for the
tooling to generate this blob. The code in `glibc.zig` parses the abilist
to build version-specific stub libraries on demand.
The generated stub library is used for compile-time linking, with the
expectation that at run-time the real glibc library will provide the
actual symbol implementations.
### Public Headers
The glibc headers are in `lib/libc/include/generic-glibc/`. These are
customized and have a couple Zig-specific `#ifdef`s to make the single set
of headers represent any of the supported glibc versions. There are
currently a handful of patches to these headers to represent new features
(e.g. `reallocarray`) or changes in implementation (e.g., the `stat()`
family of functions).
The related Zig https://github.com/ziglang/universal-headers is a project
designed to more robustly build multi-version header files suitable for
compilation across a variety of target C library versions.
## Glibc static C-Runtime object files and libraries
Linking against glibc also implies linking against several, generally
"invisible" glibc C Runtime libraries: `crti.o`, `crtn.o`, `Scrt1.o` and
`libc_nonshared.a`. These objects are linked into generated Zig binaries
and are not run-time linking dependencies. Generally they provide
bootstrapping, initialization, and mapping of un-versioned public APIs to
glibc-private versioned APIs.
Like the public headers, these files contain a couple customiziations for
Zig to be able to build for any supported glibc version. E.g., for glibc
versions before v2.32, `libc_nonshared.a` contained stubs that directed
the `fstat()` call to a versioned `__fxstat()` call.
These files used for these objects are in `lib/libc/glibc`. See the
`tools/update_glibc.zig` tool for updating content in here from the
upstream glibc.
# More Information
See
https://github.com/ziglang/zig/commit/2314051acaad37dd5630dd7eca08571d620d6496
for an example commit that updates glibc (to v2.38).

Binary file not shown.

View File

@ -1,79 +0,0 @@
/* Macros and inline functions to swap the order of bytes in integer values.
Copyright (C) 1997-2023 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
<https://www.gnu.org/licenses/>. */
#if !defined _BYTESWAP_H && !defined _NETINET_IN_H && !defined _ENDIAN_H
# error "Never use <bits/byteswap.h> directly; include <byteswap.h> instead."
#endif
#ifndef _BITS_BYTESWAP_H
#define _BITS_BYTESWAP_H 1
#include <features.h>
#include <bits/types.h>
/* Swap bytes in 16-bit value. */
#define __bswap_constant_16(x) \
((__uint16_t) ((((x) >> 8) & 0xff) | (((x) & 0xff) << 8)))
static __inline __uint16_t
__bswap_16 (__uint16_t __bsx)
{
#if __GNUC_PREREQ (4, 8)
return __builtin_bswap16 (__bsx);
#else
return __bswap_constant_16 (__bsx);
#endif
}
/* Swap bytes in 32-bit value. */
#define __bswap_constant_32(x) \
((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) \
| (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24))
static __inline __uint32_t
__bswap_32 (__uint32_t __bsx)
{
#if __GNUC_PREREQ (4, 3)
return __builtin_bswap32 (__bsx);
#else
return __bswap_constant_32 (__bsx);
#endif
}
/* Swap bytes in 64-bit value. */
#define __bswap_constant_64(x) \
((((x) & 0xff00000000000000ull) >> 56) \
| (((x) & 0x00ff000000000000ull) >> 40) \
| (((x) & 0x0000ff0000000000ull) >> 24) \
| (((x) & 0x000000ff00000000ull) >> 8) \
| (((x) & 0x00000000ff000000ull) << 8) \
| (((x) & 0x0000000000ff0000ull) << 24) \
| (((x) & 0x000000000000ff00ull) << 40) \
| (((x) & 0x00000000000000ffull) << 56))
__extension__ static __inline __uint64_t
__bswap_64 (__uint64_t __bsx)
{
#if __GNUC_PREREQ (4, 3)
return __builtin_bswap64 (__bsx);
#else
return __bswap_constant_64 (__bsx);
#endif
}
#endif /* _BITS_BYTESWAP_H */

View File

@ -1,13 +0,0 @@
/* This file should define __BYTE_ORDER as appropriate for the machine
in question. See string/endian.h for how to define it.
If only the stub bits/endian.h applies to a particular configuration,
bytesex.h is generated by running a program on the host machine.
So if cross-compiling to a machine with a different byte order,
the bits/endian.h file for that machine must exist. */
#ifndef _ENDIAN_H
# error "Never use <bits/endian.h> directly; include <endian.h> instead."
#endif
#error Machine byte order unknown.

View File

@ -1,329 +0,0 @@
/* Macros to control TS 18661-3 glibc features where the same
definitions are appropriate for all platforms.
Copyright (C) 2017-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_FLOATN_COMMON_H
#define _BITS_FLOATN_COMMON_H
#include <features.h>
#include <bits/long-double.h>
/* This header should be included at the bottom of each bits/floatn.h.
It defines the following macros for each _FloatN and _FloatNx type,
where the same definitions, or definitions based only on the macros
in bits/floatn.h, are appropriate for all glibc configurations. */
/* Defined to 1 if the current compiler invocation provides a
floating-point type with the right format for this type, and this
glibc includes corresponding *fN or *fNx interfaces for it. */
#define __HAVE_FLOAT16 0
#define __HAVE_FLOAT32 1
#define __HAVE_FLOAT64 1
#define __HAVE_FLOAT32X 1
#define __HAVE_FLOAT128X 0
/* Defined to 1 if the corresponding __HAVE_<type> macro is 1 and the
type is the first with its format in the sequence of (the default
choices for) float, double, long double, _Float16, _Float32,
_Float64, _Float128, _Float32x, _Float64x, _Float128x for this
glibc; that is, if functions present once per floating-point format
rather than once per type are present for this type.
All configurations supported by glibc have _Float32 the same format
as float, _Float64 and _Float32x the same format as double, the
_Float64x the same format as either long double or _Float128. No
configurations support _Float128x or, as of GCC 7, have compiler
support for a type meeting the requirements for _Float128x. */
#define __HAVE_DISTINCT_FLOAT16 __HAVE_FLOAT16
#define __HAVE_DISTINCT_FLOAT32 0
#define __HAVE_DISTINCT_FLOAT64 0
#define __HAVE_DISTINCT_FLOAT32X 0
#define __HAVE_DISTINCT_FLOAT64X 0
#define __HAVE_DISTINCT_FLOAT128X __HAVE_FLOAT128X
/* Defined to 1 if the corresponding _FloatN type is not binary compatible
with the corresponding ISO C type in the current compilation unit as
opposed to __HAVE_DISTINCT_FLOATN, which indicates the default types built
in glibc. */
#define __HAVE_FLOAT128_UNLIKE_LDBL (__HAVE_DISTINCT_FLOAT128 \
&& __LDBL_MANT_DIG__ != 113)
/* Defined to 1 if any _FloatN or _FloatNx types that are not
ABI-distinct are however distinct types at the C language level (so
for the purposes of __builtin_types_compatible_p and _Generic). */
#if __GNUC_PREREQ (7, 0) && !defined __cplusplus
# define __HAVE_FLOATN_NOT_TYPEDEF 1
#else
# define __HAVE_FLOATN_NOT_TYPEDEF 0
#endif
#ifndef __ASSEMBLER__
/* Defined to concatenate the literal suffix to be used with _FloatN
or _FloatNx types, if __HAVE_<type> is 1. The corresponding
literal suffixes exist since GCC 7, for C only. */
# if __HAVE_FLOAT16
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
/* No corresponding suffix available for this type. */
# define __f16(x) ((_Float16) x##f)
# else
# define __f16(x) x##f16
# endif
# endif
# if __HAVE_FLOAT32
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# define __f32(x) x##f
# else
# define __f32(x) x##f32
# endif
# endif
# if __HAVE_FLOAT64
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# ifdef __NO_LONG_DOUBLE_MATH
# define __f64(x) x##l
# else
# define __f64(x) x
# endif
# else
# define __f64(x) x##f64
# endif
# endif
# if __HAVE_FLOAT32X
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# define __f32x(x) x
# else
# define __f32x(x) x##f32x
# endif
# endif
# if __HAVE_FLOAT64X
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# if __HAVE_FLOAT64X_LONG_DOUBLE
# define __f64x(x) x##l
# else
# define __f64x(x) __f128 (x)
# endif
# else
# define __f64x(x) x##f64x
# endif
# endif
# if __HAVE_FLOAT128X
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# error "_Float128X supported but no constant suffix"
# else
# define __f128x(x) x##f128x
# endif
# endif
/* Defined to a complex type if __HAVE_<type> is 1. */
# if __HAVE_FLOAT16
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef _Complex float __cfloat16 __attribute__ ((__mode__ (__HC__)));
# define __CFLOAT16 __cfloat16
# else
# define __CFLOAT16 _Complex _Float16
# endif
# endif
# if __HAVE_FLOAT32
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# define __CFLOAT32 _Complex float
# else
# define __CFLOAT32 _Complex _Float32
# endif
# endif
# if __HAVE_FLOAT64
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# ifdef __NO_LONG_DOUBLE_MATH
# define __CFLOAT64 _Complex long double
# else
# define __CFLOAT64 _Complex double
# endif
# else
# define __CFLOAT64 _Complex _Float64
# endif
# endif
# if __HAVE_FLOAT32X
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# define __CFLOAT32X _Complex double
# else
# define __CFLOAT32X _Complex _Float32x
# endif
# endif
# if __HAVE_FLOAT64X
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# if __HAVE_FLOAT64X_LONG_DOUBLE
# define __CFLOAT64X _Complex long double
# else
# define __CFLOAT64X __CFLOAT128
# endif
# else
# define __CFLOAT64X _Complex _Float64x
# endif
# endif
# if __HAVE_FLOAT128X
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# error "_Float128X supported but no complex type"
# else
# define __CFLOAT128X _Complex _Float128x
# endif
# endif
/* The remaining of this file provides support for older compilers. */
# if __HAVE_FLOAT16
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef float _Float16 __attribute__ ((__mode__ (__HF__)));
# endif
# if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf16() ((_Float16) __builtin_huge_val ())
# define __builtin_inff16() ((_Float16) __builtin_inf ())
# define __builtin_nanf16(x) ((_Float16) __builtin_nan (x))
# define __builtin_nansf16(x) ((_Float16) __builtin_nans (x))
# endif
# endif
# if __HAVE_FLOAT32
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef float _Float32;
# endif
# if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf32() (__builtin_huge_valf ())
# define __builtin_inff32() (__builtin_inff ())
# define __builtin_nanf32(x) (__builtin_nanf (x))
# define __builtin_nansf32(x) (__builtin_nansf (x))
# endif
# endif
# if __HAVE_FLOAT64
/* If double, long double and _Float64 all have the same set of
values, TS 18661-3 requires the usual arithmetic conversions on
long double and _Float64 to produce _Float64. For this to be the
case when building with a compiler without a distinct _Float64
type, _Float64 must be a typedef for long double, not for
double. */
# ifdef __NO_LONG_DOUBLE_MATH
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef long double _Float64;
# endif
# if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf64() (__builtin_huge_vall ())
# define __builtin_inff64() (__builtin_infl ())
# define __builtin_nanf64(x) (__builtin_nanl (x))
# define __builtin_nansf64(x) (__builtin_nansl (x))
# endif
# else
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef double _Float64;
# endif
# if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf64() (__builtin_huge_val ())
# define __builtin_inff64() (__builtin_inf ())
# define __builtin_nanf64(x) (__builtin_nan (x))
# define __builtin_nansf64(x) (__builtin_nans (x))
# endif
# endif
# endif
# if __HAVE_FLOAT32X
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef double _Float32x;
# endif
# if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf32x() (__builtin_huge_val ())
# define __builtin_inff32x() (__builtin_inf ())
# define __builtin_nanf32x(x) (__builtin_nan (x))
# define __builtin_nansf32x(x) (__builtin_nans (x))
# endif
# endif
# if __HAVE_FLOAT64X
# if __HAVE_FLOAT64X_LONG_DOUBLE
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef long double _Float64x;
# endif
# if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf64x() (__builtin_huge_vall ())
# define __builtin_inff64x() (__builtin_infl ())
# define __builtin_nanf64x(x) (__builtin_nanl (x))
# define __builtin_nansf64x(x) (__builtin_nansl (x))
# endif
# else
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
typedef _Float128 _Float64x;
# endif
# if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf64x() (__builtin_huge_valf128 ())
# define __builtin_inff64x() (__builtin_inff128 ())
# define __builtin_nanf64x(x) (__builtin_nanf128 (x))
# define __builtin_nansf64x(x) (__builtin_nansf128 (x))
# endif
# endif
# endif
# if __HAVE_FLOAT128X
# if !__GNUC_PREREQ (7, 0) || (defined __cplusplus && !__GNUC_PREREQ (13, 0))
# error "_Float128x supported but no type"
# endif
# if !__GNUC_PREREQ (7, 0)
# define __builtin_huge_valf128x() ((_Float128x) __builtin_huge_val ())
# define __builtin_inff128x() ((_Float128x) __builtin_inf ())
# define __builtin_nanf128x(x) ((_Float128x) __builtin_nan (x))
# define __builtin_nansf128x(x) ((_Float128x) __builtin_nans (x))
# endif
# endif
#endif /* !__ASSEMBLER__. */
#endif /* _BITS_FLOATN_COMMON_H */

View File

@ -1,110 +0,0 @@
/* Handle feature test macros at the start of a header.
Copyright (C) 2016-2023 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
<https://www.gnu.org/licenses/>. */
/* This header is internal to glibc and should not be included outside
of glibc headers. Headers including it must define
__GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION first. This header
cannot have multiple include guards because ISO C feature test
macros depend on the definition of the macro when an affected
header is included, not when the first system header is
included. */
#ifndef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
# error "Never include <bits/libc-header-start.h> directly."
#endif
#undef __GLIBC_INTERNAL_STARTING_HEADER_IMPLEMENTATION
#include <features.h>
/* ISO/IEC TR 24731-2:2010 defines the __STDC_WANT_LIB_EXT2__
macro. */
#undef __GLIBC_USE_LIB_EXT2
#if (defined __USE_GNU \
|| (defined __STDC_WANT_LIB_EXT2__ && __STDC_WANT_LIB_EXT2__ > 0))
# define __GLIBC_USE_LIB_EXT2 1
#else
# define __GLIBC_USE_LIB_EXT2 0
#endif
/* ISO/IEC TS 18661-1:2014 defines the __STDC_WANT_IEC_60559_BFP_EXT__
macro. Most but not all symbols enabled by that macro in TS
18661-1 are enabled unconditionally in C2X. In C2X, the symbols in
Annex F still require a new feature test macro
__STDC_WANT_IEC_60559_EXT__ instead (C2X does not define
__STDC_WANT_IEC_60559_BFP_EXT__), while a few features from TS
18661-1 are not included in C2X (and thus should depend on
__STDC_WANT_IEC_60559_BFP_EXT__ even when C2X features are
enabled).
__GLIBC_USE (IEC_60559_BFP_EXT) controls those features from TS
18661-1 not included in C2X.
__GLIBC_USE (IEC_60559_BFP_EXT_C2X) controls those features from TS
18661-1 that are also included in C2X (with no feature test macro
required in C2X).
__GLIBC_USE (IEC_60559_EXT) controls those features from TS 18661-1
that are included in C2X but conditional on
__STDC_WANT_IEC_60559_EXT__. (There are currently no features
conditional on __STDC_WANT_IEC_60559_EXT__ that are not in TS
18661-1.) */
#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
#undef __GLIBC_USE_IEC_60559_EXT
#if __GLIBC_USE (IEC_60559_BFP_EXT) || defined __STDC_WANT_IEC_60559_EXT__
# define __GLIBC_USE_IEC_60559_EXT 1
#else
# define __GLIBC_USE_IEC_60559_EXT 0
#endif
/* ISO/IEC TS 18661-4:2015 defines the
__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. */
#undef __GLIBC_USE_IEC_60559_TYPES_EXT
#if defined __USE_GNU || defined __STDC_WANT_IEC_60559_TYPES_EXT__
# define __GLIBC_USE_IEC_60559_TYPES_EXT 1
#else
# define __GLIBC_USE_IEC_60559_TYPES_EXT 0
#endif

View File

@ -1,53 +0,0 @@
/* Properties of long double type.
Copyright (C) 2016-2023 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 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
<https://www.gnu.org/licenses/>. */
/* This header is included by <sys/cdefs.h>.
If long double is ABI-compatible with double, it should define
__NO_LONG_DOUBLE_MATH to 1; otherwise, it should leave
__NO_LONG_DOUBLE_MATH undefined.
If this build of the GNU C Library supports both long double
ABI-compatible with double and some other long double format not
ABI-compatible with double, it should define
__LONG_DOUBLE_MATH_OPTIONAL to 1; otherwise, it should leave
__LONG_DOUBLE_MATH_OPTIONAL undefined.
If __NO_LONG_DOUBLE_MATH is already defined, this header must not
define anything; this is needed to work with the definition of
__NO_LONG_DOUBLE_MATH in nldbl-compat.h. */
/* In the default version of this header, long double is
ABI-compatible with double. */
#ifndef __NO_LONG_DOUBLE_MATH
# define __NO_LONG_DOUBLE_MATH 1
#endif
/* The macro __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI is used to determine the
choice of the underlying ABI of long double. It will always assume
a constant value for each translation unit.
If the value is non-zero, any API which is parameterized by the long
double type (i.e the scanf/printf family of functions or the explicitly
parameterized math.h functions) will be redirected to a compatible
implementation using _Float128 ABI via symbols suffixed with ieee128.
The mechanism this macro uses to acquire may be a function
of architecture, or target specific options used to invoke the
compiler. */
#define __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI 0

View File

@ -1 +0,0 @@
/* No thread support. */

View File

@ -1,37 +0,0 @@
/* Copyright (C) 1997-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _SYS_SELECT_H
# error "Never use <bits/select.h> directly; include <sys/select.h> instead."
#endif
/* We don't use `memset' because this would require a prototype and
the array isn't too big. */
#define __FD_ZERO(s) \
do { \
unsigned int __i; \
fd_set *__arr = (s); \
for (__i = 0; __i < sizeof (fd_set) / sizeof (__fd_mask); ++__i) \
__FDS_BITS (__arr)[__i] = 0; \
} while (0)
#define __FD_SET(d, s) \
((void) (__FDS_BITS (s)[__FD_ELT(d)] |= __FD_MASK(d)))
#define __FD_CLR(d, s) \
((void) (__FDS_BITS (s)[__FD_ELT(d)] &= ~__FD_MASK(d)))
#define __FD_ISSET(d, s) \
((__FDS_BITS (s)[__FD_ELT (d)] & __FD_MASK (d)) != 0)

View File

@ -1,81 +0,0 @@
/* Signal number constants. Generic template.
Copyright (C) 1991-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_SIGNUM_GENERIC_H
#define _BITS_SIGNUM_GENERIC_H 1
#ifndef _SIGNAL_H
#error "Never include <bits/signum-generic.h> directly; use <signal.h> instead."
#endif
/* Fake signal functions. */
#define SIG_ERR ((__sighandler_t) -1) /* Error return. */
#define SIG_DFL ((__sighandler_t) 0) /* Default action. */
#define SIG_IGN ((__sighandler_t) 1) /* Ignore signal. */
#ifdef __USE_XOPEN
# define SIG_HOLD ((__sighandler_t) 2) /* Add signal to hold mask. */
#endif
/* We define here all the signal names listed in POSIX (1003.1-2008);
as of 1003.1-2013, no additional signals have been added by POSIX.
We also define here signal names that historically exist in every
real-world POSIX variant (e.g. SIGWINCH).
Signals in the 1-15 range are defined with their historical numbers.
For other signals, we use the BSD numbers.
There are two unallocated signal numbers in the 1-31 range: 7 and 29.
Signal number 0 is reserved for use as kill(pid, 0), to test whether
a process exists without sending it a signal. */
/* ISO C99 signals. */
#define SIGINT 2 /* Interactive attention signal. */
#define SIGILL 4 /* Illegal instruction. */
#define SIGABRT 6 /* Abnormal termination. */
#define SIGFPE 8 /* Erroneous arithmetic operation. */
#define SIGSEGV 11 /* Invalid access to storage. */
#define SIGTERM 15 /* Termination request. */
/* Historical signals specified by POSIX. */
#define SIGHUP 1 /* Hangup. */
#define SIGQUIT 3 /* Quit. */
#define SIGTRAP 5 /* Trace/breakpoint trap. */
#define SIGKILL 9 /* Killed. */
#define SIGPIPE 13 /* Broken pipe. */
#define SIGALRM 14 /* Alarm clock. */
/* Archaic names for compatibility. */
#define SIGIO SIGPOLL /* I/O now possible (4.2 BSD). */
#define SIGIOT SIGABRT /* IOT instruction, abort() on a PDP-11. */
#define SIGCLD SIGCHLD /* Old System V name */
/* Not all systems support real-time signals. bits/signum.h indicates
that they are supported by overriding __SIGRTMAX to a value greater
than __SIGRTMIN. These constants give the kernel-level hard limits,
but some real-time signals may be used internally by glibc. Do not
use these constants in application code; use SIGRTMIN and SIGRTMAX
(defined in signal.h) instead. */
/* Include system specific bits. */
#include <bits/signum-arch.h>
/* Biggest signal number + 1 (including real-time signals). */
#define _NSIG (__SIGRTMAX + 1)
#endif /* bits/signum-generic.h. */

View File

@ -1,103 +0,0 @@
/* Copyright (C) 1992-2023 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
<https://www.gnu.org/licenses/>. */
#if !defined _SYS_STAT_H && !defined _FCNTL_H
# error "Never include <bits/stat.h> directly; use <sys/stat.h> instead."
#endif
#ifndef _BITS_STAT_H
#define _BITS_STAT_H 1
/* This structure needs to be defined in accordance with the
implementation of __stat, __fstat, and __lstat. */
#include <bits/types.h>
/* Structure describing file characteristics. */
struct stat
{
/* These are the members that POSIX.1 requires. */
__mode_t st_mode; /* File mode. */
#ifndef __USE_FILE_OFFSET64
__ino_t st_ino; /* File serial number. */
#else
__ino64_t st_ino; /* File serial number. */
#endif
__dev_t st_dev; /* Device containing the file. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group. */
#ifndef __USE_FILE_OFFSET64
__off_t st_size; /* Size of file, in bytes. */
#else
__off64_t st_size; /* Size of file, in bytes. */
#endif
__time_t st_atime; /* Time of last access. */
__time_t st_mtime; /* Time of last modification. */
__time_t st_ctime; /* Time of last status change. */
/* This should be defined if there is a `st_blksize' member. */
#undef _STATBUF_ST_BLKSIZE
};
/* Encoding of the file mode. These are the standard Unix values,
but POSIX.1 does not specify what values should be used. */
#define __S_IFMT 0170000 /* These bits determine file type. */
/* File types. */
#define __S_IFDIR 0040000 /* Directory. */
#define __S_IFCHR 0020000 /* Character device. */
#define __S_IFBLK 0060000 /* Block device. */
#define __S_IFREG 0100000 /* Regular file. */
#define __S_IFIFO 0010000 /* FIFO. */
/* POSIX.1b objects. */
#define __S_TYPEISMQ(buf) 0
#define __S_TYPEISSEM(buf) 0
#define __S_TYPEISSHM(buf) 0
/* Protection bits. */
#define __S_ISUID 04000 /* Set user ID on execution. */
#define __S_ISGID 02000 /* Set group ID on execution. */
#define __S_IREAD 0400 /* Read by owner. */
#define __S_IWRITE 0200 /* Write by owner. */
#define __S_IEXEC 0100 /* Execute by owner. */
#ifdef __USE_LARGEFILE64
struct stat64
{
__mode_t st_mode; /* File mode. */
__ino64_t st_ino; /* File serial number. */
__dev_t st_dev; /* Device. */
__nlink_t st_nlink; /* Link count. */
__uid_t st_uid; /* User ID of the file's owner. */
__gid_t st_gid; /* Group ID of the file's group.*/
__off64_t st_size; /* Size of file, in bytes. */
__time_t st_atime; /* Time of last access. */
__time_t st_mtime; /* Time of last modification. */
__time_t st_ctime; /* Time of last status change. */
};
#endif
#endif /* bits/stat.h */

View File

@ -1,29 +0,0 @@
/* Define intN_t types.
Copyright (C) 2017-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_STDINT_INTN_H
#define _BITS_STDINT_INTN_H 1
#include <bits/types.h>
typedef __int8_t int8_t;
typedef __int16_t int16_t;
typedef __int32_t int32_t;
typedef __int64_t int64_t;
#endif /* bits/stdint-intn.h */

View File

@ -1,52 +0,0 @@
/* Perform binary search - inline version.
Copyright (C) 1991-2023 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
<https://www.gnu.org/licenses/>. */
__extern_inline void *
bsearch (const void *__key, const void *__base, size_t __nmemb, size_t __size,
__compar_fn_t __compar)
{
size_t __l, __u, __idx;
const void *__p;
int __comparison;
__l = 0;
__u = __nmemb;
while (__l < __u)
{
__idx = (__l + __u) / 2;
__p = (const void *) (((const char *) __base) + (__idx * __size));
__comparison = (*__compar) (__key, __p);
if (__comparison < 0)
__u = __idx;
else if (__comparison > 0)
__l = __idx + 1;
else
{
#if __GNUC_PREREQ(4, 6)
# pragma GCC diagnostic push
# pragma GCC diagnostic ignored "-Wcast-qual"
#endif
return (void *) __p;
#if __GNUC_PREREQ(4, 6)
# pragma GCC diagnostic pop
#endif
}
}
return NULL;
}

View File

@ -1,36 +0,0 @@
/* bits/time64.h -- underlying types for __time64_t. Generic version.
Copyright (C) 2018-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_TYPES_H
# error "Never include <bits/time64.h> directly; use <sys/types.h> instead."
#endif
#ifndef _BITS_TIME64_H
#define _BITS_TIME64_H 1
/* Define __TIME64_T_TYPE so that it is always a 64-bit type. */
#if __TIMESIZE == 64
/* If we already have 64-bit time type then use it. */
# define __TIME64_T_TYPE __TIME_T_TYPE
#else
/* Define a 64-bit time type alongsize the 32-bit one. */
# define __TIME64_T_TYPE __SQUAD_TYPE
#endif
#endif /* bits/time64.h */

View File

@ -1,20 +0,0 @@
/* Bit size of the time_t type at glibc build time, general case.
Copyright (C) 2018-2023 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
<https://www.gnu.org/licenses/>. */
/* Size in bits of the 'time_t' type of the default ABI. */
#define __TIMESIZE 64

View File

@ -1,7 +0,0 @@
#ifndef ____sigset_t_defined
#define ____sigset_t_defined 1
/* A `sigset_t' has a bit for each signal. */
typedef unsigned long int __sigset_t;
#endif

View File

@ -1,28 +0,0 @@
/* Sched parameter structure. Generic version.
Copyright (C) 1996-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_TYPES_STRUCT_SCHED_PARAM
#define _BITS_TYPES_STRUCT_SCHED_PARAM 1
/* Data structure to describe a process' schedulability. */
struct sched_param
{
int sched_priority;
};
#endif /* bits/types/struct_sched_param.h */

View File

@ -1,95 +0,0 @@
/* bits/typesizes.h -- underlying types for *_t. Generic version.
Copyright (C) 2002-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_TYPES_H
# error "Never include <bits/typesizes.h> directly; use <sys/types.h> instead."
#endif
#ifndef _BITS_TYPESIZES_H
#define _BITS_TYPESIZES_H 1
/* See <bits/types.h> for the meaning of these macros. This file exists so
that <bits/types.h> need not vary across different GNU platforms. */
#define __DEV_T_TYPE __UQUAD_TYPE
#define __UID_T_TYPE __U32_TYPE
#define __GID_T_TYPE __U32_TYPE
#define __INO_T_TYPE __ULONGWORD_TYPE
#define __INO64_T_TYPE __UQUAD_TYPE
#define __MODE_T_TYPE __U32_TYPE
#define __NLINK_T_TYPE __UWORD_TYPE
#define __OFF_T_TYPE __SLONGWORD_TYPE
#define __OFF64_T_TYPE __SQUAD_TYPE
#define __PID_T_TYPE __S32_TYPE
#define __RLIM_T_TYPE __ULONGWORD_TYPE
#define __RLIM64_T_TYPE __UQUAD_TYPE
#define __BLKCNT_T_TYPE __SLONGWORD_TYPE
#define __BLKCNT64_T_TYPE __SQUAD_TYPE
#define __FSBLKCNT_T_TYPE __ULONGWORD_TYPE
#define __FSBLKCNT64_T_TYPE __UQUAD_TYPE
#define __FSFILCNT_T_TYPE __ULONGWORD_TYPE
#define __FSFILCNT64_T_TYPE __UQUAD_TYPE
#define __FSWORD_T_TYPE __SWORD_TYPE
#define __ID_T_TYPE __U32_TYPE
#define __CLOCK_T_TYPE __SLONGWORD_TYPE
#define __TIME_T_TYPE __SLONGWORD_TYPE
#define __USECONDS_T_TYPE __U32_TYPE
#define __SUSECONDS_T_TYPE __SLONGWORD_TYPE
#define __SUSECONDS64_T_TYPE __SQUAD_TYPE
#define __DADDR_T_TYPE __S32_TYPE
#define __KEY_T_TYPE __S32_TYPE
#define __CLOCKID_T_TYPE __S32_TYPE
#define __TIMER_T_TYPE void *
#define __BLKSIZE_T_TYPE __SLONGWORD_TYPE
#define __FSID_T_TYPE struct { int __val[2]; }
#define __SSIZE_T_TYPE __SWORD_TYPE
#define __SYSCALL_SLONG_TYPE __SLONGWORD_TYPE
#define __SYSCALL_ULONG_TYPE __ULONGWORD_TYPE
#define __CPU_MASK_TYPE __ULONGWORD_TYPE
#ifdef __LP64__
/* Tell the libc code that off_t and off64_t are actually the same type
for all ABI purposes, even if possibly expressed as different base types
for C type-checking purposes. */
# define __OFF_T_MATCHES_OFF64_T 1
/* Same for ino_t and ino64_t. */
# define __INO_T_MATCHES_INO64_T 1
/* 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
/* And for getitimer, setitimer and rusage */
# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 1
#else
# define __RLIM_T_MATCHES_RLIM64_T 0
# define __STATFS_MATCHES_STATFS64 0
/* And for getitimer, setitimer and rusage */
# define __KERNEL_OLD_TIMEVAL_MATCHES_TIMEVAL64 0
#endif
/* Number of descriptors that can fit in an `fd_set'. */
#define __FD_SETSIZE 1024
#endif /* bits/typesizes.h */

View File

@ -1,50 +0,0 @@
/* Inline functions to return unsigned integer values unchanged.
Copyright (C) 2017-2023 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
<https://www.gnu.org/licenses/>. */
#if !defined _NETINET_IN_H && !defined _ENDIAN_H
# error "Never use <bits/uintn-identity.h> directly; include <netinet/in.h> or <endian.h> instead."
#endif
#ifndef _BITS_UINTN_IDENTITY_H
#define _BITS_UINTN_IDENTITY_H 1
#include <bits/types.h>
/* These inline functions are to ensure the appropriate type
conversions and associated diagnostics from macros that convert to
a given endianness. */
static __inline __uint16_t
__uint16_identity (__uint16_t __x)
{
return __x;
}
static __inline __uint32_t
__uint32_identity (__uint32_t __x)
{
return __x;
}
static __inline __uint64_t
__uint64_identity (__uint64_t __x)
{
return __x;
}
#endif /* _BITS_UINTN_IDENTITY_H. */

View File

@ -1,34 +0,0 @@
/* Definitions of flag bits for `waitpid' et al.
Copyright (C) 1992-2023 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
<https://www.gnu.org/licenses/>. */
#if !defined _SYS_WAIT_H && !defined _STDLIB_H
# error "Never include <bits/waitflags.h> directly; use <sys/wait.h> instead."
#endif
/* Bits in the third argument to `waitpid'. */
#define WNOHANG 1 /* Don't block waiting. */
#define WUNTRACED 2 /* Report status of stopped children. */
/* Bits in the fourth argument to `waitid'. */
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K8
# define WSTOPPED WUNTRACED /* Report stopped child. */
# define WCONTINUED 4 /* Report continued child. */
# define WNOWAIT 8 /* Don't reap, just poll status. */
# define WEXITED 16 /* Report dead child. */
#endif

View File

@ -1,59 +0,0 @@
/* Definitions of status bits for `wait' et al.
Copyright (C) 1992-2023 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
<https://www.gnu.org/licenses/>. */
#if !defined _SYS_WAIT_H && !defined _STDLIB_H
# error "Never include <bits/waitstatus.h> directly; use <sys/wait.h> instead."
#endif
/* Everything extant so far uses these same bits. */
/* If WIFEXITED(STATUS), the low-order 8 bits of the status. */
#define __WEXITSTATUS(status) (((status) & 0xff00) >> 8)
/* If WIFSIGNALED(STATUS), the terminating signal. */
#define __WTERMSIG(status) ((status) & 0x7f)
/* If WIFSTOPPED(STATUS), the signal that stopped the child. */
#define __WSTOPSIG(status) __WEXITSTATUS(status)
/* Nonzero if STATUS indicates normal termination. */
#define __WIFEXITED(status) (__WTERMSIG(status) == 0)
/* Nonzero if STATUS indicates termination by a signal. */
#define __WIFSIGNALED(status) \
(((signed char) (((status) & 0x7f) + 1) >> 1) > 0)
/* Nonzero if STATUS indicates the child is stopped. */
#define __WIFSTOPPED(status) (((status) & 0xff) == 0x7f)
/* Nonzero if STATUS indicates the child continued after a stop. We only
define this if <bits/waitflags.h> provides the WCONTINUED flag bit. */
#ifdef WCONTINUED
# define __WIFCONTINUED(status) ((status) == __W_CONTINUED)
#endif
/* Nonzero if STATUS indicates the child dumped core. */
#define __WCOREDUMP(status) ((status) & __WCOREFLAG)
/* Macros for constructing status values. */
#define __W_EXITCODE(ret, sig) ((ret) << 8 | (sig))
#define __W_STOPCODE(sig) ((sig) << 8 | 0x7f)
#define __W_CONTINUED 0xffff
#define __WCOREFLAG 0x80

View File

@ -1,72 +0,0 @@
/* Special .init and .fini section support.
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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
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
<https://www.gnu.org/licenses/>. */
/* Define an ELF note identifying the operating-system ABI that the
executable was created for. The ELF note information identifies a
particular OS or coordinated development effort within which the
ELF header's e_machine value plus (for dynamically linked programs)
the PT_INTERP dynamic linker name and DT_NEEDED shared library
names fully identify the runtime environment required by an
executable.
The general format of ELF notes is as follows.
Offsets and lengths are bytes or (parenthetical references) to the
values in other fields.
offset length contents
0 4 length of name
4 4 length of data
8 4 note type
12 (0) vendor name
- null-terminated ASCII string, padded to 4-byte alignment
12+(0) (4) note data,
The GNU project and cooperating development efforts (including the
Linux community) use note type 1 and a vendor name string of "GNU"
for a note descriptor that indicates ABI requirements. The note data
is four 32-bit words. The first of these is an operating system
number (0=Linux, 1=Hurd, 2=Solaris, ...) and the remaining three
identify the earliest release of that OS that supports this ABI.
See abi-tags (top level) for details. */
#include <config.h>
#include <abi-tag.h> /* OS-specific ABI tag value */
/* The linker (GNU ld 2.8 and later) recognizes an allocated section whose
name begins with `.note' and creates a PT_NOTE program header entry
pointing at it. */
.section ".note.ABI-tag", "a"
.p2align 2
.long 1f - 0f /* name length */
.long 3f - 2f /* data length */
.long 1 /* note type */
0: .asciz "GNU" /* vendor name */
1: .p2align 2
2: .long __ABI_TAG_OS /* note data: the ABI tag */
.long __ABI_TAG_VERSION
3: .p2align 2 /* pad out section */

View File

@ -1,4 +0,0 @@
#define __ABI_TAG_OS 0
#ifndef __ABI_TAG_VERSION
# define __ABI_TAG_VERSION 2,0,0
#endif

View File

@ -1,106 +0,0 @@
/* Startup support for ELF initializers/finalizers in the main executable.
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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <stddef.h>
/* These magic symbols are provided by the linker. */
extern void (*__preinit_array_start []) (int, char **, char **)
attribute_hidden;
extern void (*__preinit_array_end []) (int, char **, char **)
attribute_hidden;
extern void (*__init_array_start []) (int, char **, char **)
attribute_hidden;
extern void (*__init_array_end []) (int, char **, char **)
attribute_hidden;
extern void (*__fini_array_start []) (void) attribute_hidden;
extern void (*__fini_array_end []) (void) attribute_hidden;
#ifndef NO_INITFINI
/* These function symbols are provided for the .init/.fini section entry
points automagically by the linker. */
extern void _init (void);
extern void _fini (void);
#endif
/* These functions are passed to __libc_start_main by the startup code.
These get statically linked into each program. For dynamically linked
programs, this module will come from libc_nonshared.a and differs from
the libc.a module in that it doesn't call the preinit array. */
void
__libc_csu_init (int argc, char **argv, char **envp)
{
/* For dynamically linked executables the preinit array is executed by
the dynamic linker (before initializing any shared object). */
#ifndef LIBC_NONSHARED
/* For static executables, preinit happens right before init. */
{
const size_t size = __preinit_array_end - __preinit_array_start;
size_t i;
for (i = 0; i < size; i++)
(*__preinit_array_start [i]) (argc, argv, envp);
}
#endif
#ifndef NO_INITFINI
_init ();
#endif
const size_t size = __init_array_end - __init_array_start;
for (size_t i = 0; i < size; i++)
(*__init_array_start [i]) (argc, argv, envp);
}
/* This function should not be used anymore. We run the executable's
destructor now just like any other. We cannot remove the function,
though. */
void
__libc_csu_fini (void)
{
#ifndef LIBC_NONSHARED
size_t i = __fini_array_end - __fini_array_start;
while (i-- > 0)
(*__fini_array_start [i]) ();
# ifndef NO_INITFINI
_fini ();
# endif
#endif
}

View File

@ -1,35 +0,0 @@
/* Definition of `errno' variable. Canonical version.
Copyright (C) 2002-2023 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
<https://www.gnu.org/licenses/>. */
#include <errno.h>
#include <tls.h>
#include <dl-sysdep.h>
#undef errno
#if RTLD_PRIVATE_ERRNO
/* Code compiled for rtld refers only to this name. */
int rtld_errno attribute_hidden;
#else
__thread int errno;
extern __thread int __libc_errno __attribute__ ((alias ("errno")))
attribute_hidden;
#endif

View File

@ -1,46 +0,0 @@
/* Copyright (C) 2005-2023 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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/cdefs.h>
extern void __stack_chk_fail (void) __attribute__ ((noreturn));
/* On some architectures, this helps needless PIC pointer setup
that would be needed just for the __stack_chk_fail call. */
void __attribute__ ((noreturn)) attribute_hidden
__stack_chk_fail_local (void)
{
__stack_chk_fail ();
}

File diff suppressed because it is too large Load Diff

View File

@ -1,40 +0,0 @@
#ifndef _ALLOCA_H
#include <stdlib/alloca.h>
# ifndef _ISOMAC
#include <stackinfo.h>
#undef __alloca
/* Now define the internal interfaces. */
extern void *__alloca (size_t __size);
#ifdef __GNUC__
# define __alloca(size) __builtin_alloca (size)
#endif /* GCC. */
extern int __libc_use_alloca (size_t size) __attribute__ ((const));
extern int __libc_alloca_cutoff (size_t size) __attribute__ ((const));
libc_hidden_proto (__libc_alloca_cutoff)
#define __MAX_ALLOCA_CUTOFF 65536
#include <allocalim.h>
#if defined stackinfo_get_sp && defined stackinfo_sub_sp
# define alloca_account(size, avar) \
({ void *old__ = stackinfo_get_sp (); \
void *m__ = __alloca (size); \
avar += stackinfo_sub_sp (old__); \
m__; })
#else
# define alloca_account(size, avar) \
({ size_t s__ = (size); \
avar += s__; \
__alloca (s__); })
#endif
# endif /* !_ISOMAC */
#endif

View File

@ -1,9 +0,0 @@
#ifndef _BITS_CPU_SET_H
#include <posix/bits/cpu-set.h>
#ifndef _ISOMAC
int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp);
libc_hidden_proto (__sched_cpucount)
#endif
#endif /* _BITS_CPU_SET_H */

View File

@ -1 +0,0 @@
#include <string/bits/endian.h>

View File

@ -1 +0,0 @@
#include <io/bits/statx.h>

View File

@ -1,8 +0,0 @@
/* No floating-point inline functions in rtld and for the conform tests. */
#ifdef _ISOMAC
# include <stdlib/bits/stdlib-float.h>
#else
# if !IS_IN (rtld)
# include <stdlib/bits/stdlib-float.h>
# endif
#endif

View File

@ -1 +0,0 @@
#include <posix/bits/types.h>

View File

@ -1 +0,0 @@
#include <locale/bits/types/__locale_t.h>

View File

@ -1 +0,0 @@
#include <time/bits/types/clock_t.h>

View File

@ -1 +0,0 @@
#include <time/bits/types/clockid_t.h>

View File

@ -1 +0,0 @@
#include <locale/bits/types/locale_t.h>

View File

@ -1 +0,0 @@
#include <signal/bits/types/sig_atomic_t.h>

View File

@ -1 +0,0 @@
#include <signal/bits/types/sigset_t.h>

View File

@ -1 +0,0 @@
#include <time/bits/types/struct_itimerspec.h>

View File

@ -1 +0,0 @@
#include <time/bits/types/struct_timespec.h>

View File

@ -1 +0,0 @@
#include <time/bits/types/struct_timeval.h>

View File

@ -1 +0,0 @@
#include <time/bits/types/struct_tm.h>

View File

@ -1 +0,0 @@
#include <time/bits/types/time_t.h>

View File

@ -1 +0,0 @@
#include <time/bits/types/timer_t.h>

View File

@ -1,3 +0,0 @@
/* __dso_handle is always defined by either crtbegin.o from GCC or our
dso_handle.c. */
extern void *__dso_handle __attribute__ ((__visibility__ ("hidden")));

View File

@ -1,29 +0,0 @@
#ifndef _ELF_H
#include <elf/elf.h>
#ifndef _ISOMAC
# include <libc-pointer-arith.h>
/* Compute the offset of the note descriptor from size of note entry's
owner string and note alignment. */
# define ELF_NOTE_DESC_OFFSET(namesz, align) \
ALIGN_UP (sizeof (ElfW(Nhdr)) + (namesz), (align))
/* Compute the offset of the next note entry from size of note entry's
owner string, size of the note descriptor and note alignment. */
# define ELF_NOTE_NEXT_OFFSET(namesz, descsz, align) \
ALIGN_UP (ELF_NOTE_DESC_OFFSET ((namesz), (align)) + (descsz), (align))
/* Some information which is not meant for the public and therefore not
in <elf.h>. */
# include <dl-dtprocnum.h>
# ifdef DT_1_SUPPORTED_MASK
# error DT_1_SUPPORTED_MASK is defined!
# endif
# define DT_1_SUPPORTED_MASK \
(DF_1_NOW | DF_1_NODELETE | DF_1_INITFIRST | DF_1_NOOPEN \
| DF_1_ORIGIN | DF_1_NODEFLIB | DF_1_PIE)
#endif /* !_ISOMAC */
#endif /* elf.h */

View File

@ -1,17 +0,0 @@
#include <string/endian.h>
#if defined _LIBC && !defined _ISOMAC
# if __FLOAT_WORD_ORDER == __BIG_ENDIAN
# define BIG_ENDI 1
# undef LITTLE_ENDI
# define HIGH_HALF 0
# define LOW_HALF 1
# else
# if __FLOAT_WORD_ORDER == __LITTLE_ENDIAN
# undef BIG_ENDI
# define LITTLE_ENDI 1
# define HIGH_HALF 1
# define LOW_HALF 0
# endif
# endif
#endif

View File

@ -1,45 +0,0 @@
#ifndef _ERRNO_H
#include <stdlib/errno.h>
#if !defined _ISOMAC && !defined __ASSEMBLER__
# if IS_IN (rtld)
# include <dl-sysdep.h>
# ifndef RTLD_PRIVATE_ERRNO
# error "dl-sysdep.h must define RTLD_PRIVATE_ERRNO!"
# endif
# else
# define RTLD_PRIVATE_ERRNO 0
# endif
# if RTLD_PRIVATE_ERRNO
/* The dynamic linker uses its own private errno variable.
All access to errno inside the dynamic linker is serialized,
so a single (hidden) global variable is all it needs. */
# undef errno
# define errno rtld_errno
extern int rtld_errno attribute_hidden;
# elif IS_IN_LIB && !IS_IN (rtld)
# undef errno
# if IS_IN (libc)
# define errno __libc_errno
# else
# define errno errno /* For #ifndef errno tests. */
# endif
extern __thread int errno attribute_tls_model_ie;
# endif /* IS_IN_LIB */
# define __set_errno(val) (errno = (val))
extern int *__errno_location (void) __THROW __attribute_const__
# if RTLD_PRIVATE_ERRNO
attribute_hidden
# endif
;
libc_hidden_proto (__errno_location)
#endif /* !_ISOMAC && !__ASSEMBLER__ */
#endif /* !_ERRNO_H */

View File

@ -1,2 +0,0 @@
/* This is a placeholder used only while compiling libc.
The installed gnu/stubs.h file is created by make install. */

View File

@ -1,40 +0,0 @@
/* AUTOGENERATED BY gen-libc-modules.awk, DO NOT EDIT. */
#define MODULE_iconvprogs 1
#define MODULE_iconvdata 2
#define MODULE_ldconfig 3
#define MODULE_libmemusage 4
#define MODULE_libpcprofile 5
#define MODULE_librpcsvc 6
#define MODULE_locale_programs 7
#define MODULE_memusagestat 8
#define MODULE_nonlib 9
#define MODULE_nscd 10
#define MODULE_extramodules 11
#define MODULE_libnldbl 12
#define MODULE_libsupport 13
#define MODULE_testsuite 14
#define MODULE_testsuite_internal 15
#define MODULE_LIBS_BEGIN 16
#define MODULE_rtld 17
#define MODULE_libc 18
#define MODULE_libBrokenLocale 19
#define MODULE_libpthread 20
#define MODULE_libthread_db 21
#define MODULE_libcrypt 22
#define MODULE_libdl 23
#define MODULE_libgcc_s 24
#define MODULE_libnsl 25
#define MODULE_libc_malloc_debug 26
#define MODULE_libutil 27
#define MODULE_libnss_ldap 28
#define MODULE_libnss_dns 29
#define MODULE_libnss_compat 30
#define MODULE_libmvec 31
#define MODULE_libresolv 32
#define MODULE_libnss_db 33
#define MODULE_libm 34
#define MODULE_libnss_files 35
#define MODULE_librt 36
#define MODULE_libnss_hesiod 37
#define MODULE_libanl 38

View File

@ -1,71 +0,0 @@
/* Helper macros for pointer arithmetic.
Copyright (C) 2012-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _LIBC_POINTER_ARITH_H
#define _LIBC_POINTER_ARITH_H 1
#include <stdint.h>
/* 1 if 'type' is a pointer type, 0 otherwise. */
# define __pointer_type(type) (__builtin_classify_type ((type) 0) == 5)
/* intptr_t if P is true, or T if P is false. */
# define __integer_if_pointer_type_sub(T, P) \
__typeof__ (*(0 ? (__typeof__ (0 ? (T *) 0 : (void *) (P))) 0 \
: (__typeof__ (0 ? (intptr_t *) 0 : (void *) (!(P)))) 0))
/* intptr_t if EXPR has a pointer type, or the type of EXPR otherwise. */
# define __integer_if_pointer_type(expr) \
__integer_if_pointer_type_sub(__typeof__ ((__typeof__ (expr)) 0), \
__pointer_type (__typeof__ (expr)))
/* Cast an integer or a pointer VAL to integer with proper type. */
# define cast_to_integer(val) ((__integer_if_pointer_type (val)) (val))
/* Cast an integer VAL to void * pointer. */
# define cast_to_pointer(val) ((void *) (uintptr_t) (val))
/* Align a value by rounding down to closest size.
e.g. Using size of 4096, we get this behavior:
{4095, 4096, 4097} = {0, 4096, 4096}. */
#define ALIGN_DOWN(base, size) ((base) & -((__typeof__ (base)) (size)))
/* Align a value by rounding up to closest size.
e.g. Using size of 4096, we get this behavior:
{4095, 4096, 4097} = {4096, 4096, 8192}.
Note: The size argument has side effects (expanded multiple times). */
#define ALIGN_UP(base, size) ALIGN_DOWN ((base) + (size) - 1, (size))
/* Same as ALIGN_DOWN(), but automatically casts when base is a pointer. */
#define PTR_ALIGN_DOWN(base, size) \
((__typeof__ (base)) ALIGN_DOWN ((uintptr_t) (base), (size)))
/* Same as ALIGN_UP(), but automatically casts when base is a pointer. */
#define PTR_ALIGN_UP(base, size) \
((__typeof__ (base)) ALIGN_UP ((uintptr_t) (base), (size)))
/* Check if BASE is aligned on SIZE */
#define PTR_IS_ALIGNED(base, size) \
((((uintptr_t) (base)) & (size - 1)) == 0)
/* Returns the ptrdiff_t difference between P1 and P2. */
#define PTR_DIFF(p1, p2) \
((ptrdiff_t)((uintptr_t)(p1) - (uintptr_t)(p2)))
#endif

View File

@ -1,866 +0,0 @@
/* Support macros for making weak and strong aliases for symbols,
and for using symbol sets and linker warnings with GNU ld.
Copyright (C) 1995-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _LIBC_SYMBOLS_H
#define _LIBC_SYMBOLS_H 1
/* This file is included implicitly in the compilation of every source file,
using -include. It includes config.h. */
/* Enable declarations of GNU extensions, since we are compiling them. */
#define _GNU_SOURCE 1
#ifdef MODULE_NAME
/* Use `#if IS_IN (module)` to detect what component is being compiled. */
#define PASTE_NAME1(a,b) a##b
#define PASTE_NAME(a,b) PASTE_NAME1 (a,b)
#define IN_MODULE PASTE_NAME (MODULE_, MODULE_NAME)
#define IS_IN(lib) (IN_MODULE == MODULE_##lib)
/* True if the current module is a versioned library. Versioned
library names culled from shlib-versions files are assigned a
MODULE_* value greater than MODULE_LIBS_BEGIN. */
#define IS_IN_LIB (IN_MODULE > MODULE_LIBS_BEGIN)
/* The testsuite, and some other ancillary code, should be compiled against
as close an approximation to the installed headers as possible.
Defining this symbol disables most internal-use-only declarations
provided by this header, and all those provided by other internal
wrapper headers. */
#if IS_IN (testsuite) || defined IS_IN_build || defined __cplusplus
# define _ISOMAC 1
#endif
#else
/* The generation process for a few files created very early in the
build (notably libc-modules.h itself) involves preprocessing this
header without defining MODULE_NAME. Under these conditions,
internal declarations (especially from config.h) must be visible,
but IS_IN should always evaluate as false. */
# define IS_IN(lib) 0
# define IS_IN_LIB 0
# define IN_MODULE (-1)
#endif
#ifndef _ISOMAC
/* This is defined for the compilation of all C library code. features.h
tests this to avoid inclusion of stubs.h while compiling the library,
before stubs.h has been generated. Some library code that is shared
with other packages also tests this symbol to see if it is being
compiled as part of the C library. We must define this before including
config.h, because it makes some definitions conditional on whether libc
itself is being compiled, or just some generator program. */
#define _LIBC 1
/* Some files must be compiled with optimization on. */
#if !defined __ASSEMBLER__ && !defined __OPTIMIZE__
# error "glibc cannot be compiled without optimization"
#endif
/* -ffast-math cannot be applied to the C library, as it alters the ABI.
Some test components that use -ffast-math are currently not part of
IS_IN (testsuite) for technical reasons, so we have a secondary override. */
#if defined __FAST_MATH__ && !defined TEST_FAST_MATH
# error "glibc must not be compiled with -ffast-math"
#endif
#include <config.h>
/* Obtain the definition of symbol_version_reference. */
#include <libc-symver.h>
/* When PIC is defined and SHARED isn't defined, we are building PIE
by default. */
#if defined PIC && !defined SHARED
# define BUILD_PIE_DEFAULT 1
#else
# define BUILD_PIE_DEFAULT 0
#endif
/* Define this for the benefit of portable GNU code that wants to check it.
Code that checks with #if will not #include <config.h> again, since we've
already done it (and this file is implicitly included in every compile,
via -include). Code that checks with #ifdef will #include <config.h>,
but that file should always be idempotent (i.e., it's just #define/#undef
and nothing else anywhere should be changing the macro state it touches),
so it's harmless. */
#define HAVE_CONFIG_H 0
/* Define these macros for the benefit of portable GNU code that wants to check
them. Of course, STDC_HEADERS is never false when building libc! */
#define STDC_HEADERS 1
#define HAVE_MBSTATE_T 1
#define HAVE_MBSRTOWCS 1
#define HAVE_LIBINTL_H 1
#define HAVE_WCTYPE_H 1
#define HAVE_ISWCTYPE 1
#define ENABLE_NLS 1
/* The symbols in all the user (non-_) macros are C symbols. */
#ifndef __SYMBOL_PREFIX
# define __SYMBOL_PREFIX
#endif
#ifndef C_SYMBOL_NAME
# define C_SYMBOL_NAME(name) name
#endif
#ifndef ASM_LINE_SEP
# define ASM_LINE_SEP ;
#endif
#ifndef __attribute_copy__
/* Provide an empty definition when cdefs.h is not included. */
# define __attribute_copy__(arg)
#endif
#ifndef __ASSEMBLER__
/* GCC understands weak symbols and aliases; use its interface where
possible, instead of embedded assembly language. */
/* Define ALIASNAME as a strong alias for NAME. */
# define strong_alias(name, aliasname) _strong_alias(name, aliasname)
# define _strong_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((alias (#name))) \
__attribute_copy__ (name);
/* This comes between the return type and function name in
a function definition to make that definition weak. */
# define weak_function __attribute__ ((weak))
# define weak_const_function __attribute__ ((weak, __const__))
/* Define ALIASNAME as a weak alias for NAME.
If weak aliases are not available, this defines a strong alias. */
# define weak_alias(name, aliasname) _weak_alias (name, aliasname)
# define _weak_alias(name, aliasname) \
extern __typeof (name) aliasname __attribute__ ((weak, alias (#name))) \
__attribute_copy__ (name);
/* Zig patch. weak_hidden_alias was removed from glibc v2.36 (v2.37?), Zig
needs it for the v2.32 and earlier {f,l,}stat wrappers, so only include
in this header for 2.32 and earlier. */
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ <= 32) || __GLIBC__ < 2
# define weak_hidden_alias(name, aliasname) \
_weak_hidden_alias (name, aliasname)
# define _weak_hidden_alias(name, aliasname) \
extern __typeof (name) aliasname \
__attribute__ ((weak, alias (#name), __visibility__ ("hidden"))) \
__attribute_copy__ (name);
#endif
/* Declare SYMBOL as weak undefined symbol (resolved to 0 if not defined). */
# define weak_extern(symbol) _weak_extern (weak symbol)
# define _weak_extern(expr) _Pragma (#expr)
/* In shared builds, the expression call_function_static_weak
(FUNCTION-SYMBOL, ARGUMENTS) invokes FUNCTION-SYMBOL (an
identifier) unconditionally, with the (potentially empty) argument
list ARGUMENTS. In static builds, if FUNCTION-SYMBOL has a
definition, the function is invoked as before; if FUNCTION-SYMBOL
is NULL, no call is performed. */
# ifdef SHARED
# define call_function_static_weak(func, ...) func (__VA_ARGS__)
# else /* !SHARED */
# define call_function_static_weak(func, ...) \
({ \
extern __typeof__ (func) func weak_function; \
(func != NULL ? func (__VA_ARGS__) : (void)0); \
})
# endif
#else /* __ASSEMBLER__ */
# ifdef HAVE_ASM_SET_DIRECTIVE
# define strong_alias(original, alias) \
.globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
.set C_SYMBOL_NAME (alias),C_SYMBOL_NAME (original)
# define strong_data_alias(original, alias) strong_alias(original, alias)
# else
# define strong_alias(original, alias) \
.globl C_SYMBOL_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
# define strong_data_alias(original, alias) strong_alias(original, alias)
# endif
# define weak_alias(original, alias) \
.weak C_SYMBOL_NAME (alias) ASM_LINE_SEP \
C_SYMBOL_NAME (alias) = C_SYMBOL_NAME (original)
# define weak_extern(symbol) \
.weak C_SYMBOL_NAME (symbol)
#endif /* __ASSEMBLER__ */
/* Determine the return address. */
#define RETURN_ADDRESS(nr) \
__builtin_extract_return_addr (__builtin_return_address (nr))
/* When a reference to SYMBOL is encountered, the linker will emit a
warning message MSG. */
/* We want the .gnu.warning.SYMBOL section to be unallocated. */
#define __make_section_unallocated(section_string) \
asm (".section " section_string "\n\t.previous");
/* Tacking on "\n\t#" to the section name makes gcc put it's bogus
section attributes on what looks like a comment to the assembler. */
#ifdef HAVE_SECTION_QUOTES
# define __sec_comment "\"\n\t#\""
#else
# define __sec_comment "\n\t#"
#endif
#define link_warning(symbol, msg) \
__make_section_unallocated (".gnu.warning." #symbol) \
static const char __evoke_link_warning_##symbol[] \
__attribute__ ((used, section (".gnu.warning." #symbol __sec_comment))) \
= msg;
/* A canned warning for sysdeps/stub functions. */
#define stub_warning(name) \
__make_section_unallocated (".gnu.glibc-stub." #name) \
link_warning (name, #name " is not implemented and will always fail")
/* Warning for linking functions calling dlopen into static binaries. */
#ifdef SHARED
#define static_link_warning(name)
#else
#define static_link_warning(name) static_link_warning1(name)
#define static_link_warning1(name) \
link_warning(name, "Using '" #name "' in statically linked applications \
requires at runtime the shared libraries from the glibc version used \
for linking")
#endif
/* Declare SYMBOL to be TYPE (`function' or `object') of SIZE bytes
alias to ORIGINAL, when the assembler supports such declarations
(such as in ELF).
This is only necessary when defining something in assembly, or playing
funny alias games where the size should be other than what the compiler
thinks it is. */
#define declare_object_symbol_alias(symbol, original, size) \
declare_object_symbol_alias_1 (symbol, original, size)
#ifdef __ASSEMBLER__
# define declare_object_symbol_alias_1(symbol, original, s_size) \
strong_alias (original, symbol) ASM_LINE_SEP \
.type C_SYMBOL_NAME (symbol), %object ASM_LINE_SEP \
.size C_SYMBOL_NAME (symbol), s_size ASM_LINE_SEP
#else /* Not __ASSEMBLER__. */
# ifdef HAVE_ASM_SET_DIRECTIVE
# define declare_object_symbol_alias_1(symbol, original, size) \
asm (".global " __SYMBOL_PREFIX # symbol "\n" \
".type " __SYMBOL_PREFIX # symbol ", %object\n" \
".set " __SYMBOL_PREFIX #symbol ", " __SYMBOL_PREFIX original "\n" \
".size " __SYMBOL_PREFIX #symbol ", " #size "\n");
# else
# define declare_object_symbol_alias_1(symbol, original, size) \
asm (".global " __SYMBOL_PREFIX # symbol "\n" \
".type " __SYMBOL_PREFIX # symbol ", %object\n" \
__SYMBOL_PREFIX #symbol " = " __SYMBOL_PREFIX original "\n" \
".size " __SYMBOL_PREFIX #symbol ", " #size "\n");
# endif /* HAVE_ASM_SET_DIRECTIVE */
#endif /* __ASSEMBLER__ */
/*
*/
#ifdef HAVE_GNU_RETAIN
# define attribute_used_retain __attribute__ ((__used__, __retain__))
#else
# define attribute_used_retain __attribute__ ((__used__))
#endif
/* Symbol set support macros. */
/* Make SYMBOL, which is in the text segment, an element of SET. */
#define text_set_element(set, symbol) _elf_set_element(set, symbol)
/* Make SYMBOL, which is in the data segment, an element of SET. */
#define data_set_element(set, symbol) _elf_set_element(set, symbol)
/* Make SYMBOL, which is in the bss segment, an element of SET. */
#define bss_set_element(set, symbol) _elf_set_element(set, symbol)
/* These are all done the same way in ELF.
There is a new section created for each set. */
#ifdef SHARED
/* When building a shared library, make the set section writable,
because it will need to be relocated at run time anyway. */
# define _elf_set_element(set, symbol) \
static const void *__elf_set_##set##_element_##symbol##__ \
attribute_used_retain __attribute__ ((section (#set))) = &(symbol)
#else
# define _elf_set_element(set, symbol) \
static const void *const __elf_set_##set##_element_##symbol##__ \
attribute_used_retain __attribute__ ((section (#set))) = &(symbol)
#endif
/* Define SET as a symbol set. This may be required (it is in a.out) to
be able to use the set's contents. */
#define symbol_set_define(set) symbol_set_declare(set)
/* Declare SET for use in this module, if defined in another module.
In a shared library, this is always local to that shared object.
For static linking, the set might be wholly absent and so we use
weak references. */
#define symbol_set_declare(set) \
extern char const __start_##set[] __symbol_set_attribute; \
extern char const __stop_##set[] __symbol_set_attribute;
#ifdef SHARED
# define __symbol_set_attribute attribute_hidden
#else
# define __symbol_set_attribute __attribute__ ((weak))
#endif
/* Return a pointer (void *const *) to the first element of SET. */
#define symbol_set_first_element(set) ((void *const *) (&__start_##set))
/* Return true iff PTR (a void *const *) has been incremented
past the last element in SET. */
#define symbol_set_end_p(set, ptr) ((ptr) >= (void *const *) &__stop_##set)
#ifdef SHARED
# define symbol_version(real, name, version) \
symbol_version_reference(real, name, version)
# define default_symbol_version(real, name, version) \
_default_symbol_version(real, name, version)
/* See <libc-symver.h>. */
# ifdef __ASSEMBLER__
# define _default_symbol_version(real, name, version) \
_set_symbol_version (real, name@@version)
# else
# define _default_symbol_version(real, name, version) \
_set_symbol_version (real, #name "@@" #version)
# endif
/* Evaluates to a string literal for VERSION in LIB. */
# define symbol_version_string(lib, version) \
_symbol_version_stringify_1 (VERSION_##lib##_##version)
# define _symbol_version_stringify_1(arg) _symbol_version_stringify_2 (arg)
# define _symbol_version_stringify_2(arg) #arg
#else /* !SHARED */
# define symbol_version(real, name, version)
# define default_symbol_version(real, name, version) \
strong_alias(real, name)
#endif
#if defined SHARED || defined LIBC_NONSHARED \
|| (BUILD_PIE_DEFAULT && IS_IN (libc))
# define attribute_hidden __attribute__ ((visibility ("hidden")))
#else
# define attribute_hidden
#endif
#define attribute_tls_model_ie __attribute__ ((tls_model ("initial-exec")))
#define attribute_relro __attribute__ ((section (".data.rel.ro")))
/* Used to disable stack protection in sensitive places, like ifunc
resolvers and early static TLS init. */
#ifdef HAVE_CC_NO_STACK_PROTECTOR
# define inhibit_stack_protector \
__attribute__ ((__optimize__ ("-fno-stack-protector")))
#else
# define inhibit_stack_protector
#endif
/* The following macros are used for PLT bypassing within libc.so
(and if needed other libraries similarly).
First of all, you need to have the function prototyped somewhere,
say in foo/foo.h:
int foo (int __bar);
If calls to foo within libc.so should always go to foo defined in libc.so,
then in include/foo.h you add:
libc_hidden_proto (foo)
line and after the foo function definition:
int foo (int __bar)
{
return __bar;
}
libc_hidden_def (foo)
or
int foo (int __bar)
{
return __bar;
}
libc_hidden_weak (foo)
Similarly for global data. If references to foo within libc.so should
always go to foo defined in libc.so, then in include/foo.h you add:
libc_hidden_proto (foo)
line and after foo's definition:
int foo = INITIAL_FOO_VALUE;
libc_hidden_data_def (foo)
or
int foo = INITIAL_FOO_VALUE;
libc_hidden_data_weak (foo)
If foo is normally just an alias (strong or weak) to some other function,
you should use the normal strong_alias first, then add libc_hidden_def
or libc_hidden_weak:
int baz (int __bar)
{
return __bar;
}
strong_alias (baz, foo)
libc_hidden_weak (foo)
If the function should be internal to multiple objects, say ld.so and
libc.so, the best way is to use:
#if IS_IN (libc) || IS_IN (rtld)
hidden_proto (foo)
#endif
in include/foo.h and the normal macros at all function definitions
depending on what DSO they belong to.
If versioned_symbol macro is used to define foo,
libc_hidden_ver macro should be used, as in:
int __real_foo (int __bar)
{
return __bar;
}
versioned_symbol (libc, __real_foo, foo, GLIBC_2_1);
libc_hidden_ver (__real_foo, foo) */
#if defined SHARED && !defined NO_HIDDEN
# ifndef __ASSEMBLER__
# define __hidden_proto_hiddenattr(attrs...) \
__attribute__ ((visibility ("hidden"), ##attrs))
# define hidden_proto(name, attrs...) \
__hidden_proto (name, , __GI_##name, ##attrs)
# define hidden_proto_alias(name, alias, attrs...) \
__hidden_proto_alias (name, , alias, ##attrs)
# define hidden_tls_proto(name, attrs...) \
__hidden_proto (name, __thread, __GI_##name, ##attrs)
# define __hidden_proto(name, thread, internal, attrs...) \
extern thread __typeof (name) name __asm__ (__hidden_asmname (#internal)) \
__hidden_proto_hiddenattr (attrs);
# define __hidden_proto_alias(name, thread, internal, attrs...) \
extern thread __typeof (name) internal __hidden_proto_hiddenattr (attrs);
# define __hidden_asmname(name) \
__hidden_asmname1 (__USER_LABEL_PREFIX__, name)
# define __hidden_asmname1(prefix, name) __hidden_asmname2(prefix, name)
# define __hidden_asmname2(prefix, name) #prefix name
# define __hidden_ver1(local, internal, name) \
__hidden_ver2 (, local, internal, name)
# define __hidden_ver2(thread, local, internal, name) \
extern thread __typeof (name) __EI_##name \
__asm__(__hidden_asmname (#internal)); \
extern thread __typeof (name) __EI_##name \
__attribute__((alias (__hidden_asmname (#local)))) \
__attribute_copy__ (name)
# define hidden_ver(local, name) __hidden_ver1(local, __GI_##name, name);
# define hidden_def(name) __hidden_ver1(__GI_##name, name, name);
# define hidden_def_alias(name, internal) \
strong_alias (name, internal)
# define hidden_data_def(name) hidden_def(name)
# define hidden_data_def_alias(name, alias) hidden_def_alias(name, alias)
# define hidden_tls_def(name) \
__hidden_ver2 (__thread, __GI_##name, name, name);
# define hidden_weak(name) \
__hidden_ver1(__GI_##name, name, name) __attribute__((weak));
# define hidden_data_weak(name) hidden_weak(name)
# define hidden_nolink(name, lib, version) \
__hidden_nolink1 (__GI_##name, __EI_##name, name, VERSION_##lib##_##version)
# define __hidden_nolink1(local, internal, name, version) \
__hidden_nolink2 (local, internal, name, version)
# define __hidden_nolink2(local, internal, name, version) \
extern __typeof (name) internal __attribute__ ((alias (#local))) \
__attribute_copy__ (name); \
__hidden_nolink3 (local, internal, #name "@" #version)
# define __hidden_nolink3(local, internal, vername) \
__asm__ (".symver " #internal ", " vername);
# else
/* For assembly, we need to do the opposite of what we do in C:
in assembly gcc __REDIRECT stuff is not in place, so functions
are defined by its normal name and we need to create the
__GI_* alias to it, in C __REDIRECT causes the function definition
to use __GI_* name and we need to add alias to the real name.
There is no reason to use hidden_weak over hidden_def in assembly,
but we provide it for consistency with the C usage.
hidden_proto doesn't make sense for assembly but the equivalent
is to call via the HIDDEN_JUMPTARGET macro instead of JUMPTARGET. */
# define hidden_def(name) strong_alias (name, __GI_##name)
# define hidden_def_alias(name, alias) strong_alias (name, alias)
# define hidden_weak(name) hidden_def (name)
# define hidden_ver(local, name) strong_alias (local, __GI_##name)
# define hidden_data_def(name) strong_data_alias (name, __GI_##name)
# define hidden_data_def_alias(name, alias) strong_data_alias (name, alias)
# define hidden_tls_def(name) hidden_data_def (name)
# define hidden_data_weak(name) hidden_data_def (name)
# define HIDDEN_JUMPTARGET(name) __GI_##name
# endif
#else
# ifndef __ASSEMBLER__
# if !defined SHARED && IS_IN (libc) && !defined LIBC_NONSHARED \
&& (!defined PIC || !defined NO_HIDDEN_EXTERN_FUNC_IN_PIE) \
&& !defined NO_HIDDEN
# define __hidden_proto_hiddenattr(attrs...) \
__attribute__ ((visibility ("hidden"), ##attrs))
# define hidden_proto(name, attrs...) \
__hidden_proto (name, , name, ##attrs)
# define hidden_proto_alias(name, alias, attrs...) \
__hidden_proto_alias (name, , alias, ##attrs)
# define hidden_tls_proto(name, attrs...) \
__hidden_proto (name, __thread, name, ##attrs)
# define __hidden_proto(name, thread, internal, attrs...) \
extern thread __typeof (name) name __hidden_proto_hiddenattr (attrs);
# define __hidden_proto_alias(name, thread, internal, attrs...) \
extern thread __typeof (name) internal __hidden_proto_hiddenattr (attrs);
# else
# define hidden_proto(name, attrs...)
# define hidden_proto_alias(name, alias, attrs...)
# define hidden_tls_proto(name, attrs...)
# endif
# else
# define HIDDEN_JUMPTARGET(name) JUMPTARGET(name)
# endif /* Not __ASSEMBLER__ */
# define hidden_weak(name)
# define hidden_def(name)
# define hidden_def_alias(name, alias)
# define hidden_ver(local, name)
# define hidden_data_weak(name)
# define hidden_data_def(name)
# define hidden_data_def_alias(name, alias)
# define hidden_tls_def(name)
# define hidden_nolink(name, lib, version)
#endif
#if IS_IN (libc)
# define libc_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libc_hidden_proto_alias(name, alias, attrs...) \
hidden_proto_alias (name, alias, ##attrs)
# define libc_hidden_tls_proto(name, attrs...) hidden_tls_proto (name, ##attrs)
# define libc_hidden_def(name) hidden_def (name)
# define libc_hidden_weak(name) hidden_weak (name)
# define libc_hidden_nolink_sunrpc(name, version) hidden_nolink (name, libc, version)
# define libc_hidden_ver(local, name) hidden_ver (local, name)
# define libc_hidden_data_def(name) hidden_data_def (name)
# define libc_hidden_data_def_alias(name, alias) hidden_data_def_alias (name, alias)
# define libc_hidden_tls_def(name) hidden_tls_def (name)
# define libc_hidden_data_weak(name) hidden_data_weak (name)
#else
# define libc_hidden_proto(name, attrs...)
# define libc_hidden_proto_alias(name, alias, attrs...)
# define libc_hidden_tls_proto(name, attrs...)
# define libc_hidden_def(name)
# define libc_hidden_weak(name)
# define libc_hidden_ver(local, name)
# define libc_hidden_data_def(name)
# define libc_hidden_data_def_alias(name, alias)
# define libc_hidden_tls_def(name)
# define libc_hidden_data_weak(name)
#endif
#if IS_IN (rtld)
# define rtld_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define rtld_hidden_def(name) hidden_def (name)
# define rtld_hidden_weak(name) hidden_weak (name)
# define rtld_hidden_data_def(name) hidden_data_def (name)
#else
# define rtld_hidden_proto(name, attrs...)
# define rtld_hidden_def(name)
# define rtld_hidden_weak(name)
# define rtld_hidden_data_def(name)
#endif
#if IS_IN (libm)
# define libm_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libm_hidden_def(name) hidden_def (name)
# define libm_hidden_weak(name) hidden_weak (name)
# define libm_hidden_ver(local, name) hidden_ver (local, name)
#else
# define libm_hidden_proto(name, attrs...)
# define libm_hidden_def(name)
# define libm_hidden_weak(name)
# define libm_hidden_ver(local, name)
#endif
#if IS_IN (libmvec)
# define libmvec_hidden_def(name) hidden_def (name)
#else
# define libmvec_hidden_def(name)
#endif
#if IS_IN (libresolv)
# define libresolv_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libresolv_hidden_def(name) hidden_def (name)
# define libresolv_hidden_data_def(name) hidden_data_def (name)
#else
# define libresolv_hidden_proto(name, attrs...)
# define libresolv_hidden_def(name)
# define libresolv_hidden_data_def(name)
#endif
#if IS_IN (libpthread)
# define libpthread_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libpthread_hidden_def(name) hidden_def (name)
#else
# define libpthread_hidden_proto(name, attrs...)
# define libpthread_hidden_def(name)
#endif
#if IS_IN (librt)
# define librt_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define librt_hidden_ver(local, name) hidden_ver (local, name)
#else
# define librt_hidden_proto(name, attrs...)
# define librt_hidden_ver(local, name)
#endif
#if IS_IN (libnsl)
# define libnsl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
# define libnsl_hidden_nolink_def(name, version) hidden_nolink (name, libnsl, version)
#else
# define libnsl_hidden_proto(name, attrs...)
#endif
#define libc_hidden_builtin_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
#define libc_hidden_builtin_def(name) libc_hidden_def (name)
#define libc_hidden_ldbl_proto(name, attrs...) libc_hidden_proto (name, ##attrs)
#ifdef __ASSEMBLER__
# define HIDDEN_BUILTIN_JUMPTARGET(name) HIDDEN_JUMPTARGET(name)
#endif
#if IS_IN (libanl)
# define libanl_hidden_proto(name, attrs...) hidden_proto (name, ##attrs)
#else
# define libanl_hidden_proto(name, attrs...)
#endif
/* Get some dirty hacks. */
#include <symbol-hacks.h>
/* Move compatibility symbols out of the way by placing them all in a
special section. */
#ifndef __ASSEMBLER__
# define attribute_compat_text_section \
__attribute__ ((section (".text.compat")))
#else
# define compat_text_section .section ".text.compat", "ax";
#endif
/* Helper / base macros for indirect function symbols. */
#define __ifunc_resolver(type_name, name, expr, arg, init, classifier) \
classifier inhibit_stack_protector \
__typeof (type_name) *name##_ifunc (arg) \
{ \
init (); \
__typeof (type_name) *res = expr; \
return res; \
}
#ifdef HAVE_GCC_IFUNC
# define __ifunc(type_name, name, expr, arg, init) \
extern __typeof (type_name) name __attribute__ \
((ifunc (#name "_ifunc"))); \
__ifunc_resolver (type_name, name, expr, arg, init, static)
# define __ifunc_hidden(type_name, name, expr, arg, init) \
__ifunc (type_name, name, expr, arg, init)
#else
/* Gcc does not support __attribute__ ((ifunc (...))). Use the old behaviour
as fallback. But keep in mind that the debug information for the ifunc
resolver functions is not correct. It contains the ifunc'ed function as
DW_AT_linkage_name. E.g. lldb uses this field and an inferior function
call of the ifunc'ed function will fail due to "no matching function for
call to ..." because the ifunc'ed function and the resolver function have
different signatures. (Gcc support is disabled at least on a ppc64le
Ubuntu 14.04 system.) */
# define __ifunc(type_name, name, expr, arg, init) \
extern __typeof (type_name) name; \
__typeof (type_name) *name##_ifunc (arg) __asm__ (#name); \
__ifunc_resolver (type_name, name, expr, arg, init,) \
__asm__ (".type " #name ", %gnu_indirect_function");
# define __ifunc_hidden(type_name, name, expr, arg, init) \
extern __typeof (type_name) __libc_##name; \
__ifunc (type_name, __libc_##name, expr, arg, init) \
strong_alias (__libc_##name, name);
#endif /* !HAVE_GCC_IFUNC */
/* The following macros are used for indirect function symbols in libc.so.
First of all, you need to have the function prototyped somewhere,
say in foo.h:
int foo (int __bar);
If you have an implementation for foo which e.g. uses a special hardware
feature which isn't available on all machines where this libc.so will be
used but decidable if available at runtime e.g. via hwcaps, you can provide
two or multiple implementations of foo:
int __foo_default (int __bar)
{
return __bar;
}
int __foo_special (int __bar)
{
return __bar;
}
If your function foo has no libc_hidden_proto (foo) defined for PLT
bypassing, you can use:
#define INIT_ARCH() unsigned long int hwcap = __GLRO(dl_hwcap);
libc_ifunc (foo, (hwcap & HWCAP_SPECIAL) ? __foo_special : __foo_default);
This will define a resolver function for foo which returns __foo_special or
__foo_default depending on your specified expression. Please note that you
have to define a macro function INIT_ARCH before using libc_ifunc macro as
it is called by the resolver function before evaluating the specified
expression. In this example it is used to prepare the hwcap variable.
The resolver function is assigned to an ifunc'ed symbol foo. Calls to foo
from inside or outside of libc.so will be indirected by a PLT call.
If your function foo has a libc_hidden_proto (foo) defined for PLT bypassing
and calls to foo within libc.so should always go to one specific
implementation of foo e.g. __foo_default then you have to add:
__hidden_ver1 (__foo_default, __GI_foo, __foo_default);
or a tweaked definition of libc_hidden_def macro after the __foo_default
function definition. Calls to foo within libc.so will always go directly to
__foo_default. Calls to foo from outside libc.so will be indirected by a
PLT call to ifunc'ed symbol foo which you have to define in a separate
compile unit:
#define foo __redirect_foo
#include <foo.h>
#undef foo
extern __typeof (__redirect_foo) __foo_default attribute_hidden;
extern __typeof (__redirect_foo) __foo_special attribute_hidden;
libc_ifunc_redirected (__redirect_foo, foo,
(hwcap & HWCAP_SPECIAL)
? __foo_special
: __foo_default);
This will define the ifunc'ed symbol foo like above. The redirection of foo
in header file is needed to omit an additional definition of __GI_foo which
would end in a linker error while linking libc.so. You have to specify
__redirect_foo as first parameter which is used within libc_ifunc_redirected
macro in conjunction with typeof to define the ifunc'ed symbol foo.
If your function foo has a libc_hidden_proto (foo) defined and calls to foo
within or from outside libc.so should go via ifunc'ed symbol, then you have
to use:
libc_ifunc_hidden (foo, foo,
(hwcap & HWCAP_SPECIAL)
? __foo_special
: __foo_default);
libc_hidden_def (foo)
The first parameter foo of libc_ifunc_hidden macro is used in the same way
as for libc_ifunc_redirected macro. */
#define libc_ifunc(name, expr) __ifunc (name, name, expr, void, INIT_ARCH)
#define libc_ifunc_redirected(redirected_name, name, expr) \
__ifunc (redirected_name, name, expr, void, INIT_ARCH)
#define libc_ifunc_hidden(redirected_name, name, expr) \
__ifunc_hidden (redirected_name, name, expr, void, INIT_ARCH)
/* The body of the function is supposed to use __get_cpu_features
which will, if necessary, initialize the data first. */
#define libm_ifunc_init()
#define libm_ifunc(name, expr) \
__ifunc (name, name, expr, void, libm_ifunc_init)
/* Add the compiler optimization to inhibit loop transformation to library
calls. This is used to avoid recursive calls in memset and memmove
default implementations. */
#ifdef HAVE_CC_INHIBIT_LOOP_TO_LIBCALL
# define inhibit_loop_to_libcall \
__attribute__ ((__optimize__ ("-fno-tree-loop-distribute-patterns")))
#else
# define inhibit_loop_to_libcall
#endif
/* These macros facilitate sharing source files with gnulib.
They are here instead of sys/cdefs.h because they should not be
used in public header files.
Their definitions should be kept consistent with the definitions in
gnulib-common.m4, but it is not necessary to cater to old non-GCC
compilers, since they will only be used while building glibc itself.
(Note that _GNUC_PREREQ cannot be used in this file.) */
/* Define as a marker that can be attached to declarations that might not
be used. This helps to reduce warnings, such as from
GCC -Wunused-parameter. */
#if __GNUC__ >= 3 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 7)
# define _GL_UNUSED __attribute__ ((__unused__))
#else
# define _GL_UNUSED
#endif
/* gcc supports the "unused" attribute on possibly unused labels, and
g++ has since version 4.5. Note to support C++ as well as C,
_GL_UNUSED_LABEL should be used with a trailing ; */
#if !defined __cplusplus || __GNUC__ > 4 \
|| (__GNUC__ == 4 && __GNUC_MINOR__ >= 5)
# define _GL_UNUSED_LABEL _GL_UNUSED
#else
# define _GL_UNUSED_LABEL
#endif
/* The __pure__ attribute was added in gcc 2.96. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 96)
# define _GL_ATTRIBUTE_PURE __attribute__ ((__pure__))
#else
# define _GL_ATTRIBUTE_PURE /* empty */
#endif
/* The __const__ attribute was added in gcc 2.95. */
#if __GNUC__ > 2 || (__GNUC__ == 2 && __GNUC_MINOR__ >= 95)
# define _GL_ATTRIBUTE_CONST __attribute__ ((__const__))
#else
# define _GL_ATTRIBUTE_CONST /* empty */
#endif
#endif /* !_ISOMAC */
#endif /* libc-symbols.h */

View File

@ -1,27 +0,0 @@
#include_next <pthread.h>
#ifndef _ISOMAC
/* Prototypes repeated instead of using __typeof because pthread.h is
included in C++ tests, and declaring functions with __typeof and
__THROW doesn't work for C++. */
extern int __pthread_barrier_init (pthread_barrier_t *__restrict __barrier,
const pthread_barrierattr_t *__restrict
__attr, unsigned int __count)
__THROW __nonnull ((1));
#if PTHREAD_IN_LIBC
libc_hidden_proto (__pthread_barrier_init)
#endif
extern int __pthread_barrier_wait (pthread_barrier_t *__barrier)
__THROWNL __nonnull ((1));
#if PTHREAD_IN_LIBC
libc_hidden_proto (__pthread_barrier_wait)
#endif
/* This function is called to initialize the pthread library. */
extern void __pthread_initialize (void) __attribute__ ((weak));
extern int __pthread_kill (pthread_t threadid, int signo);
extern pthread_t __pthread_self (void);
#endif

View File

@ -1,74 +0,0 @@
#ifndef _SIGNAL_H
# include <signal/signal.h>
# ifndef _ISOMAC
# include <sigsetops.h>
libc_hidden_proto (sigemptyset)
libc_hidden_proto (sigfillset)
libc_hidden_proto (sigaddset)
libc_hidden_proto (sigdelset)
libc_hidden_proto (sigismember)
extern int __sigpause (int sig_or_mask, int is_sig);
libc_hidden_proto (__sigpause)
libc_hidden_proto (raise)
libc_hidden_proto (__libc_current_sigrtmin)
libc_hidden_proto (__libc_current_sigrtmax)
extern const char * const __sys_siglist[_NSIG] attribute_hidden;
extern const char * const __sys_sigabbrev[_NSIG] attribute_hidden;
/* Now define the internal interfaces. */
extern __sighandler_t __bsd_signal (int __sig, __sighandler_t __handler);
extern int __kill (__pid_t __pid, int __sig);
libc_hidden_proto (__kill)
extern int __sigaction (int __sig, const struct sigaction *__restrict __act,
struct sigaction *__restrict __oact);
libc_hidden_proto (__sigaction)
extern int __sigblock (int __mask);
libc_hidden_proto (__sigblock)
extern int __sigsetmask (int __mask);
extern int __sigprocmask (int __how,
const sigset_t *__set, sigset_t *__oset);
libc_hidden_proto (__sigprocmask)
extern int __sigsuspend (const sigset_t *__set);
libc_hidden_proto (__sigsuspend)
extern int __sigwait (const sigset_t *__set, int *__sig);
libc_hidden_proto (__sigwait)
extern int __sigwaitinfo (const sigset_t *__set, siginfo_t *__info);
libc_hidden_proto (__sigwaitinfo)
#if __TIMESIZE == 64
# define __sigtimedwait64 __sigtimedwait
#else
# include <struct___timespec64.h>
extern int __sigtimedwait64 (const sigset_t *__set, siginfo_t *__info,
const struct __timespec64 *__timeout);
libc_hidden_proto (__sigtimedwait64)
#endif
extern int __sigtimedwait (const sigset_t *__set, siginfo_t *__info,
const struct timespec *__timeout);
libc_hidden_proto (__sigtimedwait)
extern int __sigqueue (__pid_t __pid, int __sig,
const union sigval __val);
#ifdef __USE_MISC
extern int __sigreturn (struct sigcontext *__scp);
#endif
extern int __sigaltstack (const stack_t *__ss,
stack_t *__oss);
libc_hidden_proto (__sigaltstack)
extern int __libc_sigaction (int sig, const struct sigaction *act,
struct sigaction *oact);
libc_hidden_proto (__libc_sigaction)
extern int __default_sigpause (int mask);
extern int __xpg_sigpause (int sig);
/* Allocate real-time signal with highest/lowest available priority. */
extern int __libc_allocate_rtsig (int __high);
# if IS_IN (rtld)
extern __typeof (__sigaction) __sigaction attribute_hidden;
extern __typeof (__libc_sigaction) __libc_sigaction attribute_hidden;
# endif
# endif /* _ISOMAC */
#endif /* signal.h */

View File

@ -1,78 +0,0 @@
/* Macros for defining Systemtap <sys/sdt.h> static probe points.
Copyright (C) 2012-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _STAP_PROBE_H
#define _STAP_PROBE_H 1
#ifdef USE_STAP_PROBE
# include <stap-probe-machine.h>
# include <sys/sdt.h>
/* Our code uses one macro LIBC_PROBE (name, n, arg1, ..., argn).
Without USE_STAP_PROBE, that does nothing but evaluates all
its arguments (to prevent bit rot, unlike e.g. assert).
Systemtap's header defines the macros STAP_PROBE (provider, name) and
STAP_PROBEn (provider, name, arg1, ..., argn). For "provider" we paste
in MODULE_NAME (libc, libpthread, etc.) automagically.
The format of the arg parameters is discussed here:
https://sourceware.org/systemtap/wiki/UserSpaceProbeImplementation
The precise details of how register names are specified is
architecture specific and can be found in the gdb and SystemTap
source code. */
# define LIBC_PROBE(name, n, ...) \
LIBC_PROBE_1 (MODULE_NAME, name, n, ## __VA_ARGS__)
# define LIBC_PROBE_1(lib, name, n, ...) \
STAP_PROBE##n (lib, name, ## __VA_ARGS__)
# define STAP_PROBE0 STAP_PROBE
# define LIBC_PROBE_ASM(name, template) \
STAP_PROBE_ASM (MODULE_NAME, name, template)
# define LIBC_PROBE_ASM_OPERANDS STAP_PROBE_ASM_OPERANDS
#else /* Not USE_STAP_PROBE. */
# ifndef __ASSEMBLER__
/* Evaluate all the arguments and verify that N matches their number. */
# define LIBC_PROBE(name, n, ...) STAP_PROBE##n (__VA_ARGS__)
# define STAP_PROBE0() do {} while (0)
# define STAP_PROBE1(a1) do {} while (0)
# define STAP_PROBE2(a1, a2) do {} while (0)
# define STAP_PROBE3(a1, a2, a3) do {} while (0)
# define STAP_PROBE4(a1, a2, a3, a4) do {} while (0)
# else
# define LIBC_PROBE(name, n, ...) /* Nothing. */
# endif
# define LIBC_PROBE_ASM(name, template) /* Nothing. */
# define LIBC_PROBE_ASM_OPERANDS(n, ...) /* Nothing. */
#endif /* USE_STAP_PROBE. */
#endif /* stap-probe.h */

View File

@ -1,375 +0,0 @@
#ifndef _STDLIB_H
#ifndef _ISOMAC
# include <stdbool.h>
# include <stddef.h>
#endif
/* Workaround PR90731 with GCC 9 when using ldbl redirects in C++. */
#include <bits/floatn.h>
#if defined __cplusplus && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# if __GNUC_PREREQ (9, 0) && !__GNUC_PREREQ (9, 3)
# pragma GCC system_header
# endif
#endif
#include <stdlib/stdlib.h>
/* Now define the internal interfaces. */
#if !defined _ISOMAC
# include <sys/stat.h>
# include <rtld-malloc.h>
extern __typeof (strtol_l) __strtol_l;
extern __typeof (strtoul_l) __strtoul_l;
extern __typeof (strtoll_l) __strtoll_l;
extern __typeof (strtoull_l) __strtoull_l;
extern __typeof (strtod_l) __strtod_l;
extern __typeof (strtof_l) __strtof_l;
extern __typeof (strtold_l) __strtold_l;
libc_hidden_proto (__strtol_l)
libc_hidden_proto (__strtoul_l)
libc_hidden_proto (__strtoll_l)
libc_hidden_proto (__strtoull_l)
libc_hidden_proto (__strtod_l)
libc_hidden_proto (__strtof_l)
libc_hidden_proto (__strtold_l)
extern __typeof (strtol) __isoc23_strtol __attribute_copy__ (strtol);
extern __typeof (strtoul) __isoc23_strtoul __attribute_copy__ (strtoul);
extern __typeof (strtoll) __isoc23_strtoll __attribute_copy__ (strtoll);
extern __typeof (strtoull) __isoc23_strtoull __attribute_copy__ (strtoull);
extern __typeof (strtol_l) __isoc23_strtol_l __attribute_copy__ (strtol_l);
extern __typeof (strtoul_l) __isoc23_strtoul_l __attribute_copy__ (strtoul_l);
extern __typeof (strtoll_l) __isoc23_strtoll_l __attribute_copy__ (strtoll_l);
extern __typeof (strtoull_l) __isoc23_strtoull_l __attribute_copy__ (strtoull_l);
libc_hidden_proto (__isoc23_strtol)
libc_hidden_proto (__isoc23_strtoul)
libc_hidden_proto (__isoc23_strtoll)
libc_hidden_proto (__isoc23_strtoull)
libc_hidden_proto (__isoc23_strtol_l)
libc_hidden_proto (__isoc23_strtoul_l)
libc_hidden_proto (__isoc23_strtoll_l)
libc_hidden_proto (__isoc23_strtoull_l)
#if __GLIBC_USE (C2X_STRTOL)
/* Redirect internal uses of these functions to the C2X versions; the
redirection in the installed header does not work with
libc_hidden_proto. */
# undef strtol
# define strtol __isoc23_strtol
# undef strtoul
# define strtoul __isoc23_strtoul
# undef strtoll
# define strtoll __isoc23_strtoll
# undef strtoull
# define strtoull __isoc23_strtoull
# undef strtol_l
# define strtol_l __isoc23_strtol_l
# undef strtoul_l
# define strtoul_l __isoc23_strtoul_l
# undef strtoll_l
# define strtoll_l __isoc23_strtoll_l
# undef strtoull_l
# define strtoull_l __isoc23_strtoull_l
#endif
libc_hidden_proto (exit)
libc_hidden_proto (abort)
libc_hidden_proto (getenv)
extern __typeof (secure_getenv) __libc_secure_getenv;
libc_hidden_proto (__libc_secure_getenv)
libc_hidden_proto (bsearch)
libc_hidden_proto (qsort)
extern __typeof (qsort_r) __qsort_r;
libc_hidden_proto (__qsort_r)
libc_hidden_proto (lrand48_r)
libc_hidden_proto (wctomb)
extern long int __random (void) attribute_hidden;
extern void __srandom (unsigned int __seed);
extern char *__initstate (unsigned int __seed, char *__statebuf,
size_t __statelen);
extern char *__setstate (char *__statebuf);
extern int __random_r (struct random_data *__buf, int32_t *__result)
attribute_hidden;
extern int __srandom_r (unsigned int __seed, struct random_data *__buf)
attribute_hidden;
extern int __initstate_r (unsigned int __seed, char *__statebuf,
size_t __statelen, struct random_data *__buf)
attribute_hidden;
extern int __setstate_r (char *__statebuf, struct random_data *__buf)
attribute_hidden;
extern int __rand_r (unsigned int *__seed);
extern int __erand48_r (unsigned short int __xsubi[3],
struct drand48_data *__buffer, double *__result)
attribute_hidden;
extern int __nrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__buffer,
long int *__result) attribute_hidden;
extern int __jrand48_r (unsigned short int __xsubi[3],
struct drand48_data *__buffer,
long int *__result) attribute_hidden;
extern int __srand48_r (long int __seedval,
struct drand48_data *__buffer) attribute_hidden;
extern int __seed48_r (unsigned short int __seed16v[3],
struct drand48_data *__buffer) attribute_hidden;
extern int __lcong48_r (unsigned short int __param[7],
struct drand48_data *__buffer) attribute_hidden;
/* Internal function to compute next state of the generator. */
extern int __drand48_iterate (unsigned short int __xsubi[3],
struct drand48_data *__buffer)
attribute_hidden;
/* Global state for non-reentrant functions. Defined in drand48-iter.c. */
extern struct drand48_data __libc_drand48_data attribute_hidden;
extern int __setenv (const char *__name, const char *__value, int __replace)
attribute_hidden;
extern int __unsetenv (const char *__name) attribute_hidden;
extern int __clearenv (void) attribute_hidden;
extern char *__mktemp (char *__template) __THROW __nonnull ((1));
libc_hidden_proto (__mktemp)
extern char *__canonicalize_file_name (const char *__name);
extern char *__realpath (const char *__name, char *__resolved);
libc_hidden_proto (__realpath)
extern int __ptsname_r (int __fd, char *__buf, size_t __buflen)
attribute_hidden;
# ifndef _ISOMAC
extern int __ptsname_internal (int fd, char *buf, size_t buflen,
struct stat64 *stp) attribute_hidden;
# endif
extern int __getpt (void);
extern int __posix_openpt (int __oflag) attribute_hidden;
extern int __add_to_environ (const char *name, const char *value,
const char *combines, int replace)
attribute_hidden;
extern void _quicksort (void *const pbase, size_t total_elems,
size_t size, __compar_d_fn_t cmp, void *arg);
extern int __on_exit (void (*__func) (int __status, void *__arg), void *__arg);
extern int __cxa_atexit (void (*func) (void *), void *arg, void *d);
libc_hidden_proto (__cxa_atexit);
extern int __cxa_thread_atexit_impl (void (*func) (void *), void *arg,
void *d);
extern void __call_tls_dtors (void)
#ifndef SHARED
__attribute__ ((weak))
#endif
;
libc_hidden_proto (__call_tls_dtors)
extern void __cxa_finalize (void *d);
extern int __posix_memalign (void **memptr, size_t alignment, size_t size);
extern void *__libc_memalign (size_t alignment, size_t size)
__attribute_malloc__;
extern void *__libc_reallocarray (void *__ptr, size_t __nmemb, size_t __size)
__THROW __attribute_warn_unused_result__;
libc_hidden_proto (__libc_reallocarray)
extern int __libc_system (const char *line);
extern __typeof (getpt) __getpt;
extern __typeof (ptsname_r) __ptsname_r;
libc_hidden_proto (__getpt)
libc_hidden_proto (__ptsname_r)
libc_hidden_proto (grantpt)
libc_hidden_proto (unlockpt)
__typeof (arc4random) __arc4random;
libc_hidden_proto (__arc4random);
__typeof (arc4random_buf) __arc4random_buf;
libc_hidden_proto (__arc4random_buf);
__typeof (arc4random_uniform) __arc4random_uniform;
libc_hidden_proto (__arc4random_uniform);
extern void __arc4random_buf_internal (void *buffer, size_t len)
attribute_hidden;
extern double __strtod_internal (const char *__restrict __nptr,
char **__restrict __endptr, int __group)
__THROW __nonnull ((1)) __wur;
extern float __strtof_internal (const char *__restrict __nptr,
char **__restrict __endptr, int __group)
__THROW __nonnull ((1)) __wur;
extern long double __strtold_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __group)
__THROW __nonnull ((1)) __wur;
extern long int __strtol_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group)
__THROW __nonnull ((1)) __wur;
extern unsigned long int __strtoul_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group)
__THROW __nonnull ((1)) __wur;
__extension__
extern long long int __strtoll_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group)
__THROW __nonnull ((1)) __wur;
__extension__
extern unsigned long long int __strtoull_internal (const char *
__restrict __nptr,
char **__restrict __endptr,
int __base, int __group)
__THROW __nonnull ((1)) __wur;
libc_hidden_proto (__strtof_internal)
libc_hidden_proto (__strtod_internal)
libc_hidden_proto (__strtold_internal)
libc_hidden_proto (__strtol_internal)
libc_hidden_proto (__strtoll_internal)
libc_hidden_proto (__strtoul_internal)
libc_hidden_proto (__strtoull_internal)
extern double ____strtod_l_internal (const char *__restrict __nptr,
char **__restrict __endptr, int __group,
locale_t __loc);
extern float ____strtof_l_internal (const char *__restrict __nptr,
char **__restrict __endptr, int __group,
locale_t __loc);
extern long double ____strtold_l_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __group, locale_t __loc);
extern long int ____strtol_l_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group,
bool __bin_cst, locale_t __loc);
extern unsigned long int ____strtoul_l_internal (const char *
__restrict __nptr,
char **__restrict __endptr,
int __base, int __group,
bool __bin_cst,
locale_t __loc);
__extension__
extern long long int ____strtoll_l_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __base, int __group,
bool __bin_cst, locale_t __loc);
__extension__
extern unsigned long long int ____strtoull_l_internal (const char *
__restrict __nptr,
char **
__restrict __endptr,
int __base, int __group,
bool __bin_cst,
locale_t __loc);
libc_hidden_proto (____strtof_l_internal)
libc_hidden_proto (____strtod_l_internal)
libc_hidden_proto (____strtold_l_internal)
libc_hidden_proto (____strtol_l_internal)
libc_hidden_proto (____strtoll_l_internal)
libc_hidden_proto (____strtoul_l_internal)
libc_hidden_proto (____strtoull_l_internal)
#include <bits/floatn.h>
libc_hidden_proto (strtof)
libc_hidden_proto (strtod)
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0
libc_hidden_proto (strtold)
#endif
libc_hidden_proto (strtol)
libc_hidden_proto (strtoll)
libc_hidden_proto (strtoul)
libc_hidden_proto (strtoull)
libc_hidden_proto (atoi)
extern float __strtof_nan (const char *, char **, char);
extern double __strtod_nan (const char *, char **, char);
extern long double __strtold_nan (const char *, char **, char);
extern float __wcstof_nan (const wchar_t *, wchar_t **, wchar_t);
extern double __wcstod_nan (const wchar_t *, wchar_t **, wchar_t);
extern long double __wcstold_nan (const wchar_t *, wchar_t **, wchar_t);
libc_hidden_proto (__strtof_nan)
libc_hidden_proto (__strtod_nan)
libc_hidden_proto (__strtold_nan)
libc_hidden_proto (__wcstof_nan)
libc_hidden_proto (__wcstod_nan)
libc_hidden_proto (__wcstold_nan)
/* Enable _FloatN bits as needed. */
#include <bits/floatn.h>
#if __HAVE_DISTINCT_FLOAT128
extern __typeof (strtof128_l) __strtof128_l;
libc_hidden_proto (__strtof128_l)
libc_hidden_proto (strtof128)
extern _Float128 __strtof128_nan (const char *, char **, char);
extern _Float128 __wcstof128_nan (const wchar_t *, wchar_t **, wchar_t);
libc_hidden_proto (__strtof128_nan)
libc_hidden_proto (__wcstof128_nan)
extern _Float128 __strtof128_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __group);
libc_hidden_proto (__strtof128_internal)
extern _Float128 ____strtof128_l_internal (const char *__restrict __nptr,
char **__restrict __endptr,
int __group, locale_t __loc);
libc_hidden_proto (____strtof128_l_internal)
#endif
extern char *__ecvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign);
extern char *__fcvt (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign);
extern char *__gcvt (double __value, int __ndigit, char *__buf);
extern int __ecvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len);
libc_hidden_proto (__ecvt_r)
extern int __fcvt_r (double __value, int __ndigit, int *__restrict __decpt,
int *__restrict __sign, char *__restrict __buf,
size_t __len);
libc_hidden_proto (__fcvt_r)
extern char *__qecvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign);
extern char *__qfcvt (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign);
extern char *__qgcvt (long double __value, int __ndigit, char *__buf);
extern int __qecvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len);
libc_hidden_proto (__qecvt_r)
extern int __qfcvt_r (long double __value, int __ndigit,
int *__restrict __decpt, int *__restrict __sign,
char *__restrict __buf, size_t __len);
libc_hidden_proto (__qfcvt_r)
# if IS_IN (libc)
# undef MB_CUR_MAX
# define MB_CUR_MAX (_NL_CURRENT_WORD (LC_CTYPE, _NL_CTYPE_MB_CUR_MAX))
# endif
struct abort_msg_s
{
unsigned int size;
char msg[0];
};
extern struct abort_msg_s *__abort_msg;
libc_hidden_proto (__abort_msg)
# if IS_IN (rtld)
extern __typeof (unsetenv) unsetenv attribute_hidden;
extern __typeof (__strtoul_internal) __strtoul_internal attribute_hidden;
# endif
#endif
#endif /* include/stdlib.h */

View File

@ -1,27 +0,0 @@
#ifndef _STRUCT_TIMESPEC64_H
#define _STRUCT_TIMESPEC64_H
#if __TIMESIZE == 64
# define __timespec64 timespec
#else
#include <endian.h>
/* The glibc Y2038-proof struct __timespec64 structure for a time value.
To keep things Posix-ish, we keep the nanoseconds field a 32-bit
signed long, but since the Linux field is a 64-bit signed int, we
pad our tv_nsec with a 32-bit unnamed bit-field padding.
As a general rule the Linux kernel is ignoring upper 32 bits of
tv_nsec field. */
struct __timespec64
{
__time64_t tv_sec; /* Seconds */
# if BYTE_ORDER == BIG_ENDIAN
__int32_t :32; /* Padding */
__int32_t tv_nsec; /* Nanoseconds */
# else
__int32_t tv_nsec; /* Nanoseconds */
__int32_t :32; /* Padding */
# endif
};
#endif
#endif /* _STRUCT_TIMESPEC64_H */

View File

@ -1,17 +0,0 @@
#ifndef _STRUCT_TIMEVAL64_H
#define _STRUCT_TIMEVAL64_H
#if __TIMESIZE == 64
# define __timeval64 timeval
#else
/* The glibc Y2038-proof struct __timeval64 structure for a time value.
This structure is NOT supposed to be passed to the Linux kernel.
Instead, it shall be converted to struct __timespec64 and time shall
be [sg]et via clock_[sg]ettime (which are now Y2038 safe). */
struct __timeval64
{
__time64_t tv_sec; /* Seconds */
__suseconds64_t tv_usec; /* Microseconds */
};
#endif
#endif /* _STRUCT_TIMEVAL64_H */

View File

@ -1,59 +0,0 @@
#ifndef _SYS_CDEFS_H
/* This is outside of _ISOMAC to enforce that _Static_assert always
uses the two-argument form. This can be removed once the minimum
GCC version used to compile glibc is GCC 9.1. */
#ifndef __cplusplus
# define _Static_assert(expr, diagnostic) _Static_assert (expr, diagnostic)
#endif
#include <misc/sys/cdefs.h>
#ifndef _ISOMAC
/* The compiler will optimize based on the knowledge the parameter is
not NULL. This will omit tests. A robust implementation cannot allow
this so when compiling glibc itself we ignore this attribute. */
# undef __nonnull
# define __nonnull(params)
extern void __chk_fail (void) __attribute__ ((__noreturn__));
libc_hidden_proto (__chk_fail)
rtld_hidden_proto (__chk_fail)
/* If we are using redirects internally to support long double,
we need to tweak some macros to ensure the PLT bypass tricks
continue to work in libc. */
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1 && IS_IN (libc) && defined SHARED
# undef __LDBL_REDIR_DECL
# define __LDBL_REDIR_DECL(func) \
extern __typeof(func) func __asm (__ASMNAME ("__GI____ieee128_" #func));
# undef libc_hidden_ldbl_proto
# define libc_hidden_ldbl_proto(func, attrs...) \
extern __typeof(func) ___ieee128_ ## func; \
libc_hidden_proto (___ieee128_ ## func, ##attrs);
# undef __LDBL_REDIR2_DECL
# define __LDBL_REDIR2_DECL(func) \
extern __typeof(__ ## func) __ ## func __asm (__ASMNAME ("__GI____ieee128___" #func));
#endif
#if defined SHARED
#if IS_IN (libc) && __USE_FORTIFY_LEVEL > 0 && defined __fortify_function
#undef __REDIRECT_FORTIFY
#define __REDIRECT_FORTIFY(name, proto, alias) \
__REDIRECT(name, proto, __GI_##alias)
#undef __REDIRECT_FORTIFY_NTH
#define __REDIRECT_FORTIFY_NTH(name, proto, alias) \
__REDIRECT_NTH(name, proto, __GI_##alias)
#endif
#endif /* defined SHARED */
#endif /* !defined _ISOMAC */
#endif

View File

@ -1,51 +0,0 @@
#ifndef _SYS_SELECT_H
#include <misc/sys/select.h>
#ifndef _ISOMAC
/* Now define the internal interfaces. */
#include <bits/select-decl.h>
libc_hidden_proto (__fdelt_chk)
# if __TIMESIZE == 64
# define __pselect64 __pselect
# define __select64 __select
#else
# include <struct___timespec64.h>
# include <struct___timeval64.h>
extern int __pselect64 (int __nfds, fd_set *__readfds,
fd_set *__writefds, fd_set *__exceptfds,
const struct __timespec64 *__timeout,
const __sigset_t *__sigmask);
libc_hidden_proto (__pselect64)
extern int __pselect32 (int __nfds, fd_set *__readfds,
fd_set *__writefds, fd_set *__exceptfds,
const struct __timespec64 *__timeout,
const __sigset_t *__sigmask)
attribute_hidden;
extern int __select32 (int __nfds, fd_set *__readfds,
fd_set *__writefds, fd_set *__exceptfds,
const struct __timespec64 *ts64,
struct __timeval64 *timeout)
attribute_hidden;
extern int __select64 (int __nfds, fd_set *__readfds,
fd_set *__writefds, fd_set *__exceptfds,
struct __timeval64 *__timeout);
libc_hidden_proto (__select64)
#endif
extern int __pselect (int __nfds, fd_set *__readfds,
fd_set *__writefds, fd_set *__exceptfds,
const struct timespec *__timeout,
const __sigset_t *__sigmask);
extern int __select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout);
libc_hidden_proto (__select)
#endif
#endif

View File

@ -1 +0,0 @@
#include <signal/sys/signal.h>

View File

@ -1,100 +0,0 @@
#ifndef _SYS_STAT_H
#include <io/sys/stat.h>
#ifndef _ISOMAC
# include <xstatver.h>
# include <struct___timespec64.h>
# include <struct_stat_time64.h>
# include <stdbool.h>
static inline bool
in_ino_t_range (__ino64_t v)
{
__ino_t s = v;
return s == v;
}
static inline bool
in_off_t_range (__off64_t v)
{
__off_t s = v;
return s == v;
}
static inline bool
in_blkcnt_t_range (__blkcnt64_t v)
{
__blkcnt_t s = v;
return s == v;
}
/* Now define the internal interfaces. */
extern int __stat (const char *__file, struct stat *__buf);
extern int __stat64 (const char *__file, struct stat64 *__buf);
extern int __fstat (int __fd, struct stat *__buf);
extern int __fstat64 (int __fd, struct stat64 *__buf);
extern int __lstat (const char *__file, struct stat *__buf);
extern int __lstat64 (const char *__file, struct stat64 *__buf);
extern int __fstatat (int dirfd, const char *pathname, struct stat *buf,
int flags);
extern int __fstatat64 (int dirfd, const char *pathname, struct stat64 *buf,
int flags);
# if IS_IN (libc) || (IS_IN (rtld) && !defined NO_RTLD_HIDDEN)
hidden_proto (__stat64)
hidden_proto (__fstat64)
hidden_proto (__lstat64)
hidden_proto (__fstatat64)
# endif
# if __TIMESIZE == 64 || defined NO_RTLD_HIDDEN
# define __stat64_time64 __stat64
# define __fstat64_time64 __fstat64
# define __lstat64_time64 __lstat64
# define __fstatat64_time64 __fstatat64
# else
extern int __stat64_time64 (const char *file, struct __stat64_t64 *buf);
hidden_proto (__stat64_time64);
extern int __lstat64_time64 (const char *file, struct __stat64_t64 *buf);
hidden_proto (__lstat64_time64);
extern int __fstat64_time64 (int fd, struct __stat64_t64 *buf);
hidden_proto (__fstat64_time64);
extern int __fstatat64_time64 (int dirfd, const char *pathname,
struct __stat64_t64 *buf, int flags);
hidden_proto (__fstatat64_time64);
# endif
extern int __chmod (const char *__file, __mode_t __mode);
libc_hidden_proto (__chmod)
extern int __fchmod (int __fd, __mode_t __mode);
extern int __fchmodat (int __fd, const char *__file, mode_t __mode, int __flag);
libc_hidden_proto (fchmodat)
extern __mode_t __umask (__mode_t __mask);
extern int __mkdir (const char *__path, __mode_t __mode);
libc_hidden_proto (__mkdir)
extern int __mkdirat (int __fd, const char *__path, mode_t __mode);
extern int __mknodat (int fd, const char *path, mode_t mode, dev_t dev);
libc_hidden_proto (__mknodat);
extern int __mknod (const char *__path,
__mode_t __mode, __dev_t __dev);
libc_hidden_proto (__mknod);
extern int __xmknod (int __ver, const char *__path, __mode_t __mode,
__dev_t *__dev);
extern int __xmknodat (int __ver, int __fd, const char *__path,
__mode_t __mode, __dev_t *__dev);
int __fxstat (int __ver, int __fildes, struct stat *__stat_buf);
int __xstat (int __ver, const char *__filename,
struct stat *__stat_buf);
int __lxstat (int __ver, const char *__filename, struct stat *__stat_buf);
int __fxstatat (int __ver, int __fildes, const char *__filename,
struct stat *__stat_buf, int __flag);
int __fxstat64 (int ver, int __fildes, struct stat64 *__stat_buf);
int __xstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
int __lxstat64 (int ver, const char *__filename, struct stat64 *__stat_buf);
int __fxstatat64 (int ver, int __fildes, const char *__filename,
struct stat64 *__stat_buf, int __flag);
#endif
#endif

View File

@ -1 +0,0 @@
#include <posix/sys/types.h>

View File

@ -1 +0,0 @@
#include <misc/syscall.h>

View File

@ -1,26 +0,0 @@
/* statx-related definitions and declarations. Generic version.
Copyright (C) 2018-2023 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
<https://www.gnu.org/licenses/>. */
/* This interface is based on <linux/stat.h> in Linux. */
#ifndef _SYS_STAT_H
# error Never include <bits/statx.h> directly, include <sys/stat.h> instead.
#endif
/* Use the generic definitions. */
#include <bits/statx-generic.h>

View File

@ -1,354 +0,0 @@
/* Copyright (C) 1991-2023 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
<https://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 6.5 File Control Operations <fcntl.h>
*/
#ifndef _FCNTL_H
#define _FCNTL_H 1
#include <features.h>
/* This must be early so <bits/fcntl.h> can define types winningly. */
__BEGIN_DECLS
/* Get __mode_t, __dev_t and __off_t .*/
#include <bits/types.h>
/* Get the definitions of O_*, F_*, FD_*: all the
numbers and flag bits for `open', `fcntl', et al. */
#include <bits/fcntl.h>
/* Detect if open needs mode as a third argument (or for openat as a fourth
argument). */
#ifdef __O_TMPFILE
# define __OPEN_NEEDS_MODE(oflag) \
(((oflag) & O_CREAT) != 0 || ((oflag) & __O_TMPFILE) == __O_TMPFILE)
#else
# define __OPEN_NEEDS_MODE(oflag) (((oflag) & O_CREAT) != 0)
#endif
/* POSIX.1-2001 specifies that these types are defined by <fcntl.h>.
Earlier POSIX standards permitted any type ending in `_t' to be defined
by any POSIX header, so we don't conditionalize the definitions here. */
#ifndef __mode_t_defined
typedef __mode_t mode_t;
# define __mode_t_defined
#endif
#ifndef __off_t_defined
# ifndef __USE_FILE_OFFSET64
typedef __off_t off_t;
# else
typedef __off64_t off_t;
# endif
# define __off_t_defined
#endif
#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
typedef __off64_t off64_t;
# define __off64_t_defined
#endif
#ifndef __pid_t_defined
typedef __pid_t pid_t;
# define __pid_t_defined
#endif
/* For XPG all symbols from <sys/stat.h> should also be available. */
#ifdef __USE_XOPEN2K8
# include <bits/types/struct_timespec.h>
#endif
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
# include <bits/stat.h>
# define S_IFMT __S_IFMT
# define S_IFDIR __S_IFDIR
# define S_IFCHR __S_IFCHR
# define S_IFBLK __S_IFBLK
# define S_IFREG __S_IFREG
# ifdef __S_IFIFO
# define S_IFIFO __S_IFIFO
# endif
# ifdef __S_IFLNK
# define S_IFLNK __S_IFLNK
# endif
# if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) && defined __S_IFSOCK
# define S_IFSOCK __S_IFSOCK
# endif
/* Protection bits. */
# define S_ISUID __S_ISUID /* Set user ID on execution. */
# define S_ISGID __S_ISGID /* Set group ID on execution. */
# if defined __USE_MISC || defined __USE_XOPEN
/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
# define S_ISVTX __S_ISVTX
# endif
# define S_IRUSR __S_IREAD /* Read by owner. */
# define S_IWUSR __S_IWRITE /* Write by owner. */
# define S_IXUSR __S_IEXEC /* Execute by owner. */
/* Read, write, and execute by owner. */
# define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
# define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
# define S_IWGRP (S_IWUSR >> 3) /* Write by group. */
# define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */
/* Read, write, and execute by group. */
# define S_IRWXG (S_IRWXU >> 3)
# define S_IROTH (S_IRGRP >> 3) /* Read by others. */
# define S_IWOTH (S_IWGRP >> 3) /* Write by others. */
# define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */
/* Read, write, and execute by others. */
# define S_IRWXO (S_IRWXG >> 3)
#endif
#ifdef __USE_MISC
# ifndef R_OK /* Verbatim from <unistd.h>. Ugh. */
/* Values for the second argument to access.
These may be OR'd together. */
# define R_OK 4 /* Test for read permission. */
# define W_OK 2 /* Test for write permission. */
# define X_OK 1 /* Test for execute permission. */
# define F_OK 0 /* Test for existence. */
# endif
#endif /* Use misc. */
/* XPG wants the following symbols. <stdio.h> has the same definitions. */
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
# define SEEK_SET 0 /* Seek from beginning of file. */
# define SEEK_CUR 1 /* Seek from current position. */
# define SEEK_END 2 /* Seek from end of file. */
#endif /* XPG */
/* The constants AT_REMOVEDIR and AT_EACCESS have the same value. AT_EACCESS
is meaningful only to faccessat, while AT_REMOVEDIR is meaningful only to
unlinkat. The two functions do completely different things and therefore,
the flags can be allowed to overlap. For example, passing AT_REMOVEDIR to
faccessat would be undefined behavior and thus treating it equivalent to
AT_EACCESS is valid undefined behavior. */
#ifdef __USE_ATFILE
# define AT_FDCWD -100 /* Special value used to indicate
the *at functions should use the
current working directory. */
# define AT_SYMLINK_NOFOLLOW 0x100 /* Do not follow symbolic links. */
# define AT_REMOVEDIR 0x200 /* Remove directory instead of
unlinking file. */
# define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic links. */
# ifdef __USE_GNU
# define AT_NO_AUTOMOUNT 0x800 /* Suppress terminal automount
traversal. */
# define AT_EMPTY_PATH 0x1000 /* Allow empty relative pathname. */
# define AT_STATX_SYNC_TYPE 0x6000
# define AT_STATX_SYNC_AS_STAT 0x0000
# define AT_STATX_FORCE_SYNC 0x2000
# define AT_STATX_DONT_SYNC 0x4000
# define AT_RECURSIVE 0x8000 /* Apply to the entire subtree. */
# endif
# define AT_EACCESS 0x200 /* Test access permitted for
effective IDs, not real IDs. */
#endif
/* fcntl was a simple symbol until glibc 2.27 inclusive. glibc 2.28 onwards
* re-defines it to fcntl64 (via #define) if _FILE_OFFSET_BITS == 64. */
#if (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 28) || __GLIBC__ > 2
/* Do the file control operation described by CMD on FD.
The remaining arguments are interpreted depending on CMD.
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_TIME_BITS64
# ifndef __USE_FILE_OFFSET64
extern int fcntl (int __fd, int __cmd, ...);
# else
# ifdef __REDIRECT
extern int __REDIRECT (fcntl, (int __fd, int __cmd, ...), fcntl64);
# else
# define fcntl fcntl64
# endif
# endif
# ifdef __USE_LARGEFILE64
extern int fcntl64 (int __fd, int __cmd, ...);
# endif
#else /* __USE_TIME_BITS64 */
# ifdef __REDIRECT
extern int __REDIRECT_NTH (fcntl, (int __fd, int __request, ...),
__fcntl_time64);
extern int __REDIRECT_NTH (fcntl64, (int __fd, int __request, ...),
__fcntl_time64);
# else
extern int __fcntl_time64 (int __fd, int __request, ...) __THROW;
# define fcntl64 __fcntl_time64
# define fcntl __fcntl_time64
# endif
#endif
#else /* glibc 2.27 or lower */
extern int fcntl (int __fd, int __cmd, ...);
#endif
/* Open FILE and return a new file descriptor for it, or -1 on error.
OFLAG determines the type of access used. If O_CREAT or O_TMPFILE is set
in OFLAG, the third argument is taken as a `mode_t', the mode of the
created file.
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_FILE_OFFSET64
extern int open (const char *__file, int __oflag, ...) __nonnull ((1));
#else
# ifdef __REDIRECT
extern int __REDIRECT (open, (const char *__file, int __oflag, ...), open64)
__nonnull ((1));
# else
# define open open64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int open64 (const char *__file, int __oflag, ...) __nonnull ((1));
#endif
#ifdef __USE_ATFILE
/* Similar to `open' but a relative path name is interpreted relative to
the directory for which FD is a descriptor.
NOTE: some other `openat' implementation support additional functionality
through this interface, especially using the O_XATTR flag. This is not
yet supported here.
This function is a cancellation point and therefore not marked with
__THROW. */
# ifndef __USE_FILE_OFFSET64
extern int openat (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
# else
# ifdef __REDIRECT
extern int __REDIRECT (openat, (int __fd, const char *__file, int __oflag,
...), openat64) __nonnull ((2));
# else
# define openat openat64
# endif
# endif
# ifdef __USE_LARGEFILE64
extern int openat64 (int __fd, const char *__file, int __oflag, ...)
__nonnull ((2));
# endif
#endif
/* Create and open FILE, with mode MODE. This takes an `int' MODE
argument because that is what `mode_t' will be widened to.
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_FILE_OFFSET64
extern int creat (const char *__file, mode_t __mode) __nonnull ((1));
#else
# ifdef __REDIRECT
extern int __REDIRECT (creat, (const char *__file, mode_t __mode),
creat64) __nonnull ((1));
# else
# define creat creat64
# endif
#endif
#ifdef __USE_LARGEFILE64
extern int creat64 (const char *__file, mode_t __mode) __nonnull ((1));
#endif
#if !defined F_LOCK && (defined __USE_MISC || (defined __USE_XOPEN_EXTENDED \
&& !defined __USE_POSIX))
/* NOTE: These declarations also appear in <unistd.h>; be sure to keep both
files consistent. Some systems have them there and some here, and some
software depends on the macros being defined without including both. */
/* `lockf' is a simpler interface to the locking facilities of `fcntl'.
LEN is always relative to the current file position.
The CMD argument is one of the following. */
# define F_ULOCK 0 /* Unlock a previously locked region. */
# define F_LOCK 1 /* Lock a region for exclusive use. */
# define F_TLOCK 2 /* Test and lock a region for exclusive use. */
# define F_TEST 3 /* Test a region for other processes locks. */
# ifndef __USE_FILE_OFFSET64
extern int lockf (int __fd, int __cmd, off_t __len);
# else
# ifdef __REDIRECT
extern int __REDIRECT (lockf, (int __fd, int __cmd, __off64_t __len), lockf64);
# else
# define lockf lockf64
# endif
# endif
# ifdef __USE_LARGEFILE64
extern int lockf64 (int __fd, int __cmd, off64_t __len);
# endif
#endif
#ifdef __USE_XOPEN2K
/* Advice the system about the expected behaviour of the application with
respect to the file associated with FD. */
# ifndef __USE_FILE_OFFSET64
extern int posix_fadvise (int __fd, off_t __offset, off_t __len,
int __advise) __THROW;
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (posix_fadvise, (int __fd, __off64_t __offset,
__off64_t __len, int __advise),
posix_fadvise64);
# else
# define posix_fadvise posix_fadvise64
# endif
# endif
# ifdef __USE_LARGEFILE64
extern int posix_fadvise64 (int __fd, off64_t __offset, off64_t __len,
int __advise) __THROW;
# endif
/* Reserve storage for the data of the file associated with FD.
This function is a possible cancellation point and therefore not
marked with __THROW. */
# ifndef __USE_FILE_OFFSET64
extern int posix_fallocate (int __fd, off_t __offset, off_t __len);
# else
# ifdef __REDIRECT
extern int __REDIRECT (posix_fallocate, (int __fd, __off64_t __offset,
__off64_t __len),
posix_fallocate64);
# else
# define posix_fallocate posix_fallocate64
# endif
# endif
# ifdef __USE_LARGEFILE64
extern int posix_fallocate64 (int __fd, off64_t __offset, off64_t __len);
# endif
#endif
/* Define some inlines helping to catch common problems. */
#if __USE_FORTIFY_LEVEL > 0 && defined __fortify_function \
&& defined __va_arg_pack_len
# include <bits/fcntl2.h>
#endif
__END_DECLS
#endif /* fcntl.h */

View File

@ -1,55 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef fstat
#undef __fstat
int
attribute_hidden
__fstat (int fd, struct stat *buf)
{
return __fxstat (_STAT_VER, fd, buf);
}
weak_hidden_alias (__fstat, fstat)

View File

@ -1,52 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef fstat64
int
attribute_hidden
fstat64 (int fd, struct stat64 *buf)
{
return __fxstat64 (_STAT_VER, fd, buf);
}

View File

@ -1,52 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef fstatat
int
attribute_hidden
fstatat (int fd, const char *file, struct stat *buf, int flag)
{
return __fxstatat (_STAT_VER, fd, file, buf, flag);
}

View File

@ -1,52 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef fstatat64
int
attribute_hidden
fstatat64 (int fd, const char *file, struct stat64 *buf, int flag)
{
return __fxstatat64 (_STAT_VER, fd, file, buf, flag);
}

View File

@ -1,55 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef lstat
#undef __lstat
int
attribute_hidden
__lstat (const char *file, struct stat *buf)
{
return __lxstat (_STAT_VER, file, buf);
}
weak_hidden_alias (__lstat, lstat)

View File

@ -1,52 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef lstat64
int
attribute_hidden
lstat64 (const char *file, struct stat64 *buf)
{
return __lxstat64 (_STAT_VER, file, buf);
}

View File

@ -1,55 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/types.h>
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
int
attribute_hidden
__mknod (const char *path, mode_t mode, dev_t dev)
{
return __xmknod (_MKNOD_VER, path, mode, &dev);
}
weak_hidden_alias (__mknod, mknod)

View File

@ -1,27 +0,0 @@
/* Copyright (C) 1995-2023 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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
#include <fcntl.h>
int
__mknod (const char *path, mode_t mode, dev_t dev)
{
return __mknodat (AT_FDCWD, path, mode, dev);
}
libc_hidden_def (__mknod)
weak_alias (__mknod, mknod)

View File

@ -1,53 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/types.h>
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
int
attribute_hidden
mknodat (int fd, const char *path, mode_t mode, dev_t dev)
{
return __xmknodat (_MKNOD_VER, fd, path, mode, &dev);
}

View File

@ -1,54 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef stat
int
attribute_hidden
__stat (const char *file, struct stat *buf)
{
return __xstat (_STAT_VER, file, buf);
}
weak_hidden_alias (__stat, stat)

View File

@ -1,52 +0,0 @@
/* 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
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.
In addition to the permissions in the GNU Lesser General Public
License, the Free Software Foundation gives you unlimited
permission to link the compiled version of this file with other
programs, and to distribute those programs without any restriction
coming from the use of this file. (The GNU Lesser General Public
License restrictions do apply in other respects; for example, they
cover modification of the file, and distribution when not linked
into another program.)
Note that people who make modified versions of this file are not
obligated to grant this special exception for their modified
versions; it is their choice whether to do so. The GNU Lesser
General Public License gives permission to release a modified
version without this exception; this exception also makes it
possible to release a modified version which carries forward this
exception.
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
<https://www.gnu.org/licenses/>. */
#include <sys/stat.h>
/* This definition is only used if inlining fails for this function; see
the last page of <sys/stat.h>. The real work is done by the `x'
function which is passed a version number argument. We arrange in the
makefile that when not inlined this function is always statically
linked; that way a dynamically-linked executable always encodes the
version number corresponding to the data structures it uses, so the `x'
functions in the shared library can adapt without needing to recompile
all callers. */
#undef stat64
int
attribute_hidden
stat64 (const char *file, struct stat64 *buf)
{
return __xstat64 (_STAT_VER, file, buf);
}

View File

@ -1,471 +0,0 @@
/* Copyright (C) 1991-2023 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
<https://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 5.6 File Characteristics <sys/stat.h>
*/
#ifndef _SYS_STAT_H
#define _SYS_STAT_H 1
#include <features.h>
#include <bits/types.h> /* For __mode_t and __dev_t. */
#ifdef __USE_XOPEN2K8
# include <bits/types/struct_timespec.h>
#endif
#if defined __USE_XOPEN || defined __USE_XOPEN2K
/* The Single Unix specification says that some more types are
available here. */
# include <bits/types/time_t.h>
# ifndef __dev_t_defined
typedef __dev_t dev_t;
# define __dev_t_defined
# endif
# ifndef __gid_t_defined
typedef __gid_t gid_t;
# define __gid_t_defined
# endif
# ifndef __ino_t_defined
# ifndef __USE_FILE_OFFSET64
typedef __ino_t ino_t;
# else
typedef __ino64_t ino_t;
# endif
# define __ino_t_defined
# endif
# ifndef __mode_t_defined
typedef __mode_t mode_t;
# define __mode_t_defined
# endif
# ifndef __nlink_t_defined
typedef __nlink_t nlink_t;
# define __nlink_t_defined
# endif
# ifndef __off_t_defined
# ifndef __USE_FILE_OFFSET64
typedef __off_t off_t;
# else
typedef __off64_t off_t;
# endif
# define __off_t_defined
# endif
# ifndef __uid_t_defined
typedef __uid_t uid_t;
# define __uid_t_defined
# endif
#endif /* X/Open */
#ifdef __USE_UNIX98
# ifndef __blkcnt_t_defined
# ifndef __USE_FILE_OFFSET64
typedef __blkcnt_t blkcnt_t;
# else
typedef __blkcnt64_t blkcnt_t;
# endif
# define __blkcnt_t_defined
# endif
# ifndef __blksize_t_defined
typedef __blksize_t blksize_t;
# define __blksize_t_defined
# endif
#endif /* Unix98 */
__BEGIN_DECLS
#include <bits/stat.h>
#if defined __USE_MISC || defined __USE_XOPEN
# define S_IFMT __S_IFMT
# define S_IFDIR __S_IFDIR
# define S_IFCHR __S_IFCHR
# define S_IFBLK __S_IFBLK
# define S_IFREG __S_IFREG
# ifdef __S_IFIFO
# define S_IFIFO __S_IFIFO
# endif
# ifdef __S_IFLNK
# define S_IFLNK __S_IFLNK
# endif
# if (defined __USE_MISC || defined __USE_XOPEN_EXTENDED) \
&& defined __S_IFSOCK
# define S_IFSOCK __S_IFSOCK
# endif
#endif
/* Test macros for file types. */
#define __S_ISTYPE(mode, mask) (((mode) & __S_IFMT) == (mask))
#define S_ISDIR(mode) __S_ISTYPE((mode), __S_IFDIR)
#define S_ISCHR(mode) __S_ISTYPE((mode), __S_IFCHR)
#define S_ISBLK(mode) __S_ISTYPE((mode), __S_IFBLK)
#define S_ISREG(mode) __S_ISTYPE((mode), __S_IFREG)
#ifdef __S_IFIFO
# define S_ISFIFO(mode) __S_ISTYPE((mode), __S_IFIFO)
#endif
#ifdef __S_IFLNK
# define S_ISLNK(mode) __S_ISTYPE((mode), __S_IFLNK)
#endif
#if defined __USE_MISC && !defined __S_IFLNK
# define S_ISLNK(mode) 0
#endif
#if (defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K) \
&& defined __S_IFSOCK
# define S_ISSOCK(mode) __S_ISTYPE((mode), __S_IFSOCK)
#elif defined __USE_XOPEN2K
# define S_ISSOCK(mode) 0
#endif
/* These are from POSIX.1b. If the objects are not implemented using separate
distinct file types, the macros always will evaluate to zero. Unlike the
other S_* macros the following three take a pointer to a `struct stat'
object as the argument. */
#ifdef __USE_POSIX199309
# define S_TYPEISMQ(buf) __S_TYPEISMQ(buf)
# define S_TYPEISSEM(buf) __S_TYPEISSEM(buf)
# define S_TYPEISSHM(buf) __S_TYPEISSHM(buf)
#endif
/* Protection bits. */
#define S_ISUID __S_ISUID /* Set user ID on execution. */
#define S_ISGID __S_ISGID /* Set group ID on execution. */
#if defined __USE_MISC || defined __USE_XOPEN
/* Save swapped text after use (sticky bit). This is pretty well obsolete. */
# define S_ISVTX __S_ISVTX
#endif
#define S_IRUSR __S_IREAD /* Read by owner. */
#define S_IWUSR __S_IWRITE /* Write by owner. */
#define S_IXUSR __S_IEXEC /* Execute by owner. */
/* Read, write, and execute by owner. */
#define S_IRWXU (__S_IREAD|__S_IWRITE|__S_IEXEC)
#ifdef __USE_MISC
# define S_IREAD S_IRUSR
# define S_IWRITE S_IWUSR
# define S_IEXEC S_IXUSR
#endif
#define S_IRGRP (S_IRUSR >> 3) /* Read by group. */
#define S_IWGRP (S_IWUSR >> 3) /* Write by group. */
#define S_IXGRP (S_IXUSR >> 3) /* Execute by group. */
/* Read, write, and execute by group. */
#define S_IRWXG (S_IRWXU >> 3)
#define S_IROTH (S_IRGRP >> 3) /* Read by others. */
#define S_IWOTH (S_IWGRP >> 3) /* Write by others. */
#define S_IXOTH (S_IXGRP >> 3) /* Execute by others. */
/* Read, write, and execute by others. */
#define S_IRWXO (S_IRWXG >> 3)
#ifdef __USE_MISC
/* Macros for common mode bit masks. */
# define ACCESSPERMS (S_IRWXU|S_IRWXG|S_IRWXO) /* 0777 */
# define ALLPERMS (S_ISUID|S_ISGID|S_ISVTX|S_IRWXU|S_IRWXG|S_IRWXO)/* 07777 */
# define DEFFILEMODE (S_IRUSR|S_IWUSR|S_IRGRP|S_IWGRP|S_IROTH|S_IWOTH)/* 0666*/
# define S_BLKSIZE 512 /* Block size for `st_blocks'. */
#endif
#ifndef __USE_FILE_OFFSET64
/* Get file attributes for FILE and put them in BUF. */
extern int stat (const char *__restrict __file,
struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
/* Get file attributes for the file, device, pipe, or socket
that file descriptor FD is open on and put them in BUF. */
extern int fstat (int __fd, struct stat *__buf) __THROW __nonnull ((2));
#else
# ifdef __USE_TIME_BITS64
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
struct stat *__restrict __buf),
__stat64_time64)
__nonnull ((1, 2));
extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf),
__fstat64_time64)
__nonnull ((2));
# else
# define stat __stat64_time64
# define fstat __fstat64_time64
# endif
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (stat, (const char *__restrict __file,
struct stat *__restrict __buf), stat64)
__nonnull ((1, 2));
extern int __REDIRECT_NTH (fstat, (int __fd, struct stat *__buf), fstat64)
__nonnull ((2));
# else
# define stat stat64
# define fstat fstat64
# endif
# endif
#endif
#ifdef __USE_LARGEFILE64
# ifndef __USE_TIME_BITS64
extern int stat64 (const char *__restrict __file,
struct stat64 *__restrict __buf) __THROW __nonnull ((1, 2));
extern int fstat64 (int __fd, struct stat64 *__buf) __THROW __nonnull ((2));
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (stat64, (const char *__restrict __file,
struct stat64 *__restrict __buf),
__stat64_time64)
__nonnull ((1, 2));
extern int __REDIRECT_NTH (fstat64, (int __fd, struct stat64 *__buf),
__fstat64_time64)
__nonnull ((2));
# else
# define stat64 __stat64_time64
# define fstat64 __fstat64_time
# endif
# endif
#endif
#ifdef __USE_ATFILE
/* Similar to stat, get the attributes for FILE and put them in BUF.
Relative path names are interpreted relative to FD unless FD is
AT_FDCWD. */
# ifndef __USE_FILE_OFFSET64
extern int fstatat (int __fd, const char *__restrict __file,
struct stat *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
# else
# ifdef __USE_TIME_BITS64
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
struct stat *__restrict __buf,
int __flag),
__fstatat64_time64) __nonnull ((2, 3));
# else
# define fstatat __fstatat64_time64
# endif
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (fstatat, (int __fd, const char *__restrict __file,
struct stat *__restrict __buf,
int __flag),
fstatat64) __nonnull ((2, 3));
# else
# define fstatat fstatat64
# endif
# endif
# endif
# ifdef __USE_LARGEFILE64
# ifndef __USE_TIME_BITS64
extern int fstatat64 (int __fd, const char *__restrict __file,
struct stat64 *__restrict __buf, int __flag)
__THROW __nonnull ((2, 3));
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (fstatat64, (int __fd,
const char *__restrict __file,
struct stat64 *__restrict __buf,
int __flag),
__fstatat64_time64)
__nonnull ((2, 3));
# else
# define fstatat64 __fstatat64_time64
# endif
# endif
# endif
#endif
#if defined __USE_XOPEN_EXTENDED || defined __USE_XOPEN2K
# ifndef __USE_FILE_OFFSET64
/* Get file attributes about FILE and put them in BUF.
If FILE is a symbolic link, do not follow it. */
extern int lstat (const char *__restrict __file,
struct stat *__restrict __buf) __THROW __nonnull ((1, 2));
# else
# ifdef __USE_TIME_BITS64
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (lstat,
(const char *__restrict __file,
struct stat *__restrict __buf), __lstat64_time64)
__nonnull ((1, 2));
# else
# define lstat __lstat64_time64
# endif
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (lstat,
(const char *__restrict __file,
struct stat *__restrict __buf), lstat64)
__nonnull ((1, 2));
# else
# define lstat lstat64
# endif
# endif
# endif
# ifdef __USE_LARGEFILE64
# ifndef __USE_TIME_BITS64
extern int lstat64 (const char *__restrict __file,
struct stat64 *__restrict __buf)
__THROW __nonnull ((1, 2));
# else
extern int __REDIRECT_NTH (lstat64, (const char *__restrict __file,
struct stat64 *__restrict __buf),
__lstat64_time64)
__nonnull ((1, 2));
# endif
# endif
#endif
/* Set file access permissions for FILE to MODE.
If FILE is a symbolic link, this affects its target instead. */
extern int chmod (const char *__file, __mode_t __mode)
__THROW __nonnull ((1));
#ifdef __USE_MISC
/* Set file access permissions for FILE to MODE.
If FILE is a symbolic link, this affects the link itself
rather than its target. */
extern int lchmod (const char *__file, __mode_t __mode)
__THROW __nonnull ((1));
#endif
/* Set file access permissions of the file FD is open on to MODE. */
#if defined __USE_POSIX199309 || defined __USE_XOPEN_EXTENDED
extern int fchmod (int __fd, __mode_t __mode) __THROW;
#endif
#ifdef __USE_ATFILE
/* Set file access permissions of FILE relative to
the directory FD is open on. */
extern int fchmodat (int __fd, const char *__file, __mode_t __mode,
int __flag)
__THROW __nonnull ((2)) __wur;
#endif /* Use ATFILE. */
/* Set the file creation mask of the current process to MASK,
and return the old creation mask. */
extern __mode_t umask (__mode_t __mask) __THROW;
#ifdef __USE_GNU
/* Get the current `umask' value without changing it.
This function is only available under the GNU Hurd. */
extern __mode_t getumask (void) __THROW;
#endif
/* Create a new directory named PATH, with permission bits MODE. */
extern int mkdir (const char *__path, __mode_t __mode)
__THROW __nonnull ((1));
#ifdef __USE_ATFILE
/* Like mkdir, create a new directory with permission bits MODE. But
interpret relative PATH names relative to the directory associated
with FD. */
extern int mkdirat (int __fd, const char *__path, __mode_t __mode)
__THROW __nonnull ((2));
#endif
/* Create a device file named PATH, with permission and special bits MODE
and device number DEV (which can be constructed from major and minor
device numbers with the `makedev' macro above). */
#if defined __USE_MISC || defined __USE_XOPEN_EXTENDED
extern int mknod (const char *__path, __mode_t __mode, __dev_t __dev)
__THROW __nonnull ((1));
# ifdef __USE_ATFILE
/* Like mknod, create a new device file with permission bits MODE and
device number DEV. But interpret relative PATH names relative to
the directory associated with FD. */
extern int mknodat (int __fd, const char *__path, __mode_t __mode,
__dev_t __dev) __THROW __nonnull ((2));
# endif
#endif
/* Create a new FIFO named PATH, with permission bits MODE. */
extern int mkfifo (const char *__path, __mode_t __mode)
__THROW __nonnull ((1));
#ifdef __USE_ATFILE
/* Like mkfifo, create a new FIFO with permission bits MODE. But
interpret relative PATH names relative to the directory associated
with FD. */
extern int mkfifoat (int __fd, const char *__path, __mode_t __mode)
__THROW __nonnull ((2));
#endif
#ifdef __USE_ATFILE
# ifndef __USE_TIME_BITS64
/* Set file access and modification times relative to directory file
descriptor. */
extern int utimensat (int __fd, const char *__path,
const struct timespec __times[2],
int __flags)
__THROW __nonnull ((2));
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (utimensat, (int fd, const char *__path,
const struct timespec __times[2],
int flags),
__utimensat64) __nonnull ((2));
# else
# define utimensat __utimensat64
# endif
# endif
#endif
#ifdef __USE_XOPEN2K8
# ifndef __USE_TIME_BITS64
/* Set file access and modification times of the file associated with FD. */
extern int futimens (int __fd, const struct timespec __times[2]) __THROW;
# else
# ifdef __REDIRECT_NTH
extern int __REDIRECT_NTH (futimens, (int fd, const struct timespec __times[2]),
__futimens64);
# else
# define futimens __futimens64
# endif
# endif
#endif
#ifdef __USE_GNU
# include <bits/statx.h>
#endif
__END_DECLS
#endif /* sys/stat.h */

View File

@ -1,43 +0,0 @@
/* Definition of struct __locale_struct and __locale_t.
Copyright (C) 1997-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_TYPES___LOCALE_T_H
#define _BITS_TYPES___LOCALE_T_H 1
/* POSIX.1-2008: the locale_t type, representing a locale context
(implementation-namespace version). This type should be treated
as opaque by applications; some details are exposed for the sake of
efficiency in e.g. ctype functions. */
struct __locale_struct
{
/* Note: LC_ALL is not a valid index into this array. */
struct __locale_data *__locales[13]; /* 13 = __LC_LAST. */
/* To increase the speed of this solution we add some special members. */
const unsigned short int *__ctype_b;
const int *__ctype_tolower;
const int *__ctype_toupper;
/* Note: LC_ALL is not a valid index into this array. */
const char *__names[13];
};
typedef struct __locale_struct *__locale_t;
#endif /* bits/types/__locale_t.h */

View File

@ -1,26 +0,0 @@
/* Definition of locale_t.
Copyright (C) 2017-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_TYPES_LOCALE_T_H
#define _BITS_TYPES_LOCALE_T_H 1
#include <bits/types/__locale_t.h>
typedef __locale_t locale_t;
#endif /* bits/types/locale_t.h */

View File

@ -1,723 +0,0 @@
/* Copyright (C) 1992-2023 Free Software Foundation, Inc.
Copyright The GNU Toolchain Authors.
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
<https://www.gnu.org/licenses/>. */
#ifndef _SYS_CDEFS_H
#define _SYS_CDEFS_H 1
/* We are almost always included from features.h. */
#ifndef _FEATURES_H
# include <features.h>
#endif
/* The GNU libc does not support any K&R compilers or the traditional mode
of ISO C compilers anymore. Check for some of the combinations not
supported anymore. */
#if defined __GNUC__ && !defined __STDC__ && !defined __cplusplus
# error "You need a ISO C or C++ conforming compiler to use the glibc headers"
#endif
/* Some user header file might have defined this before. */
#undef __P
#undef __PMT
/* Compilers that lack __has_attribute may object to
#if defined __has_attribute && __has_attribute (...)
even though they do not need to evaluate the right-hand side of the &&.
Similarly for __has_builtin, etc. */
#if (defined __has_attribute \
&& (!defined __clang_minor__ \
|| 3 < __clang_major__ + (5 <= __clang_minor__)))
# define __glibc_has_attribute(attr) __has_attribute (attr)
#else
# define __glibc_has_attribute(attr) 0
#endif
#ifdef __has_builtin
# define __glibc_has_builtin(name) __has_builtin (name)
#else
# define __glibc_has_builtin(name) 0
#endif
#ifdef __has_extension
# define __glibc_has_extension(ext) __has_extension (ext)
#else
# define __glibc_has_extension(ext) 0
#endif
#if defined __GNUC__ || defined __clang__
/* All functions, except those with callbacks or those that
synchronize memory, are leaf functions. */
# if __GNUC_PREREQ (4, 6) && !defined _LIBC
# define __LEAF , __leaf__
# define __LEAF_ATTR __attribute__ ((__leaf__))
# else
# define __LEAF
# define __LEAF_ATTR
# endif
/* GCC can always grok prototypes. For C++ programs we add throw()
to help it optimize the function calls. But this only works with
gcc 2.8.x and egcs. For gcc 3.4 and up we even mark C functions
as non-throwing using a function attribute since programs can use
the -fexceptions options for C code as well. */
# if !defined __cplusplus \
&& (__GNUC_PREREQ (3, 4) || __glibc_has_attribute (__nothrow__))
# define __THROW __attribute__ ((__nothrow__ __LEAF))
# define __THROWNL __attribute__ ((__nothrow__))
# define __NTH(fct) __attribute__ ((__nothrow__ __LEAF)) fct
# define __NTHNL(fct) __attribute__ ((__nothrow__)) fct
# else
# if defined __cplusplus && (__GNUC_PREREQ (2,8) || __clang_major__ >= 4)
# if __cplusplus >= 201103L
# define __THROW noexcept (true)
# else
# define __THROW throw ()
# endif
# define __THROWNL __THROW
# define __NTH(fct) __LEAF_ATTR fct __THROW
# define __NTHNL(fct) fct __THROW
# else
# define __THROW
# define __THROWNL
# define __NTH(fct) fct
# define __NTHNL(fct) fct
# endif
# endif
# if __GNUC_PREREQ (4, 3) || __glibc_has_attribute (__cold__)
# define __COLD __attribute__ ((__cold__))
# else
# define __COLD
# endif
#else /* Not GCC or clang. */
# if (defined __cplusplus \
|| (defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L))
# define __inline inline
# else
# define __inline /* No inline functions. */
# endif
# define __THROW
# define __THROWNL
# define __NTH(fct) fct
# define __COLD
#endif /* GCC || clang. */
/* These two macros are not used in glibc anymore. They are kept here
only because some other projects expect the macros to be defined. */
#define __P(args) args
#define __PMT(args) args
/* For these things, GCC behaves the ANSI way normally,
and the non-ANSI way under -traditional. */
#define __CONCAT(x,y) x ## y
#define __STRING(x) #x
/* This is not a typedef so `const __ptr_t' does the right thing. */
#define __ptr_t void *
/* C++ needs to know that types and declarations are C, not C++. */
#ifdef __cplusplus
# define __BEGIN_DECLS extern "C" {
# define __END_DECLS }
#else
# define __BEGIN_DECLS
# define __END_DECLS
#endif
/* Fortify support. */
#define __bos(ptr) __builtin_object_size (ptr, __USE_FORTIFY_LEVEL > 1)
#define __bos0(ptr) __builtin_object_size (ptr, 0)
/* Use __builtin_dynamic_object_size at _FORTIFY_SOURCE=3 when available. */
#if __USE_FORTIFY_LEVEL == 3 && (__glibc_clang_prereq (9, 0) \
|| __GNUC_PREREQ (12, 0))
# define __glibc_objsize0(__o) __builtin_dynamic_object_size (__o, 0)
# define __glibc_objsize(__o) __builtin_dynamic_object_size (__o, 1)
#else
# define __glibc_objsize0(__o) __bos0 (__o)
# define __glibc_objsize(__o) __bos (__o)
#endif
#if __USE_FORTIFY_LEVEL > 0
/* Compile time conditions to choose between the regular, _chk and _chk_warn
variants. These conditions should get evaluated to constant and optimized
away. */
#define __glibc_safe_len_cond(__l, __s, __osz) ((__l) <= (__osz) / (__s))
#define __glibc_unsigned_or_positive(__l) \
((__typeof (__l)) 0 < (__typeof (__l)) -1 \
|| (__builtin_constant_p (__l) && (__l) > 0))
/* Length is known to be safe at compile time if the __L * __S <= __OBJSZ
condition can be folded to a constant and if it is true, or unknown (-1) */
#define __glibc_safe_or_unknown_len(__l, __s, __osz) \
((__builtin_constant_p (__osz) && (__osz) == (__SIZE_TYPE__) -1) \
|| (__glibc_unsigned_or_positive (__l) \
&& __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
(__s), (__osz))) \
&& __glibc_safe_len_cond ((__SIZE_TYPE__) (__l), (__s), (__osz))))
/* Conversely, we know at compile time that the length is unsafe if the
__L * __S <= __OBJSZ condition can be folded to a constant and if it is
false. */
#define __glibc_unsafe_len(__l, __s, __osz) \
(__glibc_unsigned_or_positive (__l) \
&& __builtin_constant_p (__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), \
__s, __osz)) \
&& !__glibc_safe_len_cond ((__SIZE_TYPE__) (__l), __s, __osz))
/* Fortify function f. __f_alias, __f_chk and __f_chk_warn must be
declared. */
#define __glibc_fortify(f, __l, __s, __osz, ...) \
(__glibc_safe_or_unknown_len (__l, __s, __osz) \
? __ ## f ## _alias (__VA_ARGS__) \
: (__glibc_unsafe_len (__l, __s, __osz) \
? __ ## f ## _chk_warn (__VA_ARGS__, __osz) \
: __ ## f ## _chk (__VA_ARGS__, __osz)))
/* Fortify function f, where object size argument passed to f is the number of
elements and not total size. */
#define __glibc_fortify_n(f, __l, __s, __osz, ...) \
(__glibc_safe_or_unknown_len (__l, __s, __osz) \
? __ ## f ## _alias (__VA_ARGS__) \
: (__glibc_unsafe_len (__l, __s, __osz) \
? __ ## f ## _chk_warn (__VA_ARGS__, (__osz) / (__s)) \
: __ ## f ## _chk (__VA_ARGS__, (__osz) / (__s))))
#endif
#if __GNUC_PREREQ (4,3)
# define __warnattr(msg) __attribute__((__warning__ (msg)))
# define __errordecl(name, msg) \
extern void name (void) __attribute__((__error__ (msg)))
#else
# define __warnattr(msg)
# define __errordecl(name, msg) extern void name (void)
#endif
/* Support for flexible arrays.
Headers that should use flexible arrays only if they're "real"
(e.g. only if they won't affect sizeof()) should test
#if __glibc_c99_flexarr_available. */
#if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L && !defined __HP_cc
# define __flexarr []
# define __glibc_c99_flexarr_available 1
#elif __GNUC_PREREQ (2,97) || defined __clang__
/* GCC 2.97 and clang support C99 flexible array members as an extension,
even when in C89 mode or compiling C++ (any version). */
# define __flexarr []
# define __glibc_c99_flexarr_available 1
#elif defined __GNUC__
/* Pre-2.97 GCC did not support C99 flexible arrays but did have
an equivalent extension with slightly different notation. */
# define __flexarr [0]
# define __glibc_c99_flexarr_available 1
#else
/* Some other non-C99 compiler. Approximate with [1]. */
# define __flexarr [1]
# define __glibc_c99_flexarr_available 0
#endif
/* __asm__ ("xyz") is used throughout the headers to rename functions
at the assembly language level. This is wrapped by the __REDIRECT
macro, in order to support compilers that can do this some other
way. When compilers don't support asm-names at all, we have to do
preprocessor tricks instead (which don't have exactly the right
semantics, but it's the best we can do).
Example:
int __REDIRECT(setpgrp, (__pid_t pid, __pid_t pgrp), setpgid); */
#if (defined __GNUC__ && __GNUC__ >= 2) || (__clang_major__ >= 4)
# define __REDIRECT(name, proto, alias) name proto __asm__ (__ASMNAME (#alias))
# ifdef __cplusplus
# define __REDIRECT_NTH(name, proto, alias) \
name proto __THROW __asm__ (__ASMNAME (#alias))
# define __REDIRECT_NTHNL(name, proto, alias) \
name proto __THROWNL __asm__ (__ASMNAME (#alias))
# else
# define __REDIRECT_NTH(name, proto, alias) \
name proto __asm__ (__ASMNAME (#alias)) __THROW
# define __REDIRECT_NTHNL(name, proto, alias) \
name proto __asm__ (__ASMNAME (#alias)) __THROWNL
# endif
# define __ASMNAME(cname) __ASMNAME2 (__USER_LABEL_PREFIX__, cname)
# define __ASMNAME2(prefix, cname) __STRING (prefix) cname
#ifndef __REDIRECT_FORTIFY
#define __REDIRECT_FORTIFY __REDIRECT
#endif
#ifndef __REDIRECT_FORTIFY_NTH
#define __REDIRECT_FORTIFY_NTH __REDIRECT_NTH
#endif
/*
#elif __SOME_OTHER_COMPILER__
# define __REDIRECT(name, proto, alias) name proto; \
_Pragma("let " #name " = " #alias)
*/
#endif
/* GCC and clang have various useful declarations that can be made with
the '__attribute__' syntax. All of the ways we use this do fine if
they are omitted for compilers that don't understand it. */
#if !(defined __GNUC__ || defined __clang__)
# define __attribute__(xyz) /* Ignore */
#endif
/* At some point during the gcc 2.96 development the `malloc' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */
#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__malloc__)
# define __attribute_malloc__ __attribute__ ((__malloc__))
#else
# define __attribute_malloc__ /* Ignore */
#endif
/* Tell the compiler which arguments to an allocation function
indicate the size of the allocation. */
#if __GNUC_PREREQ (4, 3)
# define __attribute_alloc_size__(params) \
__attribute__ ((__alloc_size__ params))
#else
# define __attribute_alloc_size__(params) /* Ignore. */
#endif
/* Tell the compiler which argument to an allocation function
indicates the alignment of the allocation. */
#if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__alloc_align__)
# define __attribute_alloc_align__(param) \
__attribute__ ((__alloc_align__ param))
#else
# define __attribute_alloc_align__(param) /* Ignore. */
#endif
/* At some point during the gcc 2.96 development the `pure' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */
#if __GNUC_PREREQ (2,96) || __glibc_has_attribute (__pure__)
# define __attribute_pure__ __attribute__ ((__pure__))
#else
# define __attribute_pure__ /* Ignore */
#endif
/* This declaration tells the compiler that the value is constant. */
#if __GNUC_PREREQ (2,5) || __glibc_has_attribute (__const__)
# define __attribute_const__ __attribute__ ((__const__))
#else
# define __attribute_const__ /* Ignore */
#endif
#if __GNUC_PREREQ (2,7) || __glibc_has_attribute (__unused__)
# define __attribute_maybe_unused__ __attribute__ ((__unused__))
#else
# define __attribute_maybe_unused__ /* Ignore */
#endif
/* At some point during the gcc 3.1 development the `used' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings. */
#if __GNUC_PREREQ (3,1) || __glibc_has_attribute (__used__)
# define __attribute_used__ __attribute__ ((__used__))
# define __attribute_noinline__ __attribute__ ((__noinline__))
#else
# define __attribute_used__ __attribute__ ((__unused__))
# define __attribute_noinline__ /* Ignore */
#endif
/* Since version 3.2, gcc allows marking deprecated functions. */
#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__deprecated__)
# define __attribute_deprecated__ __attribute__ ((__deprecated__))
#else
# define __attribute_deprecated__ /* Ignore */
#endif
/* Since version 4.5, gcc also allows one to specify the message printed
when a deprecated function is used. clang claims to be gcc 4.2, but
may also support this feature. */
#if __GNUC_PREREQ (4,5) \
|| __glibc_has_extension (__attribute_deprecated_with_message__)
# define __attribute_deprecated_msg__(msg) \
__attribute__ ((__deprecated__ (msg)))
#else
# define __attribute_deprecated_msg__(msg) __attribute_deprecated__
#endif
/* At some point during the gcc 2.8 development the `format_arg' attribute
for functions was introduced. We don't want to use it unconditionally
(although this would be possible) since it generates warnings.
If several `format_arg' attributes are given for the same function, in
gcc-3.0 and older, all but the last one are ignored. In newer gccs,
all designated arguments are considered. */
#if __GNUC_PREREQ (2,8) || __glibc_has_attribute (__format_arg__)
# define __attribute_format_arg__(x) __attribute__ ((__format_arg__ (x)))
#else
# define __attribute_format_arg__(x) /* Ignore */
#endif
/* At some point during the gcc 2.97 development the `strfmon' format
attribute for functions was introduced. We don't want to use it
unconditionally (although this would be possible) since it
generates warnings. */
#if __GNUC_PREREQ (2,97) || __glibc_has_attribute (__format__)
# define __attribute_format_strfmon__(a,b) \
__attribute__ ((__format__ (__strfmon__, a, b)))
#else
# define __attribute_format_strfmon__(a,b) /* Ignore */
#endif
/* The nonnull function attribute marks pointer parameters that
must not be NULL. This has the name __nonnull in glibc,
and __attribute_nonnull__ in files shared with Gnulib to avoid
collision with a different __nonnull in DragonFlyBSD 5.9. */
#ifndef __attribute_nonnull__
# if __GNUC_PREREQ (3,3) || __glibc_has_attribute (__nonnull__)
# define __attribute_nonnull__(params) __attribute__ ((__nonnull__ params))
# else
# define __attribute_nonnull__(params)
# endif
#endif
#ifndef __nonnull
# define __nonnull(params) __attribute_nonnull__ (params)
#endif
/* The returns_nonnull function attribute marks the return type of the function
as always being non-null. */
#ifndef __returns_nonnull
# if __GNUC_PREREQ (4, 9) || __glibc_has_attribute (__returns_nonnull__)
# define __returns_nonnull __attribute__ ((__returns_nonnull__))
# else
# define __returns_nonnull
# endif
#endif
/* If fortification mode, we warn about unused results of certain
function calls which can lead to problems. */
#if __GNUC_PREREQ (3,4) || __glibc_has_attribute (__warn_unused_result__)
# define __attribute_warn_unused_result__ \
__attribute__ ((__warn_unused_result__))
# if defined __USE_FORTIFY_LEVEL && __USE_FORTIFY_LEVEL > 0
# define __wur __attribute_warn_unused_result__
# endif
#else
# define __attribute_warn_unused_result__ /* empty */
#endif
#ifndef __wur
# define __wur /* Ignore */
#endif
/* Forces a function to be always inlined. */
#if __GNUC_PREREQ (3,2) || __glibc_has_attribute (__always_inline__)
/* The Linux kernel defines __always_inline in stddef.h (283d7573), and
it conflicts with this definition. Therefore undefine it first to
allow either header to be included first. */
# undef __always_inline
# define __always_inline __inline __attribute__ ((__always_inline__))
#else
# undef __always_inline
# define __always_inline __inline
#endif
/* Associate error messages with the source location of the call site rather
than with the source location inside the function. */
#if __GNUC_PREREQ (4,3) || __glibc_has_attribute (__artificial__)
# define __attribute_artificial__ __attribute__ ((__artificial__))
#else
# define __attribute_artificial__ /* Ignore */
#endif
/* GCC 4.3 and above with -std=c99 or -std=gnu99 implements ISO C99
inline semantics, unless -fgnu89-inline is used. Using __GNUC_STDC_INLINE__
or __GNUC_GNU_INLINE is not a good enough check for gcc because gcc versions
older than 4.3 may define these macros and still not guarantee GNU inlining
semantics.
clang++ identifies itself as gcc-4.2, but has support for GNU inlining
semantics, that can be checked for by using the __GNUC_STDC_INLINE_ and
__GNUC_GNU_INLINE__ macro definitions. */
#if (!defined __cplusplus || __GNUC_PREREQ (4,3) \
|| (defined __clang__ && (defined __GNUC_STDC_INLINE__ \
|| defined __GNUC_GNU_INLINE__)))
# if defined __GNUC_STDC_INLINE__ || defined __cplusplus
# define __extern_inline extern __inline __attribute__ ((__gnu_inline__))
# define __extern_always_inline \
extern __always_inline __attribute__ ((__gnu_inline__))
# else
# define __extern_inline extern __inline
# define __extern_always_inline extern __always_inline
# endif
#endif
#ifdef __extern_always_inline
# define __fortify_function __extern_always_inline __attribute_artificial__
#endif
/* GCC 4.3 and above allow passing all anonymous arguments of an
__extern_always_inline function to some other vararg function. */
#if __GNUC_PREREQ (4,3)
# define __va_arg_pack() __builtin_va_arg_pack ()
# define __va_arg_pack_len() __builtin_va_arg_pack_len ()
#endif
/* It is possible to compile containing GCC extensions even if GCC is
run in pedantic mode if the uses are carefully marked using the
`__extension__' keyword. But this is not generally available before
version 2.8. */
#if !(__GNUC_PREREQ (2,8) || defined __clang__)
# define __extension__ /* Ignore */
#endif
/* __restrict is known in EGCS 1.2 and above, and in clang.
It works also in C++ mode (outside of arrays), but only when spelled
as '__restrict', not 'restrict'. */
#if !(__GNUC_PREREQ (2,92) || __clang_major__ >= 3)
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __restrict restrict
# else
# define __restrict /* Ignore */
# endif
#endif
/* ISO C99 also allows to declare arrays as non-overlapping. The syntax is
array_name[restrict]
GCC 3.1 and clang support this.
This syntax is not usable in C++ mode. */
#if (__GNUC_PREREQ (3,1) || __clang_major__ >= 3) && !defined __cplusplus
# define __restrict_arr __restrict
#else
# ifdef __GNUC__
# define __restrict_arr /* Not supported in old GCC. */
# else
# if defined __STDC_VERSION__ && __STDC_VERSION__ >= 199901L
# define __restrict_arr restrict
# else
/* Some other non-C99 compiler. */
# define __restrict_arr /* Not supported. */
# endif
# endif
#endif
#if (__GNUC__ >= 3) || __glibc_has_builtin (__builtin_expect)
# define __glibc_unlikely(cond) __builtin_expect ((cond), 0)
# define __glibc_likely(cond) __builtin_expect ((cond), 1)
#else
# define __glibc_unlikely(cond) (cond)
# define __glibc_likely(cond) (cond)
#endif
#if (!defined _Noreturn \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
&& !(__GNUC_PREREQ (4,7) \
|| (3 < __clang_major__ + (5 <= __clang_minor__))))
# if __GNUC_PREREQ (2,8)
# define _Noreturn __attribute__ ((__noreturn__))
# else
# define _Noreturn
# endif
#endif
#if __GNUC_PREREQ (8, 0)
/* Describes a char array whose address can safely be passed as the first
argument to strncpy and strncat, as the char array is not necessarily
a NUL-terminated string. */
# define __attribute_nonstring__ __attribute__ ((__nonstring__))
#else
# define __attribute_nonstring__
#endif
/* Undefine (also defined in libc-symbols.h). */
#undef __attribute_copy__
#if __GNUC_PREREQ (9, 0)
/* Copies attributes from the declaration or type referenced by
the argument. */
# define __attribute_copy__(arg) __attribute__ ((__copy__ (arg)))
#else
# define __attribute_copy__(arg)
#endif
#if (!defined _Static_assert && !defined __cplusplus \
&& (defined __STDC_VERSION__ ? __STDC_VERSION__ : 0) < 201112 \
&& (!(__GNUC_PREREQ (4, 6) || __clang_major__ >= 4) \
|| defined __STRICT_ANSI__))
# define _Static_assert(expr, diagnostic) \
extern int (*__Static_assert_function (void)) \
[!!sizeof (struct { int __error_if_negative: (expr) ? 2 : -1; })]
#endif
/* Gnulib avoids including these, as they don't work on non-glibc or
older glibc platforms. */
#ifndef __GNULIB_CDEFS
# include <bits/wordsize.h>
# include <bits/long-double.h>
#endif
#if __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 1
# ifdef __REDIRECT
/* Alias name defined automatically. */
# define __LDBL_REDIR(name, proto) ... unused__ldbl_redir
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__" #name "ieee128"));
# define __REDIRECT_LDBL(name, proto, alias) \
name proto __asm (__ASMNAME ("__" #alias "ieee128"))
/* Alias name defined automatically, with leading underscores. */
# define __LDBL_REDIR2_DECL(name) \
extern __typeof (__##name) __##name \
__asm (__ASMNAME ("__" #name "ieee128"));
/* Alias name defined manually. */
# define __LDBL_REDIR1(name, proto, alias) ... unused__ldbl_redir1
# define __LDBL_REDIR1_DECL(name, alias) \
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR1_NTH(name, proto, alias) \
__REDIRECT_NTH (name, proto, alias)
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __##alias##ieee128)
/* Unused. */
# define __LDBL_REDIR_NTH(name, proto) ... unused__ldbl_redir_nth
# else
_Static_assert (0, "IEEE 128-bits long double requires redirection on this platform");
# endif
#elif defined __LONG_DOUBLE_MATH_OPTIONAL && defined __NO_LONG_DOUBLE_MATH
# define __LDBL_COMPAT 1
# ifdef __REDIRECT
# define __LDBL_REDIR1(name, proto, alias) __REDIRECT (name, proto, alias)
# define __LDBL_REDIR(name, proto) \
__LDBL_REDIR1 (name, proto, __nldbl_##name)
# define __LDBL_REDIR1_NTH(name, proto, alias) __REDIRECT_NTH (name, proto, alias)
# define __LDBL_REDIR_NTH(name, proto) \
__LDBL_REDIR1_NTH (name, proto, __nldbl_##name)
# define __LDBL_REDIR2_DECL(name) \
extern __typeof (__##name) __##name __asm (__ASMNAME ("__nldbl___" #name));
# define __LDBL_REDIR1_DECL(name, alias) \
extern __typeof (name) name __asm (__ASMNAME (#alias));
# define __LDBL_REDIR_DECL(name) \
extern __typeof (name) name __asm (__ASMNAME ("__nldbl_" #name));
# define __REDIRECT_LDBL(name, proto, alias) \
__LDBL_REDIR1 (name, proto, __nldbl_##alias)
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__LDBL_REDIR1_NTH (name, proto, __nldbl_##alias)
# endif
#endif
#if (!defined __LDBL_COMPAT && __LDOUBLE_REDIRECTS_TO_FLOAT128_ABI == 0) \
|| !defined __REDIRECT
# define __LDBL_REDIR1(name, proto, alias) name proto
# define __LDBL_REDIR(name, proto) name proto
# define __LDBL_REDIR1_NTH(name, proto, alias) name proto __THROW
# define __LDBL_REDIR_NTH(name, proto) name proto __THROW
# define __LDBL_REDIR2_DECL(name)
# define __LDBL_REDIR_DECL(name)
# ifdef __REDIRECT
# define __REDIRECT_LDBL(name, proto, alias) __REDIRECT (name, proto, alias)
# define __REDIRECT_NTH_LDBL(name, proto, alias) \
__REDIRECT_NTH (name, proto, alias)
# endif
#endif
/* __glibc_macro_warning (MESSAGE) issues warning MESSAGE. This is
intended for use in preprocessor macros.
Note: MESSAGE must be a _single_ string; concatenation of string
literals is not supported. */
#if __GNUC_PREREQ (4,8) || __glibc_clang_prereq (3,5)
# define __glibc_macro_warning1(message) _Pragma (#message)
# define __glibc_macro_warning(message) \
__glibc_macro_warning1 (GCC warning message)
#else
# define __glibc_macro_warning(msg)
#endif
/* Generic selection (ISO C11) is a C-only feature, available in GCC
since version 4.9. Previous versions do not provide generic
selection, even though they might set __STDC_VERSION__ to 201112L,
when in -std=c11 mode. Thus, we must check for !defined __GNUC__
when testing __STDC_VERSION__ for generic selection support.
On the other hand, Clang also defines __GNUC__, so a clang-specific
check is required to enable the use of generic selection. */
#if !defined __cplusplus \
&& (__GNUC_PREREQ (4, 9) \
|| __glibc_has_extension (c_generic_selections) \
|| (!defined __GNUC__ && defined __STDC_VERSION__ \
&& __STDC_VERSION__ >= 201112L))
# define __HAVE_GENERIC_SELECTION 1
#else
# define __HAVE_GENERIC_SELECTION 0
#endif
#if __GNUC_PREREQ (10, 0)
/* Designates a 1-based positional argument ref-index of pointer type
that can be used to access size-index elements of the pointed-to
array according to access mode, or at least one element when
size-index is not provided:
access (access-mode, <ref-index> [, <size-index>]) */
# define __attr_access(x) __attribute__ ((__access__ x))
/* For _FORTIFY_SOURCE == 3 we use __builtin_dynamic_object_size, which may
use the access attribute to get object sizes from function definition
arguments, so we can't use them on functions we fortify. Drop the object
size hints for such functions. */
# if __USE_FORTIFY_LEVEL == 3
# define __fortified_attr_access(a, o, s) __attribute__ ((__access__ (a, o)))
# else
# define __fortified_attr_access(a, o, s) __attr_access ((a, o, s))
# endif
# if __GNUC_PREREQ (11, 0)
# define __attr_access_none(argno) __attribute__ ((__access__ (__none__, argno)))
# else
# define __attr_access_none(argno)
# endif
#else
# define __fortified_attr_access(a, o, s)
# define __attr_access(x)
# define __attr_access_none(argno)
#endif
#if __GNUC_PREREQ (11, 0)
/* Designates dealloc as a function to call to deallocate objects
allocated by the declared function. */
# define __attr_dealloc(dealloc, argno) \
__attribute__ ((__malloc__ (dealloc, argno)))
# define __attr_dealloc_free __attr_dealloc (__builtin_free, 1)
#else
# define __attr_dealloc(dealloc, argno)
# define __attr_dealloc_free
#endif
/* Specify that a function such as setjmp or vfork may return
twice. */
#if __GNUC_PREREQ (4, 1)
# define __attribute_returns_twice__ __attribute__ ((__returns_twice__))
#else
# define __attribute_returns_twice__ /* Ignore. */
#endif
#endif /* sys/cdefs.h */

View File

@ -1,155 +0,0 @@
/* `fd_set' type and related macros, and `select'/`pselect' declarations.
Copyright (C) 1996-2023 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
<https://www.gnu.org/licenses/>. */
/* POSIX 1003.1g: 6.2 Select from File Descriptor Sets <sys/select.h> */
#ifndef _SYS_SELECT_H
#define _SYS_SELECT_H 1
#include <features.h>
/* Get definition of needed basic types. */
#include <bits/types.h>
/* Get __FD_* definitions. */
#include <bits/select.h>
/* Get sigset_t. */
#include <bits/types/sigset_t.h>
/* Get definition of timer specification structures. */
#include <bits/types/time_t.h>
#include <bits/types/struct_timeval.h>
#ifdef __USE_XOPEN2K
# include <bits/types/struct_timespec.h>
#endif
#ifndef __suseconds_t_defined
typedef __suseconds_t suseconds_t;
# define __suseconds_t_defined
#endif
/* The fd_set member is required to be an array of longs. */
typedef long int __fd_mask;
/* Some versions of <linux/posix_types.h> define this macros. */
#undef __NFDBITS
/* It's easier to assume 8-bit bytes than to get CHAR_BIT. */
#define __NFDBITS (8 * (int) sizeof (__fd_mask))
#define __FD_ELT(d) ((d) / __NFDBITS)
#define __FD_MASK(d) ((__fd_mask) (1UL << ((d) % __NFDBITS)))
/* fd_set for select and pselect. */
typedef struct
{
/* XPG4.2 requires this member name. Otherwise avoid the name
from the global namespace. */
#ifdef __USE_XOPEN
__fd_mask fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->fds_bits)
#else
__fd_mask __fds_bits[__FD_SETSIZE / __NFDBITS];
# define __FDS_BITS(set) ((set)->__fds_bits)
#endif
} fd_set;
/* Maximum number of file descriptors in `fd_set'. */
#define FD_SETSIZE __FD_SETSIZE
#ifdef __USE_MISC
/* Sometimes the fd_set member is assumed to have this type. */
typedef __fd_mask fd_mask;
/* Number of bits per word of `fd_set' (some code assumes this is 32). */
# define NFDBITS __NFDBITS
#endif
/* Access macros for `fd_set'. */
#define FD_SET(fd, fdsetp) __FD_SET (fd, fdsetp)
#define FD_CLR(fd, fdsetp) __FD_CLR (fd, fdsetp)
#define FD_ISSET(fd, fdsetp) __FD_ISSET (fd, fdsetp)
#define FD_ZERO(fdsetp) __FD_ZERO (fdsetp)
__BEGIN_DECLS
/* Check the first NFDS descriptors each in READFDS (if not NULL) for read
readiness, in WRITEFDS (if not NULL) for write readiness, and in EXCEPTFDS
(if not NULL) for exceptional conditions. If TIMEOUT is not NULL, time out
after waiting the interval specified therein. Returns the number of ready
descriptors, or -1 for errors.
This function is a cancellation point and therefore not marked with
__THROW. */
#ifndef __USE_TIME_BITS64
extern int select (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout);
#else
# ifdef __REDIRECT
extern int __REDIRECT (select,
(int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
struct timeval *__restrict __timeout),
__select64);
# else
# define select __select64
# endif
#endif
#ifdef __USE_XOPEN2K
/* Same as above only that the TIMEOUT value is given with higher
resolution and a sigmask which is been set temporarily. This version
should be used.
This function is a cancellation point and therefore not marked with
__THROW. */
# ifndef __USE_TIME_BITS64
extern int pselect (int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
const struct timespec *__restrict __timeout,
const __sigset_t *__restrict __sigmask);
# else
# ifdef __REDIRECT
extern int __REDIRECT (pselect,
(int __nfds, fd_set *__restrict __readfds,
fd_set *__restrict __writefds,
fd_set *__restrict __exceptfds,
const struct timespec *__restrict __timeout,
const __sigset_t *__restrict __sigmask),
__pselect64);
# else
# define pselect __pselect64
# endif
# endif
#endif
/* Define some inlines helping to catch common problems. */
#if __USE_FORTIFY_LEVEL > 0 && defined __GNUC__
# include <bits/select2.h>
#endif
__END_DECLS
#endif /* sys/select.h */

View File

@ -1 +0,0 @@
#include <sys/syscall.h>

View File

@ -1,124 +0,0 @@
/* Definition of the cpu_set_t structure used by the POSIX 1003.1b-1993
scheduling interface.
Copyright (C) 1996-2023 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
<https://www.gnu.org/licenses/>. */
#ifndef _BITS_CPU_SET_H
#define _BITS_CPU_SET_H 1
#ifndef _SCHED_H
# error "Never include <bits/cpu-set.h> directly; use <sched.h> instead."
#endif
/* Size definition for CPU sets. */
#define __CPU_SETSIZE 1024
#define __NCPUBITS (8 * sizeof (__cpu_mask))
/* Type for array elements in 'cpu_set_t'. */
typedef __CPU_MASK_TYPE __cpu_mask;
/* Basic access functions. */
#define __CPUELT(cpu) ((cpu) / __NCPUBITS)
#define __CPUMASK(cpu) ((__cpu_mask) 1 << ((cpu) % __NCPUBITS))
/* Data structure to describe CPU mask. */
typedef struct
{
__cpu_mask __bits[__CPU_SETSIZE / __NCPUBITS];
} cpu_set_t;
/* Access functions for CPU masks. */
#if __GNUC_PREREQ (2, 91)
# define __CPU_ZERO_S(setsize, cpusetp) \
do __builtin_memset (cpusetp, '\0', setsize); while (0)
#else
# define __CPU_ZERO_S(setsize, cpusetp) \
do { \
size_t __i; \
size_t __imax = (setsize) / sizeof (__cpu_mask); \
__cpu_mask *__bits = (cpusetp)->__bits; \
for (__i = 0; __i < __imax; ++__i) \
__bits[__i] = 0; \
} while (0)
#endif
#define __CPU_SET_S(cpu, setsize, cpusetp) \
(__extension__ \
({ size_t __cpu = (cpu); \
__cpu / 8 < (setsize) \
? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
|= __CPUMASK (__cpu)) \
: 0; }))
#define __CPU_CLR_S(cpu, setsize, cpusetp) \
(__extension__ \
({ size_t __cpu = (cpu); \
__cpu / 8 < (setsize) \
? (((__cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
&= ~__CPUMASK (__cpu)) \
: 0; }))
#define __CPU_ISSET_S(cpu, setsize, cpusetp) \
(__extension__ \
({ size_t __cpu = (cpu); \
__cpu / 8 < (setsize) \
? ((((const __cpu_mask *) ((cpusetp)->__bits))[__CPUELT (__cpu)] \
& __CPUMASK (__cpu))) != 0 \
: 0; }))
#define __CPU_COUNT_S(setsize, cpusetp) \
__sched_cpucount (setsize, cpusetp)
#if __GNUC_PREREQ (2, 91)
# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
(__builtin_memcmp (cpusetp1, cpusetp2, setsize) == 0)
#else
# define __CPU_EQUAL_S(setsize, cpusetp1, cpusetp2) \
(__extension__ \
({ const __cpu_mask *__arr1 = (cpusetp1)->__bits; \
const __cpu_mask *__arr2 = (cpusetp2)->__bits; \
size_t __imax = (setsize) / sizeof (__cpu_mask); \
size_t __i; \
for (__i = 0; __i < __imax; ++__i) \
if (__arr1[__i] != __arr2[__i]) \
break; \
__i == __imax; }))
#endif
#define __CPU_OP_S(setsize, destset, srcset1, srcset2, op) \
(__extension__ \
({ cpu_set_t *__dest = (destset); \
const __cpu_mask *__arr1 = (srcset1)->__bits; \
const __cpu_mask *__arr2 = (srcset2)->__bits; \
size_t __imax = (setsize) / sizeof (__cpu_mask); \
size_t __i; \
for (__i = 0; __i < __imax; ++__i) \
((__cpu_mask *) __dest->__bits)[__i] = __arr1[__i] op __arr2[__i]; \
__dest; }))
#define __CPU_ALLOC_SIZE(count) \
((((count) + __NCPUBITS - 1) / __NCPUBITS) * sizeof (__cpu_mask))
#define __CPU_ALLOC(count) __sched_cpualloc (count)
#define __CPU_FREE(cpuset) __sched_cpufree (cpuset)
__BEGIN_DECLS
extern int __sched_cpucount (size_t __setsize, const cpu_set_t *__setp)
__THROW;
extern cpu_set_t *__sched_cpualloc (size_t __count) __THROW __wur;
extern void __sched_cpufree (cpu_set_t *__set) __THROW;
__END_DECLS
#endif /* bits/cpu-set.h */

View File

@ -1,228 +0,0 @@
/* bits/types.h -- definitions of __*_t types underlying *_t types.
Copyright (C) 2002-2023 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
<https://www.gnu.org/licenses/>. */
/*
* Never include this file directly; use <sys/types.h> instead.
*/
#ifndef _BITS_TYPES_H
#define _BITS_TYPES_H 1
#include <features.h>
#include <bits/wordsize.h>
#include <bits/timesize.h>
/* Convenience types. */
typedef unsigned char __u_char;
typedef unsigned short int __u_short;
typedef unsigned int __u_int;
typedef unsigned long int __u_long;
/* Fixed-size types, underlying types depend on word size and compiler. */
typedef signed char __int8_t;
typedef unsigned char __uint8_t;
typedef signed short int __int16_t;
typedef unsigned short int __uint16_t;
typedef signed int __int32_t;
typedef unsigned int __uint32_t;
#if __WORDSIZE == 64
typedef signed long int __int64_t;
typedef unsigned long int __uint64_t;
#else
__extension__ typedef signed long long int __int64_t;
__extension__ typedef unsigned long long int __uint64_t;
#endif
/* Smallest types with at least a given width. */
typedef __int8_t __int_least8_t;
typedef __uint8_t __uint_least8_t;
typedef __int16_t __int_least16_t;
typedef __uint16_t __uint_least16_t;
typedef __int32_t __int_least32_t;
typedef __uint32_t __uint_least32_t;
typedef __int64_t __int_least64_t;
typedef __uint64_t __uint_least64_t;
/* quad_t is also 64 bits. */
#if __WORDSIZE == 64
typedef long int __quad_t;
typedef unsigned long int __u_quad_t;
#else
__extension__ typedef long long int __quad_t;
__extension__ typedef unsigned long long int __u_quad_t;
#endif
/* Largest integral types. */
#if __WORDSIZE == 64
typedef long int __intmax_t;
typedef unsigned long int __uintmax_t;
#else
__extension__ typedef long long int __intmax_t;
__extension__ typedef unsigned long long int __uintmax_t;
#endif
/* The machine-dependent file <bits/typesizes.h> defines __*_T_TYPE
macros for each of the OS types we define below. The definitions
of those macros must use the following macros for underlying types.
We define __S<SIZE>_TYPE and __U<SIZE>_TYPE for the signed and unsigned
variants of each of the following integer types on this machine.
16 -- "natural" 16-bit type (always short)
32 -- "natural" 32-bit type (always int)
64 -- "natural" 64-bit type (long or long long)
LONG32 -- 32-bit type, traditionally long
QUAD -- 64-bit type, traditionally long long
WORD -- natural type of __WORDSIZE bits (int or long)
LONGWORD -- type of __WORDSIZE bits, traditionally long
We distinguish WORD/LONGWORD, 32/LONG32, and 64/QUAD so that the
conventional uses of `long' or `long long' type modifiers match the
types we define, even when a less-adorned type would be the same size.
This matters for (somewhat) portably writing printf/scanf formats for
these types, where using the appropriate l or ll format modifiers can
make the typedefs and the formats match up across all GNU platforms. If
we used `long' when it's 64 bits where `long long' is expected, then the
compiler would warn about the formats not matching the argument types,
and the programmer changing them to shut up the compiler would break the
program's portability.
Here we assume what is presently the case in all the GCC configurations
we support: long long is always 64 bits, long is always word/address size,
and int is always 32 bits. */
#define __S16_TYPE short int
#define __U16_TYPE unsigned short int
#define __S32_TYPE int
#define __U32_TYPE unsigned int
#define __SLONGWORD_TYPE long int
#define __ULONGWORD_TYPE unsigned long int
#if __WORDSIZE == 32
# define __SQUAD_TYPE __int64_t
# define __UQUAD_TYPE __uint64_t
# define __SWORD_TYPE int
# define __UWORD_TYPE unsigned int
# define __SLONG32_TYPE long int
# define __ULONG32_TYPE unsigned long int
# define __S64_TYPE __int64_t
# define __U64_TYPE __uint64_t
/* We want __extension__ before typedef's that use nonstandard base types
such as `long long' in C89 mode. */
# define __STD_TYPE __extension__ typedef
#elif __WORDSIZE == 64
# define __SQUAD_TYPE long int
# define __UQUAD_TYPE unsigned long int
# define __SWORD_TYPE long int
# define __UWORD_TYPE unsigned long int
# define __SLONG32_TYPE int
# define __ULONG32_TYPE unsigned int
# define __S64_TYPE long int
# define __U64_TYPE unsigned long int
/* No need to mark the typedef with __extension__. */
# define __STD_TYPE typedef
#else
# error
#endif
#include <bits/typesizes.h> /* Defines __*_T_TYPE macros. */
#include <bits/time64.h> /* Defines __TIME*_T_TYPE macros. */
__STD_TYPE __DEV_T_TYPE __dev_t; /* Type of device numbers. */
__STD_TYPE __UID_T_TYPE __uid_t; /* Type of user identifications. */
__STD_TYPE __GID_T_TYPE __gid_t; /* Type of group identifications. */
__STD_TYPE __INO_T_TYPE __ino_t; /* Type of file serial numbers. */
__STD_TYPE __INO64_T_TYPE __ino64_t; /* Type of file serial numbers (LFS).*/
__STD_TYPE __MODE_T_TYPE __mode_t; /* Type of file attribute bitmasks. */
__STD_TYPE __NLINK_T_TYPE __nlink_t; /* Type of file link counts. */
__STD_TYPE __OFF_T_TYPE __off_t; /* Type of file sizes and offsets. */
__STD_TYPE __OFF64_T_TYPE __off64_t; /* Type of file sizes and offsets (LFS). */
__STD_TYPE __PID_T_TYPE __pid_t; /* Type of process identifications. */
__STD_TYPE __FSID_T_TYPE __fsid_t; /* Type of file system IDs. */
__STD_TYPE __CLOCK_T_TYPE __clock_t; /* Type of CPU usage counts. */
__STD_TYPE __RLIM_T_TYPE __rlim_t; /* Type for resource measurement. */
__STD_TYPE __RLIM64_T_TYPE __rlim64_t; /* Type for resource measurement (LFS). */
__STD_TYPE __ID_T_TYPE __id_t; /* General type for IDs. */
__STD_TYPE __TIME_T_TYPE __time_t; /* Seconds since the Epoch. */
__STD_TYPE __USECONDS_T_TYPE __useconds_t; /* Count of microseconds. */
__STD_TYPE __SUSECONDS_T_TYPE __suseconds_t; /* Signed count of microseconds. */
__STD_TYPE __SUSECONDS64_T_TYPE __suseconds64_t;
__STD_TYPE __DADDR_T_TYPE __daddr_t; /* The type of a disk address. */
__STD_TYPE __KEY_T_TYPE __key_t; /* Type of an IPC key. */
/* Clock ID used in clock and timer functions. */
__STD_TYPE __CLOCKID_T_TYPE __clockid_t;
/* Timer ID returned by `timer_create'. */
__STD_TYPE __TIMER_T_TYPE __timer_t;
/* Type to represent block size. */
__STD_TYPE __BLKSIZE_T_TYPE __blksize_t;
/* Types from the Large File Support interface. */
/* Type to count number of disk blocks. */
__STD_TYPE __BLKCNT_T_TYPE __blkcnt_t;
__STD_TYPE __BLKCNT64_T_TYPE __blkcnt64_t;
/* Type to count file system blocks. */
__STD_TYPE __FSBLKCNT_T_TYPE __fsblkcnt_t;
__STD_TYPE __FSBLKCNT64_T_TYPE __fsblkcnt64_t;
/* Type to count file system nodes. */
__STD_TYPE __FSFILCNT_T_TYPE __fsfilcnt_t;
__STD_TYPE __FSFILCNT64_T_TYPE __fsfilcnt64_t;
/* Type of miscellaneous file system fields. */
__STD_TYPE __FSWORD_T_TYPE __fsword_t;
__STD_TYPE __SSIZE_T_TYPE __ssize_t; /* Type of a byte count, or error. */
/* Signed long type used in system calls. */
__STD_TYPE __SYSCALL_SLONG_TYPE __syscall_slong_t;
/* Unsigned long type used in system calls. */
__STD_TYPE __SYSCALL_ULONG_TYPE __syscall_ulong_t;
/* These few don't really vary by system, they always correspond
to one of the other defined types. */
typedef __off64_t __loff_t; /* Type of file sizes and offsets (LFS). */
typedef char *__caddr_t;
/* Duplicates info from stdint.h but this is used in unistd.h. */
__STD_TYPE __SWORD_TYPE __intptr_t;
/* Duplicate info from sys/socket.h. */
__STD_TYPE __U32_TYPE __socklen_t;
/* C99: An integer type that can be accessed as an atomic entity,
even in the presence of asynchronous interrupts.
It is not currently necessary for this to be machine-specific. */
typedef int __sig_atomic_t;
/* Seconds since the Epoch, visible to user code when time_t is too
narrow only for consistency with the old way of widening too-narrow
types. User code should never use __time64_t. */
#if __TIMESIZE == 64
# define __time64_t __time_t
#elif __TIMESIZE != 64
__STD_TYPE __TIME64_T_TYPE __time64_t;
#endif
#undef __STD_TYPE
#endif /* bits/types.h */

View File

@ -1,232 +0,0 @@
/* Copyright (C) 1991-2023 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
<https://www.gnu.org/licenses/>. */
/*
* POSIX Standard: 2.6 Primitive System Data Types <sys/types.h>
*/
#ifndef _SYS_TYPES_H
#define _SYS_TYPES_H 1
#include <features.h>
__BEGIN_DECLS
#include <bits/types.h>
#ifdef __USE_MISC
# ifndef __u_char_defined
typedef __u_char u_char;
typedef __u_short u_short;
typedef __u_int u_int;
typedef __u_long u_long;
typedef __quad_t quad_t;
typedef __u_quad_t u_quad_t;
typedef __fsid_t fsid_t;
# define __u_char_defined
# endif
typedef __loff_t loff_t;
#endif
#ifndef __ino_t_defined
# ifndef __USE_FILE_OFFSET64
typedef __ino_t ino_t;
# else
typedef __ino64_t ino_t;
# endif
# define __ino_t_defined
#endif
#if defined __USE_LARGEFILE64 && !defined __ino64_t_defined
typedef __ino64_t ino64_t;
# define __ino64_t_defined
#endif
#ifndef __dev_t_defined
typedef __dev_t dev_t;
# define __dev_t_defined
#endif
#ifndef __gid_t_defined
typedef __gid_t gid_t;
# define __gid_t_defined
#endif
#ifndef __mode_t_defined
typedef __mode_t mode_t;
# define __mode_t_defined
#endif
#ifndef __nlink_t_defined
typedef __nlink_t nlink_t;
# define __nlink_t_defined
#endif
#ifndef __uid_t_defined
typedef __uid_t uid_t;
# define __uid_t_defined
#endif
#ifndef __off_t_defined
# ifndef __USE_FILE_OFFSET64
typedef __off_t off_t;
# else
typedef __off64_t off_t;
# endif
# define __off_t_defined
#endif
#if defined __USE_LARGEFILE64 && !defined __off64_t_defined
typedef __off64_t off64_t;
# define __off64_t_defined
#endif
#ifndef __pid_t_defined
typedef __pid_t pid_t;
# define __pid_t_defined
#endif
#if (defined __USE_XOPEN || defined __USE_XOPEN2K8) \
&& !defined __id_t_defined
typedef __id_t id_t;
# define __id_t_defined
#endif
#ifndef __ssize_t_defined
typedef __ssize_t ssize_t;
# define __ssize_t_defined
#endif
#ifdef __USE_MISC
# ifndef __daddr_t_defined
typedef __daddr_t daddr_t;
typedef __caddr_t caddr_t;
# define __daddr_t_defined
# endif
#endif
#if (defined __USE_MISC || defined __USE_XOPEN) && !defined __key_t_defined
typedef __key_t key_t;
# define __key_t_defined
#endif
#if defined __USE_XOPEN || defined __USE_XOPEN2K8
# include <bits/types/clock_t.h>
#endif
#include <bits/types/clockid_t.h>
#include <bits/types/time_t.h>
#include <bits/types/timer_t.h>
#ifdef __USE_XOPEN
# ifndef __useconds_t_defined
typedef __useconds_t useconds_t;
# define __useconds_t_defined
# endif
# ifndef __suseconds_t_defined
typedef __suseconds_t suseconds_t;
# define __suseconds_t_defined
# endif
#endif
#define __need_size_t
#include <stddef.h>
#ifdef __USE_MISC
/* Old compatibility names for C types. */
typedef unsigned long int ulong;
typedef unsigned short int ushort;
typedef unsigned int uint;
#endif
/* These size-specific names are used by some of the inet code. */
#include <bits/stdint-intn.h>
/* These were defined by ISO C without the first `_'. */
typedef __uint8_t u_int8_t;
typedef __uint16_t u_int16_t;
typedef __uint32_t u_int32_t;
typedef __uint64_t u_int64_t;
#if __GNUC_PREREQ (2, 7)
typedef int register_t __attribute__ ((__mode__ (__word__)));
#else
typedef int register_t;
#endif
/* Some code from BIND tests this macro to see if the types above are
defined. */
#define __BIT_TYPES_DEFINED__ 1
#ifdef __USE_MISC
/* In BSD <sys/types.h> is expected to define BYTE_ORDER. */
# include <endian.h>
/* It also defines `fd_set' and the FD_* macros for `select'. */
# include <sys/select.h>
#endif /* Use misc. */
#if (defined __USE_UNIX98 || defined __USE_XOPEN2K8) \
&& !defined __blksize_t_defined
typedef __blksize_t blksize_t;
# define __blksize_t_defined
#endif
/* Types from the Large File Support interface. */
#ifndef __USE_FILE_OFFSET64
# ifndef __blkcnt_t_defined
typedef __blkcnt_t blkcnt_t; /* Type to count number of disk blocks. */
# define __blkcnt_t_defined
# endif
# ifndef __fsblkcnt_t_defined
typedef __fsblkcnt_t fsblkcnt_t; /* Type to count file system blocks. */
# define __fsblkcnt_t_defined
# endif
# ifndef __fsfilcnt_t_defined
typedef __fsfilcnt_t fsfilcnt_t; /* Type to count file system inodes. */
# define __fsfilcnt_t_defined
# endif
#else
# ifndef __blkcnt_t_defined
typedef __blkcnt64_t blkcnt_t; /* Type to count number of disk blocks. */
# define __blkcnt_t_defined
# endif
# ifndef __fsblkcnt_t_defined
typedef __fsblkcnt64_t fsblkcnt_t; /* Type to count file system blocks. */
# define __fsblkcnt_t_defined
# endif
# ifndef __fsfilcnt_t_defined
typedef __fsfilcnt64_t fsfilcnt_t; /* Type to count file system inodes. */
# define __fsfilcnt_t_defined
# endif
#endif
#ifdef __USE_LARGEFILE64
typedef __blkcnt64_t blkcnt64_t; /* Type to count number of disk blocks. */
typedef __fsblkcnt64_t fsblkcnt64_t; /* Type to count file system blocks. */
typedef __fsfilcnt64_t fsfilcnt64_t; /* Type to count file system inodes. */
#endif
/* Now add the thread types. */
#if defined __USE_POSIX199506 || defined __USE_UNIX98
# include <bits/pthreadtypes.h>
#endif
__END_DECLS
#endif /* sys/types.h */

View File

@ -1,10 +0,0 @@
#ifndef __sig_atomic_t_defined
#define __sig_atomic_t_defined 1
#include <bits/types.h>
/* An integral type that can be modified atomically, without the
possibility of a signal arriving in the middle of the operation. */
typedef __sig_atomic_t sig_atomic_t;
#endif

View File

@ -1,9 +0,0 @@
#ifndef __sigset_t_defined
#define __sigset_t_defined 1
#include <bits/types/__sigset_t.h>
/* A set of signals to be blocked, unblocked, or waited for. */
typedef __sigset_t sigset_t;
#endif

Some files were not shown because too many files have changed in this diff Show More