Skip to content

Consider storing stat results in a struct #14

Description

@jakewilliami

Consider storing stat results in a struct rather than indexing the st_flags attribute directly.

Something like this (untested):

struct BSDStatStruct
    st_dev::UInt64
    st_mode::UInt64
    st_nlink::UInt64
    st_uid::UInt64
    st_gid::UInt64
    st_rdev::UInt64
    st_ino::UInt64
    st_size::UInt64
    st_blksize::UInt64
    st_blocks::UInt64
    st_flags::UInt64
    st_gen::UInt64
    st_atime::Int
    st_mtim::Int
    st_ctim::Int
    st_birthtim::Int
end

function _st_flags(f::AbstractString)
    stat_t = Ref{BSDStatStruct}()
    ccall(:jl_lstat, Cvoid, (Cstring, Ref{BSDStatStruct}), f, stat_t)
    return stat_t.x.st_flags
end

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions