2013-05-17 15:53:52

by Pavel Tikhomirov

[permalink] [raw]
Subject: [PATCH 0/1] posix timers: Expand exitsting info in proc file

Hi.

I'm working on the checkpoint-restore project (http://criu.org), on
realisation of posix-timers. To compleatly checkpoint and restore these
timers we need to know which clock they are using. So I d'like to add
this information to existing syscall which shows posix-timers info.

Pavel Tikhomirov (1):
posix-timers: Show clock ID in proc file

fs/proc/base.c | 1 +
1 file changed, 1 insertion(+)

--
1.7.9.5


2013-05-17 15:54:06

by Pavel Tikhomirov

[permalink] [raw]
Subject: [PATCH 1/1] posix-timers: Show clock ID in proc file

Expand information about posix-timers in /proc/<pid>/timers by adding
info about clock, with which the timer was created. I.e. in the forth
line of timer info after "notify:" line go "ClockID: <clock_id>".

Signed-off-by: Pavel Tikhomirov <[email protected]>
---
fs/proc/base.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index 2dad4a9..8a38eef 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2079,6 +2079,7 @@ static int show_timer(struct seq_file *m, void *v)
nstr[notify & ~SIGEV_THREAD_ID],
(notify & SIGEV_THREAD_ID) ? "tid" : "pid",
pid_nr_ns(timer->it_pid, tp->ns));
+ seq_printf(m, "ClockID: %d\n", timer->it_clock);

return 0;
}
--
1.7.9.5

2013-05-17 15:59:18

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/1] posix-timers: Show clock ID in proc file

On Fri, May 17, 2013 at 02:12:03AM +0400, Pavel Tikhomirov wrote:
> Expand information about posix-timers in /proc/<pid>/timers by adding
> info about clock, with which the timer was created. I.e. in the forth
> line of timer info after "notify:" line go "ClockID: <clock_id>".
>
> Signed-off-by: Pavel Tikhomirov <[email protected]>
> ---
> fs/proc/base.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index 2dad4a9..8a38eef 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2079,6 +2079,7 @@ static int show_timer(struct seq_file *m, void *v)
> nstr[notify & ~SIGEV_THREAD_ID],
> (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
> pid_nr_ns(timer->it_pid, tp->ns));
> + seq_printf(m, "ClockID: %d\n", timer->it_clock);

What userspace tool just broke by adding a new field to this file?

thanks,

greg k-h

2013-05-17 16:11:49

by Pavel Emelyanov

[permalink] [raw]
Subject: Re: [PATCH 1/1] posix-timers: Show clock ID in proc file

On 05/17/2013 02:12 AM, Pavel Tikhomirov wrote:
> Expand information about posix-timers in /proc/<pid>/timers by adding
> info about clock, with which the timer was created. I.e. in the forth
> line of timer info after "notify:" line go "ClockID: <clock_id>".
>
> Signed-off-by: Pavel Tikhomirov <[email protected]>


Acked-by: Pavel Emelyanov <[email protected]>

> ---
> fs/proc/base.c | 1 +
> 1 file changed, 1 insertion(+)
>
> diff --git a/fs/proc/base.c b/fs/proc/base.c
> index 2dad4a9..8a38eef 100644
> --- a/fs/proc/base.c
> +++ b/fs/proc/base.c
> @@ -2079,6 +2079,7 @@ static int show_timer(struct seq_file *m, void *v)
> nstr[notify & ~SIGEV_THREAD_ID],
> (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
> pid_nr_ns(timer->it_pid, tp->ns));
> + seq_printf(m, "ClockID: %d\n", timer->it_clock);
>
> return 0;
> }
>

2013-05-17 16:13:01

by Pavel Emelyanov

[permalink] [raw]
Subject: Re: [PATCH 1/1] posix-timers: Show clock ID in proc file

On 05/17/2013 07:59 PM, Greg KH wrote:
> On Fri, May 17, 2013 at 02:12:03AM +0400, Pavel Tikhomirov wrote:
>> Expand information about posix-timers in /proc/<pid>/timers by adding
>> info about clock, with which the timer was created. I.e. in the forth
>> line of timer info after "notify:" line go "ClockID: <clock_id>".
>>
>> Signed-off-by: Pavel Tikhomirov <[email protected]>
>> ---
>> fs/proc/base.c | 1 +
>> 1 file changed, 1 insertion(+)
>>
>> diff --git a/fs/proc/base.c b/fs/proc/base.c
>> index 2dad4a9..8a38eef 100644
>> --- a/fs/proc/base.c
>> +++ b/fs/proc/base.c
>> @@ -2079,6 +2079,7 @@ static int show_timer(struct seq_file *m, void *v)
>> nstr[notify & ~SIGEV_THREAD_ID],
>> (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
>> pid_nr_ns(timer->it_pid, tp->ns));
>> + seq_printf(m, "ClockID: %d\n", timer->it_clock);
>
> What userspace tool just broke by adding a new field to this file?

