Open speedingdaemon opened 7 years ago
Yes, polling is supported and it has been tested with libhijack, via fcntl.
I'll push a patch to define LKL_SOCK_NONBLOCK later but in the meanwhile I think you can use LKL_O_NONBLOCK.
Yes. I've used epoll with LKL.
You can just use SOCKNONBLOCK if LKL ones are not defined.
On Fri, Jul 14, 2017 at 12:25 PM, speedingdaemon notifications@github.com wrote:
Trying to port my code: sd = socket(PF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); to: sd = lkl_sys_socket(PF_INET, LKL_SOCK_STREAM | LKL_SOCK_NONBLOCK, 0);
But I don't see LKL_SOCK_NONBLOCK being defined anywhere. Also, has anyone implemented polling using LKL?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/lkl/linux/issues/360, or mute the thread https://github.com/notifications/unsubscribe-auth/AEVfUvO7S9gPOennH_m7lmc6gbcIJoZHks5sN8CagaJpZM4OYpID .
Ok. The reason I asked was because I have a polling server code that works without any issues if I don't use LKL APIs. But when I replaced with LKL APIs, I am getting following error (printed in my application code) with SSL_accept: [ERROR]: FATAL SSL_retcode for OPERATION=SSL_ACCEPT Retcode=5 Error:error:00000000:lib(0):func(0):reason(0)
Here, Retcode=5 corresponds to SSL_ERROR_SYSCALL in OpenSSL.
This is the place (in openssl/ssl/statem/statem.c) that is causing state_machine() to return -1 for SSL_accept call: while (st->state != MSG_FLOW_FINISHED) { if (st->state == MSG_FLOW_READING) { ssret = read_state_machine(s); if (ssret == SUB_STATE_FINISHED) { st->state = MSG_FLOW_WRITING; init_write_state_machine(s); } else { / NBIO or error / <<<<<<<<===== this one goto end; } This is the bt:
Any clue on what am I missing?
I think I found the offending code. But I am not sure why it causes things to break. WIll really help if someone can explain.
This was my working non-lkl code: client = accept(gl_server_fd, NULL, NULL); ret = fcntl(client, F_SETFL, fcntl(client, F_GETFL, 0) | O_NONBLOCK);
The following LKL code didn't let SSL work: client = lkl_sys_accept(gl_server_fd, NULL, NULL); ret = lkl_sys_fcntl(client, LKL_F_SETFL, lkl_sys_fcntl(client, LKL_F_GETFL, 0) | LKL_O_NONBLOCK);
Removing the call to lkl_sys_fcntl() got things working for me. But I dont think that is what I want because my FD won't be NONBLOCKING anymore otherwise.
Can someone please help me understand what might have happened inside LKL that doesn't seem to like call to lkl_sys_fcntl()?
Any clues?
@tavip
Hmm, no idea. Can yoy reproduce the issue without openssl, with a simple server?
Trying to port my code: sd = socket(PF_INET, SOCK_STREAM | SOCK_NONBLOCK, 0); to: sd = lkl_sys_socket(PF_INET, LKL_SOCK_STREAM | LKL_SOCK_NONBLOCK, 0);
But I don't see LKL_SOCK_NONBLOCK being defined anywhere. Also, has anyone implemented polling using LKL?