Skip to content

Commit

Permalink
Support FreeBSD 12 (64-bit inodes) (#5199)
Browse files Browse the repository at this point in the history
  • Loading branch information
valpackett authored and RX14 committed Jan 2, 2018
1 parent c40c292 commit a3f2ecc
Show file tree
Hide file tree
Showing 4 changed files with 48 additions and 11 deletions.
15 changes: 13 additions & 2 deletions src/lib_c/x86_64-portbld-freebsd/c/dirent.cr
Expand Up @@ -4,10 +4,21 @@ lib LibC
type DIR = Void

struct Dirent
d_fileno : UInt
{% if flag?(:"freebsd12.0") %}
d_fileno : ULong
d_off : ULong
{% else %}
d_fileno : UInt
{% end %}
d_reclen : UShort
d_type : UChar
d_namlen : UChar
{% if flag?(:"freebsd12.0") %}
d_pad0 : UChar
d_namlen : UShort
d_pad1 : UShort
{% else %}
d_namlen : UChar
{% end %}
d_name : StaticArray(Char, 256)
end

Expand Down
31 changes: 24 additions & 7 deletions src/lib_c/x86_64-portbld-freebsd/c/sys/stat.cr
Expand Up @@ -31,23 +31,40 @@ lib LibC
struct Stat
st_dev : DevT
st_ino : InoT
st_mode : ModeT
st_nlink : NlinkT
{% if flag?(:"freebsd12.0") %}
st_nlink : NlinkT
st_mode : ModeT
st_pad0 : UShort
{% else %}
st_mode : ModeT
st_nlink : NlinkT
{% end %}
st_uid : UidT
st_gid : GidT
{% if flag?(:"freebsd12.0") %}
st_pad1 : UInt
{% end %}
st_rdev : DevT
st_atim : Timespec
st_mtim : Timespec
st_ctim : Timespec
{% if flag?(:"freebsd12.0") %}
st_birthtim : Timespec
{% end %}
st_size : OffT
st_blocks : BlkcntT
st_blksize : BlksizeT
st_flags : FflagsT
st_gen : UInt
st_lspare : Int
st_birthtim : Timespec
__reserved_17 : UInt
__reserved_18 : UInt
{% if flag?("freebsd12.0") %}
st_gen : ULong
st_spare : StaticArray(ULong, 10)
{% else %}
st_gen : UInt
st_lspare : Int
st_birthtim : Timespec
__reserved_17 : UInt
__reserved_18 : UInt
{% end %}
end

fun chmod(x0 : Char*, x1 : ModeT) : Int
Expand Down
12 changes: 10 additions & 2 deletions src/lib_c/x86_64-portbld-freebsd/c/sys/types.cr
Expand Up @@ -9,9 +9,17 @@ lib LibC
alias DevT = UInt
alias GidT = UInt
alias IdT = Long
alias InoT = UInt
{% if flag?(:"freebsd12.0") %}
alias InoT = ULong
{% else %}
alias InoT = UInt
{% end %}
alias ModeT = UShort
alias NlinkT = UShort
{% if flag?(:"freebsd12.0") %}
alias NlinkT = ULong
{% else %}
alias NlinkT = UShort
{% end %}
alias OffT = Long
alias PidT = Int
type PthreadAttrT = Void*
Expand Down
1 change: 1 addition & 0 deletions src/lib_c/x86_64-unknown-freebsd

0 comments on commit a3f2ecc

Please sign in to comment.