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

Fix some Linux glibc bindings #13249

Merged
merged 3 commits into from
Apr 9, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/lib_c/aarch64-linux-gnu/c/dirent.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ lib LibC

struct Dirent
d_ino : InoT
d_off : Long
d_off : OffT
d_reclen : UShort
d_type : Char
d_type : UChar
d_name : StaticArray(Char, 256)
end

Expand Down
4 changes: 4 additions & 0 deletions src/lib_c/aarch64-linux-gnu/c/link.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ lib LibC
name : Char*
phdr : Elf_Phdr*
phnum : Elf_Half
adds : ULongLong
subs : ULongLong
tls_modid : SizeT
tls_data : Void*
end

alias DlPhdrCallback = (DlPhdrInfo*, LibC::SizeT, Void*) -> LibC::Int
Expand Down
4 changes: 2 additions & 2 deletions src/lib_c/aarch64-linux-gnu/c/signal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ lib LibC
si_code : Int
__pad0 : Int
si_addr : Void* # Assuming the sigfault form of siginfo_t
__pad1 : StaticArray(Int, 20) # __SI_PAD_SIZE (28) - sizeof(void*) (8) = 20
__pad1 : StaticArray(Int, 26) # __SI_PAD_SIZE (28) - sizeof(void*) / sizeof(int) = 26
end

alias SigactionHandlerT = (Int, SiginfoT*, Void*) ->
Expand All @@ -66,7 +66,7 @@ lib LibC
sa_sigaction : SigactionHandlerT
sa_mask : SigsetT
sa_flags : Int
sa_restorer : Void*
sa_restorer : ->
end

struct StackT
Expand Down
2 changes: 1 addition & 1 deletion src/lib_c/aarch64-linux-gnu/c/stddef.cr
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
lib LibC
alias SizeT = ULongLong
alias SizeT = ULong
end
2 changes: 1 addition & 1 deletion src/lib_c/aarch64-linux-gnu/c/sys/resource.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ lib LibC
RUSAGE_SELF = 0
RUSAGE_CHILDREN = -1

fun getrusage(who : Int, usage : RUsage*) : Int16
fun getrusage(who : Int, usage : RUsage*) : Int
end
2 changes: 1 addition & 1 deletion src/lib_c/aarch64-linux-gnu/c/sys/socket.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ lib LibC

struct SockaddrStorage
ss_family : SaFamilyT
__ss_padding : StaticArray(Char, 118)
__ss_align : ULong
__ss_padding : StaticArray(Char, 112)
end

struct Linger
Expand Down
17 changes: 2 additions & 15 deletions src/lib_c/aarch64-linux-gnu/c/sys/types.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,9 @@ lib LibC
__align : Long
end

struct PthreadCondTData
__lock : Int
__futex : UInt
__total_seq : ULongLong
__wakeup_seq : ULongLong
__woken_seq : ULongLong
__mutex : Void*
__nwaiters : UInt
__broadcast_seq : UInt
end

union PthreadCondT
__data : PthreadCondTData
__size : StaticArray(Char, 48)
__align : Long
__align : LongLong
end

union PthreadCondattrT
Expand All @@ -43,14 +31,13 @@ lib LibC
end

union PthreadMutexT
__data : Void*
__size : StaticArray(Char, 48)
__align : Long
end

union PthreadMutexattrT
__size : StaticArray(Char, 8)
__align : Long
__align : Int
end

alias PthreadT = ULong
Expand Down
2 changes: 1 addition & 1 deletion src/lib_c/i386-linux-gnu/c/dirent.cr
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ lib LibC
d_ino : InoT
d_off : OffT
d_reclen : UShort
d_type : Char
d_type : UChar
d_name : StaticArray(Char, 256)
end

Expand Down
4 changes: 4 additions & 0 deletions src/lib_c/i386-linux-gnu/c/link.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ lib LibC
name : Char*
phdr : Elf_Phdr*
phnum : Elf_Half
adds : ULongLong
subs : ULongLong
tls_modid : SizeT
tls_data : Void*
end

alias DlPhdrCallback = (DlPhdrInfo*, LibC::SizeT, Void*) -> LibC::Int
Expand Down
6 changes: 3 additions & 3 deletions src/lib_c/i386-linux-gnu/c/signal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ lib LibC
SIG_IGN = SighandlerT.new(Pointer(Void).new(1_u64), Pointer(Void).null)

struct SigsetT
val : ULong[32] # (1024 / (8 * sizeof(long)))
val : ULong[32] # (1024 / (8 * sizeof(ULong)))
end

SA_ONSTACK = 0x08000000
Expand All @@ -56,7 +56,7 @@ lib LibC
si_errno : Int
si_code : Int
si_addr : Void* # Assuming the sigfault form of siginfo_t
__pad : StaticArray(Int, 25) # __SI_PAD_SIZE (29) - sizeof(void*) (4) = 25
__pad : StaticArray(Int, 27) # __SI_PAD_SIZE (29) - sizeof(void*) (4) = 25
end

alias SigactionHandlerT = (Int, SiginfoT*, Void*) ->
Expand All @@ -65,7 +65,7 @@ lib LibC
sa_sigaction : SigactionHandlerT
sa_mask : SigsetT
sa_flags : Int
sa_restorer : Void*
sa_restorer : ->
end

