Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

no support for fcntl? #601

Closed
sxu55 opened this issue Jun 30, 2016 · 11 comments
Closed

no support for fcntl? #601

sxu55 opened this issue Jun 30, 2016 · 11 comments
Labels

Comments

@sxu55
Copy link

sxu55 commented Jun 30, 2016

I found the following code will yield panic output in windows bash:

int flags = fcntl(fd, F_GETFL);
if (flags == -1)
panic("Could not set up async IO");

if (set)
flags |= FASYNC;
else
flags &= ~(FASYNC);

if (set) {
if (fcntl(fd, F_SETOWN, getpid()) == -1)
panic("Could not set up async IO");
}

if (fcntl(fd, F_SETFL, flags) == -1)
panic("Could not set up async IO");

@jackchammons
Copy link
Contributor

jackchammons commented Jun 30, 2016

We do not yet support O_ASYNC and the associated SIGIO signal that would be required for this to work as expected. We have opened a bug for this internally. Thanks for bringing this to our attention.

@stehufntdev
Copy link
Collaborator

@sxu55 can you please let us know what scenario you were trying or if this was a test? Also, do you know what type of file was being used (e.g. socket, pipe, ...)? Signal driven IO can only be enabled on a handful of types and we wanted to make sure we prioritize the ones of interest.

@sxu55
Copy link
Author

sxu55 commented Jan 20, 2017

@stehufntdev I encountered this situation when I tried to run an computer architecture simulator called gem5 in bash. The code that results in this issue is here: http://www.gem5.org/docs/html/pollevent_8cc_source.html
please let me know if you need more information

BTW, I am wondering if the bash in insider preview has much more bugs fixed than the current stable 14393 bash? Several days ago I encountered another issue with scala and sbt not able to run on oracle java 1.8 but can somewhat run on jdk7, but I've not tested it in insider preview version.

@benhillis
Copy link
Member

@sxu55 - The Insider builds have a ton more functionality than the 14393 build. To get an idea of how much has been changed take a look at the release notes.

@sxu55
Copy link
Author

sxu55 commented Jan 20, 2017

perfect. thx

@stehufntdev
Copy link
Collaborator

Thanks for the reply. I looked through the code but it wasn't immediately obvious what type of what type of file was being used. Do you happen to know? If could you please take a strace of the scenario so we can check?

@sxu55
Copy link
Author

sxu55 commented Jan 23, 2017

I don't know.. Since I am currently not working on gem5 anymore, I will find some time later and run strace to collect what you need.

@stehufntdev
Copy link
Collaborator

Sounds great, thanks for the help!

@TheJare
Copy link

TheJare commented Mar 13, 2017

For the record, I just ran into this while using the Termbox-go library for text-mode UI apps (its written in Go, but the code is trivially similar to equivalent C code): https://github.com/nsf/termbox-go/blob/master/api.go#L30, basically:

in = open("/dev/tty", O_RDONLY, 0)
signal(SIGIO, handler)
fcntl(in, F_SETFL, O_ASYNC | O_NONBLOCK)
// And fails here with invalid argument, F_GETOWN also fails:
fcntl(in, F_SETOWN, getpid())

I have public WSL with Ubuntu 14.04, not the insider preview.

@stehufntdev
Copy link
Collaborator

Thanks for the follow-up. WSL does not current support signal driven IO on tty devices, but we are tracking the work. Please give us feedback on user voice for this scenario so we can prioritize - https://wpdev.uservoice.com/forums/266908-command-prompt-console-bash-on-ubuntu-on-windo/.

@therealkenc
Copy link
Collaborator

Brian marked this fixedinsiderbuilds last fall. Closing. If there are still failures in the OP test case (I didn't check), please re-file and we can do a reboot on the issue.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

7 participants