Operating System - HP-UX
1832444 Members
3358 Online
110042 Solutions
New Discussion

Re: HPUX 11.11, Number of copy on write pages

 
sushaga
New Member

HPUX 11.11, Number of copy on write pages

The problem is 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(). Please help me out.

1 #include
2 #include
3 #include
4 #include
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 }


Thank you,
sushaga
2 REPLIES 2
harry d brown jr
Honored Contributor

Re: HPUX 11.11, Number of copy on write pages

Try this thread on nlist & nlist64:

http://forums.itrc.hp.com/cm/QuestionAnswer/1,,0x987450011d20d6118ff40090279cd0f9,00.html

live free or die
harry
Live Free or Die
sushaga_1
Occasional Contributor

Re: HPUX 11.11, Number of copy on write pages

Thanks harry,

My code is running perfectly fine.