From owner-freebsd-hackers@freebsd.org Mon Oct 3 18:18:08 2016 Return-Path: Delivered-To: freebsd-hackers@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id BB66FAF4CA6 for ; Mon, 3 Oct 2016 18:18:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from kib.kiev.ua (kib.kiev.ua [IPv6:2001:470:d5e7:1::1]) (using TLSv1 with cipher DHE-RSA-CAMELLIA256-SHA (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 3B6AF339; Mon, 3 Oct 2016 18:18:08 +0000 (UTC) (envelope-from kostikbel@gmail.com) Received: from tom.home (kib@localhost [127.0.0.1]) by kib.kiev.ua (8.15.2/8.15.2) with ESMTPS id u93II37g000968 (version=TLSv1 cipher=DHE-RSA-CAMELLIA256-SHA bits=256 verify=NO); Mon, 3 Oct 2016 21:18:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) DKIM-Filter: OpenDKIM Filter v2.10.3 kib.kiev.ua u93II37g000968 Received: (from kostik@localhost) by tom.home (8.15.2/8.15.2/Submit) id u93II35W000967; Mon, 3 Oct 2016 21:18:03 +0300 (EEST) (envelope-from kostikbel@gmail.com) X-Authentication-Warning: tom.home: kostik set sender to kostikbel@gmail.com using -f Date: Mon, 3 Oct 2016 21:18:03 +0300 From: Konstantin Belousov To: Alan Somers Cc: "freebsd-hackers@freebsd.org" Subject: Re: Proper way to add vendor-specific syscalls? Message-ID: <20161003181803.GS38409@kib.kiev.ua> References: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.1 (2016-04-27) X-Spam-Status: No, score=-2.0 required=5.0 tests=ALL_TRUSTED,BAYES_00, DKIM_ADSP_CUSTOM_MED,FREEMAIL_FROM,NML_ADSP_CUSTOM_MED autolearn=no autolearn_force=no version=3.4.1 X-Spam-Checker-Version: SpamAssassin 3.4.1 (2015-04-28) on tom.home X-BeenThere: freebsd-hackers@freebsd.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Technical Discussions relating to FreeBSD List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 03 Oct 2016 18:18:08 -0000 On Mon, Oct 03, 2016 at 11:48:39AM -0600, Alan Somers wrote: > What's the proper way to add a vendor-specific syscall? The comments > in kern/syscalls.master suggest that they should be put in the range > from 151-180, but most of that range is actually occupied. I think that the 'vendors' there means vendors of other BSD-derived systems and not e.g. an appliance vendors. > Only five > nosys slots are available. If I add syscalls to the end of the list, > they'll likely collide with future standard syscalls. Should I just > added ~100 nosys syscalls to the end of the list, and put my custom > syscalls afterwards? Is there any penalty to lengthening the list? Each nosys syscall increases the size of the default ABI syscalls table. On amd64 sizeof(struct sysent) == 48, adding 100 nosys entries would waste a page and some more. How many syscalls do you need ? You probably do not allow random modules loaded and implementing syscalls, so could you use e.g. range 210-219 ? If you look further, you will see lot of holes like 258-271, 281-288 etc. Current practice is to allocate new syscalls at the end of the table, which leaves there holes unused with high chance of never being collected.