class Sys::Proc::System::Freebsd::LibC
The “getprogname()“ and “setprogname()“ functions manipulate the name of the current program. They are used by error-reporting routines to produce consistent output.
These functions first appeared in NetBSD 1.6, and made their way into FreeBSD 4.4.
@see www.freebsd.org/cgi/man.cgi?query=setprogname&sektion=3
Public Instance Methods
Return the name of the program.
If the name has not been set yet, it will return NULL.
“` include <stdlib.h>
const char * getprogname(void); “`
@return [String]
# File lib/sys/proc/system/freebsd/lib_c.rb, line 54 def getprogname function('getprogname', nil, Fiddle::TYPE_VOIDP).call.to_s end
Sets the name of the program to be the last component of the progname argument.
Since a pointer to the given string is kept as the program name, it should not be modified for the rest of the program's lifetime.
“` include <stdlib.h>
void setprogname(const char *progname); “`
@return [Boolean]
# File lib/sys/proc/system/freebsd/lib_c.rb, line 37 def setprogname(progname) function('setprogname', [Fiddle::TYPE_VOIDP]).call(progname.to_s) true end
Protected Instance Methods
Common method binding over system libc
@return [Fiddle::Function]
# File lib/sys/proc/system/freebsd/lib_c.rb, line 63 def function(fname, args = [], ret_type = Fiddle::TYPE_INT) config = { handle: helper.get(:lib_c).dlopen[fname], args: args || [], ret_type: ret_type } Fiddle::Function.new(*config.values) end