Project Home
Project Home
Wiki
Wiki
Discussion Forums
Discussions
Project Information
Project Info
Forum Topic - KERN_BOOTTIME: (3 Items)
   
KERN_BOOTTIME  
I have written a piece of code to get the kernel boot-time but it returns the error "No such file or directory". Where 
does it try to look this up from ? Couldn't find anything in the documentation.

While browsing for this, saw somewhere about a file called /kernel/boottime. My installation doesn't have a /kernel 
directory.

thanks
Sree.


#include <sys/time.h>
#include <sys/sysctl.h>
#include <errno.h>

int
main  (struct timeval *tv, struct timezone *tz)
{
  struct timeval boot = { 0, 0 };
  int mib[2] = {CTL_KERN, KERN_BOOTTIME};
  size_t size;

  size = sizeof (boot);

  if (sysctl (mib, 2, &boot, &size, NULL, 0) < 0)
     perror ("Boot time : ");
		
 return 0;
}


RE: KERN_BOOTTIME  
There's a boot_time entry in the qtime portion of the system page. See
the docs for SYSPAGE_ENTRY() in the Neutrino Library Reference:

 
http://www.qnx.com/developers/docs/6.4.0/neutrino/lib_ref/s/syspage_entr
y.html

as well as the section on the system page in the Customizing Image
Startup Programs chapter of Building Embedded Systems:

 
http://www.qnx.com/developers/docs/6.4.0/neutrino/building/startup.html#
SYSPAGE_STUFF


Steve Reid (stever@qnx.com)
Technical Editor
QNX Software Systems 
Re: RE: KERN_BOOTTIME  
Thank you.