Last active
February 5, 2021 22:47
-
-
Save djberg96/c4ae2a5e11a9a741f1921c394fa16ce1 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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