[fpc-pascal] Linux IPC (SHM) : Getting Strange Value for shm_nattch (# of attachements)

Henry Vermaak henry.vermaak at gmail.com
Thu Oct 15 11:21:15 CEST 2009


2009/10/13 Tom__G <tom at guilleminot.org>:
>
> Hi,
>
> I try to get number of processes attached to a specific shared memory
> segment.
> So I read the shmctl record to retrieve this into shared memory :
>
> type TShmid_ds = record
>  shm_perm: TIPC_Perm; Permissions
>  shm_segsz: cint; Segment size
>  shm_atime: time_t; Last access time
>  shm_dtime: time_t; Last detach time
>  shm_ctime: time_t; Create time
>  shm_cpid: ipc_pid_t; Creator PID
>  shm_lpid: ipc_pid_t; Last operation PID
>  shm_nattch: Word; Number of attachments  <--<< !
>  shm_npages: Word; Number of pages
>  shm_pages: Pointer; ?
>  attaches: pointer; ?
> end;

This definition differs from the one I've got in
/usr/include/bits/shm.h, where shm_nattch is defined as "unsigned long
int", so you may want to look into that.  I haven't tried this myself,
so sorry if I'm barking up the wrong tree...

Henry



More information about the fpc-pascal mailing list