#include #include #include #include #include #include #define O(s,m) printf("offsetof(%s, %s)==%zd\n", #s, #m, offsetof(s,m)) int main() { O(struct semid_ds, sem_perm); O(struct semid_ds, sem_otime); O(struct semid_ds, sem_ctime); O(struct semid_ds, sem_nsems); O(struct shmid_ds, shm_perm); O(struct shmid_ds, shm_segsz); O(struct shmid_ds, shm_atime); O(struct shmid_ds, shm_dtime); O(struct shmid_ds, shm_ctime); O(struct shmid_ds, shm_cpid); O(struct shmid_ds, shm_lpid); O(struct shmid_ds, shm_nattch); O(struct msqid_ds, msg_perm); O(struct msqid_ds, msg_stime); O(struct msqid_ds, msg_rtime); O(struct msqid_ds, msg_ctime); O(struct msqid_ds, msg_cbytes); O(struct msqid_ds, msg_qnum); O(struct msqid_ds, msg_qbytes); O(struct msqid_ds, msg_lspid); O(struct msqid_ds, msg_lrpid); O(struct stat, st_dev); O(struct stat, st_ino); O(struct stat, st_mode); O(struct stat, st_nlink); O(struct stat, st_uid); O(struct stat, st_gid); O(struct stat, st_rdev); O(struct stat, st_size); O(struct stat, st_blksize); O(struct stat, st_blocks); O(struct stat, st_atim); O(struct stat, st_mtim); O(struct stat, st_ctim); }