Date: Wed, 31 Jul 2024 16:39:43 -0400 From: John Baldwin <jhb@FreeBSD.org> To: Nimbly2329 <hjlftdygaqf@use.startmail.com>, freebsd-drivers@freebsd.org Subject: Re: Asistence with sysctl proc's handle in kernel space Message-ID: <1116740a-8f7c-4adf-afdf-cc12d854ea84@FreeBSD.org> In-Reply-To: <172064548937.305907.8627778909077618453@startmail.com> References: <172064548937.305907.8627778909077618453@startmail.com>
next in thread | previous in thread | raw e-mail | index | archive | help
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
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?1116740a-8f7c-4adf-afdf-cc12d854ea84>