Commit Graph

1176 Commits

Author SHA1 Message Date
Bryce Harrington 49554b2b6c eina: Add doxygen in/out tags for lalloc and list
Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6688
2018-07-27 03:59:44 -04:00
Bryce Harrington ff5cc5d988 eina: Add doxygen in/out tags for inlist and iterator
Reviewers: segfaultxavi

Subscribers: segfaultxavi, cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6686
2018-07-26 20:04:46 +09:00
Bryce Harrington 6fb4608458 eina: Add doxygen in/out tags for evlog, file, fp, freeq
Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6673
2018-07-24 08:30:08 -04:00
Bryce Harrington d9515f002a eina: Add doxygen in/out tags for cow, cpu, and debug
Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6642
2018-07-20 10:36:24 -04:00
Bryce Harrington 582d342afe eina: Fix doxygen in/out tags for eina_bezier
Reviewers: Hermet

Reviewed By: Hermet

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6630
2018-07-19 15:51:53 +09:00
Bryce Harrington 096c01a818 eina: Add doxygen in/out tags
Reviewers: Hermet

Reviewed By: Hermet

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6624
2018-07-18 15:21:07 +09:00
Daniel Hirt 93397449d4 Eina binbuf: add explicit null-check before magic-check
Summary:
Using `--disable-magic-debug` defines EINA_MAGIC_CHECK to always
evaluate to `1`. Eina_Binbuf's null-check relied solely on the
EINA_MAGIC_CHECK, and failed to pick up on the cases where `buf` was
passed as NULL. This has led to  a segfault when a NULL `buf` was passed
in the test suite (see referenced ticket).

This fix adds an explicit NULL check.

Fixes https://phab.enlightenment.org/T7147

Reviewers: zmike

Reviewed By: zmike

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6592
2018-07-16 06:09:38 -04:00
Bryce Harrington 45173fa375 eina: Add doxygen in/out tags for strbuf's and ustrbuf's parameters
Reviewers: devilhorns, Hermet

Reviewed By: Hermet

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6586
2018-07-13 18:23:27 +09:00
Bryce Harrington bdb9a41750 eina: Spelling fixes
Reviewers: devilhorns, Hermet

Reviewed By: Hermet

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6570
2018-07-12 16:27:15 +09:00
Bryce Harrington 6a68e51460 eina: Add doxygen in/out tags for binbuf's parameters
Reviewers: devilhorns, Hermet

Reviewed By: Hermet

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6571
2018-07-12 16:14:42 +09:00
Bryce Harrington d7c67febe1 eina: Improve documentation for binbuf/strbuf/ustrbuf
Summary:
These three classes have essentially the same API, just different
underlying data types.  This patch seeks to improve the docs for all
three while retaining or improving the consistency between them.

Several functions had completely incorrect documentation (looks like
cut-and-paste mistakes), others had missing or incorrectly named
parameter documentation, typographical errors, or other similar issues.
This also cleans up a lot of spelling and grammar errors, defines return
values as part of @return, and reformats/revises doxygen code for
consistency.

There are no changes to code, except some whitespace cleanup.

Reviewers: devilhorns

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6544
2018-07-10 10:55:10 +09:00
Stefan Schmidt 695b44526c eina: remove no longer used function _eina_thread_queue_msg_block_real_free
Summary:
It seems this function is no longer used since some rework. Clean it up.
lib/eina/eina_thread_queue.c:127:1: warning: ‘_eina_thread_queue_msg_block_real_free’ defined but not used [-Wunused-function]

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6537
2018-07-09 10:22:59 -04:00
Bryce Harrington cc345edccd eina: Improve eina_binbuf function documentation
Summary:
Define return values as part of @return.
Cleanup grammar.

Reviewers: devilhorns

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6503
2018-07-04 11:12:57 +09:00
Bryce Harrington f3512bec57 eina: Improve eina_benchmark function documentation
Summary:
Define return values as part of @return.
Clarify that the returned list of files are gnuplot filenames specifically.
Cleanup grammar throughout.

Reviewers: zmike, devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6502
2018-07-03 14:44:41 -04:00
Mike Blumenkrantz 7c50209baa eina/debug: remove global lock for session list access
this list is now only accessed from the main thread so there's no reason
to have a lock for it
2018-07-03 16:10:23 +02:00
Mike Blumenkrantz e7e1560e18 eina/debug: rework session thread destruction to avoid deadlock on shutdown
when debugging was active, this would frequently result in the monitor thread
blocking in a read() call for a fd which had already been closed by the main
thread. the main thread would be waiting for the monitor thread to fail its read()
and destroy itself, but the read() would never end without an interrupt

