Skip to content

Commit

Permalink
std: Add more standard type definitions for FreeBSD
Browse files Browse the repository at this point in the history
  • Loading branch information
LemonBoy authored and aarvay committed Jan 4, 2021
1 parent 714ae8c commit e310b84
Showing 1 changed file with 19 additions and 12 deletions.
31 changes: 19 additions & 12 deletions lib/std/os/bits/freebsd.zig
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,23 @@ const std = @import("../../std.zig");
const builtin = std.builtin;
const maxInt = std.math.maxInt;

// See https://svnweb.freebsd.org/base/head/sys/sys/_types.h?view=co
// TODO: audit pid_t/mode_t. They should likely be i32 and u16, respectively
pub const fd_t = c_int;
pub const pid_t = c_int;
pub const blksize_t = i32;
pub const blkcnt_t = i64;
pub const clockid_t = i32;
pub const fsblkcnt_t = u64;
pub const fsfilcnt_t = u64;
pub const nlink_t = u64;
pub const fd_t = i32;
pub const pid_t = i32;
pub const uid_t = u32;
pub const gid_t = u32;
pub const mode_t = c_uint;
pub const mode_t = u16;
pub const off_t = i64;
pub const ino_t = u64;
pub const dev_t = u64;
pub const time_t = i64;
// The signedness is not constant across different architectures.
pub const clock_t = isize;

pub const socklen_t = u32;

Expand Down Expand Up @@ -117,20 +127,17 @@ pub const msghdr_const = extern struct {
msg_flags: i32,
};

pub const off_t = i64;
pub const ino_t = u64;

pub const libc_stat = extern struct {
dev: u64,
dev: dev_t,
ino: ino_t,
nlink: usize,
nlink: nlink_t,

mode: u16,
mode: mode_t,
__pad0: u16,
uid: uid_t,
gid: gid_t,
__pad1: u32,
rdev: u64,
rdev: dev_t,

atim: timespec,
mtim: timespec,
Expand Down

0 comments on commit e310b84

Please sign in to comment.