I need to print out the following values on std-out:
-CPU Type and Model
-Kernel Version
-Amount of time since the system was last booted, in the form dd:hh:mm:ss

This is all on Ubuntu 8.04

I have looked through my Linux Kernel book but it is very vague about how I am supposed to discover these values...It mentions using the Header File include/linux/sched.h and then "in the source code file kernel/sched.c contains a declaration of the form:
struct task_struct * task[NR_TASKS] = { &init_task, };"

But there is no kernel/sched.c file that I can find to use in my program, and I am just quite lost on how to go about coding this program.

If anyone could help me out, point me in the right direction or anything, it would be very appreciated.

Thank you

May be u can get some hint from this thread.
http://www.daniweb.com/forums/thread33551.html

Many of the machine info u can get from the files present in the following folder:

/proc/sys/kernel

Orrrrr you could open a terminal and type uname -a to get most of the info

Well I'm supposed to use the struct that they showed declared in sched.c but there is no sched.c... I am supposed to use it and then point to what I need, example:
task->pid == 1234

I am supposed to "read the task kernel variable"...
Any ideas on how to set up this struct and use it?

Well I'm supposed to use the struct that they showed declared in sched.c but there is no sched.c... I am supposed to use it and then point to what I need, example:
task->pid == 1234

I am supposed to "read the task kernel variable"...
Any ideas on how to set up this struct and use it?

Do you have the source code down loaded for your kernel?

I am getting confused on how I am supposed to code this..could anyone give an example of code that would print out the Kernel Version, CPU Type/Model? I think if I had something to reference then I could get a better understanding of how to do this.

Thank you

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.