this reworks the monitor thread destruction to stop relying on the thread to
remove its session from the session list and instead only access the list from
the main thread, allowing sessions to always be immediately destroyed

fix T7103
2018-07-03 16:10:21 +02:00
Carsten Haitzler 194971342b eina debug - fix setuid process shutdown by initting fully except conn
init eina debug fully except for the debug daemon connection that the
setuid check was meant to skip. this fixes T7055
2018-06-27 14:13:00 +09:00
Xavi Artigas 80baf516a3 Revert "eina: provide full string length to vsnprintf to allow for null character"
Summary:
This reverts commit e0f8e65d20 which changed the
behavior of eina_stringshare_nprintf() and was not really needed to fix T6903.

Reviewers: zmike, Jaehyun_Cho, devilhorns

Reviewed By: zmike

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T6903

Differential Revision: https://phab.enlightenment.org/D6431
2018-06-26 12:38:22 -04:00
Mike Blumenkrantz b0cb3b935a eina/threadqueue: use mempool_del for hash free function
Summary:
I typod this in 14ae3e3dec and when using
mempools other than chained, this probably caused all apps to crash on
shutdown

Reviewers: ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6428
2018-06-25 17:55:25 -04:00
Mike Blumenkrantz 83bab7cab4 eina/lock: add errno wrapping for backtrace() calls in thread debug blocks
Summary:
somehow backtrace() is able to generate EINVAL in certain cases even though
this is not documented anywhere. these irrelevant errors should not be noticed
by users of the api during debugging, as this can cause some tests/apps to
randomly fail without explanation

@fix

Reviewers: ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6377
2018-06-25 15:20:37 -04:00
Mike Blumenkrantz b3b104a1e7 eina/debug_cpu: rework thread usage
Summary:
this changes the explicit pthread usage (and reimplementation of eina_thread_create)
to just use eina function calls. it also causes the thread to start and stop when
profiling is enabled and resolves some possible errors which could occur after
a fork or when trying to compile under windows

pthread usage: this code appears to have been 100% copied from eina_thread.c, and it
isn't clear to me why existing eina_thread api was not used. this has no functional
benefit, but it makes the code more readable

thread lifetime: there is no need to have a thread running at all times for a feature
which will be rarely used and which must be explicitly enabled by the user

windows: this file previously generated a lot of compiler warnings from unused functions
and variables since nothing here is available under windows. the entire file is now
a giant #ifndef _WIN32 to avoid any compile warnings or unexpected runtime behavior

fix T7055
Depends on D6371

Reviewers: ManMower, vtorri, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T7055

Differential Revision: https://phab.enlightenment.org/D6372
2018-06-25 15:17:14 -04:00
Mike Blumenkrantz 3562878e21 eina/debug: replace some explicit pthread_t usage with Eina_Thread
no functional changes

Differential Revision: https://phab.enlightenment.org/D6371
2018-06-25 15:17:14 -04:00
Mike Blumenkrantz aedaa7ed19 eina/lock: rework meaning of EINA_DEBUG_THREADS variable
Summary:
previously this used to mean 'the number of ms that a lock can wait for
until abort() is called once the lock is acquired' and it was useful
when trying to find contention issues with locks

unfortunately this required a bit of reading into the code to determine,
and it made the common case of setting values to 1 fail in some cases,
as this is a very short amount of time. also the documentation explicitly
gives '1' as an example setting for this variable, which will cause immediate
abort() in most cases when debugging was enabled since things are much slower

this variable now is the number of usec that a lock can wait for before abort()
is called, and the lowest value that will be checked for abort()ing is 100, meaning
that '1' is valid again
Depends on D6375

Reviewers: ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6376
2018-06-25 15:15:34 -04:00
Mike Blumenkrantz 6b91b6a389 eina/lock: when debug threads are enabled, always call trylock in lock function
Summary:
when debugging thread issues, it's not actually helpful to immediately
deadlock--this defeats any attempt at debugging. instead, call trylock first
in order to detect a possible deadlock and then throw an error which can be
caught by the user
Depends on D6374

Reviewers: ManMower, devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6375
2018-06-25 15:15:32 -04:00
Mike Blumenkrantz 73ba4006bd eina/lock: reorder inline posix lock functions
Summary: no functional changes

Reviewers: ManMower, devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6374
2018-06-25 15:15:29 -04:00
Mike Blumenkrantz 14ae3e3dec eina_thread_queue: use normal mempools for block allocation
there's no need to reimplement mempools here when we already have a great
mempool api

