@@ -404,36 +404,36 @@ srand(seed=floor(Int, time()) % Cuint) = ccall(:srand, Cvoid, (Cuint,), seed)
404
404
405
405
struct Cpasswd
406
406
username:: Cstring
407
- uid:: Clong
408
- gid:: Clong
407
+ uid:: Culong
408
+ gid:: Culong
409
409
shell:: Cstring
410
410
homedir:: Cstring
411
411
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 )
413
413
end
414
414
mutable 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 )
419
419
end
420
420
struct Passwd
421
421
username:: String
422
- uid:: Int
423
- gid:: Int
422
+ uid:: UInt
423
+ gid:: UInt
424
424
shell:: String
425
425
homedir:: String
426
426
gecos:: String
427
427
end
428
428
struct Group
429
429
groupname:: String
430
- gid:: Int
430
+ gid:: UInt
431
431
mem:: Vector{String}
432
432
end
433
433
434
434
function getpwuid (uid:: Unsigned , throw_error:: Bool = true )
435
435
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)
437
437
if ret != 0
438
438
throw_error && Base. uv_error (" getpwuid" , ret)
439
439
return
@@ -452,7 +452,7 @@ function getpwuid(uid::Unsigned, throw_error::Bool=true)
452
452
end
453
453
function getgrgid (gid:: Unsigned , throw_error:: Bool = true )
454
454
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)
456
456
if ret != 0
457
457
throw_error && Base. uv_error (" getgrgid" , ret)
458
458
return
@@ -475,6 +475,9 @@ function getgrgid(gid::Unsigned, throw_error::Bool=true)
475
475
return gp
476
476
end
477
477
478
+ getuid () = ccall (:jl_getuid , Culong, ())
479
+ geteuid () = ccall (:jl_geteuid , Culong, ())
480
+
478
481
# Include dlopen()/dlpath() code
479
482
include (" libdl.jl" )
480
483
using . Libdl
0 commit comments