Commit Graph

21 Commits

Author SHA1 Message Date
Philippe Gerum 07f7d3584d libevl: allow for receiving NULL element names
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-05-03 19:49:13 +02:00
Philippe Gerum f27fc99387 lib: introduce the interface to observables
Since ABI 23, the core provides the new observable element, which
enables the observer design pattern. Any EVL thread is in and of
itself an observable which can be monitored for events too.

As a by-product, the poll interface can now be given a user-defined
opaque data when subscribing file descriptors to poll elements, which
the core passes back on return to evl_poll().

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-04-30 12:11:14 +02:00
Philippe Gerum 9b42b85ed8 lib: introduce element visibility attribute
Since core ABI 21, users can decide whether a new element should be
made public or private depending on the value of clone flags added to
the new long form of all element creation calls, i.e. evl_create_*().
All evl_new_*() calls become a shorthand for their respective long
form with reasonable default arguments, including private visibility.

As a shorthand, libevl also interprets a slash character leading the
name argument passed to these services as an implicit request for
creating a public element. In other words, this is the same as passing
EVL_CLONE_PUBLIC in the clone flags.

A public element appears as a cdev in the /dev/evl hierarchy, which
means that it is visible to other processes, which may share it. On
the contrary, a private element is only known from the process
creating it, although it does appear in the /sysfs hierarchy
regardless.

e.g.:

efd = evl_attach_self("/visible-thread");

total 0
crw-rw----    1 root     root      248,   1 Apr 17 11:59 clone
crw-rw----    1 root     root      246,   0 Apr 17 11:59 visible-thread

or,

efd = evl_attach_self("private-thread");

total 0
crw-rw----    1 root     root      248,   1 Apr 17 11:59 clone

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-04-18 20:43:02 +02:00
Philippe Gerum 46868bd894 include/mutex: make interface C++ friendly
Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-26 10:20:16 +01:00
Philippe Gerum 4204f25b5c lib: y2038: convert to timespec64 kernel interface
This set of changes makes libevl y2038-safe by switching to the ABI
revision 19 of the EVL core, which generalizes the use of a 64bit
timespec type. These changes also go a long way preparing for the
upcoming mixed 32/64 ABI support (aka compat mode).

The changes only affect the internal interface between libevl and the
kernel, not the API.  Nevertheless, the API was bumped to revision 10
with the removal of the evl_adjust_clock() service, which neither had
proper specification nor defined use case currently, but would stand
in the way of the sanitization work for y2038. At any rate, any future
service implementing some sort of EVL clock adjustment should
definitely not depend on the legacy struct timex which is
y2038-unsafe.

Signed-off-by: Philippe Gerum <rpm@xenomai.org>
2020-03-19 12:30:55 +01:00
Philippe Gerum 158fbbf720 lib/monitor: force synchronize PTEs of shared state data 2019-11-07 13:55:47 +01:00
Philippe Gerum 672bc22c7c lib/mutex: return zero on get_ceiling() in non-PP case
This is a simple way to figure out the protocol of a mutex without
crippling the API with trivial accessors people might need twice a
century.
2019-08-24 12:37:22 +02:00
Philippe Gerum bdc3aab501 lib/mutex: introduce compact creation calls
Normal (i.e. non-recursive) mutexes timed on the monotonic clock are
the most common form of locks used by applications. Allow people to
write more compact code by providing creation calls and static
initializers aimed at building these directly:

- evl_new_mutex(), EVL_MUTEX_INITIALIZER() for PI locks timed on the
  monotonic clock.

- evl_new_mutex_any() and EVL_MUTEX_ANY_INITIALIZER() for building any
  supported type of lock (normal/recursive), specifying the protocol
  (PI/PP) and the base clock.
2019-08-19 10:22:49 +02:00
Philippe Gerum a6044094db lib/mutex: add support for recursive type 2019-08-18 16:30:47 +02:00
Philippe Gerum c7c785c060 lib/event: check mutex sanity in wait ops 2019-08-07 10:10:34 +02:00
Philippe Gerum 882dfc5b4f lib/thread: convert to T_WOSS, T_WOLI flags 2019-06-25 19:03:00 +02:00
Philippe Gerum 59dd3a1591 lib: normalize return values of evl_new_*(), evl_open_*() calls
Some creation calls have to return the file descriptor of the new
element because there is no in-memory descriptor associated with the
latter where we could stick the former. So for consistency, just have
all evl_new_*() calls return the file descriptor referring to the new
element.

Likewise, all evl_open_*() calls now do the same.
2019-06-16 19:22:15 +02:00
Philippe Gerum 61d7d212cd lib: drop redundant switch to async cancelability
oob_ioctl() already switches the caller to async cancelability, there
is no need for the caller to do this.
2019-06-14 13:03:24 +02:00
Philippe Gerum f0d37f4730 treewide: API update
Improve consistency in naming and disambiguate some calls.
2019-06-13 10:31:04 +02:00
Philippe Gerum 68dd86747c lib/monitor: split type and protocol information 2019-06-11 17:17:48 +02:00
Jorge Ramirez-Ortiz bad49d4470 lib, tests: access kernel elements and utilities via UAPI 2019-03-28 13:57:17 +01:00
Philippe Gerum eda7791f9b evl: rename evenless/ paths to evl/ 2019-03-10 16:25:02 +01:00
Philippe Gerum 75fb37bf92 lib/mutex: silent success on closing an uninit mutex 2019-03-08 17:01:33 +01:00
Philippe Gerum 10afb077ff lib/mutex, convar: drop useless struct evl_monitor 2019-03-08 16:58:34 +01:00
Philippe Gerum 277381a275 lib/event: rename event to condvar
This is actually how it behaves, 'event' may be confusing due to
other implementations using different semantics.
2019-03-07 19:14:07 +01:00
Philippe Gerum 7feaec7b02 lib/monitor: split implementation of mutex, event and sema4 features 2019-03-04 17:49:07 +01:00