Subject: Re: 1.3.3: fcntl F_{SETOWN,ASYNC} seems broken?
From: Pavel Tsekov <[email-masked]>
To: Rony Shapiro <[email-masked]>
Cc: [email-masked]
Date: Mon, 15 Oct 2001 10:28:42 +0200

Hey, Rony :)

Rony Shapiro wrote:

EINVAL is returned in case of invalid argument being passed
to the function called - in this case fcntl. So I'd say that
F_SETOWN is not implemented in cygwin's fcntl :)

Look below :)

  switch (cmd)
    {
	// [snip]
	// Here cygwin processes supported operations
    default:
	// This is what happens to you :)
      set_errno (EINVAL);
      res = -1;
      break;
    }

Btw more info on the subj:
http://sources.redhat.com/cgi-bin/cvsweb.cgi/src/winsup/cygwin/fhandler.cc?rev=1.94&content-type=text/x-cvsweb-markup&cvsroot=src

This is the source in cygwin handling fcntl.

> Here's the code fragment that seems to be the problem, symptoms in comments:
> 
> void
> FileSetFd (int fd)
> {
>     int flags;
> 
>     fcntl (fd, F_SETOWN, getpid()); // This return EINVAL
> 
>     flags = fcntl (fd, F_GETFL);
>     flags |= F_ASYNC|F_NOBLOCK;
>     fcntl (fd, F_SETFL, flags) != 0); // This succeeds, but has no effect
>     { // Tried the following based on something I found in the cygwin mail
> archive,
>         // to no avail.
>       int yesplease = 1;
>       ioctl( fd, FIOASYNC, &yesplease );
>     }
> }
>

--
Unsubscribe info:      http://cygwin.com/ml/#unsubscribe-simple
Bug reporting:         http://cygwin.com/bugs.html
Documentation:         http://cygwin.com/docs.html
FAQ:                   http://cygwin.com/faq/