Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
xenomai
xenomai
Commits
06a131cc
Commit
06a131cc
authored
Jul 03, 2014
by
Philippe Gerum
Browse files
cobalt/kernel/thread: add cobalt_thread_getpid service
This service returns the per-task kernel pid of a local pthread.
parent
5438340e
Changes
5
Hide whitespace changes
Inline
Side-by-side
include/cobalt/uapi/syscall.h
View file @
06a131cc
...
...
@@ -23,7 +23,7 @@
#define COBALT_BINDING_MAGIC 0x50534531
#define sc_cobalt_thread_create 0
/* 1 unimplemented */
#define sc_cobalt_thread_getpid 1
#define sc_cobalt_sched_weightprio 2
#define sc_cobalt_sched_yield 3
/* 4-5 unimplemented */
...
...
kernel/cobalt/posix/syscall.c
View file @
06a131cc
...
...
@@ -88,6 +88,7 @@ static int cobalt_syscall_ni(void)
static
struct
xnsyscall
cobalt_syscalls
[]
=
{
[
0
...
__NR_COBALT_SYSCALLS
-
1
]
=
SKINCALL_NI
,
SKINCALL_DEF
(
sc_cobalt_thread_create
,
cobalt_thread_create
,
init
),
SKINCALL_DEF
(
sc_cobalt_thread_getpid
,
cobalt_thread_pid
,
current
),
SKINCALL_DEF
(
sc_cobalt_thread_setschedparam_ex
,
cobalt_thread_setschedparam_ex
,
conforming
),
SKINCALL_DEF
(
sc_cobalt_thread_getschedparam_ex
,
cobalt_thread_getschedparam_ex
,
current
),
SKINCALL_DEF
(
sc_cobalt_sched_weightprio
,
cobalt_sched_weighted_prio
,
current
),
...
...
kernel/cobalt/posix/thread.c
View file @
06a131cc
...
...
@@ -705,6 +705,30 @@ int cobalt_thread_join(unsigned long pth)
return
xnthread_join
(
&
thread
->
threadbase
,
false
);
}
pid_t
cobalt_thread_pid
(
unsigned
long
pth
)
{
struct
cobalt_local_hkey
hkey
;
struct
cobalt_thread
*
thread
;
pid_t
pid
;
spl_t
s
;
trace_cobalt_pthread_pid
(
pth
);
xnlock_get_irqsave
(
&
nklock
,
s
);
hkey
.
u_pth
=
pth
;
hkey
.
mm
=
current
->
mm
;
thread
=
thread_lookup
(
&
hkey
);
if
(
thread
==
NULL
)
pid
=
-
ESRCH
;
else
pid
=
xnthread_host_pid
(
&
thread
->
threadbase
);
xnlock_put_irqrestore
(
&
nklock
,
s
);
return
pid
;
}
int
cobalt_thread_stat
(
pid_t
pid
,
struct
cobalt_threadstat
__user
*
u_stat
)
{
...
...
kernel/cobalt/posix/thread.h
View file @
06a131cc
...
...
@@ -128,7 +128,7 @@ struct cobalt_thread *cobalt_thread_find_local(pid_t pid);
struct
cobalt_thread
*
cobalt_thread_lookup
(
unsigned
long
pth
);
int
cobalt_thread_create
(
unsigned
long
tid
,
int
policy
,
int
cobalt_thread_create
(
unsigned
long
pth
,
int
policy
,
struct
sched_param_ex
__user
*
u_param
,
int
shifted_muxid
,
unsigned
long
__user
*
u_window_offset
);
...
...
@@ -140,24 +140,24 @@ cobalt_thread_shadow(struct task_struct *p,
int
cobalt_thread_setmode_np
(
int
clrmask
,
int
setmask
,
int
__user
*
u_mode_r
);
int
cobalt_thread_setname_np
(
unsigned
long
tid
,
const
char
__user
*
u_name
);
int
cobalt_thread_setname_np
(
unsigned
long
pth
,
const
char
__user
*
u_name
);
int
cobalt_thread_
probe_np
(
pid_t
h_tid
);
int
cobalt_thread_
kill
(
unsigned
long
pth
,
int
sig
);
int
cobalt_thread_
kill
(
unsigned
long
tid
,
int
sig
);
int
cobalt_thread_
join
(
unsigned
long
pth
);
in
t
cobalt_thread_
join
(
unsigned
long
tid
);
pid_
t
cobalt_thread_
pid
(
unsigned
long
pth
);
int
cobalt_thread_stat
(
pid_t
pid
,
struct
cobalt_threadstat
__user
*
u_stat
);
int
cobalt_thread_setschedparam_ex
(
unsigned
long
tid
,
int
cobalt_thread_setschedparam_ex
(
unsigned
long
pth
,
int
policy
,
const
struct
sched_param_ex
__user
*
u_param
,
unsigned
long
__user
*
u_window_offset
,
int
__user
*
u_promoted
);
int
cobalt_thread_getschedparam_ex
(
unsigned
long
tid
,
int
cobalt_thread_getschedparam_ex
(
unsigned
long
pth
,
int
__user
*
u_policy
,
struct
sched_param_ex
__user
*
u_param
);
...
...
kernel/cobalt/trace/cobalt-posix.h
View file @
06a131cc
...
...
@@ -177,11 +177,6 @@ DECLARE_EVENT_CLASS(cobalt_posix_pid,
TP_printk
(
"pid=%d"
,
__entry
->
pid
)
);
DEFINE_EVENT
(
cobalt_posix_pid
,
cobalt_pthread_probe
,
TP_PROTO
(
pid_t
pid
),
TP_ARGS
(
pid
)
);
DEFINE_EVENT
(
cobalt_posix_pid
,
cobalt_pthread_stat
,
TP_PROTO
(
pid_t
pid
),
TP_ARGS
(
pid
)
...
...
@@ -213,6 +208,18 @@ TRACE_EVENT(cobalt_pthread_join,
TP_printk
(
"pth=%p"
,
(
void
*
)
__entry
->
pth
)
);
TRACE_EVENT
(
cobalt_pthread_pid
,
TP_PROTO
(
unsigned
long
pth
),
TP_ARGS
(
pth
),
TP_STRUCT__entry
(
__field
(
unsigned
long
,
pth
)
),
TP_fast_assign
(
__entry
->
pth
=
pth
;
),
TP_printk
(
"pth=%p"
,
(
void
*
)
__entry
->
pth
)
);
TRACE_EVENT
(
cobalt_pthread_extend
,
TP_PROTO
(
unsigned
long
pth
,
const
char
*
name
),
TP_ARGS
(
pth
,
name
),
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment