Commit 50bd5540 authored by Philippe Gerum's avatar Philippe Gerum
Browse files

cobalt: fix naming consistency issues with *_np() calls

To match the GNU extension equivalent, pthread_set_name_np() is
renamed to pthread_setname_np(). For consistency with the previous
change, pthread_set_mode_np() becomes pthread_setmode_np().

The former calls will be available from the upcoming transition kit.
parent f34c1025
......@@ -102,7 +102,7 @@ static void *transmitter(void *arg)
frame.can_dlc = sizeof(*rtt_time);
#ifdef CONFIG_XENO_COBALT
pthread_set_name_np(pthread_self(), "rtcan_rtt_transmitter");
pthread_setname_np(pthread_self(), "rtcan_rtt_transmitter");
#endif
pthread_setschedparam(pthread_self(), SCHED_FIFO, &param);
......@@ -148,7 +148,7 @@ static void *receiver(void *arg)
0, 0, 0};
#ifdef CONFIG_XENO_COBALT
pthread_set_name_np(pthread_self(), "rtcan_rtt_receiver");
pthread_setname_np(pthread_self(), "rtcan_rtt_receiver");
#endif
pthread_setschedparam(pthread_self(), SCHED_FIFO, &param);
......
......@@ -96,11 +96,11 @@ COBALT_DECL(int, pthread_kill(pthread_t ptid, int sig));
COBALT_DECL(int, pthread_join(pthread_t ptid, void **retval));
int pthread_set_mode_np(int clrmask, int setmask,
int *mask_r);
int pthread_setmode_np(int clrmask, int setmask,
int *mask_r);
int pthread_set_name_np(pthread_t thread,
const char *name);
/* May be absent from outdated glibc releases. */
int pthread_setname_np(pthread_t thread, const char *name);
COBALT_DECL(int, pthread_setname_np(pthread_t thread, const char *name));
......
......@@ -27,8 +27,8 @@
#define sc_cobalt_sched_weightprio 2
#define sc_cobalt_sched_yield 3
/* 4-5 unimplemented */
#define sc_cobalt_thread_set_mode 6
#define sc_cobalt_thread_set_name 7
#define sc_cobalt_thread_setmode 6
#define sc_cobalt_thread_setname 7
#define sc_cobalt_sem_init 8
#define sc_cobalt_sem_destroy 9
#define sc_cobalt_sem_post 10
......
......@@ -403,7 +403,7 @@ config XENO_OPT_DEBUG_SYNCH_RELAX
another thread currently running in secondary mode (i.e. plain
Linux execution mode). The SIGDEBUG signal may be sent in such
a case to the sleeper, provided the WARNSW flag is enabled for
it, as set by e.g. rt_task_set_mode() or pthread_set_mode_np().
it, as set by e.g. rt_task_set_mode() or pthread_setmode_np().
This particular situation is a possible source of unwanted
latency, since the current mutex owner may be unexpectedly
......
......@@ -522,7 +522,7 @@ int cobalt_sched_setconfig_np(int cpu, int policy,
union sched_config *buf;
int ret;
trace_cobalt_sched_set_config(cpu, policy, len);
trace_cobalt_sched_setconfig(cpu, policy, len);
if (cpu < 0 || cpu >= NR_CPUS || !cpu_online(cpu))
return -EINVAL;
......
......@@ -92,8 +92,8 @@ static struct xnsyscall cobalt_syscalls[] = {
SKINCALL_DEF(sc_cobalt_thread_getschedparam_ex, cobalt_thread_getschedparam_ex, current),
SKINCALL_DEF(sc_cobalt_sched_weightprio, cobalt_sched_weighted_prio, current),
SKINCALL_DEF(sc_cobalt_sched_yield, cobalt_sched_yield, primary),
SKINCALL_DEF(sc_cobalt_thread_set_mode, cobalt_thread_set_mode_np, primary),
SKINCALL_DEF(sc_cobalt_thread_set_name, cobalt_thread_set_name_np, current),
SKINCALL_DEF(sc_cobalt_thread_setmode, cobalt_thread_setmode_np, primary),
SKINCALL_DEF(sc_cobalt_thread_setname, cobalt_thread_setname_np, current),
SKINCALL_DEF(sc_cobalt_thread_kill, cobalt_thread_kill, conforming),
SKINCALL_DEF(sc_cobalt_thread_getstat, cobalt_thread_stat, current),
SKINCALL_DEF(sc_cobalt_thread_join, cobalt_thread_join, primary),
......
......@@ -417,7 +417,7 @@ static inline int pthread_create(struct cobalt_thread **thread_p,
return 0;
}
static inline int pthread_set_mode_np(int clrmask, int setmask, int *mode_r)
static inline int pthread_setmode_np(int clrmask, int setmask, int *mode_r)
{
const int valid_flags = XNLOCK|XNWARN|XNTRAPLB;
struct xnthread *curr = xnshadow_current();
......@@ -604,13 +604,13 @@ fail:
return ERR_PTR(ret);
}
int cobalt_thread_set_mode_np(int clrmask, int setmask, int __user *u_mode_r)
int cobalt_thread_setmode_np(int clrmask, int setmask, int __user *u_mode_r)
{
int ret, old;
trace_cobalt_pthread_set_mode(clrmask, setmask);
trace_cobalt_pthread_setmode(clrmask, setmask);
ret = pthread_set_mode_np(clrmask, setmask, &old);
ret = pthread_setmode_np(clrmask, setmask, &old);
if (ret)
return ret;
......@@ -620,7 +620,7 @@ int cobalt_thread_set_mode_np(int clrmask, int setmask, int __user *u_mode_r)
return 0;
}
int cobalt_thread_set_name_np(unsigned long pth, const char __user *u_name)
int cobalt_thread_setname_np(unsigned long pth, const char __user *u_name)
{
struct cobalt_local_hkey hkey;
struct cobalt_thread *thread;
......@@ -636,7 +636,7 @@ int cobalt_thread_set_name_np(unsigned long pth, const char __user *u_name)
hkey.u_pth = pth;
hkey.mm = current->mm;
trace_cobalt_pthread_set_name(pth, name);
trace_cobalt_pthread_setname(pth, name);
xnlock_get_irqsave(&nklock, s);
......
......@@ -138,9 +138,9 @@ cobalt_thread_shadow(struct task_struct *p,
struct cobalt_local_hkey *lhkey,
unsigned long __user *u_window_offset);
int cobalt_thread_set_mode_np(int clrmask, int setmask, int __user *u_mode_r);
int cobalt_thread_setmode_np(int clrmask, int setmask, int __user *u_mode_r);
int cobalt_thread_set_name_np(unsigned long tid, const char __user *u_name);
int cobalt_thread_setname_np(unsigned long tid, const char __user *u_name);
int cobalt_thread_probe_np(pid_t h_tid);
......
......@@ -135,7 +135,7 @@ DEFINE_EVENT(cobalt_posix_schedparam, cobalt_pthread_getschedparam,
{PTHREAD_LOCK_SCHED, "lock"}, \
{PTHREAD_DISABLE_LOCKBREAK, "nolockbreak"})
TRACE_EVENT(cobalt_pthread_set_mode,
TRACE_EVENT(cobalt_pthread_setmode,
TP_PROTO(int clrmask, int setmask),
TP_ARGS(clrmask, setmask),
TP_STRUCT__entry(
......@@ -151,7 +151,7 @@ TRACE_EVENT(cobalt_pthread_set_mode,
__entry->setmask, cobalt_print_thread_mode(__entry->setmask))
);
TRACE_EVENT(cobalt_pthread_set_name,
TRACE_EVENT(cobalt_pthread_setname,
TP_PROTO(unsigned long pth, const char *name),
TP_ARGS(pth, name),
TP_STRUCT__entry(
......@@ -246,7 +246,7 @@ DEFINE_EVENT(cobalt_void, cobalt_pthread_yield,
TP_ARGS(dummy)
);
TRACE_EVENT(cobalt_sched_set_config,
TRACE_EVENT(cobalt_sched_setconfig,
TP_PROTO(int cpu, int policy, size_t len),
TP_ARGS(cpu, policy, len),
TP_STRUCT__entry(
......
......@@ -169,7 +169,7 @@ sync_with_creator:
retval = start(arg);
pthread_set_mode_np(PTHREAD_WARNSW, 0, NULL);
pthread_setmode_np(PTHREAD_WARNSW, 0, NULL);
return retval;
}
......@@ -378,36 +378,13 @@ COBALT_IMPL(int, pthread_create, (pthread_t *ptid_r,
* @note Setting @a clrmask and @a setmask to zero leads to a nop,
* only returning the previous mode if @a mode_r is a valid address.
*/
int pthread_set_mode_np(int clrmask, int setmask, int *mode_r)
int pthread_setmode_np(int clrmask, int setmask, int *mode_r)
{
return -XENOMAI_SKINCALL3(__cobalt_muxid,
sc_cobalt_thread_set_mode,
sc_cobalt_thread_setmode,
clrmask, setmask, mode_r);
}
/**
* Set a thread name.
*
* This service set to @a name, the name of @a thread. This name is used for
* displaying information in /proc/xenomai/sched.
*
* This service is a non-portable extension of the POSIX interface.
*
* @param thread target thread;
*
* @param name name of the thread.
*
* @return 0 on success;
* @return an error number if:
* - ESRCH, @a thread is invalid.
*
*/
int pthread_set_name_np(pthread_t thread, const char *name)
{
return -XENOMAI_SKINCALL2(__cobalt_muxid,
sc_cobalt_thread_set_name, thread, name);
}
/**
* Set a thread name.
*
......@@ -428,7 +405,7 @@ int pthread_set_name_np(pthread_t thread, const char *name)
COBALT_IMPL(int, pthread_setname_np, (pthread_t thread, const char *name))
{
return -XENOMAI_SKINCALL2(__cobalt_muxid,
sc_cobalt_thread_set_name, thread, name);
sc_cobalt_thread_setname, thread, name);
}
/**
......
......@@ -110,7 +110,7 @@ struct remote_request {
static inline void agent_init_corespec(const char *name)
{
pthread_set_name_np(pthread_self(), name);
__RT(pthread_setname_np(pthread_self(), name));
}
#else /* CONFIG_XENO_MERCURY */
......@@ -255,7 +255,7 @@ static inline void threadobj_uninit_corespec(struct threadobj *thobj)
static inline int threadobj_setup_corespec(struct threadobj *thobj)
{
pthread_set_name_np(pthread_self(), thobj->name);
__RT(pthread_setname_np(pthread_self(), thobj->name));
thobj->core.handle = cobalt_get_current();
thobj->core.u_window = cobalt_get_current_window();
......@@ -356,7 +356,7 @@ int __threadobj_lock_sched(struct threadobj *current)
* locking the scheduler, so no need to drop the thread lock
* across this call.
*/
return __bt(-pthread_set_mode_np(0, PTHREAD_LOCK_SCHED, NULL));
return __bt(-pthread_setmode_np(0, PTHREAD_LOCK_SCHED, NULL));
}
int threadobj_lock_sched(void)
......@@ -383,7 +383,7 @@ int __threadobj_unlock_sched(struct threadobj *current)
if (--current->schedlock_depth > 0)
return 0;
return __bt(-pthread_set_mode_np(PTHREAD_LOCK_SCHED, 0, NULL));
return __bt(-pthread_setmode_np(PTHREAD_LOCK_SCHED, 0, NULL));
}
int threadobj_unlock_sched(void)
......@@ -417,7 +417,7 @@ int threadobj_set_mode(int clrmask, int setmask, int *mode_r) /* current->lock h
__threadobj_unlock_sched(current);
if (mode_r || __setmask || __clrmask)
return __bt(-pthread_set_mode_np(__clrmask, __setmask, mode_r));
return __bt(-pthread_setmode_np(__clrmask, __setmask, mode_r));
return 0;
}
......
......@@ -47,7 +47,7 @@ static DEFINE_PRIVATE_LIST(svtimers);
static inline void timersv_init_corespec(const char *name)
{
pthread_set_name_np(pthread_self(), name);
__RT(pthread_setname_np(pthread_self(), name));
}
#else /* CONFIG_XENO_MERCURY */
......
......@@ -103,7 +103,7 @@ static void *latency(void *cookie)
}
#ifdef CONFIG_XENO_COBALT
err = pthread_set_mode_np(0, PTHREAD_WARNSW, NULL);
err = pthread_setmode_np(0, PTHREAD_WARNSW, NULL);
if (err) {
fprintf(stderr, "latency: setting WARNSW: error code %d\n", err);
return NULL;
......
......@@ -120,7 +120,7 @@ static void __create_quota_thread(pthread_t *tid, const char *name,
error(1, ret, "pthread_create_ex(SCHED_QUOTA)");
pthread_attr_destroy_ex(&attr_ex);
pthread_set_name_np(*tid, name);
pthread_setname_np(*tid, name);
}
#define create_quota_thread(__tid, __label, __tgid, __count) \
......@@ -145,7 +145,7 @@ static void __create_fifo_thread(pthread_t *tid, const char *name,
error(1, ret, "pthread_create(SCHED_FIFO)");
pthread_attr_destroy(&attr);
pthread_set_name_np(*tid, name);
pthread_setname_np(*tid, name);
}
#define create_fifo_thread(__tid, __label, __count) \
......
......@@ -87,7 +87,7 @@ static void __create_thread(pthread_t *tid, const char *name, int seq)
error(1, ret, "pthread_create");
pthread_attr_destroy(&attr);
pthread_set_name_np(*tid, name);
pthread_setname_np(*tid, name);
}
#define create_thread(tid, n) __create_thread(&(tid), # tid, n)
......
......@@ -428,9 +428,9 @@ static void *rtup(void *cookie)
allowed when suspended in ioctl. */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
if ((err = pthread_set_mode_np(0, PTHREAD_CONFORMING, NULL))) {
if ((err = pthread_setmode_np(0, PTHREAD_CONFORMING, NULL))) {
fprintf(stderr,
"rtup: pthread_set_mode_np: %s\n",
"rtup: pthread_setmode_np: %s\n",
strerror(err));
clean_exit(EXIT_FAILURE);
}
......@@ -514,9 +514,9 @@ static void *rtus(void *cookie)
allowed when suspended in ioctl. */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
if ((err = pthread_set_mode_np(PTHREAD_CONFORMING, 0, NULL))) {
if ((err = pthread_setmode_np(PTHREAD_CONFORMING, 0, NULL))) {
fprintf(stderr,
"rtus: pthread_set_mode_np: %s\n",
"rtus: pthread_setmode_np: %s\n",
strerror(err));
clean_exit(EXIT_FAILURE);
}
......@@ -600,9 +600,9 @@ static void *rtuo(void *cookie)
allowed when suspended in ioctl. */
pthread_setcanceltype(PTHREAD_CANCEL_ASYNCHRONOUS, NULL);
if ((err = pthread_set_mode_np(0, PTHREAD_CONFORMING, NULL))) {
if ((err = pthread_setmode_np(0, PTHREAD_CONFORMING, NULL))) {
fprintf(stderr,
"rtup: pthread_set_mode_np: %s\n",
"rtup: pthread_setmode_np: %s\n",
strerror(err));
clean_exit(EXIT_FAILURE);
}
......@@ -659,10 +659,10 @@ static void *rtuo(void *cookie)
/* Switch mode. */
if (i % 3 == 2) {
mode = PTHREAD_CONFORMING - mode;
if ((err = pthread_set_mode_np
if ((err = pthread_setmode_np
(PTHREAD_CONFORMING - mode, mode, NULL))) {
fprintf(stderr,
"rtuo: pthread_set_mode_np: %s\n",
"rtuo: pthread_setmode_np: %s\n",
strerror(err));
clean_exit(EXIT_FAILURE);
}
......@@ -881,12 +881,12 @@ static int task_create(struct cpu_tasks *cpu,
return err;
}
err = pthread_set_name_np(param->thread,
task_name(buffer, sizeof(buffer),
param->cpu,param->swt.index));
err = pthread_setname_np(param->thread,
task_name(buffer, sizeof(buffer),
param->cpu,param->swt.index));
if (err)
fprintf(stderr,"pthread_set_name_np: %s\n", strerror(err));
fprintf(stderr,"pthread_setname_np: %s\n", strerror(err));
return err;
}
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment