[go: up one dir, main page]

Module getauxval

Source
Expand description

Read auxv entries one at a time via getauxval.

Because the underlying getauxval C function is weakly linked, and only available on Linux, access to it is done via the trait Getauxval to provide some indirection. On target_os="linux", the struct NativeGetauxval will be available, and that will call through to getauxval if it is available and return an appropriate error if it is not. That means it should be safe to try it if you’re not sure your glibc has the function, etc.

On all OSs, if you want a no-op sort of implementation (for use on non-Linux OSs, etc), you can use NotAvailableGetauxval. It (surprise!) always returns the error that indicates that getauxval function was not found. Of course, you can also use write your own stub implementation of the trait for testing.

Structs§

NativeGetauxval
Calls through to the underlying glibc or Bionic getauxval().
NotAvailableGetauxval
A stub implementation that always returns FunctionNotAvailable. This can be used when you want to use something reasonable (i.e. won’t crash or fail to compile) that’s not NativeGetauxval on non-Linux systems.

Enums§

GetauxvalError
Errors from invoking getauxval.

Traits§

Getauxval
On Linux, you will probably want NativeGetauxval. If you’re not on Linux but want to use the same getauxv-based logic, you could conditionally use NotAvailableGetauxval instead.