Skip site navigation (1)Skip section navigation (2)
Date:      Mon, 05 May 2003 16:53:26 +0100
From:      Ian Dowse <iedowse@maths.tcd.ie>
To:        Martin Blapp <mbr@FreeBSD.org>
Cc:        cvs-all@FreeBSD.org
Subject:   Re: cvs commit: src/sys/compat/linux linux_ipc.c src/sys/sys syscallsubr.h src/sys/kern sysv_shm.c 
Message-ID:  <200305051653.aa98706@salmon.maths.tcd.ie>
In-Reply-To: Your message of "Mon, 05 May 2003 02:22:58 PDT." <200305050922.h459Mwdu049419@repoman.freebsd.org> 

next in thread | previous in thread | raw e-mail | index | archive | help
In message <200305050922.h459Mwdu049419@repoman.freebsd.org>, Martin Blapp writ
es:
>  Change the semantics of sysv shm emulation to take a additional
>  argument to the functions shm{at,ctl}1 and shm_find_segment_by_shmid{x}.
>  The BSD semantics didn't allow the usage of shared segment after
>  being marked for removal through IPC_RMID.

I had a few incomplete stack-gap patches in this area, so I was
just looking over this change while merging. The shmctl() system
call is unfortunately quite messy to deal with, since its `struct
shmid_ds *buf' argument can point at a different type of structure
(struct shm_info) for some commands. BTW, it seems that these
additional commands (IPC_INFO, SHM_INFO) and also SHM_STAT are not
documented in shmctl(2) so they really only exist for use by the
Linux emulator.

A few comments about these changes:
 - shmctl() now assumes that it can fit a `struct shm_info' into
   `struct shmid_ds buf'. While it does fit now, it would be much
   better to use a union so as not to need this assumption.

 - The `bufsz' argument to kern_shmctl() seems to be unnecessary,
   since callers are required to know already how much space is
   required - they supplied that space. It would be better just to
   have shmctl() switch on the command code and then copyout
   sizeof(struct shm_info) or sizeof(struct shm_info) accordingly.

 - Is the 'if (error) {td->td_retval[0] = -1;}' at the end of shmctl()
   really necessary? The syscall() code should ignore td->td_retval[0]
   in the error case.

Ian



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200305051653.aa98706>