public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
@ 2007-09-26 14:39 Maxim Uvarov
  2007-09-26 11:01 ` [PATCH] Since we have counters in __u64 format we have to print themwith " Balbir Singh
  2007-09-26 11:32 ` [PATCH] Since we have counters in __u64 format we have to print them with " Andreas Schwab
  0 siblings, 2 replies; 8+ messages in thread
From: Maxim Uvarov @ 2007-09-26 14:39 UTC (permalink / raw)
  To: LKML; +Cc: balbir, jlan


Small fix for documentation.


                                                      
---

 Documentation/accounting/getdelays.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index cbee3a2..73924df 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
 void task_context_switch_counts(struct taskstats *t)
 {
 	printf("\n\nTask   %15s%15s\n"
-	       "       %15lu%15lu\n",
+	       "       %15llu%15llu\n",
 	       "voluntary", "nonvoluntary",
 	       t->nvcsw, t->nivcsw);
 }


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
@ 2007-09-26 17:52 Maxim Uvarov
  0 siblings, 0 replies; 8+ messages in thread
From: Maxim Uvarov @ 2007-09-26 17:52 UTC (permalink / raw)
  To: LKML; +Cc: balbir, jlan


Small fix for documentation.

Added (unsigned long long).

                                                      
---

 Documentation/accounting/getdelays.c |    5 +++--
 1 files changed, 3 insertions(+), 2 deletions(-)

diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
index cbee3a2..056f024 100644
--- a/Documentation/accounting/getdelays.c
+++ b/Documentation/accounting/getdelays.c
@@ -208,9 +208,10 @@ void print_delayacct(struct taskstats *t)
 void task_context_switch_counts(struct taskstats *t)
 {
 	printf("\n\nTask   %15s%15s\n"
-	       "       %15lu%15lu\n",
+	       "       %15llu%15llu\n",
 	       "voluntary", "nonvoluntary",
-	       t->nvcsw, t->nivcsw);
+	       (unsigned long long)t->nvcsw,
+	       (unsigned long long)t->nivcsw);
 }
 
 void print_ioacct(struct taskstats *t)


^ permalink raw reply related	[flat|nested] 8+ messages in thread
* Re: [PATCH] Since we have counters in __u64 format we have to print them with %llu macros.
@ 2007-09-26 12:36 Mikael Pettersson
  0 siblings, 0 replies; 8+ messages in thread
From: Mikael Pettersson @ 2007-09-26 12:36 UTC (permalink / raw)
  To: balbir, schwab; +Cc: balbir, jlan, linux-kernel, muvarov

On Wed, 26 Sep 2007 17:18:06 +0530, Balbir Singh wrote:
> Andreas Schwab wrote:
> > Maxim Uvarov <muvarov@ru.mvista.com> writes:
> > 
> >> diff --git a/Documentation/accounting/getdelays.c b/Documentation/accounting/getdelays.c
> >> index cbee3a2..73924df 100644
> >> --- a/Documentation/accounting/getdelays.c
> >> +++ b/Documentation/accounting/getdelays.c
> >> @@ -208,7 +208,7 @@ void print_delayacct(struct taskstats *t)
> >>  void task_context_switch_counts(struct taskstats *t)
> >>  {
> >>  	printf("\n\nTask   %15s%15s\n"
> >> -	       "       %15lu%15lu\n",
> >> +	       "       %15llu%15llu\n",
> >>  	       "voluntary", "nonvoluntary",
> >>  	       t->nvcsw, t->nivcsw);
> > 
> > __u64 is not always long long.
> 
> What is the maximum size of long long across all architectures?
> How does one format __u64 for printing?

With %lu you get warnings when u64 is long long (32-bit).
With %llu you get warnings when u64 is plain long (most 64-bit).

Hence %llu + long long cast, i.e.:
printf("%llu", (unsigned long long)value);

This is ugly but luckily imposes no runtime overheads on
current 32- or 64-bit machines.

This could be done more cleanly if the u64 typedef also
#define:d a corresponding FMT_U64 format string.

^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2007-09-27  8:20 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-09-26 14:39 [PATCH] Since we have counters in __u64 format we have to print them with %llu macros Maxim Uvarov
2007-09-26 11:01 ` [PATCH] Since we have counters in __u64 format we have to print themwith " Balbir Singh
2007-09-26 11:32 ` [PATCH] Since we have counters in __u64 format we have to print them with " Andreas Schwab
2007-09-26 11:48   ` Balbir Singh
2007-09-26 18:22     ` H. Peter Anvin
2007-09-27  8:19       ` Balbir Singh
  -- strict thread matches above, loose matches on Subject: below --
2007-09-26 17:52 Maxim Uvarov
2007-09-26 12:36 Mikael Pettersson

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox