Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 234616
b: refs/heads/master
c: 81e294c
h: refs/heads/master
v: v3
  • Loading branch information
Richard Cochran authored and Thomas Gleixner committed Feb 2, 2011
1 parent 292e2ce commit 1a84ec2
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 2 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: ce26efdefa5e8f22d933df72d7f7482725091d6d
refs/heads/master: 81e294cba2596f5f10848bbe19d98b344c2a2d5c
13 changes: 13 additions & 0 deletions trunk/include/linux/posix-timers.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,17 @@ struct cpu_timer_list {
int firing;
};

/*
* Bit fields within a clockid:
*
* The most significant 29 bits hold either a pid or a file descriptor.
*
* Bit 2 indicates whether a cpu clock refers to a thread or a process.
*
* Bits 1 and 0 give the type: PROF=0, VIRT=1, SCHED=2, or FD=3.
*
* A clockid is invalid if bits 2, 1, and 0 are all set.
*/
#define CPUCLOCK_PID(clock) ((pid_t) ~((clock) >> 3))
#define CPUCLOCK_PERTHREAD(clock) \
(((clock) & (clockid_t) CPUCLOCK_PERTHREAD_MASK) != 0)
Expand All @@ -29,6 +40,8 @@ struct cpu_timer_list {
#define CPUCLOCK_VIRT 1
#define CPUCLOCK_SCHED 2
#define CPUCLOCK_MAX 3
#define CLOCKFD CPUCLOCK_MAX
#define CLOCKFD_MASK (CPUCLOCK_PERTHREAD_MASK|CPUCLOCK_CLOCK_MASK)

#define MAKE_PROCESS_CPUCLOCK(pid, clock) \
((~(clockid_t) (pid) << 3) | (clockid_t) (clock))
Expand Down
2 changes: 1 addition & 1 deletion trunk/kernel/posix-timers.c
Original file line number Diff line number Diff line change
Expand Up @@ -488,7 +488,7 @@ static void release_posix_timer(struct k_itimer *tmr, int it_id_set)
static struct k_clock *clockid_to_kclock(const clockid_t id)
{
if (id < 0)
return &clock_posix_cpu;
return (id & CLOCKFD_MASK) == CLOCKFD ? NULL : &clock_posix_cpu;

if (id >= MAX_CLOCKS || !posix_clocks[id].clock_getres)
return NULL;
Expand Down

0 comments on commit 1a84ec2

Please sign in to comment.