Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 11 Feb 1999 16:31:46 +1100
From:      Peter Jeremy <peter.jeremy@auss2.alcatel.com.au>
To:        tlambert@primenet.com
Cc:        hackers@FreeBSD.ORG
Subject:   Re: portability of shm, mmap, pipes and socket IPC
Message-ID:  <99Feb11.162122est.40373@border.alcanet.com.au>

next in thread | raw e-mail | index | archive | help
Terry Lambert <tlambert@primenet.com> wrote:
>If the sem_op is a negative integer, and the absolute value of the
>sem_op is larger than the current value of the semaphore, and the
>value of (sem_flg&IPC_NOWAIT) is false, then the operation is ignored.

As far as I can tell, this is handled correctly.

Looking at v 1.22, this is detected at line 690.  Then follows a debug
statement "can't do it now" and a break.  The break exits the inner
for loop (ending at line 717) whick is working thru all the semops
passed in.  Since we haven't made it through all the semops, we fall
through lines 725-746, unwinding any partially commited operations.
Then there's a tsleep() on semaptr (which is the semaphore
descriptor).  If the tsleep returns normally, the whole thing is
repeated courtesy of the for loop covering lines 671-786.

The tsleep is woken up by a semctl() with IPC_RMID, SETVAL, SETALL,
or a semop() or semexit() that up's any semaphores in that descriptor.

>Oh yeah; while I'm at having to prove someone else's bug report is
>a valid bug report, it's supposed to return EIDRM instead of EINVAL;
>contrary to the comments at ~ line 770, BSD *does* define this value.
>I'm pretty sure no one has bug reported that, though...

EIDRM was added (I believe by sos) sometime after 2.2.6.  It's only
used by sysv_msg.c and sysv_sem.c - and from what I can see, the code
is all protected by #ifdef EIDRM's, so the code should work correctly,
whether or not EIDRM is defined.  Someone with commit priv's just
needs to remove the comment saying it doesn't exist.

Peter

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?99Feb11.162122est.40373>