From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1755161AbbIWUnX (ORCPT ); Wed, 23 Sep 2015 16:43:23 -0400 Received: from mail.linuxfoundation.org ([140.211.169.12]:34507 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1755003AbbIWUnV (ORCPT ); Wed, 23 Sep 2015 16:43:21 -0400 Date: Wed, 23 Sep 2015 13:43:20 -0700 From: Andrew Morton To: Petr Mladek Cc: Ingo Molnar , Masami Hiramatsu , Andy Lutomirski , Peter Zijlstra , "H. Peter Anvin" , Thomas Gleixner , Thiago Macieira , Jiri Kosina , linux-kernel@vger.kernel.org Subject: Re: [PATCH 1/2] clone: Declare do_fork() only when available Message-Id: <20150923134320.bae22a467a427c9c77c1da9e@linux-foundation.org> In-Reply-To: <1443009569-1508-2-git-send-email-pmladek@suse.com> References: <1443009569-1508-1-git-send-email-pmladek@suse.com> <1443009569-1508-2-git-send-email-pmladek@suse.com> X-Mailer: Sylpheed 3.4.1 (GTK+ 2.24.23; x86_64-pc-linux-gnu) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, 23 Sep 2015 13:59:28 +0200 Petr Mladek wrote: > The commit 3033f14ab78c32687 ("clone: support passing tls argument via C > rather than pt_regs magic") introduced _do_fork() that allowed to pass > @tls parameter. > > The old do_fork() is defined only for architectures that are not ready > to use this way and do not define HAVE_COPY_THREAD_TLS. But the function > is always declared in linux/sched.h. > > This patch hides the declaration when the function is not defined. > > .. > > --- a/include/linux/sched.h > +++ b/include/linux/sched.h > @@ -2618,7 +2618,9 @@ extern int do_execveat(int, struct filename *, > const char __user * const __user *, > int); > extern long _do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *, unsigned long); > +#ifndef CONFIG_HAVE_COPY_THREAD_TLS > extern long do_fork(unsigned long, unsigned long, unsigned long, int __user *, int __user *); > +#endif Generally we avoid adding such ifdefs. Downside: a compile-time error is turned into a link-time error. This inconveniences a small number of people a small number of times. Upside: cleaner-looking header files. This benefits a larger number of people a larger number of times. So it's a good tradeoff, I think. Now there may be some special reason why do_fork() is special. If so, you owe us a new changelog ;)