EventReceiver: use Unix domain sockets with socketpair() instead of mkfifo()#580
Open
Frenzie wants to merge 2 commits intokoreader:masterfrom
Open
EventReceiver: use Unix domain sockets with socketpair() instead of mkfifo()#580Frenzie wants to merge 2 commits intokoreader:masterfrom
Frenzie wants to merge 2 commits intokoreader:masterfrom
Conversation
…kfifo() mkfifo seems to suffer from SELinux restrictions with unsafe_app, so it can't be used normally. Given that the code is the way it is, it must've been different on older Android versions. As far as I can find, you can't get around it without compiling a custom Android kernel. This is extremely similar to the approach described in <koreader/koreader#14358 (reply in thread)>, but it seems slightly cleaner. Without this change events like android.intent.action.ACTION_POWER_CONNECTED don't reach the frontend, but I'm primarily interested in TEXT_INPUT from the IME/onscreen-keyboard.
Frenzie
commented
Feb 11, 2026
Comment on lines
515
to
520
| JNIEXPORT jint JNICALL | ||
| Java_org_koreader_launcher_EventReceiver_nativeGetEventSocketFd(JNIEnv* env, jclass clazz) { | ||
| (void)env; | ||
| (void)clazz; | ||
| return g_event_write_fd; | ||
| } |
Member
Author
There was a problem hiding this comment.
The diff looks quite large, but conceptually the only real change is this here, with the associated System.loadLibrary("luajit-launcher") and private external fun nativeGetEventSocketFd(): Int.
Member
Author
Contributor
|
Did you check the native code to see if it's safer to close the FD so the native code doesn't keep a old reference? |
Member
Author
|
I'm not sure if I quite understand what you mean. Some potential issue when the program is shutting down? |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
mkfifo seems to suffer from SELinux restrictions with unsafe_app, so it can't be used normally. Given that the code is the way it is, it must've been different on older Android versions. As far as I can find, you can't get around it without compiling a custom Android kernel.
This is extremely similar to the approach described in koreader/koreader#14358 (reply in thread), but it seems slightly cleaner.
Without this change events like android.intent.action.ACTION_POWER_CONNECTED don't reach the frontend, but I'm primarily interested in TEXT_INPUT from the IME/onscreen-keyboard.
This change is