@@ -404,36 +404,36 @@ srand(seed=floor(Int, time()) % Cuint) = ccall(:srand, Cvoid, (Cuint,), seed)
404404
405405struct Cpasswd
406406 username:: Cstring
407- uid:: Clong
408- gid:: Clong
407+ uid:: Culong
408+ gid:: Culong
409409 shell:: Cstring
410410 homedir:: Cstring
411411 gecos:: Cstring
412- Cpasswd () = new (C_NULL , - 1 , - 1 , C_NULL , C_NULL , C_NULL )
412+ Cpasswd () = new (C_NULL , typemax (Culong), typemax (Culong) , C_NULL , C_NULL , C_NULL )
413413end
414414mutable struct Cgroup
415- groupname:: Cstring # group name
416- gid:: Clong # group ID
417- mem:: Ptr{Cstring} # group members
418- Cgroup () = new (C_NULL , - 1 , C_NULL )
415+ groupname:: Cstring # group name
416+ gid:: Culong # group ID
417+ mem:: Ptr{Cstring} # group members
418+ Cgroup () = new (C_NULL , typemax (Culong) , C_NULL )
419419end
420420struct Passwd
421421 username:: String
422- uid:: Int
423- gid:: Int
422+ uid:: UInt
423+ gid:: UInt
424424 shell:: String
425425 homedir:: String
426426 gecos:: String
427427end
428428struct Group
429429 groupname:: String
430- gid:: Int
430+ gid:: UInt
431431 mem:: Vector{String}
432432end
433433
434434function getpwuid (uid:: Unsigned , throw_error:: Bool = true )
435435 ref_pd = Ref (Cpasswd ())
436- ret = ccall (:jl_os_get_passwd , Cint, (Ref{Cpasswd}, UInt ), ref_pd, uid)
436+ ret = ccall (:jl_os_get_passwd , Cint, (Ref{Cpasswd}, Culong ), ref_pd, uid)
437437 if ret != 0
438438 throw_error && Base. uv_error (" getpwuid" , ret)
439439 return
@@ -452,7 +452,7 @@ function getpwuid(uid::Unsigned, throw_error::Bool=true)
452452end
453453function getgrgid (gid:: Unsigned , throw_error:: Bool = true )
454454 ref_gp = Ref (Cgroup ())
455- ret = ccall (:jl_os_get_group , Cint, (Ref{Cgroup}, UInt ), ref_gp, gid)
455+ ret = ccall (:jl_os_get_group , Cint, (Ref{Cgroup}, Culong ), ref_gp, gid)
456456 if ret != 0
457457 throw_error && Base. uv_error (" getgrgid" , ret)
458458 return
@@ -475,6 +475,9 @@ function getgrgid(gid::Unsigned, throw_error::Bool=true)
475475 return gp
476476end
477477
478+ getuid () = ccall (:jl_getuid , Culong, ())
479+ geteuid () = ccall (:jl_geteuid , Culong, ())
480+
478481# Include dlopen()/dlpath() code
479482include (" libdl.jl" )
480483using . Libdl
0 commit comments