From nobody Wed Jul 31 20:39:43 2024 X-Original-To: freebsd-drivers@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4WZ3qh6D7xz5RJtD for ; Wed, 31 Jul 2024 20:39:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Received: from smtp.freebsd.org (smtp.freebsd.org [96.47.72.83]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "R10" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4WZ3qh4wg2z4hLg; Wed, 31 Jul 2024 20:39:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722458384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tHt+coTuqC0QTrRz1AzFCsdVd2SuuWbPWXv33LkIxmI=; b=LZjJf6HLH10wzeeKUrHZmK2ptiKc1dJvHCM8j3OtSZYxemZ62MOhGaha1RXXVjDgXH+NfB H0CKAwJ9G/6dAYAlvVo+TkMJPqgqBAg09a7mQEuvW3AQ6//SH+AksZzsV87Nnbu27vbP49 WUNvraHuK96yqGmKSyTWeNdIzVOQq5+MCbJpXp+Wc0DdtMhycirxPsYLwqcT2jHd6Oe19J KwRmHeYkitg/Q/ggkDkj1ctiNp+2hDv0Vwv/wzvzTiPpRqU/kxKa+Uiqvy+8EfH6iDMwhD GoVq4mfwnmuNl+VuamvyF75VVJ6lgfV8n3rC25DMeMKlj7No5YoeI/1CkWkYcw== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1722458384; a=rsa-sha256; cv=none; b=I6h0octIPpGVK4IfymqRWPP9aBdo4HX5mxek6/VnZWFdHdC7pDJGbaImoFoUdIJqqZOqJr EoB7rSfQSKn6FcCf6cyWm+WVy4X3I0bfjzyZ2BMF88nGRpFycYk9Swv7ZpN+T8QQQHXUHc N5iJvPD3f1kpax1BpV93wd70TlBXkWvpK8PmKQREA5L6+AoU4S+3y9VX8quDkzE9xPeuMt IwF+X4S527sHj4zkrHrGrX9XlgmCRavZDmZsbbn1g62hY0JAmjIfnt5IVpidBe8g/klUjT quk7kPkC0FGTfl6RVqVzWKb5B2VZ4C67fnNvweUA0C1ZZd4lLb6QRL3zB/ZT2w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1722458384; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=tHt+coTuqC0QTrRz1AzFCsdVd2SuuWbPWXv33LkIxmI=; b=eDDSElkqzljJQveTERKqRJFfVKZyv0/bgTBK/bt8IfhNtbf/E+juhhoJvvCcLh5GYHsVek Tc06aFP2kD5g1Vv/yRYG88LkVYJSb9CCWaH0YNP85HRAJxqvXtU6EvEn+0MAdG6kqy7fjH e2YN6s0kgbvTEYN8IXqBvbh2M6MnEap5vcP0Iv4acOZwqocb0mzZalBJOuIMGav1yRl2av 5s3wGgq+8yUsAxndYZfmqN9gdGMVuKKFX18hvUbes77OjTxLSDuzC06e56CYuxa7tIdnU7 ufFBNKFCs20etI3VaKPIOdj2omSAuIpj1RNCcgbbhUDZAmMJpVI6sGmpaVkaYQ== Received: from [IPV6:2601:5c0:4200:b830:a527:982d:44f2:7b0b] (unknown [IPv6:2601:5c0:4200:b830:a527:982d:44f2:7b0b]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) (Authenticated sender: jhb) by smtp.freebsd.org (Postfix) with ESMTPSA id 4WZ3qh3Trqz1Hhl; Wed, 31 Jul 2024 20:39:44 +0000 (UTC) (envelope-from jhb@FreeBSD.org) Message-ID: <1116740a-8f7c-4adf-afdf-cc12d854ea84@FreeBSD.org> Date: Wed, 31 Jul 2024 16:39:43 -0400 List-Id: Writing device drivers for FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-drivers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-drivers@FreeBSD.org MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: Asistence with sysctl proc's handle in kernel space Content-Language: en-US To: Nimbly2329 , freebsd-drivers@freebsd.org References: <172064548937.305907.8627778909077618453@startmail.com> From: John Baldwin In-Reply-To: <172064548937.305907.8627778909077618453@startmail.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit 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 > > #include > > > > .... > > > > 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