struct StackT
Expand Down
2 changes: 1 addition & 1 deletion src/lib_c/i386-linux-gnu/c/sys/resource.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ lib LibC
RUSAGE_SELF = 0
RUSAGE_CHILDREN = -1

fun getrusage(who : Int, usage : RUsage*) : Int16
fun getrusage(who : Int, usage : RUsage*) : Int
end
2 changes: 1 addition & 1 deletion src/lib_c/i386-linux-gnu/c/sys/socket.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ lib LibC

struct SockaddrStorage
ss_family : SaFamilyT
__ss_padding : StaticArray(Char, 122)
__ss_align : ULong
__ss_padding : StaticArray(Char, 120)
end

struct Linger
Expand Down
6 changes: 3 additions & 3 deletions src/lib_c/i386-linux-gnu/c/sys/stat.cr
Original file line number Diff line number Diff line change
Expand Up @@ -26,16 +26,16 @@ lib LibC
S_ISGID = 0o2000
S_ISVTX = 0o1000

struct Stat
struct Stat # stat64
st_dev : DevT
__pad1 : UShort
__pad1 : UInt
__st_ino : ULong
st_mode : ModeT
st_nlink : NlinkT
st_uid : UidT
st_gid : GidT
st_rdev : DevT
__pad2 : UShort
__pad2 : UInt
st_size : OffT
st_blksize : BlksizeT
st_blocks : BlkcntT
Expand Down
17 changes: 2 additions & 15 deletions src/lib_c/i386-linux-gnu/c/sys/types.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,37 +20,24 @@ lib LibC
__align : Long
end

struct PthreadCondTData
__lock : Int
__futex : UInt
__total_seq : ULongLong
__wakeup_seq : ULongLong
__woken_seq : ULongLong
__mutex : Void*
__nwaiters : UInt
__broadcast_seq : UInt
end

union PthreadCondT
__data : PthreadCondTData
__size : StaticArray(Char, 48)
__align : LongLong
end

union PthreadCondattrT
__size : StaticArray(Char, 4)
__align : Long
__align : Int
end

union PthreadMutexT
__data : Void*
__size : StaticArray(Char, 24)
__align : Long
end

union PthreadMutexattrT
__size : StaticArray(Char, 4)
__align : Long
__align : Int
end

alias PthreadT = ULong
Expand Down
4 changes: 2 additions & 2 deletions src/lib_c/x86_64-linux-gnu/c/dirent.cr
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ lib LibC

struct Dirent
d_ino : InoT
d_off : Long
d_off : OffT
d_reclen : UShort
d_type : Char
d_type : UChar
d_name : StaticArray(Char, 256)
end

Expand Down
4 changes: 4 additions & 0 deletions src/lib_c/x86_64-linux-gnu/c/link.cr
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,10 @@ lib LibC
name : Char*
phdr : Elf_Phdr*
phnum : Elf_Half
adds : ULongLong
subs : ULongLong
tls_modid : SizeT
tls_data : Void*
end

alias DlPhdrCallback = (DlPhdrInfo*, LibC::SizeT, Void*) -> LibC::Int
Expand Down
4 changes: 2 additions & 2 deletions src/lib_c/x86_64-linux-gnu/c/signal.cr
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ lib LibC
si_code : Int
__pad0 : Int
si_addr : Void* # Assuming the sigfault form of siginfo_t
__pad1 : StaticArray(Int, 20) # __SI_PAD_SIZE (28) - sizeof(void*) (8) = 20
__pad1 : StaticArray(Int, 26) # __SI_PAD_SIZE (28) - sizeof(void*) / sizeof(int) = 26
end

alias SigactionHandlerT = (Int, SiginfoT*, Void*) ->
Expand All @@ -66,7 +66,7 @@ lib LibC
sa_sigaction : SigactionHandlerT
sa_mask : SigsetT
sa_flags : Int
sa_restorer : Void*
sa_restorer : ->
end

struct StackT
Expand Down
2 changes: 1 addition & 1 deletion src/lib_c/x86_64-linux-gnu/c/sys/resource.cr
Original file line number Diff line number Diff line change
Expand Up @@ -21,5 +21,5 @@ lib LibC
RUSAGE_SELF = 0
RUSAGE_CHILDREN = -1

fun getrusage(who : Int, usage : RUsage*) : Int16
fun getrusage(who : Int, usage : RUsage*) : Int
end
2 changes: 1 addition & 1 deletion src/lib_c/x86_64-linux-gnu/c/sys/socket.cr
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ lib LibC

struct SockaddrStorage
ss_family : SaFamilyT
__ss_padding : StaticArray(Char, 118)
__ss_align : ULong
__ss_padding : StaticArray(Char, 112)
end

struct Linger
Expand Down
13 changes: 0 additions & 13 deletions src/lib_c/x86_64-linux-gnu/c/sys/types.cr
Original file line number Diff line number Diff line change
Expand Up @@ -20,19 +20,7 @@ lib LibC
__align : Long
end

struct PthreadCondTData
__lock : Int
__futex : UInt
__total_seq : ULongLong
__wakeup_seq : ULongLong
__woken_seq : ULongLong
__mutex : Void*
__nwaiters : UInt
__broadcast_seq : UInt
end

union PthreadCondT
__data : PthreadCondTData
__size : StaticArray(Char, 48)
__align : LongLong
end
Expand All @@ -43,7 +31,6 @@ lib LibC
end

union PthreadMutexT
__data : Void*
__size : StaticArray(Char, 40)
__align : Long
end
Expand Down