how to kernel printf a int64_t?
Eric van Gyzen
eric at vangyzen.net
Fri Oct 31 00:53:57 UTC 2014
On 10/30/2014 17:01, Rick Macklem wrote:
> I feel kinda dumb asking this, but...
> int64_t i;
>
> printf("%qd\n", (u_quad_t)i);
>
> works but looks dorky, to put it technically;-).
> Is there a better way to printf() a int64_t in the kernel?
The ANSI C way would be:
#include <machine/_inttypes.h>
int64_t i;
printf("%"PRId64"\n", i);
It's probably bad form to directly #include a file name with an
underscore into an implementation file, but I don't see any other way.
Maybe we could create a <sys/inttypes.h> that #includes the necessary
files to be a kernel equivalent of <inttypes.h>.
Eric
More information about the freebsd-hackers
mailing list