This is the mail archive of the cygwin-developers mailing list for the Cygwin project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: sem_init() fails (when used in a certain way)


On 03/30/2011 02:01 AM, Corinna Vinschen wrote:
> Thanks for clarifying.  We just have to keep in mind to return EINVAL
> rather than EFAULT.
> 
> Btw., glibc does not test the validity of the semaphore at all.  If you
> give an invalid sem pointer to the sem functions, it just crashes:

Which is allowed by POSIX.  In fact, my understanding is that older
POSIX used to require that invalid objects be identified, until Ulrich
argued that there are pathological cases (such as reuse of heap that
already contains contents from a prior pointer) that make such detection
practically impossible in any reasonable amount of time, so POSIX was
intentionally relaxed to no longer require detection of invalid objects
(they are just as undefined as any other use of a bad pointer) in order
to cater to glibc.

-- 
Eric Blake   eblake@redhat.com    +1-801-349-2682
Libvirt virtualization library http://libvirt.org

Attachment: signature.asc
Description: OpenPGP digital signature


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]