I am interesting in writing a simple C program like “sin”. I haven’t found any good kernel API functions for getting processes memory usage. Do you know how to do it ? (maybe you have some C-language examples) ?
Dominik,
Good C-language example you may find in qnx on-line CVS cvs.qnx.com/cgi-bin/cvsweb.cgi/utils/p/pidin/
Also, there was source code of ‘spin’ utility somewhere around. Google it up
Eduard.
Not all functions available in the C library are documented, some are not even declared in the headers. Also some of the devctl()'s to work with the /proc filesystem can carry somewhat more data than the structures suggest. The migration tool from QNX4 to Neutrino (mig4nto), which is freely available for download, has some source codes in it that show you how to get that information. You may also try the Russian QNX site, they have done amazing things.
In that sense, “sin” and friends are NOT simple programs unless you know the tricks.
Since you used word “sin” I assume you are using qnx4.
You can get information about segments mapped into process using qnx_psinfo() system call.
Number of segments is stored in _psinfo.nselectors. Then you can iterate through all segments using qnx_psinfo() again but with different value in segindex argument.
Examine _seginfo.flags to determine whether the segment is shared or not.
The utility “sin” also shows size of ‘microkernel’, this information is available through qnx_osinfo() call in _osinfo.microkernel_size.