Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Consider storing stat results in a struct #14

Open
jakewilliami opened this issue Sep 11, 2022 · 1 comment
Open

Consider storing stat results in a struct #14

jakewilliami opened this issue Sep 11, 2022 · 1 comment
Labels
BSD enhancement New feature or request macOS

Comments

@jakewilliami
Copy link
Owner

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
@jakewilliami jakewilliami added enhancement New feature or request question Further information is requested macOS BSD and removed question Further information is requested labels Sep 11, 2022
@jakewilliami
Copy link
Owner Author

Should also consider the same for statfs results. See #20.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
BSD enhancement New feature or request macOS
Projects
None yet
Development

No branches or pull requests

1 participant