system calls for memory stats

system calls for memory stats

Post by Doug Cowle » Wed, 02 Dec 1998 04:00:00



Here's a very small program that gathers memory stats on an HP.
Can onyone give me the equivalent system call and header file for AIX
4.2?
Thanks,
Dc.

#include <stdio.h>
#include <sys/pstat.h>
main()
{
struct pst_static buf;
struct pst_dynamic dyn;
pstat_getstatic(&buf,sizeof(struct pst_static),1,0);
pstat_getdynamic(&dyn,sizeof(struct pst_dynamic),1,0);
printf("Total  Phys
memory=%dMB\n",buf.page_size/1024*buf.physical_memory/1024);
printf("Total  Virt memory=%dMB\n",buf.page_size/1024*dyn.psd_vm/1024);
printf("Active Virt memory=%dMB\n",buf.page_size/1024*dyn.psd_avm/1024);

printf("Total  Real memory=%dMB\n",buf.page_size/1024*dyn.psd_rm/1024);
printf("Active Real memory=%dMB\n",buf.page_size/1024*dyn.psd_arm/1024);

printf("Free
memory=%dMB\n",buf.page_size/1024*dyn.psd_free/1024);

Quote:}

 
 
 

1. stat system call

I need some info on the "stat" system call. I'm not that familiar with
it.

In my code, I have the following:

int temp;
struct stat my_struct;
temp = stat(filename, my_struct);
printf("File Type: \t\n");
printf("Permissions: \t\n");
printf("Inode Number: \t%d\n", my_struct.st_ino);
printf("Owner ID: \t%d\n", my_struct.st_uid);
printf("File Size: \t%d\n", my_struct.st_size);
printf("Last Accessed: \t%d\n", my_struct.st_atime);
printf("Last Modified: \t%d\n", my_struct.st_mtime);
printf("Last Changed: \t%d\n", my_struct.st_ctime);

Questions:
1. In the structure, how do I determine using st_mode if the file is a
fifo, char special, dir, block special, or ordinary?

2. How do I get the permissions using st_mode?

3. How do I get the access times to display in Date & HH:MM:SS rather
than a really large integer that I get?

2. Linux box as Netware File Server

3. /dev/zero open versus stat system call sequence?

4. help:what is xt? Can I do Motif programming in linux?

5. stat system call

6. how to deny reply to return-receipt request ?

7. having problem using stat() system call

8. MouseMan Logitech Serial Problem

9. Replace stat-linked system call with dynamic one?

10. problems with stat() system call with gcc 2.7.2 under SCO

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

12. How to use open system call in a new system call

13. "Interrupted system call" at "low level" - system calls