-
Notifications
You must be signed in to change notification settings - Fork 137
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
question: idiomatic/safe method to detect nanos & klibs at runtime #1885
Comments
|
thank you |
running local instance
...
en1: assigned 10.0.2.15
Nanos version: "Nanos 5.0-0.1.45 888809a7a8f0003b66a8ec2af2f5e8dd749866d0 x86_64"
package main
import (
"fmt"
"syscall"
)
func main() {
fmt.Printf("Nanos version: %q\n", Version())
}
func Version() string {
var uts syscall.Utsname
if err := syscall.Uname(&uts); err != nil {
return ""
}
sysname := int8ToString(uts.Sysname[:])
release := int8ToString(uts.Release[:])
version := int8ToString(uts.Version[:])
machine := int8ToString(uts.Machine[:])
return sysname + " " + release + " " + version + " " + machine
}
func int8ToString(s []int8) string {
b := make([]byte, 0, len(s))
for _, v := range s {
if v == 0x00 {
break
}
b = append(b, byte(v))
}
return string(b)
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
what would be an alternate idiomatic/safe method for an app (process) to detect at runtime if it's running on nanos, without making use of the environment variable(s) injected by ops/manually? -
not a feature request and not important
what would be an alternate idiomatic/safe method for an app (process) to detect at runtime the enabled klibs with the respective features, without making use of the environment variable(s) injected by ops/manually? -
not a feature request and not important
The text was updated successfully, but these errors were encountered: