Re: 64bit type printf formats...

From: Richard B. Johnson (root@chaos.analogic.com)
Date: Thu Feb 03 2000 - 17:22:17 EST


On Thu, 3 Feb 2000, Richard B. Johnson wrote:

> On Thu, 3 Feb 2000, Raj, Ashok wrote:
>
> > Hello.
> >
> > Is there a 64bit type printf format. If so is that available for printk
> > also?
> >
> > thanks
> > ashokr
>
> ../linux/lib/vsprintf.c seems to handle 'long long'. Try it and
> see. It's 'printk("%L\n", long_long);', a quick glance of the source
> seems to show.

This bit of code shows that the kernel's long-long works.

Just compile this and insert it as a module. You can remove it
also.

#define MODULE
#define __KERNEL__
#include <linux/kernel.h>
#include <linux/module.h>

unsigned long long foo = 0x1234123412341234;

int init_module()
{
    printk("%Lu\n", foo);
    printk("%16Lx\n", foo);
    return 0;
}
void cleanup_module()
{
    printk("Removed\n");
    return;
}

FYI, writing a tiny module like this is how I test things in the
kernel environment. Great stuff, those modules.

Cheers,
Dick Johnson

Penguin : Linux version 2.3.41 on an i686 machine (800.63 BogoMips).

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Feb 07 2000 - 21:00:10 EST