From nobody Tue Sep 19 09:53:45 2023 X-Original-To: freebsd-hackers@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 4RqcSL3Mhnz4thmm for ; Tue, 19 Sep 2023 09:53:54 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Received: from heemeyer.club (heemeyer.club [195.93.173.158]) (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 did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 4RqcSK5l47z3TD2 for ; Tue, 19 Sep 2023 09:53:53 +0000 (UTC) (envelope-from dchagin@heemeyer.club) Authentication-Results: mx1.freebsd.org; none Received: from heemeyer.club (localhost [127.0.0.1]) by heemeyer.club (8.17.2/8.16.1) with ESMTP id 38J9rjLT067046; Tue, 19 Sep 2023 12:53:45 +0300 (MSK) (envelope-from dchagin@heemeyer.club) Received: (from dchagin@localhost) by heemeyer.club (8.17.2/8.16.1/Submit) id 38J9rjxs067045; Tue, 19 Sep 2023 12:53:45 +0300 (MSK) (envelope-from dchagin) Date: Tue, 19 Sep 2023 12:53:45 +0300 From: Dmitry Chagin To: Rocky Hotas Cc: freebsd-hackers@freebsd.org Subject: Re: Error while building a kernel module with mkdir(2) Message-ID: References: List-Id: Technical discussions relating to FreeBSD List-Archive: https://lists.freebsd.org/archives/freebsd-hackers List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-hackers@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: X-Spamd-Bar: ---- X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:61400, ipnet:195.93.173.0/24, country:RU] X-Rspamd-Queue-Id: 4RqcSK5l47z3TD2 On Mon, Sep 18, 2023 at 11:12:57PM +0200, Rocky Hotas wrote: > Hello! > I hope this is the right ML to discuss about this issue. I am trying to > build the example kernel module presented in paragraph 2.1 of > > Designing BSD Rootkits: An Introduction to Kernel Hacking > by Joseph Kong > > However, I get this error: > > mkdir_hook.c:42:9: error: implicit declaration of function 'mkdir' is invalid in C99 [-Werror,-Wimplicit-function-declaration] > return(mkdir(td, syscall_args)); > ^ > mkdir_hook.c:57:45: error: use of undeclared identifier 'mkdir' > sysent[SYS_mkdir].sy_call = (sy_call_t *)mkdir; > > mkdir(2) requires `#include ' and I added it (while it was > not in the code from the book), but nothing changes. > > What's still wrong? > No more mkdir, look for kern_mkdirat at syscallsubr.h