Hi there!
Right now I'm learnig driver development with the mentioned book. Now, in chapter 3, "Implementing sysctls, Part 1", there are compiler errors by using my own sourcecode and by using the sample code directly from the webiste, https://nostarch.com/bsddrivers.htm :
is this book outdated or something?
Right now I'm learnig driver development with the mentioned book. Now, in chapter 3, "Implementing sysctls, Part 1", there are compiler errors by using my own sourcecode and by using the sample code directly from the webiste, https://nostarch.com/bsddrivers.htm :
Code:
root@FreeBSD:/home/ralf # make
Warning: Object directory not changed from original /usr/home/ralf
cc -O2 -pipe -fno-strict-aliasing -Werror -D_KERNEL -DKLD_MODULE -nostdinc -I. -I/usr/src/sys -I/usr/src/sys/contrib/ck/include -fno-common -fno-omit-frame-pointer -mno-omit-leaf-frame-pointer -MD -MF.depend.pointless.o -MTpointless.o -mcmodel=kernel -mno-red-zone -mno-mmx -mno-sse -msoft-float -fno-asynchronous-unwind-tables -ffreestanding -fwrapv -fstack-protector -Wall -Wredundant-decls -Wnested-externs -Wstrict-prototypes -Wmissing-prototypes -Wpointer-arith -Wcast-qual -Wundef -Wno-pointer-sign -D__printf__=__freebsd_kprintf__ -Wmissing-include-dirs -fdiagnostics-show-option -Wno-unknown-pragmas -Wno-error-tautological-compare -Wno-error-empty-body -Wno-error-parentheses-equality -Wno-error-unused-function -Wno-error-pointer-sign -Wno-error-shift-negative-value -Wno-address-of-packed-member -mno-aes -mno-avx -std=iso9899:1999 -c pointless.c -o pointless.o
pointless.c:62:7: error: use of undeclared identifier 'sysctl__'
SYSCTL_STATIC_CHILDREN(/* tree top */), OID_AUTO,
^
/usr/src/sys/sys/sysctl.h:241:44: note: expanded from macro 'SYSCTL_STATIC_CHILDREN'
#define SYSCTL_STATIC_CHILDREN(oid_name) (&sysctl__##oid_name.oid_children)
^
pointless.c:61:8: error: assigning to 'struct sysctl_oid *' from incompatible type 'void'
poid = SYSCTL_ADD_NODE(&clist,
^ ~~~~~~~~~~~~~~~~~~~~~~~
pointless.c:80:3: error: static_assert failed "compile-time assertion failed"
SYSCTL_ADD_PROC(&clist, SYSCTL_CHILDREN(poid), OID_AUTO,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/sys/sysctl.h:759:2: note: expanded from macro 'SYSCTL_ADD_PROC'
CTASSERT(((access) & CTLTYPE) != 0); \
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/usr/src/sys/sys/systm.h:120:21: note: expanded from macro 'CTASSERT'
#define CTASSERT(x) _Static_assert(x, "compile-time assertion failed")
^ ~
3 errors generated.
*** Error code 1
is this book outdated or something?