System call for current machine load ?

System call for current machine load ?

Post by Marco A. Hernand » Thu, 10 Oct 1996 04:00:00



--
Hi all:

        Under solaris 2.5 which system call would give you the current and
average load on the machine ....

        Any pointers appreciated.

Cheers,

Marco Hernandez

 
 
 

System call for current machine load ?

Post by Vic Abe » Thu, 10 Oct 1996 04:00:00



Quote:

>    Under solaris 2.5 which system call would give you the current and
>average load on the machine ....

Check out the kstat(3K) interface.  I believe load averages are
available in the "unix" module named "system_misc".  Call kstat_open(),
then locate "system_misc" with kstat_lookup().  Use its returned
pointer to kstat_read() the values.  Then use kstat_data_lookup()
to find its "avenrun_1min", "avenrun_5min", and "avenrun_15min"
data.  Treat their value.l contents as doubles and divide them by
1<<8 to get the same numbers that uptime(1) reports.



 
 
 

1. Kernel Extension(system call) loaded but could not call it !!!!

Hi ,
can anybody tell me why I am unable to call my own system call.

/* This is the kernel extension I wrote */

testcall_entry(int cmd, struct uio *uio)
{

   if (cmd == CFG_INIT) {
      if (pincode(testcall_entry) != 0) { /* pin the kernel ext into
memory */
         return(ENOMEM);                  /* report error  */
         }
      }
   else {
      unpincode(testcall_entry);
   }
   return(0);

/* These are the steps I followed to compile the extension */
cc -c -O -qlist -qsource testcall.c
ld -e testcall_entry -T512 -H512 -bI:./testcall.exp -bI:./kernex.exp
testcall.o -o testcall

/* this is a test system call */
int testcall()
{
        return 10;

Yes I did load the kernel extension and it was loaded successfully and
gave me kmid also.

/* This is a sample file to test system call */
main ()

{
        int val = 0;

        printf ("value before testcall %d\n",val);
        val = testcall ();
        printf ("value after testcall %d\n",val);

/* This is what I use to compile this program */
cc -bI:./kernex.exp -bI:./testcall.exp sample.c

/* This is the error it gives  when I run the a.out file */
exec(): 0509-036 Cannot load program a.out because of the following
errors:
        0509-023 Symbol testcall in a.out is not defined.
        0509-026 System error: Cannot run a file that does not have a
valid format.

Nilesh

2. Newbies don't know how to use rexec on HP-UX and Sequent Dynix

3. System call for querying system load?

4. Linux in Flash ROM? Is it Possible?

5. What system call to get current directory in Unix?

6. Net Hang sendmail

7. Can I get info about current filesystem by using system calls?

8. Does mktemp() work in linux?

9. System call on Solaris 2.8 to retrieve current user's password

10. Is there any system calls to get current status of CPU(Sol2.4)?

11. get current processes system call

12. get current system load via kvm_read

13. How I could add a new system call to linux or modify a system calls