From nobody Sat Jul 01 15:58:22 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 4QtcLZ0GSTz4lFlp for ; Sat, 1 Jul 2023 15:59:02 +0000 (UTC) (envelope-from garyj@gmx.de) Received: from mout.gmx.net (mout.gmx.net [212.227.17.20]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange ECDHE (P-256) server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (2048 bits) client-digest SHA256) (Client CN "mout.gmx.net", Issuer "Telekom Security ServerID OV Class 2 CA" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4QtcLY3b6hz4H1w for ; Sat, 1 Jul 2023 15:59:01 +0000 (UTC) (envelope-from garyj@gmx.de) Authentication-Results: mx1.freebsd.org; none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=gmx.de; s=s31663417; t=1688227137; x=1688831937; i=garyj@gmx.de; bh=Lub4HGs6OPh5BEoJOTZ/nfDHHvCie/g2MTQvJqCB1LQ=; h=X-UI-Sender-Class:Date:From:To:Cc:Subject:In-Reply-To:References:Reply- To; b=c2kMIAGtN0+XDNBxl9cSZiUdc1/5nFcDraT7zKhgdlyXrcQNPe8j5TzlaKJbljuAtsE+R2V jJITk9u6AIx36rnMFIiFcByIrChf284zXUDbOoXVpeJfUyKgKn+b7ZRNYFLVgcOE1cEjONvmm w14hLsTvWnxP1QZsOS2CrEse0fRUs5u1p+p+ZrlYKoyH09fI5r6+cVpAKlhcXdZyqCqsm4YoV hco55axT8nqpclIb6RM6E4uJ32fuCYMMQ1ROy2SPPRtXeFxUu9AkM0sSCZaUfFO4BBOvVbzkh oqfLJEG7Vs6lkAnrrFDQxyEZqB4YJbrzwFGZpET/x6LJ/MkCrTlA== X-UI-Sender-Class: 724b4f7f-cbec-4199-ad4e-598c01a50d3a Received: from ernst.home ([217.226.50.54]) by mail.gmx.net (mrgmx105 [212.227.17.168]) with ESMTPSA (Nemesis) id 1MmUHp-1pY4qv42qX-00iRMq; Sat, 01 Jul 2023 17:58:57 +0200 Date: Sat, 1 Jul 2023 15:58:22 +0000 From: Gary Jennejohn To: "Pat Maddox" Cc: freebsd-hackers@freebsd.org Subject: Re: How are syscall functions defined? Message-ID: <20230701175822.5905eb50@ernst.home> In-Reply-To: <32a0f7e7-11b7-443e-a601-40bec7798d8f@app.fastmail.com> References: <5f311275-e307-4e78-a479-c6d4e7f116d5@app.fastmail.com> <32a0f7e7-11b7-443e-a601-40bec7798d8f@app.fastmail.com> Reply-To: garyj@gmx.de X-Mailer: Claws Mail 3.19.0 (GTK+ 2.24.33; amd64-portbld-freebsd14.0) 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=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-Provags-ID: V03:K1:MPAqwCzGT4LB13UDOfpl85jiZ1wrf3zRj0SIeFeKawq20iyFVeU Eik2q3qM/DGIzrTqLtUMFC6vbrszUiYjvyx+/Eya4pfhDly0u9aEuh8LsuSQyr8sahImgaS TqEjynANnZXUGxhBFgq6D0YntZGiYJqX4QlN2mAErdERu1S5mUHoMWriENZ1u5b+l3A+QXJ DuaJ3/14N38t5bSvqnOAg== X-Spam-Flag: NO UI-OutboundReport: notjunk:1;M01:P0:kHmGgx9+2jA=;PLkDKNOiXwCIHdKH+iUnLh0J07K aJTfI60uWYZps4Du4CuoVUer6BVwC+xTRZJ4K2iqnZ4sm/4cj1pNRnW6+XVjw4Uhg9I6oKGC6 WcA1iEw28RzZTT8RzMU4JqbEArEGZYLajM4r/BwRVrn0kniViXA9MASQlG9Xd6Sbej4VjYoeg t4rg4yJV1pF5ojZ9TrGGhl6MfDXn/NW8HGHb3vUU4zz26GY18/oLfSgYMHpLhJe7y52zM23ZI U7eAc6XqdnaWU5yIU9G2TS89aL1eIZGKoFJyuKfRyJLYSMYADeWS2UsFJMnIaLXufNH9no74C 9Pb2PCxAmgKPZ+0Ym/FgKA+0MPJ7yeG5LRASEmLZrM3acEp5s+wclbODuPaYDSHpW/rTuK0SR fhOQTIvHrvREzM2MGVfB+KjFfr5JMo1gesQnVODE0tf4pU5xQhh/PBF1HKsWp8vjqTWQBAB+8 tfszM27q0I7S74JIXYj+DaCdKTO+y4y4M6sORsTdmsRj1JOTrC0+VGZvs/WkDyeKIpsSubD8E ixe8QupopP99jSSs6rR0ozi1sK3Nob1GroHZP01229dse6mqtAzDOHwH1AiZwbEw+yZbudIBZ BnaWAUcsDVn56DZG2DDKCRNWoFxXgnyyVH5vHvRP5X1fXXPluoxHbSWyk0CqFEj9/u7PGQqxz 6suXRPi9iUDqbu+OHQEN8YzGOWTL0zaC1VgcwPIPlzUI+vGf3dhaDOC5T1OKRvOwhHq1KixcT wBTL33HDT4R/lAtpYgbc0RpZzJIlqFaEAX6WH3vDpdHE9XLwtEVWQeTK9IGNzVyASP19s3JDK 96g8gAEcMi0XcWE8XLQ97LYNLLHihxKnjwyKjeUZBnLAguCIuvh60N6ufEljxd6sxKZiBouu4 XeaIUT6wwgpp7Nj4oIQ03JRgX524Czz5O3KedyJJnUfE7VgY5aa6+w9PmvwB8UT3+YkiYxrxZ CVhk9ySkh22rXJZY/MByYv05zGU= X-Rspamd-Queue-Id: 4QtcLY3b6hz4H1w X-Spamd-Bar: ---- X-Spamd-Result: default: False [-4.00 / 15.00]; REPLY(-4.00)[]; ASN(0.00)[asn:8560, ipnet:212.227.0.0/16, country:DE] X-Rspamd-Pre-Result: action=no action; module=replies; Message is reply to one we originated X-ThisMailContainsUnwantedMimeParts: N On Sat, 01 Jul 2023 04:22:35 -0700 "Pat Maddox" wrote: > On Sat, Jul 1, 2023, at 3:11 AM, Pat Maddox wrote: > > jail_attach is defined in syscalls.master [1] which generates a > > declaration in jail.h [2]. Try as I might, I can?t find any definition > > of that specific syscall function (or any other). I think the closest > > I?ve found is sys_jail_attach in kern_jail.c [3]. I suspect there?s > > some generation going on that defines jail_attach - but if that?s the > > case, I haven?t been able to track it down. > > > > Can someone point me to how the C function gets defined? > > > > Thanks, > > Pat > > > > [1] > > https://github.com/freebsd/freebsd-src/blob/releng/13.2/sys/kern/sysca= lls.master#L2307 > > [2] > > https://github.com/freebsd/freebsd-src/blob/releng/13.2/sys/sys/jail.h= #L119 > > [3] > > https://github.com/freebsd/freebsd-src/blob/releng/13.2/sys/kern/kern_= jail.c#L2340 > > Symbol.map [1] is used to produce a version map [2] which is then fed to= the linker [3], which I assume maps the symbols in the resulting binary. = I intend to experiment with that a bit, but I think that makes sense. > > Pat > > [1] https://github.com/freebsd/freebsd-src/blob/releng/13.2/lib/libc/sys= /Symbol.map#L672 > [2] https://github.com/freebsd/freebsd-src/blob/releng/13.2/share/mk/bsd= .symver.mk#L43 > [3] https://github.com/freebsd/freebsd-src/blob/releng/13.2/share/mk/bsd= .lib.mk#L253 > There's struct sysent sysent[] in /sys/kern/init_sysent.c which has all the syscalls. It's apparently indexed using the syscall number. It's automatically generated, although I don't exactly know how. =2D- Gary Jennejohn