Vergoz Michael said at 21:18 22-7-2002:

> > Currently sysvsem.c is incompatible with FreeBSD and when a semaphore is
> > removed it crashes (using the example code in the notes for the
>documentation).
>
>are you sure that your fbsd kernel is configured for ?

Yep - recompiled the kernel, with the values from i386/LINT as well as the
suggestions made below (which I recall from the PostGres docs ? :-)).
The problem is only with the removal - the rest of that code runs fine.

I traced it to the IPC_STAT entry just before that.

If un is passed as a pointer, it's changed by sem_ctl corrupting any subsequent
calls to sem_ptr properties - notice the null pointer on this_ptr vs. a valid
address on sem_ptr and the problem with calls to sem_ptr->semid.

Passing un as a copy, fixes the issue, however I'm left with 20 bytes of memory
unfreed:
sapi/cli/php -f ./test_sysv.php
Start.
Got semaphore 4.
Success aquire semaphore 4.
Success to attach shared memory : 5.
Write var1 to shared memory.
Write var2 to shared memory.
Read var1=Variable 1.
Read var2=Variable 2.
Semaphore 4 released.
Shared memory successfully removed from SysV.
semaphore removed successfully from SysV.
End.
/home/mdev/cvs/php4/ext/sysvsem/sysvsem.c(269) :  Freeing 0x082945A4 (20 
bytes), script=./test_sysv.php

I've tried freeing un and buf, but they're not the issue.

Any advice on what isn't freed, is appreciated :-)

All in all - this makes detection of what to pass on what platform, quite a bit
harder, as FreeBSD will accept a pointer to IPC_STAT during compilation and 
even
run it, but then corrupts the whole thing.


>check :
>options         SYSVSHM
>options         SHMMAXPGS=8192
>options         SHMSEG=1024
>
>options         SYSVSEM
>options         SEMMNI=1024
>options         SEMMNS=2048
>options         SEMMNU=1024
>options         SEMMAP=1024
>
>----- Original Message -----
>From: "Melvyn Sopacua" <[EMAIL PROTECTED]>
>To: "Derick Rethans" <[EMAIL PROTECTED]>
>Cc: "PHP QA Team" <[EMAIL PROTECTED]>
>Sent: Monday, July 22, 2002 9:03 PM
>Subject: [PHP-QA] ext/sysvsem/sysvsem.c / Bug #17785 / PHP 4.2.3
>
>
> > Hi,
> >
> > As a follow-up on my message for bug #17785, I'm not sure whether we can
> > get this fixed, especially since I haven't heard/seen from the original
> > developers
> > of the extension on this issue.
> >
> > Currently sysvsem.c is incompatible with FreeBSD and when a semaphore is
> > removed it crashes (using the example code in the notes for the
>documentation).
> >
> > This does not happen with BSD/OS and looking at the man page for FreeBSD,
> > the passing of the union semun to sem_ctl is dependant on the command
>issued.
> >
> > SO - all in all - this will need proper attention and testing on different
> > platforms,
> > and I'm not sure there's enough time.
> >
> > Let me know what you would like to do with it.
> >
> >
> >
> > Met vriendelijke groeten / With kind regards,
> >
> > Webmaster IDG.nl
> > Melvyn Sopacua
> >
> > <@Logan> I spent a minute looking at my own code by accident.
> > <@Logan> I was thinking "What the hell is this guy doing?"
> > http://www.geekissues.org/quotes/top50.html?6824
> >
> >
> > --
> > PHP Quality Assurance Mailing List <http://www.php.net/>
> > To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
>---
>Incoming mail is certified Virus Free.
>Checked by AVG anti-virus system (http://www.grisoft.com).
>Version: 6.0.377 / Virus Database: 211 - Release Date: 15-7-2002

Met vriendelijke groeten / With kind regards,

IDG.nl
Melvyn Sopacua
Webmaster


-- 
PHP Development Mailing List <http://www.php.net/>
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to