Zero for two reasons:

1. this proc file appeared this merge window
2. this file format is

<name>: <value>

and should be parsed line-by-line by applications like e.g. /proc/pid/status
or /proc/pid/smaps. Both these files were extended with fields in the past with
no worries to tools, so should be this new one.

> thanks,
>
> greg k-h
> .
>


Thanks,
Pavel

2013-05-17 16:22:10

by Greg Kroah-Hartman

[permalink] [raw]
Subject: Re: [PATCH 1/1] posix-timers: Show clock ID in proc file

On Fri, May 17, 2013 at 08:12:55PM +0400, Pavel Emelyanov wrote:
> On 05/17/2013 07:59 PM, Greg KH wrote:
> > On Fri, May 17, 2013 at 02:12:03AM +0400, Pavel Tikhomirov wrote:
> >> Expand information about posix-timers in /proc/<pid>/timers by adding
> >> info about clock, with which the timer was created. I.e. in the forth
> >> line of timer info after "notify:" line go "ClockID: <clock_id>".
> >>
> >> Signed-off-by: Pavel Tikhomirov <[email protected]>
> >> ---
> >> fs/proc/base.c | 1 +
> >> 1 file changed, 1 insertion(+)
> >>
> >> diff --git a/fs/proc/base.c b/fs/proc/base.c
> >> index 2dad4a9..8a38eef 100644
> >> --- a/fs/proc/base.c
> >> +++ b/fs/proc/base.c
> >> @@ -2079,6 +2079,7 @@ static int show_timer(struct seq_file *m, void *v)
> >> nstr[notify & ~SIGEV_THREAD_ID],
> >> (notify & SIGEV_THREAD_ID) ? "tid" : "pid",
> >> pid_nr_ns(timer->it_pid, tp->ns));
> >> + seq_printf(m, "ClockID: %d\n", timer->it_clock);
> >
> > What userspace tool just broke by adding a new field to this file?
>
> Zero for two reasons:
>
> 1. this proc file appeared this merge window
> 2. this file format is
>
> <name>: <value>
>
> and should be parsed line-by-line by applications like e.g. /proc/pid/status
> or /proc/pid/smaps. Both these files were extended with fields in the past with
> no worries to tools, so should be this new one.

Ok, just making sure :)

Subject: [tip:timers/urgent] posix-timers: Show clock ID in proc file

Commit-ID: 15ef0298deb3929eb6ad6d2334fd2059fd53807c
Gitweb: http://git.kernel.org/tip/15ef0298deb3929eb6ad6d2334fd2059fd53807c
Author: Pavel Tikhomirov <[email protected]>
AuthorDate: Fri, 17 May 2013 02:12:03 +0400
Committer: Thomas Gleixner <[email protected]>
CommitDate: Tue, 28 May 2013 11:41:14 +0200

posix-timers: Show clock ID in proc file

Expand information about posix-timers in /proc/<pid>/timers by adding
info about clock, with which the timer was created. I.e. in the forth
line of timer info after "notify:" line go "ClockID: <clock_id>".

Signed-off-by: Pavel Tikhomirov <[email protected]>
Cc: Michael Kerrisk <[email protected]>
Cc: Matthew Helsley <[email protected]>
Cc: Pavel Emelyanov <[email protected]>
Link: http://lkml.kernel.org/r/[email protected]
Signed-off-by: Thomas Gleixner <[email protected]>
---
fs/proc/base.c | 1 +
1 file changed, 1 insertion(+)

diff --git a/fs/proc/base.c b/fs/proc/base.c
index dd51e50..c3834da 100644
--- a/fs/proc/base.c
+++ b/fs/proc/base.c
@@ -2118,6 +2118,7 @@ static int show_timer(struct seq_file *m, void *v)
nstr[notify & ~SIGEV_THREAD_ID],
(notify & SIGEV_THREAD_ID) ? "tid" : "pid",
pid_nr_ns(timer->it_pid, tp->ns));
+ seq_printf(m, "ClockID: %d\n", timer->it_clock);

return 0;
}