The output of hexadecimal bytes are in lowercase. Update the example to reflect the reality.
MFC after: 1 week
Differential D39543
printf.9: Update the example for %D conversion specifier Authored by zlei on Apr 13 2023, 4:03 AM. Tags None Referenced Files
Details The output of hexadecimal bytes are in lowercase. Update the example to reflect the reality. MFC after: 1 week
Diff Detail
Event TimelineComment Actions Tested with a minimal kernel module: #include <sys/types.h>
#include <sys/param.h>
#include <sys/systm.h>
#include <sys/module.h>
#include <sys/kernel.h>
static void
printf_test(void)
{
printf("reg=%b\n", 3, "\10\2BITTWO\1BITONE");
printf("out: %4D\n", "AAZZ", ":");
}
/*
* The function called at load/unload.
*/
static int
load(module_t mod, int cmd, void *arg)
{
int error;
error = 0;
switch (cmd) {
case MOD_LOAD:
printf("Load foo\n");
printf_test();
break;
case MOD_UNLOAD:
printf("Unload foo\n");
break;
default:
error = EOPNOTSUPP;
break;
}
return (error);
}
static moduledata_t mod_data = {
"foo",
load,
0
};
DECLARE_MODULE(foo, mod_data, SI_SUB_EXEC, SI_ORDER_ANY);Makefile: # $FreeBSD$ PACKAGE=foo SRCS = foo.c KMOD = foo .include <bsd.kmod.mk> Steps to test: # make # kldload ./foo.ko # kldunload foo.ko # dmesg | tail Load foo reg=3<BITTWO,BITONE> out: 41:41:5a:5a Unload foo |