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: https://lwn.net/Articles/696474/
So actually there is quite a big issue with semaphores
on OSX. We use (named) POSIX semaphores, but this was
a (my) mistake... I'll fix it later...
The real issue is that named semaphore are persistants:
when the program dies, it stays alive. This is pretty
bad with eina_debug_monitor because we create a semaphore
we never release, due to a wild thread...
This leak of semaphores went unnoticed before commit
4a40ff95de because the
name of the semaphore was unique per process, and
overriden when another process was launched. This
was very bad, but saved us from overflowing the
semaphore pool. It is now overflowed pretty fast when
building a lot EFL, because of Eolian that runs A LOT!
So that's one problem that still needs to be fixed,
by using OSX' own semaphores (see T4423).
Another big issue, which is now fixed is that the
buffer in which we generated the semaphore ID was
too small, and therefore we were reduced to one shared
semaphore for a whole process... This buffer has been
now set to 31 characters, which seems to be the maximum
length of a semaphore ID.
So now things are better, but still with a deadly issue.
As pointed out in the mailing list, it was introduced in this release,
so it's better to remove the symbol instead of deprecating it.
People should use ETIMEDOUT directly.
So, first, the wrong strerror_r() was detected on
Mac OS X. Instead of using a complex set of macros
to try to detect which strerror_r() to use, when
it is defined, let the autotools handle that clerverness
for us.
we have some duplication of errors between Eina_Error and errno.h,
however we should use Eina_Error to extend the traditional errno.h
system.
then change eina_error_msg_register() and
eina_error_msg_static_register() to return a magic bit to state the
number was registered, and on other functions test this bit in order
to operate on registered values, otherwise fallback to errno.h, such
as strerror().
It also deprecates 2 clear duplicated errors:
- EINA_ERROR_OUT_OF_MEMORY -> ENOMEM
- EINA_ERROR_TIMEOUT -> ETIMEDOUT
There are two details when using strerror():
- old behavior did not return strings for non-error, such as
"Success" or "Unknown error ${N}"
- thread-safety issues: since we must be thread safe, then use
strerror_r() and eina_stringshare_add() that value, keeping a hash
of cached values
So it may be used outside EO (eina error is what I have in mind).
I believe it doesn't need to be redefined in all EFL libs, especially
since it's not used on Windows yet.
This reverts commit d19cd4e63c.
This causes a SIGBUS error on OpenBSD when closing any application. As this
was safety patch only I will revert it for the 1.18 release and we can work
out what breaks OpenBSD here for 1.19
Fixes T4332
Without this I get errors from the clang compiler used on Travis for some OSX
builds:
../src/lib/eina/eina_inline_lock_posix.x:845:27: error: use of undeclared identifier 'getpid'
we don't give any debug or info if a module in a list fails to load.
we should at least offer debug info. do that. this fixes coverity
issue CID 1039687
fixes CID 1361219
if you had an env var a few gb in size or we had stuff in the last bit
of memory address space this might be an issue, but that won't happen.
@fix
fixes CID 1361220
in theory yes end minus start could be insanely huge or end be very
high in memory thus causing an overflow. this would have to be in the
last few bytes of memory space, so it never going to happen. and the
input from the env var has to be sane anyway as its user controlled.
@fix
the way eina does sempahores, they can NEVER be sensibly shared
cross-process portably. so enabling sharing is a pointless idea. in
fact some os's like openbsd check if the sempahore addres is in a
sharable mem region and deny init if it is not. on osx you dont use
shared memory but a sempahore name you share instead... and this is
not exposed thus it can't be shared either. if we did process sharable
semaphores we'd make shm segments and/or name them in a sharable way
were you can share the idenitifer of the shm segment and/or the offset
address or name from osx. but we don't, so making them
process-private is the right thing. sharable sempahores will need a
whole new api.
this also fixes osx naming to make the name pretty unguessable/private
and opened exclusive (or it fails) by using pid, sem counter, and 4
random numbers. it's not a security mechanism as the create will fail
if there is a clash. chances are low. we unlink before anyway. good
enough for osx for now.
@fix
Coverity reports that eina_safepointer_get returns a NULL promise here
(checked 20 out of 21 times). As eina_safepointer_get can return NULL,
we should check the validity of 'promise' here before trying to
derefernce it later.
Fixes Coverity CID1356625
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
there was a leak of elements on the itrator stack when the stack was
flushed still having some items on it, thus losing their pointers and
never freeing them.
@fix
I guess the overflow was badly handled. Fixing it by using
explicit int intermediate value.
Fixes CID 1356616 and 1356619:
Operands don't affect result
Logically dead code
so. on linux signals are delivered to the main process thread/loop.
thats' where signal handlers are set up and always run. this is sane.
it's predicatble. but of course this is not the same in bsd land.
there "just send the signal to any old thread and call the signal
handler there" seems to tbe the order of the day. this explains why
wer are losing sigchld signals in edje_cc - it's heavily threaded and
bsd is just randombly picking a thread to call it on.
this fixes that. in theory. i hope. i can't test, but putting it in to
share
@fix
This is a reccurring compatibility issue...
MAP_ANONYMOUS is not defined on OSX, but MAP_ANON is.
I know MAP_ANON is marked as deprecated in the Linux man
pages, but it has the benefit of being more portable.
This is heavily inspired from Eo_Id infrastructure. Main change
are that the lower bit are always guaranteed to be zero and ignored
by all function. Also it may be a little bit less efficient in some
case, but we will tune it once we have real life usage of it.
Eo won't be migrated for 1.18 to it as Eo_Id is deeply integrated
and it is quite risky to touch it so close from a freeze. This can
wait.
In case of failure within eina_lock_new() (posix), a
pthread_mutexattr_t would have been left in an initialized state,
without any deinitialization being called.
Consequences would have been implementation defined.
DragonFlyBSD has pthread_setname_np but no pthread_setaffinity_np;
we still need to include pthread_np though.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Cancelling a promise will fulfill it but won't actually free the memory. This
memory is under custody of the owner, who must either call value_set or
error_set to finish it.
Now when dealing with pointer types, we will not get pointer to
pointer semantics in callbacks and eina_promise_owner_value_set
for Eina_Promise.
It will work as expected:
Eina_Promise_Owner* promise = eina_promise_add();
void* p = malloc(sizeof(T));
eina_promise_owner_value_set(promise, p, &free);
The call to eina_promise_then steals the first ref'count, so it is
possible that the promise is freed after the eina_promise_then,
so we need to eina_promise_ref before eina_promise_then.
We do properly unref promise while calling all the then callback. There
is no need to check it a second time (which actually lead to a 100%
bad access).
T3759
Eina_Error is not passed by pointer anymore, which could cause invalid
pointer access in promise compositions (all and race).
Also added Eina_Promise* to prototypes.
this fixes T3638
@fix
a note... thanks so much to aerodynamik for spotting this. i'm rather
surprised coverity didn't spot this... unless someone said to "shut up
coverity you're wrong" and they should not have.
i also might have expected compilers to spot this too... and add a
warning.
anyway ... this was a seriously subtle bug that could have caused all
kinds of havoc in efl. keys that are different may be compared to be
the same. it could get ordering wrong and sorting thus maybe insert
keys that cannot be found anymore and oh so much more besides.
rthis replaces double a == double b with a macro that keeps a close
enough range using epsilon (which is the error range for a dobule).
this fixes T3245
this should fix T3245
this is basicall where we go double a == double b and due to precision
issues this may not always be right, but this means that the
equivalent now checks for "really close values" rather than perfectly
exact.
@fix
This is done on an attempt to permanently fix our Windows port. Windows
doesn't have MIN/MAX, so we should always do a ifndef/define in every
piece of code that use it. Of course we always forget and it take times
to notice and fix. We have over the year added it in many private
headers, but as the issue continue to raise again and again, I prefer
to get this fixed in our main header.
Added eina_promise_race function that composes multiple
promise objects into a new promise which is fulfilled
when one of the promises are fulfilled, or fails
when one of the promises have failed.
Add a way for users of the promise owner to get notified when a
promise progress is registered. Also added a convenience composition
function that creates a promise which is fulfilled when another
promise has a progress notification.
So it seems we are using Eina_Hash_Iterator quite a lot more than before.
This lead to a huge amount of alloc/free of Eina_Rbtree_Iterator that
was noticable in Enlightenment callgrind trace. This patch make it vanish
from the trace :-)
Fix value_set and error_set signatures which were receiving a
owner. They actually receive the promise and not the owner, this
caused wrong access to memory and were not visible by warnings because
the functions are casted.
This problem caused errors in which it seemed that promise had
actually error'ed when questioned it.
Modify the way hooks are defined and used by promise generation in
Eolian in the Eo API.
Instead of passing macro names as parameters to EO_FUNC_BODY macros,
just re-define the actual hooks when it is needed.
xdg runtime dir is NOT a tmp dir in the normal sense. it's not world
writable nor world readable. only for the user. using
eina_environment_tmp_get() would imply that it is a regular tmp dir,
not a per-user private only runtime dir. that is something else
entirely.
@fix
Add a promise object to allows Eolian interface to include promises
as a way to have asynchronous value return and composibility.
The usage is like this in a .eo file:
class Foo {
methods {
bar {
params {
@inout promise: Promise<int>;
}
}
}
}
Which will create the following API interface:
void foo_bar(Eo* obj, Eina_Promise** promise);
and a Eina_Promise_Owner for the implementation, like this:
void _foo_bar(Eo* obj, Private_Data* pdata, Eina_Promise_Owner* promise);
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
Add a promise object that will allows Eolian interface to include promises
as a way to have asynchronous value return and composibility.
To understand better, let see the coming usage in a .eo file:
class Foo {
methods {
bar {
params {
@inout promise: Promise<int>;
}
}
}
}
Which will create the following API interface:
void foo_bar(Eo* obj, Eina_Promise** promise);
and the equivalent declaration for implementation.
However, the API function will instantiate the Promise for the user
and the implementer of the class automatically. So the user of this
function will treat it as a @out parameter, while the developer of the
function will treat it like a @inout parameter.
So, the user will use this function like this:
Eina_Promise* promise; // No need to instantiate
foo_bar(obj, &promise);
eina_promise_then(promise, callback);
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
Summary:
Use aditional temporary vector for intermedia results in case output vector
the same as target vector in functions:
eina_vector2_transform,
eina_vector2_homogeneous_direction_transform,
eina_vector3_cross_product,
eina_vector3_transform,
eina_vector3_homogeneous_direction_transform
It was in original version (in evas_vecN, module evas_3d_utils.h)
Enrich test suit for this case.
Reviewers: jpeg, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D3795
Signed-off-by: Cedric Bail <cedric@osg.samsung.com>
This reverts commit 7f4ea1a79c.
This reverts one of three parts of the try to get sub directory
compilation back into eina. It breaks our distcheck though and I
talked to Cedric about it and he prefers to revert these as we might
need to go another route to bring this functionality back. Details
will come to the mailing list.
This reverts commit 1affc60d00.
This reverts one of three parts of the try to get sub directory
compilation back into eina. It breaks our distcheck though and I
talked to Cedric about it and he prefers to revert these as we might
need to go another route to bring this functionality back. Details
will come to the mailing list.
This reverts commit e26fcbb1dc.
This reverts one of three parts of the try to get sub directory
compilation back into eina. It breaks our distcheck though and I
talked to Cedric about it and he prefers to revert these as we might
need to go another route to bring this functionality back. Details
will come to the mailing list.
This iterator is convenient when you already have a C-Array and you
need to pass this array to a function receiving an Eina_Iterator.
int array[] = {1, 2, 3, 4};
int* array2[] = {&array[0], &array[1], &array[2], &array[3], NULL};
Eina_Iterator* iterator = eina_carray_iterator_new((void**)array);
so the spinlock on the threadqueue block pool it taken on shutdownn,
while the block pool is freed up then its is destroyed, but openbsd
very much doesnt like this and returns an error, so release the lock
before destroying it.
@fix
Before this patch, eina_log would simply record a non-formatted
entry like:
unknown domain -1, original message format 'proxy=%p, obj=%p'
This was not very useful as even if the log domain is invalid, the
message itself might be relevant (often those are ERR logs).
Now the message format is roughly the same as the default format,
except that the line info comes from the original message (and
doesn't refer to eina_log.c).
Backtrace printing will happen at the same level as the original
log level, in order to avoid log pollution in case DBG logs are
printed with an invalid domain (and CRI would trigger bt).
I actually wonder if the logs shouldn't actually be forwarded
to the standard log callback instead of just stderr. This may
be useful for logging with dlog or journald (atm we will simply
lose all logs without a valid domain). This would mean eina_log
itself requires a log domain.
applying this optimization to prevent the same rectangle from being added
or removed repeatedly in succession would result in the rejecting of successive
operations of the same type when the other operation occurred in between.
as an example:
add(0, 0, 100, 100)
del(0, 0, 100, 100)
add(0, 0, 100, 100)
should yield (0, 0, 100, 100), not zero rects and a failure to add the
second rect
this fixes a serious issue in enlightenment where stacking three windows
on top of each other with the first and third windows having the same geometry
would result in the top window receiving no input geometry (oops)
@fix
The prototype means "unspecified arguments". However, the implementation
specifies no parameters (void).
GCC's warning -Wstrict-prototypes complains a lots about this old-style
prototype, spamming the console when compiling more than one compiling
units including Eina.
@fix
If the template is a path, mkstemp and mkdtemp would fail
miserably as they would try to create a file inside
/run/user/1000//path/to/file.XXXXXX even if the path did not
exist.
This patch fixes that by creating temp files inside the sys temp
dir iif the templatename is just a basic name without path
separator.
@fix
We have to use void in a function declaration if we want no function
parameters. Using just empty parenthesis means the function takes an
unspecified number of parameters.
Summary:
Fixes T2949.
In the bug, its been mentioned about updating the documentation, so added this.
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
Reviewers: cedric, jpeg
Reviewed By: jpeg
Maniphest Tasks: T2949
Differential Revision: https://phab.enlightenment.org/D3462
The main reason is convenience for debugging when using GDB,
this will give a simple breakpoint for all safety check failures.
Also, this creates a more visible log domain (red).
The EINA_LOG_BACKTRACE thing is aimed at production environments,
so we can extract a backtrace from a log file post-mortem, but not
for continuous development of EFL itself.
I know this should make a few people happy.
Most eina log env vars mean "if loglevel <= val then print log"
but eina_log_backtrace was "if loglevel < val" which I thought
was a bit confusing. The default behaviour is unchanged.
Eina Value Optional can be used to create a eina value that can be set
or be empty and can be embedded in a eina_value_struct.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
Related to T2287.
Log lock errors (printf to avoid eina_log locks) and continue or abort,
conditional on EINA_HAVE_DEBUG_THREADS.
Reviewers: raster, cedric
Subscribers: stefan_schmidt, cedric, seoz
Differential Revision: https://phab.enlightenment.org/D2376
Note - fixed review comments on macro names and some formatting and
error strings too - raster.
Summary:
I have put the common encoding code in the common function. The 2 API's
call them with a flag. Thinking of doing the same way to decode
function also.
T2880
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
Reviewers: cedric, jpeg
Differential Revision: https://phab.enlightenment.org/D3414
This caused functions from eina_util to be undefined at compile time.
The compiler would make implicit casts of return values into ints,
which had major side effects (e.g. segfault edje_cc)
@fix
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
We had this nice shortcuts for multiply and inverse with the identity matrix.
Pity we never used it! The EINA_MATRIX_TYPE_IDENTITY is coming from an enum
without and direct assignments to its internals. Being the first item in the
enum it is most likely will be 0 which makes the whole bitwise AND zero and thus
the optimized path will never get called. If our compiler now decides hew wants
to handle enums differently and does not assign the 0 to the first item this
bitwise operation will be even more screwed. What we really want is to check is
if the type we get for the matrix matches EINA_MATRIX_TYPE_IDENTITY. So better
do this. Made me look into matrix multply and inverse. Fun!
Thanks to smatch for poiting this out.
Required some special treatment to get words (substring) out of an
input Unicode string to a utf8 one. This saves the trouble converting
the whole string: you input an offset in the Eina_Unicode array, and
provide the required length. That's is, now you can extract words and
whatnot in utf8 form.
To save code I wrapped the original one to get the whole length.
Summary:
This API is analogous to c++ substr. It returns a Eina_Strbuf with
substring of passed buf.
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
Reviewers: cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D3224
This is useful when Eo calls it to get the current frame stack.
This improves the performance of this function by ~50% which meant
from ~3% total CPU time to ~1.5% CPU time (if called at each eo_do).
Now this patch is a bit irrelevant since eo uses __thread instead.
This optimization is still useful for evas_eglGetCurrentXXX.
Summary:
Add new API eina_strftime API in eina_str
@feature
Test Plan: test case and example also updated
Reviewers: tasn, cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D3148
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
Add eina_tmpstr_manage_new, eina_tmpstr_manage_new_length APIs, these APIs create new tmpstr but reuse the input string memory.
@feature
Test Plan: Test case and example updated
Reviewers: tasn, cedric
Reviewed By: cedric
Differential Revision: https://phab.enlightenment.org/D3178
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
This API would be used in efl_network_websocket.
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
Reviewers: cedric
Differential Revision: https://phab.enlightenment.org/D3200
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
This is not an ABI break as we never did provide the broken name symbol, just a typo
in the header that wasn't detected until now.
@fix
Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>
Reviewers: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D3248
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This reverts commit 22b45f220c.
eina_file_cleanup always does an eina_tmpstr_del. This is now capable of doing
double or even triple free in some case.
lib/eina/eina_util.c: In function 'eina_environment_tmp_get':
lib/eina/eina_util.c:96:7: warning: 'tmp' may be used uninitialized in this function [-Wmaybe-uninitialized]
if (!tmp) tmp = "/tmp";
^
Summary: If we do not include unistd.h, we end up with implicit
declaration warnings when compiling
@fix
Signed-off-by: Chris Michael <cp.michael@samsung.com>
This reverts commit 05c18876b3.
i endabled backtraces by DEFAULT because it is otherwise pretty damned
hard to get them from things like enlightenment, or on tizen apps as
running them on the cmdline and having them work is close to
impossible. yes it's noise. FIX THE ERRORS then. this commit is just
like turning off gcc etc. warnings because the code is too noisy in
compilation with them on. it's a bug. fix it. the bt lets you do that
without gdb or re-executing AGAIN with an env var and HOPING to find
the bug the next time around.
not to mention efl programming docs cover this backtrace and say it
is on by default and how to get useful info out of this. this makes
the elf docs a lie by removing what is documented as default.
@fix
Summary:
@feature
Test Plan:
eina_tmpstr_strftime API can be used to create a temporary string
which is updated with strftime output
eina_tmpstr_steal can be used to get actual string set in eina_tmpstr
Reviewers: cedric
Subscribers: rajeshps, cedric, govi
Differential Revision: https://phab.enlightenment.org/D3048
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
added support to set thread names for debugging. this wraps the gnu
extension to set a thread name of up to 15 chars (16 inc nul byte).
eina_thread_name_set() is the new api.
@feature
in the process i found the autofoo wasnt enabling cpu affinity support
at all in reality, so i had to fix that at the same time.
Summary:
Check for valid rectangle
If any dst or src rectangle has zero width or height,
intersection should not return true.
@fix
Test Plan: Added test cases
Reviewers: cedric, herdsman, Hermet
Reviewed By: Hermet
Subscribers: shilpasingh, cedric
Differential Revision: https://phab.enlightenment.org/D2990
eina_str_join() is used a lot to contatenate paths, but the
separator should be '\' on Windows. So add 2 API and 2 defines for
more cross platform code
@feature
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
We mostly use in our code base ERR in conjunction with system related error. This
doesn't require any information from who did call that function to get debugged and
is creating way to much noise with little value.
Summary:
Implemenation of eina_matrix3_quaternion_get function
Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>
Reviewers: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2786
This was a function I forgot to finish implement. Thanks Vivek to take care of it.
As it comes with a test case, is self contained and fix a missing bit of code I will
push it at this point in time of our release process. Sorry everyone for that late push.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Failing to load a module that does not exist is indeed not an error,
but failing to load a module that exists on disk happened probably
because of an error like "symbol not found".
Considering eina_module is most likely used by EFL itself, I believe
an internal linking failure is a warning worth reporting.
it is not an error. eina_module may be used on files that don't exist
and the caller may handle that as a "does not exist" error. it is not
good to go spewing out errors for this. it's debug at best.
@fix
The tag identifier should not be inside of the string "~".
Previous logic doesn't care that scenario,
the parser context can be corrupted and it will be no more useful.
@fix
@fix - this fixes eina sephamore lock/wait to not return just because
of a signal sent to the process - try again if the semaphore wait is
interrupted by a signal as opposed to a semaphore wakeup.
Summary:
When dlopen() fails, eina_module_load() print error information using dlerror().
But, it is printed with WRN. If EINA_LOG_LEVEL is lower than WRN,
application developer is hard to see which has a problem.
Reviewers: woohyun, Hermet, raster, cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2536
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
@fix
this fixes the cpu count to count the numebr of available cores
correctly. before if core 0 happened to be off, we'd get 0 cpu cores
available due to the break
Summary:
Currently eina_inarray_search was using binary search to search elements
which would not work on unsorted array so modified it to work as linear search.
There is already a function eina_inarray_search_sorted to work on sorted array.
Signed-off-by: Vivek Ellur <vivek.ellur@samsung.com>
Reviewers: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2501
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Using EINA_LOG_LEVEL=4 for standard debugging has now become
absolutely horrible (and slow!). Backtraces may make sense in
case of ERR and CRI messages, but are just pollution for other
levels.
WRN could be argued over but the old env variable is still there
so just use it if you want backtraces:
$ export EINA_LOG_BACKTRACE=2
In eina_debug.h we only include the eina headsers when all defines are true
for backtrace, dlopen, unwind, etc. We still use Eina_Bool here when these
cases are not met. I just hit this case and failed the build.
this makes eina_log give bt's for all error logs. this is very useful
in finding just where a problem happens. the problem int he past is
that these have not been too useful due to backtrace_symbols() being
"useless". thus use the eina_btlog tool i added too.
also started infra for a debug monitor that can use the backtrace
infra to collect runtime stats ANY TIME for a process (don't need to
run under a debugger).
@feat
Summary:
Added eina_crc function in eina to calculate crc for the key passed and
added eina_hash_crc function for hashing using crc
Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewers: Sergeant_Whitespace, cedric
Reviewed By: cedric
Subscribers: Sergeant_Whitespace, cedric
Differential Revision: https://phab.enlightenment.org/D2260
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
Since the type of 'r' changed from unsigned short to unsigned int we
need to change its format as well.
Reviewers: stefan_schmidt, raster, cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2446
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
At the moment there are no errors possible for safety checks.
This may change in the future (unlikely), so we have the eina_error
already exposed for that. However, there's no need for the string.
One more down towards a warningless build.
This is a late change that has been discussing on the ML as we don't want to release an API, we can't make faster.
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
Now the developer has to iterate the whole list to find the
index of the first occurence of the data.
I see that it is possible to get the index of the item for
the genlist widget, but for the eina_list not.
With these APIs it will be easier to implement *index_get
functions for the rest of widgets which contain items (Elm_List,
Elm_Ctxpopup etc.).
These functions returns the index of the given data or node in the eina_list.
Reviewers: Hermet, cedric
Subscribers: raster, cedric
Differential Revision: https://phab.enlightenment.org/D2189
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
eina_binbuf_manage_new provide the functionnality of both eina_binbuf_manage_new_length
and eina_binbuf_manage_read_only_new_length. Those function get deprecated.
Summary: Added new symbols, that will be escaped. There are '\"', '\t' and '\n'.
Reviewers: raster, cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D2130
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
It's better to realese the lock before returning NULL. Otherwise the program
is waiting indefinitely then crashing on Windows ("program not responding").
@fix
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
if you fork and even if you do ecore_fork_reset() a thread calling
ecore_main_loop_thread_safe_call_async(0 for example eill end up
resetting the mainloop thread id to itself (a non mainlopo thread) via
calling eina_main_loop_is() since pid changed. there is little point
in doing this so remove the pid tracking from eina and ensure mainloop
thread id is updated in ecore's fork reset.
@fix
We take a lock, search the list, and the release the lock before we
finish using the values of the list. While unlikely, the string could be
deleted in the meanwhile.
This patch fix the semaphore initialisation on posix plateform
there was a preconditon test which returned the semaphore
uninitialised when count_init was 1, this caused the semaphore to
be unusable on OSX plateform. Furthermore, it seems that we need to
unlink the semaphore before its initialisation on OSX as there seems
to have some kind of persistence of the semaphore accross execution.
warning, this patch change the signification of the parametter
count_init on linux plateform, this parametter is now consistent on
every plateform, with the meaning of setting the initial count value
of the semaphore.
This used to be on linux 1 -> the semaphore is shared and initialised
at 1 and 0 -> the semaphore is not initialised, thus, by side effect
not shared and initialised at 0.
This patch set on linux plateform the semaphore as systematically
shared
@fix
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
The new value is allocated using Eina_Mempool, it should be freed using
eina_mempool, not using libc free.
@fix
Signed-off-by: vivek <vivek.ellur@samsung.com>
Reviewers: cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1940
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
Apparently eina_tmpstr_strlen counts the null character as well. This
doesn't follow how strlen works, as the latter excludes it from the count.
This resulted in mistreatment of the string in _eina_file_escape, with
tmp_str paths that had "../".
This fix will do for now, but it is advised that we avoid using
eina_tmpstr_strlen, to prevent such confusions in the future.
Test Plan:
The following lines will throw a valgrind 'invalid read of size 1' error
prior this fix:
char *path = "home/mydir/../myfile";
Eina_Tmpstr *tmp_str = eina_tmpstr_add(path);
char *ret_path = eina_file_path_sanitize(path);
@fix
Reviewers: cedric, stefan_schmidt
Subscribers: tasn, cedric
Differential Revision: https://phab.enlightenment.org/D1929
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This reverts commit f52f562891.
This is reverted because it breaks eina_file_path_sanitize when using
"/../" in paths, for example:
eina_file_path_sanitize("/home/../mydir/myfile")
returns: "/mydir/myfili"
What invalid read size does this fix? Why was no test case specified?
Anyway, this change affects too much code to leave it in like this.
This should not be an ABI regression on the platform where it work (Unix). It is on Windows,
but the API was unusable at all without this change, so this is a necessary breakage to
unbreak things.
@fix
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
Nothing was printed to journald before because sd_journal_send_with_location
expects file and line to be of the NAME=VALUE form.
Change-Id: I382b82b665558fddebae61b7d0a8d4de87638511
Signed-off-by: Vasyl Vavrychuk <vasyl.vavrychuk@globallogic.com>
Reviewers: kuri, cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1865
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
@fix
this fixes the eina mmap safety handler to only handle what comes
from actual i/o errors (not actual corrupt/hw memory faults or invalid
objects), and if it's not a sigbus eina mmap should handle then pass
it onto the previous handler before eina mmap took over.
Previously Eina_Stringshare printf variant where returning NULL with ("%s", ""). This
is highly disturbing as you would have gotten "(null)", if you asked for ("s", NULL).
To clarify and make things logical, we now return "".
Summary:
eina_inarray_free was not called. So calling it to fix the memory leak.
@fix
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
Reviewers: devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1808
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary:
While going through eina for understanding, wrote a program to understand
he differences between different eina inarray functions. Thought, this might
be useful for others too, so adding the same.
Signed-off-by: Srivardhan Hebbar <sri.hebbar@samsung.com>
Reviewers: devilhorns
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1803
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Summary: The first parameter must be the count of elements to be allocated.
Reviewers: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1660
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
This is a quick fix.
It looks like OSX doesn't provide the same infra as linux for
cond_timedwait, but instead they provide directly a
relative time wait function. Since I don't have any build / test
environment for OSX, this is as far as I can go.
Arguably, OSX libc seems to use gettimeofday() for cond_timedwait,
so this should close T1701.
See the pthread cond implementation:
http://www.opensource.apple.com/source/Libc/Libc-167/pthreads.subproj/pthread_cond.c
Summary:
Schedule group is made for eina_sched_xxx.
It is grouped into Tools group.
Futher description is needed later.
Reviewers: raster, cedric
Reviewed By: cedric
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1623
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Much confusion with this spaghetti code of #ifdefs and clocks.
So, we can't use CPU clocks for the timedwait, this doesn't make
sense (and it's explicit in the manpage, too).
But we can use CLOCK_MONOTONIC or CLOCK_MONOTONIC_RAW which are
much better than the wall clock (because of ntp updates, etc...)
The test case tests that the cond actually waited for as long as was
requested and for not too long either.
This is hopefully a final fix for T1701.
There seems to be an intent to check that UID==EUID
before calling getenv to get the temp directory.
But that was lost in commits 61478af3a6 and
then in e105abc99e.
XDG_RUNTIME_DIR gives us a nice securty benefit by only allowing the
same user to read wand write files.
In some configuration this is problematic though. If one looks at the
bug report this fixes for example you can see that there are build
scripts that use a special build user.
The way this has always worked on unix is that you can define your
own tempdir with TMPDIR. When I was making the original change towards
XDG_RUNTIME_DIR I expected some trouble with it but it worked quite
well so far.
To avoid breaking scripts out there and maybe configurations we
haven't tested yet give TMPDIR precedence over XDG_RUNTIME_DIR.
Fixes T1766
The pthread man page clearly states that pthread_cond_timedwait() takes an
absolute time parameter. So far we always passed it epoch plus timeout in
seconds. This would never trigger the timeout.
Making sure we fill out timespec struct with the current time before adding
the timeout as offset now. Also handling the t < 0 error case.
Various version worked up together with Jean-Philippe Andre <jp.andre@samsung.com>
This version does not use _eina_time_get directly as this is currently not a
public API of eina. If we decide to make _eina_time_get public we can remove the
extra code here.
Fixes T1701
Summary:
OSX only support named semaphores. Eina_Semaphore was actually broken on OSX.
Since OSX 10.10 sem_init() and sem_destroy() (were not implemented) are also marked as
"deprecated", which adds huge pollution to the output when compiling.
Reviewers: cedric, raster, stefan_schmidt
Subscribers: cedric
Differential Revision: https://phab.enlightenment.org/D1576
Signed-off-by: Cedric BAIL <cedric@osg.samsung.com>
Not ready yet as it uses _eina_time_get which is internal only right now. Compiling
works fine for efl alone as the private header is in teh include search part but it
blows up when compiling elementary.
Need to think a bit more about this. Maybe exposing _eina_time_get as API but that
should wait until after the release.
This reverts commit f0a02a92be.
The pthread man page clearly states that pthread_cond_timedwait() takes an
absolute time parameter. So far we always passed it epoch plus timeout in
seconds. This would never trigger the timeout.
Making sure we fill out timespec struct with the current time before adding
the timeout as offset now. Also handling the t < 0 error case.
Various version worked up together with Jean-Philippe Andre <jp.andre@samsung.com>
Fixes T1701
Except for the weird _Eina_Mempool_Backend_ABI1/ABI2 work-around which is
completely internal and probably is of interest to noone (the only person
on Earth who will be interested in it in a decade will hate me for skipping
it).
It looks like doxygen doesn't appreciate having a group inside a group of
the same name and simply ignores any documentation coming from the parent
one.
Since the .x is included from the .h, it is always already inside the
group so simply remove the directive from the .x.
This fixes the documentation for all the functions which are declared and
documented in the .h and implemented in the .x.