shared memory functions

Hi,

I wanted to compile samba 2.2.0 but one file (profile/profile.c) uses
the following
functions, normally in sys/shm.h:

shm_id = shmget(PROF_SHMEM_KEY, sizeof(*profile_h),
IPC_CREAT | IPC_EXCL | IPC_PERMS);

profile_h = (struct profile_header *)shmat(shm_id, 0,
read_only?SHM_RDONLY:0);

if (shmctl(shm_id, IPC_STAT, &shm_ds) != 0) {


maybe shm_ctl() is ok (I didn’t verify) but what can I do with shmget()
and shmat()?


Thanks,
Alain.

System V shared memory is not currently supported. I wrote a
wrapper that maps calls onto posix shared memory at
http://staff.qnx.com/~kewarken which may help. I haven’t tested it
extensively but it seems to work okay…

cheers,

Kris

Alain Bonnefoy <alain.bonnefoy@icbt.com> wrote:

Hi,

I wanted to compile samba 2.2.0 but one file (profile/profile.c) uses
the following
functions, normally in sys/shm.h:

shm_id = shmget(PROF_SHMEM_KEY, sizeof(*profile_h),
IPC_CREAT | IPC_EXCL | IPC_PERMS);

profile_h = (struct profile_header *)shmat(shm_id, 0,
read_only?SHM_RDONLY:0);

if (shmctl(shm_id, IPC_STAT, &shm_ds) != 0) {



maybe shm_ctl() is ok (I didn’t verify) but what can I do with shmget()
and shmat()?



Thanks,
Alain.


Kris Warkentin
kewarken@qnx.com
(613)591-0836 x9368
“You’re bound to be unhappy if you optimize everything” - Donald Knuth

Kris Eric Warkentin a écrit :

System V shared memory is not currently supported. I wrote a
wrapper that maps calls onto posix shared memory at
http://staff.qnx.com/~kewarken > which may help. I haven’t tested it
extensively but it seems to work okay…

cheers,

Kris

Alain Bonnefoy <> alain.bonnefoy@icbt.com> > wrote:
Hi,

I wanted to compile samba 2.2.0 but one file (profile/profile.c) uses
the following
functions, normally in sys/shm.h:

shm_id = shmget(PROF_SHMEM_KEY, sizeof(*profile_h),
IPC_CREAT | IPC_EXCL | IPC_PERMS);

profile_h = (struct profile_header *)shmat(shm_id, 0,
read_only?SHM_RDONLY:0);

if (shmctl(shm_id, IPC_STAT, &shm_ds) != 0) {

maybe shm_ctl() is ok (I didn’t verify) but what can I do with shmget()
and shmat()?

Thanks,
Alain.


Kris Warkentin
kewarken@qnx.com
(613)591-0836 x9368
“You’re bound to be unhappy if you optimize everything” - Donald Knuth

Ok Kris Eric, it seems to be good but I had some problems with my source
file.
I don’t know if you have time but I join the files.
Problems are on line 110 with IPC_PERMS (defined line 29) which expects some
SHM_R and SHM_W.
Line 140, 142, it expect a shm_segsz field in the shmid_ds structure.
Line 150, it expects a smh_nattch field in the shmid_ds structure. I saw that
we can had something in this structure ?! What does it mean exactly?

I made samba 2.2.0 successfully by adding some infos in your shm.h from a
HP-UX shm.h (also joined as HP_UX_shm.h) to make a new shm.h.
I don’t know if your shm.o has to become a library. Anyway, I’ve copied it in
the source/profile directory and I’ve modified the makefile. Maybe not clean
but my Unix experience is very limited.

My goal is to see if this version also leaves these (unavailable) processes.

After some minutes, nmbd, smbd, testparam, swat seem to work correctly ;o)

Thanks,
Alain.