Repository navigation
Conversation
Author
Heads up: openzim/libzim#1119 (which this PR builds on) reworked its fd exposure after an ABI-break review finding - |
DirectAccessInfo gains an `fd` field. On POSIX it's read via libzim's getDirectAccessFd() (openzim/libzim#1119), which now returns an owned dup()'d fd + offset in one call; getDirectAccessInformation() is deprecated there, so it's used only as the Windows fallback. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
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.
Draft — depends on openzim/libzim#1119, not asking for a merge yet.
Summary
openzim/libzim#1119 added an already-open
fdtozim::ItemDataDirectAccessInfo, populated for both fd-opened and path-opened archives, so callers candup()it instead of reopeningfilenameby path - a reopen that fails withEACCESfor some Android content-provider descriptors (openzim/libzim#852, kiwix/kiwix-android#3636, #3628).Item::getDirectAccessInformation()(used for direct access to large media items) already returns thatfdon the C++ side. This PR wires it through the JNI boundary:DirectAccessInfo.java: newpublic int fdfield,-1when unavailable.utils.h:setDaiObjValue()now also sets thefdfield.item.cpp:dup()s the native fd before handing it to Java, so the Java side owns an independent descriptor rather than one whose lifetime is tied to the underlyingItem/Archive.test.java: assertsdai.fd >= 0alongside the existing filename/offset checks.Why not ready to merge
This repo's build (
install_deps.sh) downloads a released libzim tarball. Until libzim#1119 lands and ships in a release, CI here won't compile clean against it -cDirectObjInfo.fddoesn't exist in the current release'sItemDataDirectAccessInfo. Opening now so the JNI-side change is visible alongside the libzim PR it depends on; happy to hold pending that.Test plan
./gradlew buildHeaderssucceeds (Java side compiles,DirectAccessInfo.fdfield present).item.cppsyntax-checked withg++ -fsyntax-onlyagainst a local libzim build carrying #1119's header changes - compiles clean (confirmed the one pre-existing unrelated warning, ajlong/int64_tmismatch inutils.h'sSetLongArrayRegionon macOS-hosted JNI headers, reproduces identically on the unmodified baseline).Related
getFd()to get file descriptors from Java for Kiwix Android openzim/libzim#852