Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752778AbbG1QlL (ORCPT ); Tue, 28 Jul 2015 12:41:11 -0400 Received: from lists.s-osg.org ([54.187.51.154]:54681 "EHLO lists.s-osg.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751768AbbG1QlJ (ORCPT ); Tue, 28 Jul 2015 12:41:09 -0400 Message-ID: <55B7B0A1.4080100@osg.samsung.com> Date: Tue, 28 Jul 2015 10:41:05 -0600 From: Shuah Khan Organization: Samsung Open Source Group User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.8.0 MIME-Version: 1.0 To: David Drysdale , Peter Zijlstra CC: Linux API , Michael Kerrisk , Andrew Morton , Arnd Bergmann , Jonathan Corbet , Andrea Arcangeli , Thomas Gleixner , Eric B Munson , Ingo Molnar , "H. Peter Anvin" , Oleg Nesterov , Linus Torvalds , Greg Kroah-Hartman , Andy Lutomirski , Al Viro , Rusty Russell , Vivek Goyal , Alexei Starovoitov , David Herrmann , "Theodore Ts'o" , Kees Cook , Miklos Szeredi , Milosz Tanski , Fam Zheng , Josh Triplett , Mathieu Desnoyers , linux-doc@vger.kernel.org, "linux-kernel@vger.kernel.org" , Shuah Khan Subject: Re: [PATCH RFC 0/1] Document how to add a new syscall References: <1438083663-24814-1-git-send-email-drysdale@google.com> <55B78AB4.2010807@osg.samsung.com> <20150728141920.GC19282@twins.programming.kicks-ass.net> In-Reply-To: Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2496 Lines: 65 On 07/28/2015 10:02 AM, David Drysdale wrote: > On Tue, Jul 28, 2015 at 3:19 PM, Peter Zijlstra wrote: >> On Tue, Jul 28, 2015 at 07:59:16AM -0600, Shuah Khan wrote: >>> On 07/28/2015 05:41 AM, David Drysdale wrote: >>>> Given that I've gotten some of the details wrong in the past (and I've >>>> seen others do likewise), I thought it might be helpful to collate the >>>> best practices for adding a new system call to the kernel. >>>> >>>> Apologies for the wide circulation -- I've tried to include folk who've >>>> recently added or proposed a system call, as they're most likely to >>>> have opinions on: >>>> - whether this a useful addition to Documentation/ >>>> - whether the details of the advice are correct and complete. >>>> >>>> Shuah, is there anything more that should be added for the Testing >>>> section in particular? >>>> >>> >>> David, >>> >>> Looks good. You could add a one liner on in some cases, it might be >>> necessary to install headers before test compiles. Other than that, >>> the information looks good. >> >> For perf we still use the syscall() wrapper and we have hardcoded >> (fallback) syscall numbers in there in case they've not yet reached >> unistd.h. >> >> People update their kernels far more often than their userspace headers. > > How about: > > diff --git a/Documentation/adding-syscalls.txt > b/Documentation/adding-syscalls.txt > index 5f52edda8951..b274c3d01edb 100644 > --- a/Documentation/adding-syscalls.txt > +++ b/Documentation/adding-syscalls.txt > @@ -389,6 +389,11 @@ reviewers with a demonstration of how user space > programs will use the system > call. A good way to combine these aims is to include a simple self-test > program in a new directory under tools/testing/selftests/. > > +For a new system call, there will obviously be no libc wrapper function and so > +the test will need to invoke it using syscall(); also, if the system call > +involves a new userspace-visible structure, the corresponding header will need > +to be installed to compile the test. > + This looks good. thanks, -- Shuah -- Shuah Khan Sr. Linux Kernel Developer Open Source Innovation Group Samsung Research America (Silicon Valley) shuahkh@osg.samsung.com | (970) 217-8978 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/