struct ipc_perm

Gary Jennejohn garyj at jennejohn.org
Thu Jun 19 01:57:11 PDT 2003


Dmitry Sivachenko writes:
> On Wed, Jun 18, 2003 at 06:08:37PM +0200, Gary Jennejohn wrote:
> > 
> > Dmitry Sivachenko writes:
> > > Hello!
> > > 
> > > Is there any reason why struct ipc_perm is not protected by #ifdef _KERNE
> L
> > > in ipc.h?  Is it supposed to be used from userland?
> > > 
> > 
> > It's needed by ipcs.
> > 
> 
> Ah, I see.  It is visible via struct msqid_ds.
> 
> I developed a patch which requires addition of custom field to ipc_perm.
> I am trying to imagine which problems can it cause to userland programs.
> 
> Any ideas?
> 

The usual way to handle this sort of change is to put any new structure
elements at the end so that existing applications don't get confused.
They simply aren't aware the new elements were added.

Of course, this can cause problems when the kernel does a copyout()
using the new size but the application passed a pointer to
storage which can only hold the old, smaller structure.

---
Gary Jennejohn / garyj[at]jennejohn.org gj[at]freebsd.org gj[at]denx.de



More information about the freebsd-hackers mailing list