Subject: copy-on-write
To: None <tech-kern@netbsd.org>
From: susa gaga <sushaga@rediffmail.com>
List: tech-kern
Date: 04/16/2002 12:10:51
Hi,

I have got a problem with HP-UX 11.11, i want to  know the number 
of copy on write pages, this member (v_cwfaults) is in the 
structure vmmeter in the header file /usr/include/sys/vmmeter.h ,i 
wrote the following
code to access it,i used cnt which is declared in vmmeter.h along 
with the variables rate & sum but it is giving error in system 
call nlist().plz. help me out.

1  #include <stdio.h>
      2  #include <nlist.h>
      3  #include <fcntl.h>
      4  #include <sys/vmmeter.h>
      5  main()
      6  {
      7      struct nlist nl[2] = { { "cnt"} , {"NULL"} };
      8      struct vmmeter cnt;
      9      int fd;
     10      long address;
     11
     12      if(( fd = open("/dev/kmem",O_RDONLY)) == -1 )
     13          printf("\nERROR IN OPENING FILE /dev/kmem \n");
     14
     15      printf("fd is %d\n",fd);
     16
     17      if(( nlist("/stand/vmunix",nl)) == -1 )
     18          printf("\nERROR IN  nlist\n");
     19
     20      address = nl[0].n_value;
     21      printf("\naddress is  %ld\n",address);
     22      printf("\nreturn value of lseek
%ld\n",lseek(fd,address,SEEK_SE
T));
     23      if (read(fd,&cnt,sizeof (struct vmmeter)) == -1 );
     24          printf("\nERROR IN  read\n");
     25
     26      printf("The number of COW pages is :
%ld\n",cnt.v_cwfault);
     29  }