From owner-freebsd-hackers@freebsd.org Mon Oct 3 20:00:17 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 88D2BAF4828 for ; Mon, 3 Oct 2016 20:00:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: from mail-wm0-x233.google.com (mail-wm0-x233.google.com [IPv6:2a00:1450:400c:c09::233]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "Google Internet Authority G2" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 20DADE41; Mon, 3 Oct 2016 20:00:17 +0000 (UTC) (envelope-from asomers@gmail.com) Received: by mail-wm0-x233.google.com with SMTP id f193so128036448wmg.0; Mon, 03 Oct 2016 13:00:17 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=5f2upL/wuXJdp2RSmHFxAiUa//aBq8rIUwYKdXa0j8o=; b=hZKjQxXEwoJOR94ukYY08la3Dcn6+zvihnqvi5+lvh9tWbBcvH4eCfqL080/9SdMWY 7O0wKnVkLLdnqBWq1+yPMi1bCnBK+4Ym6DMV+S7yDn3s1kyCCdSxncnHN7rjofULs18c 3NWx4nL3K4Ml2HN3XxpFX2zFXDPj/M0HGJHUAZx/Jw0JiMkk1P6nh0ulftohjR3o99vp xkOfz8MnGw/9K1hzZlvGbnbrI0WtT+hMBB9zK4Ouqil2pgjkp/aWZHC+id6hMjQ4NFl2 bXZbQ8opj7xv8YfqebUxfd90xUFq06qncJ6wTvXbdbqT1kEx0HxE7g0CdlJkVJn/JM6a EBSw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=5f2upL/wuXJdp2RSmHFxAiUa//aBq8rIUwYKdXa0j8o=; b=fpz31cdfDe3JSK6Ro+egg8F/MBaB9s1OHIIezfk1KJxS5NC6Rv3FqKoDv8UIKh9exA PBUPvUzayr2opUCgE+hikk5hxf42Vi/+R8UNjWMTFNTAqKIG8kqYiww2OM9rv0a7/Jf/ DRkNMR5w+k5UHjg19HKuGcK3QntY2BweWw85sZTfXvCWfcFV50TMvsu3N2wLpb0EizmL PIiflhkGe3ZbOczZS1K7M7LgOq6johUpa4vPNxzYvwXCCjL3elCsngOofPQZmvZVUJM5 zAuzafrwUbniw1gPlPh3x51WgsbFY/xP8jVRkmM6OHgJZQveGTJR+oJ6QGsn77IeYTZT uEKw== X-Gm-Message-State: AA6/9RlxkcLAF1uRvmAFToMXS6vMy4tcuVVxaZIu2JrnLGBLyjcA/kp2KFION1fUQS4iTVwwsyMc9FR0lAxQNw== X-Received: by 10.28.144.74 with SMTP id s71mr308052wmd.65.1475524815595; Mon, 03 Oct 2016 13:00:15 -0700 (PDT) MIME-Version: 1.0 Received: by 10.194.15.137 with HTTP; Mon, 3 Oct 2016 13:00:14 -0700 (PDT) In-Reply-To: <20161003181803.GS38409@kib.kiev.ua> References: <20161003181803.GS38409@kib.kiev.ua> From: alan somers Date: Mon, 3 Oct 2016 14:00:14 -0600 Message-ID: Subject: Re: Proper way to add vendor-specific syscalls? To: Konstantin Belousov Cc: Alan Somers , "freebsd-hackers@freebsd.org" Content-Type: text/plain; charset=UTF-8 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 20:00:17 -0000 On Mon, Oct 3, 2016 at 12:18 PM, Konstantin Belousov wrote: > 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. Ok, it sounds like filling holes is the best method. Thanks for the advice, kib. -Alan