path: root/src/lib/eina/eina_file.c (follow)
AgeCommit message (Collapse)Author
5 daysesacpe: remove library from treeStefan Schmidt
This has not been used for a while and is not even buildable after our switch to meson. It was a niche to start with given that it needed the PS3 OS to run on. I asked for any remaining users at EDD and on the list but heard nothing. Time to remove. Signed-off-by: Stefan Schmidt <> Reviewed-by: Cedric BAIL <> Differential Revision:
12 dayseina - add portable close all fd's we don't need functionCarsten Haitzler (Rasterman)
close all fd's starting at a given fd and then leving out an exception list specially passed, if any. useful for fork+exec. this uses it in efl's fork+exec paths. @feat
2019-08-11eina file - don't double unlock a lockCarsten Haitzler (Rasterman)
thanks to coverity - found this double unlock path in case of error. fix CID 1403899
2019-07-28eina file - stat generation inexactness supportCarsten Haitzler (Rasterman)
this is a performance optimization. it brings in a "stat generation". for now it's disabled by default so we retain previous behavior. this stops eina file from opening and stating a file every time you open ... it only does it if stat generation is off, or, if the generation changed since the last time it opened that file. this makes cache hits not have a 3 syscall cost (open+fstat+close). this optimizes that lower end of things path. but .. it comes at a cost. if the file changes before generation ticks over (which this forces to tick over every time the loop exits idle by default). now here is something to ask. 1. should we have this on by default and accept the "inexactness" since you can eina_file_statgen_next() before any call that would do i/o to force it to look at the real file stat info... 2. should we tick over every idle enter OR every N idle enters or every frame we render instead? ... i want to avoid getting a timestamp or having a timer interrupt often... so what should we do? at least this introduces the idea, some api's and an env var to turn this on. it definitely cuts down syscalls during things like creation of widdgets or objects in large batches etc.
2019-07-26reduce syscalls on opening files - roll CLOEXEC into openCarsten Haitzler (Rasterman)
on linux open supports() O_CLOEXEC. add test case for this in meson build and ifdef. this rolls 3 syscalls into 1 as we were doing open, then fnctl to get and fcntl to set flags. less syscalls is a good thing as syscalls are not cheap on some architectures or systems. I've seen a syscall on 1 system take 2-3x as long as another and another syscall in the same 2 system comparison take 10x as long. depending on the syscall you may only have a budget of something like 5000 syscalls "per frame" (60fps) before you spend all of your frame time just in syscalls not doing any processing, so we should keep these down if possible and that is what this does.
2019-05-29eina/file: use INFO log level when eina_file_open failsMike Blumenkrantz
Summary: this function is commonly used to detect the existence of files using its return value. for this purpose, printing warnings any time the file cannot be opened is spammy and not very helpful in the context of detecting actual errors. Depends on D8950 Reviewers: devilhorns Reviewed By: devilhorns Subscribers: cedric, #reviewers, #committers Tags: #efl Differential Revision:
2018-11-09eina file - fix unused param warning by marking as unusedCarsten Haitzler (Rasterman)
unsued in some ifdef paths, so mark as such to avouid warning noise
2017-11-30eina_file: make sure we use a stringshare when virtualized.Al Poole
As the filename is now a stringshare, also make sure virtual files use stringshares for the filename! Also when unmapping we still need to test whether it is copied or not as unmap will break on less tolerant architectures. @fix T6449
2017-10-17eina: use a stringshare to store the filename internally.Cedric Bail
2017-10-09eina: comparing less than zero with unsigned long intSubodh Kumar
Summary: Unsigned integer should not be compared to less than zero @fix Test Plan: NA Reviewers: cedric Reviewed By: cedric Subscribers: jpeg Differential Revision: Signed-off-by: Cedric Bail <>
2017-09-18eina file: Ensure populate is safe to callJean-Philippe Andre
This makes sure that the call to madvise is safe. On Linux it's not too much of an issue as checks are made inside madvise, and the worst that can happen is an error is returned (EINVAL). Not great. But if MAP_POPULATE is not present, as is the case on *BSD, then the internal function _eina_file_map_populate() is used for the populate rule. In that case actual data is read and we should make sure not to trigger a segfault or bus error. Also, this makes sure that in case of HugeTLB we actually populate all pages, rather than one page out of 8 (we were jumping by 16Mb instead of 2Mb). Note: Can we get the size of a HugeTLB at runtime? We're assuming 2Mb which might very well not be the case! See: Tested by disabling MAP_POPULATE and observing crashes :) @fix
2017-09-18eina file: Fix map_populate on the global mapJean-Philippe Andre
If eina_file_map_all() is called, the map isn't added to the internal hash "rmap" and so _eina_file_map_rule_apply() would never be called. @fix asa
2017-08-30eina mmap safety - only map zeropages if it's an eina file that sigbusesCarsten Haitzler (Rasterman)
restrict mapping /dev/zero to only eina files having a sigbus reported. the mmap was before all our file access used eina_file i think thus the raw mmap of it. now walk all eina files and find the candidate and only then if it exists flag is as having a faulty i/o backing and map the zerto pages then return, otherwise call abort. more restricted mapping and perhaps a fix for not trapping non-efl issues. @fix
2017-08-02Eina_File: Avoid using munmap() on file->global_map.Guilherme Iscaro
When a virtualized file is created the file->global_map will not point to a mmapped region, thus it's not safe to use munmap() during the file cleanup. Only use munmap() if the file is backed by a FD. Fixes: T5234. Signed-off-by: Cedric BAIL <>
2017-07-07eina_file: fix unmap of unmapped region when Eina_File has copied data and ↵Al Poole
not a map; Summary: This was causing problems on non-Linux architectures as eina_file_real_close unmapped not mapped data. Added a "copied" flag to Eina_File which is set on eina_file_virtualize (on copied data), and tested for when eina_file_real_close does the unmap. I'm surprised Linux allowed this. Certainly all of the BSDs crashed with the previous behaviour. @fix T5479 Test Plan: Example inlcude Rage and Enlightenment Thumb on BSD systems which use eina_file_virtualize with emotion to obtain album artwork. Reviewers: raster, cedric, jpeg Reviewed By: jpeg Maniphest Tasks: T5479 Differential Revision:
2017-04-18eina: use new API eina_file_close_on_exec.Cedric BAIL
2017-02-07eina_file: add eina_file_unlinkIvan Furs
Test Plan: split D4423 - unlink Reviewers: raster, vtorri, an.kroitor, jpeg, reutskiy.v.v, NikaWhite, cedric Reviewed By: cedric Subscribers: artem.popov, cedric, vtorri, jpeg Tags: #windows, #efl Differential Revision: Signed-off-by: Cedric BAIL <>
2016-09-20eina - eina file map populate fallback to use log int not int... for sizeCarsten Haitzler (Rasterman)
this makes the size match other sizes in eina_file. doesn't affect linux but i think bsd's get hit.
2016-09-19eina: populate memory in the right limit.Cedric BAIL
2016-08-25eina: readdir_r has been deprecated.Cedric BAIL
So glibc has decided that readdir_r is hard to use safely and deprecated it this summer. They recommand to use readdir, which was in the past unsafe to use in a multi thread scenario, but is now on most system (and all system we care, including our own implementation in evil). It is basically safe as long the same DIRP is not accessed from another thread. This is true in our code base, so we are fine to go with this. For further reading:
2014-07-14eina: win32 and linux version code are the same. Sharing code is better.Cedric BAIL
2014-07-13eina: call the function, then returnVincent Torri
2014-05-30Remove warning by adding eina_cpu.h which expose eina_cpu_page_size()Guillaume Friloux
2014-02-22eina: reduce log to warning when not found.Cedric Bail
2014-02-21eina: add more debug information when failing to open a file.Cedric BAIL
2013-11-21eina: fix the crash seen by some during rebuild.Cedric Bail
Before this patch, we were unconditionnaly destroying the Eina_File if that one did change on disk. We also make sure that we remove the right entry from the cache if the file did change there.
2013-11-20eina: cleanup file destruction and reintroduce EINA_MAGIC use.Cedric Bail
2013-11-20Revert "eina: fix a possible race condition during eina_file_close."Jérémy Zurcher
it breaks everything This reverts commit 7e8fb93206ee95945bb757267832537c13ab4287.
2013-11-20eina: fix a possible race condition during eina_file_close.Cedric Bail
The lock on the main hash was taken to late (after we took the decision to remove the targeted Eina_File from the cache), this means it was possible to get an Eina_File from the cache that was going to be removed. This patch attempt to fix that potential race condition. Hopefully should fix T461.
2013-11-10eina: use portable infrastructure to detect page size.Cedric BAIL
2013-10-28eina: fix API as we don't and never will touch memory for write in that ↵Cedric Bail
2013-09-02eina: don't try close dummy handle.Cedric Bail
2013-08-27eina: Fix invalid check on Eina_File::global_mapJean-Philippe Andre
global_map is set to MAP_FAILED in case of error after mmap. So, it is initialized to MAP_FAILED and considered valid otherwise. So, we don't want to set the map to NULL or even check again NULL.
2013-08-06eina-file - adapt to bsd version of MADV_REMOVECarsten Haitzler (Rasterman)
2013-07-31eina: add eina_file_refresh().Cedric Bail
2013-07-31eina: add support for in memory only Eina_File.Cedric Bail
2013-07-06eina: add eina_file_map_populate()Carsten Haitzler (Rasterman)
2013-05-08eina: more meaningful message.Cedric Bail
2013-03-15eina: a little bit sleepy, put that in the right file.Cedric BAIL
2013-03-15eina: add evil in.Cedric BAIL
2013-03-15eina: share eina_file_copy code accross platform.Cedric BAIL
2013-03-15eina: improve portability of Eina_File.Cedric BAIL
2013-03-14Revert "eina: improve portability of Eina_File."Daniel Willmann
This reverts commit c002d113f11310b5367bfcd300c0add84bf6f57f. This commit reliably breaks builds with clang. Please test with export CC=clang before you commit again. export CC=clang ./ --enable-multisense && make -j 10 The error Jenkins gets (I confirmed locally): /bin/bash: line 1: 13549 Segmentation fault (core dumped) EFL_RUN_IN_TREE=1 ./bin/edje/edje_cc -id . -fd . -id ./tests/emotion/data tests/emotion/data/theme.edc tests/emotion/data/theme.edj
2013-03-14eina: improve portability of Eina_File.Cedric BAIL
2013-03-13check fchmod existence for portabilityyCedric Bail
2013-03-10efl: use HAVE_FCNTL around call to fcntl.Cedric Bail
2013-02-06efl/eina: fix map leak in Eina_File.Cedric BAIL
SVN revision: 83668
2013-01-14eina: add missing ifdef around splice code.Gustavo Sverzut Barbieri
SVN revision: 82735
2013-01-03efl: eina_alloca.h to simplify alloca() usage.Gustavo Sverzut Barbieri
having to replicate 18 lines per file just to access alloca() is insane. Let's do that in Eina.h and avoid that crap :-/ SVN revision: 82082
2012-12-31oops: remove printfGustavo Sverzut Barbieri
SVN revision: 81943