As root, I can examine the characteristics of all IPC shared memory segments. But is there a way to see them all that's more straightforward than throwing a Brazillion segment IDs at the wall to see which ones stick, as below?
Code:
#include <sys/ipc.h>
#include <sys/shm.h>
#include <sys/types.h>
#include <errno.h>
#include <stdio.h>
#include <stdlib.h>
int
main(void)
{
int lo_result;
int lo_shmid;
long long lo_long;
struct shmid_ds lo_shmbuf;
for(lo_long=0;
lo_long<0x100000000;
lo_long++
)
{
lo_shmid=lo_long;
lo_result=shmctl(lo_shmid,IPC_STAT,&lo_shmbuf);
if(lo_result==0)
{
printf("got 0x%08X\n",lo_shmid);
}
else
if(errno==EINVAL)
{
/* empty block */
}
else
{
perror("shmctl");
exit(1);
}
}
return 0;
} /* main() */