int id, rm_me, maxid;
struct shmid_ds shmseg;
- struct shm_info shm_info;
struct semid_ds semary;
struct seminfo seminfo;
struct msginfo msginfo;
if (type == SHM || type == ALL) {
- maxid =
- shmctl(0, SHM_INFO, (struct shmid_ds *)(void *)&shm_info);
+ maxid = shmctl(0, SHM_INFO, &shmseg);
if (maxid < 0)
errx(EXIT_FAILURE,
_("kernel not configured for shared memory"));
case STATUS:
{
int maxid;
- struct shm_info shm_info;
+ struct shmid_ds shmbuf;
+ struct shm_info *shm_info;
- maxid = shmctl (0, SHM_INFO, (struct shmid_ds *) &shm_info);
+ maxid = shmctl (0, SHM_INFO, &shmbuf);
+ shm_info = (struct shm_info *) &shmbuf;
if (maxid < 0) {
printf (_("kernel not configured for shared memory\n"));
return;
"pages resident %ld\n"
"pages swapped %ld\n"
"Swap performance: %ld attempts\t %ld successes\n"),
- shm_info.used_ids,
- shm_info.shm_tot,
- shm_info.shm_rss,
- shm_info.shm_swp,
- shm_info.swap_attempts, shm_info.swap_successes);
+ shm_info->used_ids,
+ shm_info->shm_tot,
+ shm_info->shm_rss,
+ shm_info->shm_swp,
+ shm_info->swap_attempts, shm_info->swap_successes);
return;
}
-
#include <inttypes.h>
#include "c.h"
lim->shmmni = path_read_u64(_PATH_PROC_IPC_SHMMNI);
} else {
- struct shminfo shminfo;
+ struct shminfo *shminfo;
+ struct shmid_ds shmbuf;
- if (shmctl(0, IPC_INFO, (struct shmid_ds *) &shminfo) < 0)
+ if (shmctl(0, IPC_INFO, &shmbuf) < 0)
return 1;
- lim->shmmni = shminfo.shmmni;
- lim->shmall = shminfo.shmall;
+ shminfo = (struct shminfo *) &shmbuf;
+ lim->shmmni = shminfo->shmmni;
+ lim->shmall = shminfo->shmall;
+ lim->shmmax = shminfo->shmmax;
}
return 0;