OpenCores
URL https://opencores.org/ocsvn/c0or1k/c0or1k/trunk

Subversion Repositories c0or1k

[/] [c0or1k/] [trunk/] [docs/] [man/] [man7/] [l4_getid.7] - Blame information for rev 2

Details | Compare with Previous | View Log

Line No. Rev Author Line
1 2 drasko
.TH L4_GETID 7 2009-11-02 "Codezero" "Codezero Programmer's Manual"
2
.SH NAME
3
.nf
4
.BR "l4_getid" " - returns thread id, thread group id and space id of a thread."
5
 
6
.SH SYNOPSIS
7
.nf
8
.B #include 
9
.B #include 
10
 
11
.BI "int l4_getid(struct task_ids " "*ids" ");"
12
.SH DESCRIPTION
13
.BR "l4_getid() " "returns thread id, thread group id and space id of a thread in a " "struct task_ids " "structure, as shown below."
14
 
15
.nf
16
.B struct task_ids {
17
.BI "      int " "tid" ";   /* Fully qualified thread id */"
18
.BI "      int " "spid" ";  /* Address space id (local to container) */"
19
.BI "      int " "tgid" ";  /* Thread group id (local, defined by userspace protocol) */"
20
};
21
 
22
.fi
23
 
24
.in 7
25
Every thread in the system has a thread id, space id and a thread group id associated with it. Each thread and space id is globally unique across the system. Thread group ids are available for grouping threads in arbitrary groups, via a user-defined protocol. A newly created thread may join an existing thread group or create a new group. This behaviour is defined by the thread's pager. Such a user-defined thread group allocation protocol may be useful for implementing groups of threads by higher level OS services.
26
 
27
Even though both thread and space ids are globally unique across the system, there is an addressability difference between them. Each thread id is a fully qualified id, carrying its container id information with it. Upon a system call that targets a thread id, the system allows addressing threads that reside in other containers. In contrast, space ids are not fully qualified. They are local to a container, and any system call addressing a space id cannot target a space in another container. For thread ids,
28
.BI "__cid("tid ")"
29
macro extracts the Container ID information from the fully qualified thread id, whereas the
30
.BI " __raw_tid("tid ")"
31
macro provides the raw Thread ID, which omits the container ID information from the thread id. Such a raw ID still uniquely identifies the thread across containers, i.e. there is one such raw id per thread across the system.
32
 
33
.SH FUTURE
34
.BR "l4_getid() " "call is currently not subject to capability checking, as every thread has a natural right to discover their ids. In the future, it is possible that this system call is used for naming discovery for other addressable entities. If such a role is given to this call, it may also become subject to capability checking, as access control would prove beneficial over naming discovery services."
35
 
36
 
37
.SH L4 USERSPACE LIBRARY
38
 
39
.nf
40
.B #include 
41
 
42
/*
43
 * Returns Thread ID of current thread
44
 */
45
.BI "static inline l4id_t self_tid(" "void" ")"
46
 
47
.SH RETURN VALUE
48
.BR "l4_getid()" " always succeeds with a return value of 0."
49
 

powered by: WebSVN 2.1.0

© copyright 1999-2024 OpenCores.org, equivalent to Oliscience, all rights reserved. OpenCores®, registered trademark.