this makes the code slightly more readable

Differential Revision: https://phab.enlightenment.org/D6353
2018-06-25 15:14:30 -04:00
Marcel Hollerbach 592de0e4b6 eina_stringshare: cast in order to fix a warning
Summary:
casting here is safe, as before we check and return on size < 1.
Depends on D6379

Reviewers: devilhorns, Hermet

Reviewed By: Hermet

Subscribers: cedric, #committers, zmike

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6380
2018-06-25 14:55:13 +09:00
Carsten Haitzler 9639fab82b Revert "Revert "eina debug - fix segv if an app is compiled with -pg for profiling""
This reverts commit 0d91088d0f.

It also includes a workaround for OSX where RT signals aren't
supported due to kernel age (too old a fork of freebsd). fixes D6310
and T7029
2018-06-22 10:07:49 +09:00
Mike Blumenkrantz 46081e4e6a eina_debug_bt: add ifdef for windows build
Summary: ref D7028

Reviewers: vtorri, devilhorns

Reviewed By: vtorri

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6348
2018-06-21 17:44:46 -04:00
Daniel Kolesa 1bcdc8af7b efl: include sys/types.h where ssize_t is used
This include is necessary according to POSIX. Without it, build
fails on certain platforms (QNX). It may already be included
implicitly in some of those files, but declare intent.

Fixes T6667.
2018-06-21 14:09:59 +02:00
Mike Blumenkrantz 217f30001a eina_debug_bt: only enable SIGPROF handler when profiling is enabled
Summary:
if profiling is not enabled then reaching this signal handler will always
result in a crash

moreover, the signal handler has no functional value if profiling is not active,
so do not add it until that point

fix T7028

@fix
Depends on D6311

Reviewers: ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T7028

Differential Revision: https://phab.enlightenment.org/D6312
2018-06-19 14:04:45 -04:00
Mike Blumenkrantz 1de5c251d1 eina_debug: add function to reset debug subsystem after fork
fork() kills this entire subsystem and leaves its internals
in an inactive but allocated state, so it's necessary to explicitly restart
everything in order to guarantee behavior

@feature

Differential Revision: https://phab.enlightenment.org/D6307
2018-06-19 13:55:36 -04:00
Mike Blumenkrantz bd9edfad00 eina_debug: make shutdown perform cleanups and kill the timer thread
this should not remain active after eina has been deactivated, so ensure
that everything stops as expected

ref T7019

Differential Revision: https://phab.enlightenment.org/D6306
2018-06-19 13:55:36 -04:00
Mike Blumenkrantz 9d2d1a2677 eina_debug_cpu: make shutdown perform cleanups and kill the timer thread
this should not remain active after eina has been deactivated, so ensure
that everything stops as expected

ref T7019

Differential Revision: https://phab.enlightenment.org/D6305
2018-06-19 13:55:36 -04:00
Mike Blumenkrantz d4a8856426 eina_debug_timer: make shutdown perform cleanups and kill the timer thread
this should not remain active after eina has been deactivated, so ensure
that everything stops as expected

ref T7019

Differential Revision: https://phab.enlightenment.org/D6304
2018-06-19 13:55:36 -04:00
Mike Blumenkrantz c043f55a43 eina: prevent threads subcomponent from being shutdown while eina is active
this basically breaks all thread usage if it happens, so ensure that the
threads infrastructure stays active for as long as eina is active

@fix

Differential Revision: https://phab.enlightenment.org/D6303
2018-06-19 13:55:36 -04:00
Mike Blumenkrantz d886b18fc3 eina: call eina_threads_init from eina_debug_init
eina is guaranteed to crash in any process without this call now that
eina_debug exists and requires threads

@fix

Differential Revision: https://phab.enlightenment.org/D6302
2018-06-19 13:55:36 -04:00
Mike Blumenkrantz 0e49bfda65 eina: don't init subcomponents inside eina_debug
this should be done in a single location to avoid dependency conflicts
and make the code easier to read

Differential Revision: https://phab.enlightenment.org/D6301
2018-06-19 13:55:36 -04:00
Mike Blumenkrantz 6353a699e3 eina_threadqueue: add locking for variable used between threads
Summary:
the 'first' member of this struct is used simultaneously across
threads and can have conflicting read/write operations occurring at this
time

as int operations are not guaranteed to be atomic, ensure that we are
using atomic operations or locking as necessary

@fix

Depends on D6299

Reviewers: ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6300
2018-06-19 13:30:44 -04:00
Mike Blumenkrantz a446fb86fc eina_threadqueue: simplify/unify some locking code
Summary:
this moves lock calls outside #ifdef blocks to make the code more
readable

no functional changes
Depends on D6298

Reviewers: ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6299
2018-06-19 13:30:36 -04:00
Mike Blumenkrantz df2f614431 eina_threadqueue: fix spinlock destruction by using spinlock api
Summary:
this would deadlock in some cases

@fix
Depends on D6297

Reviewers: ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6298
2018-06-19 13:30:26 -04:00
Mike Blumenkrantz 44bafb0741 eina: replace memsets in thread debugging lock create/free with manual zeroing
Summary:
memset overwrites the thread value, triggering errors when running tools like
helgrind

attempting an operation on an invalid thread will cause errors naturally,
so zeroing the rest of the struct and ignoring the thread member is fine

Reviewers: ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6297
2018-06-19 13:30:20 -04:00
Marcel Hollerbach 0d91088d0f Revert "eina debug - fix segv if an app is compiled with -pg for profiling"
This reverts commit 8343de6ce3.

This borke mac os build, CI is spamming on irc channels and addtional
tests are failing. I would give this back to the drawingboard.

ref T7029

Differential Revision: https://phab.enlightenment.org/D6310
2018-06-18 16:09:14 +02:00
Carsten Haitzler 8343de6ce3 eina debug - fix segv if an app is compiled with -pg for profiling
gprof uses SIGPROF ... and this causes all sorts of bad things with
the eina debug profiling too. so - use SIGRT instead ... fixes T7028
2018-06-18 11:52:39 +09:00
Mike Blumenkrantz 032e4bd116 eina_lock: remove safety checks for main thread
Summary:
these effectively prevent locks from being used to synchronize operations
between (non-main) threads, which restricts their usefulness and also
prevents our own unit tests from passing

fix T7004

Depends on D6267

Reviewers: devilhorns, ManMower

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T7004, T1984

Differential Revision: https://phab.enlightenment.org/D6285
2018-06-15 15:38:49 -04:00
Mike Blumenkrantz 8ef0cd0950 eina: disable abort on shutdown when triggered by system monitoring thread
Summary:
this lock/thread never gets destroyed, so it should not trigger failure cases
when that is always the case

@fix

Depends on D6266

Reviewers: stefan_schmidt, ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6267
2018-06-15 15:38:33 -04:00
Mike Blumenkrantz 66bfc5ff4b eina_lock: remove locks from eina tracking list on free while thread debugging
Summary:
this prevents invalid memory access during subsequent inlist operations

@fix

sq
Depends on D6265

Reviewers: stefan_schmidt, ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6266
2018-06-15 15:38:20 -04:00
Mike Blumenkrantz fb534b328e eina_lock: modify mutex debugging to ignore recursive locks
Summary:
recursive locks are locked multiple times in the same thread, leading to
failure with the tracking infrastructure which was written prior to
the addition of recursive locks and assumed that locks would only be
taken exactly once

given that this debug info is meant to handle non-recursive locks,
it makes little sense to include them in the handling

@fix

Depends on D6264

Reviewers: stefan_schmidt, ManMower, devilhorns

Reviewed By: ManMower

Subscribers: cedric, #committers

Tags: #efl

Differential Revision: https://phab.enlightenment.org/D6265
2018-06-15 15:37:56 -04:00
Mike Blumenkrantz 4ca3a51ca6 eina_cow: rework debug profile safety checks for recursive writes
Summary:
recursive writes are not inherently bad, so long as the pointer is
consistently re-set (handled automatically by macros), and they are nearly
unavoidable in some places such as eo/evas internals

issues may arise in a specific corner case of recursive writes when a pointer
has been hashed for garbage collection, so adjust the checks to watch for this
specific case instead of crashing on every case

fix T7005

Reviewers: devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T7005

Differential Revision: https://phab.enlightenment.org/D6284
2018-06-15 11:39:53 -04:00
Mike Blumenkrantz 1c52aede2b eina_lock: do not set PTHREAD_MUTEX_ERRORCHECK on recursive locks
Summary:
a mutex can only have one type, so setting this type onto a recursive mutex
will unset the recursive attribute and cause deadlocks

ref T1984
@fix

Reviewers: stefan_schmidt, ManMower, devilhorns

Reviewed By: devilhorns

Subscribers: cedric, #committers

Tags: #efl

Maniphest Tasks: T1984

Differential Revision: https://phab.enlightenment.org/D6264
2018-06-15 11:21:43 -04:00