Skip to content

Instantly share code, notes, and snippets.

@djberg96
Last active February 5, 2021 22:47
Show Gist options
  • Save djberg96/c4ae2a5e11a9a741f1921c394fa16ce1 to your computer and use it in GitHub Desktop.
Save djberg96/c4ae2a5e11a9a741f1921c394fa16ce1 to your computer and use it in GitHub Desktop.
module Sys::Uname
VERSION = "0.1.0"
lib C
struct Uname
sysname : StaticArray(UInt8, 256)
nodename : StaticArray(UInt8, 256)
release : StaticArray(UInt8, 256)
version : StaticArray(UInt8, 256)
machine : StaticArray(UInt8, 256)
end
fun uname(value : Uname*) : Int32
end
def self.uname
uname_struct = C::Uname.new
if C.uname(pointerof(uname_struct)) < 0
puts "oops"
else
uname_struct
end
end
end
p Sys::Uname.uname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment