Re: Asistence with sysctl proc's handle in kernel space
Date: Wed, 31 Jul 2024 20:39:43 UTC
On 7/10/24 17:04, Nimbly2329 wrote: > I am following FreeBSD drivers: A guide for the intrepid by Joseph Kong to > learn to write FreeBSD device drivers. > > > > I got to the sysctl subchapter where is more or less this code > > > > #include <sys/param.h> > > #include <sys/sysctl.h> > > > > .... > > > > static int sysctl_set_buffer_size(SYSCTL_HANDLER_ARGS) { > > int error = 0; > > int size = echo_message->buffer_size; > > error = sysctl_handle_int(oidp, &size, 0, req); > > if (error || !req->newptr || echo_message->buffer_size == size) return > (error); > > if (size >= 128 && size <= 512) { > > echo_message->buffer = realloc(echo_message->buffer, size, M_ECHO, M_WAITOK); > > echo_message->buffer_size = size; > > if (echo_message->length >= size) { > > echo_message->length = size - 1; > > echo_message->buffer[size - 1] = '\0'; > > } > > } else { > > error = EINVAL; > > } > > return (error); > > } > > > > but when compiling I got the error: > > > > error: call to undeclared function 'sysctl_int_handle'; ISO C99 and later do > not support implicit function declarations [-Werror,-Wimplicit-function- > declaration] > > 167 | error = sysctl_int_handle(oidp, &size, 0, req); > Your error here shows 'sysctl_int_handle' instead of 'sysctl_handle_int' -- John Baldwin