Review Request 129267: [OS X] emulate posix_fallocate()

René J.V. Bertin rjvbertin at gmail.com
Fri Oct 28 20:03:22 UTC 2016


-----------------------------------------------------------
This is an automatically generated e-mail. To reply, visit:
https://git.reviewboard.kde.org/r/129267/
-----------------------------------------------------------

(Updated Oct. 28, 2016, 10:03 p.m.)


Status
------

This change has been marked as submitted.


Review request for KDE Software on Mac OS X and KDE Frameworks.


Changes
-------

Submitted with commit 606ea66f0338987f040f9b414745b3cc7c8dd6b1 by René J.V. Bertin to branch master.


Repository: kcoreaddons


Description
-------

Mac OS X doesn't have `posix_fallocate()` but as written in the comments, this function can be emulated (at least for simple use with `offset=0`).

This patch introduces such an emulation, based on `mozilla::fallocation()`. There's so little of that function left that it may be overkill to maintain its original copyright statement but I'll leave that to the legalese experts.


Diffs
-----

  src/lib/caching/kshareddatacache_p.h 9fd0bb1 
  src/lib/caching/posix_fallocate_mac.h PRE-CREATION 

Diff: https://git.reviewboard.kde.org/r/129267/diff/


Testing
-------

Works as intended on OS X 10.9.5 as far as I can tell; original file contents were not overwritten in my testing.

The autotest succeeds (with an additional debug statement left out of the patch):

```
> kf5-kcoreaddons/work/build/autotests/kshareddatacachetest 
********* Start testing of KSharedDataCacheTest *********
Config: Using QtTest library 5.6.1, Qt 5.6.1 (x86_64-little_endian-lp64 shared (dynamic) release build; by Clang 6.0 (clang-600.0.57) (Apple))
PASS   : KSharedDataCacheTest::initTestCase()
QWARN  : KSharedDataCacheTest::simpleInsert() void KSharedDataCache::Private::mapSharedMemory() posix_fallocated 5273696 bytes for file "/Users/bertin/.cache/myTestCache.kcache"
PASS   : KSharedDataCacheTest::simpleInsert()
PASS   : KSharedDataCacheTest::cleanupTestCase()
Totals: 3 passed, 0 failed, 0 skipped, 0 blacklisted
********* Finished testing of KSharedDataCacheTest *********
```


File Attachments
----------------

a simple commandline test app
  https://git.reviewboard.kde.org/media/uploaded/files/2016/10/26/e0af195f-b484-4647-b211-cc78b5b0584b__posix_fallocate.c


Thanks,

René J.V. Bertin

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.kde.org/pipermail/kde-mac/attachments/20161028/212556d2/attachment-0001.html>


More information about the kde-mac mailing list