2018-12-10 01:28:32 +08:00
|
|
|
/*
|
|
|
|
* SPDX-License-Identifier: MIT
|
|
|
|
*
|
|
|
|
* Copyright (C) 2018 Philippe Gerum <rpm@xenomai.org>
|
|
|
|
*/
|
|
|
|
|
2019-03-10 23:25:02 +08:00
|
|
|
#ifndef _EVL_THREAD_H
|
|
|
|
#define _EVL_THREAD_H
|
2018-12-10 01:28:32 +08:00
|
|
|
|
|
|
|
#include <linux/types.h>
|
|
|
|
#include <limits.h>
|
2019-06-16 18:11:01 +08:00
|
|
|
#include <stdbool.h>
|
2020-04-17 12:49:34 +08:00
|
|
|
#include <sched.h>
|
2019-03-10 23:25:02 +08:00
|
|
|
#include <evl/syscall.h>
|
2019-06-27 23:42:40 +08:00
|
|
|
#include <uapi/evl/signal.h>
|
2019-03-10 23:25:02 +08:00
|
|
|
#include <uapi/evl/thread.h>
|
|
|
|
#include <uapi/evl/sched.h>
|
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-17 18:24:28 +08:00
|
|
|
#include <uapi/evl/factory.h>
|
2018-12-10 01:28:32 +08:00
|
|
|
|
|
|
|
#define EVL_STACK_DEFAULT \
|
|
|
|
({ \
|
|
|
|
int __ret = PTHREAD_STACK_MIN; \
|
|
|
|
if (__ret < 65536) \
|
|
|
|
__ret = 65536; \
|
|
|
|
__ret; \
|
|
|
|
})
|
|
|
|
|
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-17 18:24:28 +08:00
|
|
|
#define evl_attach_self(__fmt, __args...) \
|
2020-04-22 01:07:17 +08:00
|
|
|
evl_attach_thread(EVL_CLONE_PRIVATE, __fmt, ##__args)
|
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-17 18:24:28 +08:00
|
|
|
|
2018-12-10 01:28:32 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2020-04-22 01:07:17 +08:00
|
|
|
int evl_attach_thread(int flags, const char *fmt, ...);
|
2018-12-10 01:28:32 +08:00
|
|
|
|
2020-04-22 01:07:17 +08:00
|
|
|
int evl_detach_thread(int flags);
|
|
|
|
|
2020-12-13 19:08:03 +08:00
|
|
|
int evl_detach_self(void);
|
2019-02-08 02:32:17 +08:00
|
|
|
|
2018-12-10 01:28:32 +08:00
|
|
|
int evl_get_self(void);
|
2019-02-08 02:32:17 +08:00
|
|
|
|
2018-12-10 01:28:32 +08:00
|
|
|
int evl_switch_oob(void);
|
|
|
|
|
|
|
|
int evl_switch_inband(void);
|
|
|
|
|
2020-12-13 19:29:25 +08:00
|
|
|
bool evl_is_inband(void);
|
|
|
|
|
2019-02-08 02:32:17 +08:00
|
|
|
int evl_get_state(int efd, struct evl_thread_state *statebuf);
|
|
|
|
|
2020-04-22 17:19:16 +08:00
|
|
|
int evl_unblock_thread(int efd);
|
|
|
|
|
|
|
|
int evl_demote_thread(int efd);
|
|
|
|
|
2020-04-23 01:59:43 +08:00
|
|
|
int evl_set_thread_mode(int efd, int mask,
|
|
|
|
int *oldmask);
|
|
|
|
|
|
|
|
int evl_clear_thread_mode(int efd, int mask,
|
|
|
|
int *oldmask);
|
|
|
|
|
2020-04-25 01:25:19 +08:00
|
|
|
int evl_subscribe(int ofd,
|
|
|
|
unsigned int backlog_count,
|
|
|
|
int flags);
|
|
|
|
|
|
|
|
int evl_unsubscribe(int ofd);
|
|
|
|
|
2018-12-10 01:28:32 +08:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|
2019-03-10 23:25:02 +08:00
|
|
|
#endif /* _EVL_THREAD_H */
|