Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1231718
| From | Andrew Morton <akpm@linux-foundation.org> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] clone: Declare do_fork() only when available |
| Date | 2015-09-23 22:50 +0200 |
| Message-ID | <qbZ9h-6R6-41@gated-at.bofh.it> (permalink) |
| References | <qbQSm-3fk-13@gated-at.bofh.it> <qbR22-3Gg-13@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
On Wed, 23 Sep 2015 13:59:28 +0200 Petr Mladek <pmladek@suse.com> 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 ;)
--
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/
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 0/2] clone/kprobe: Do not use do_fork() when not defined Petr Mladek <pmladek@suse.com> - 2015-09-23 14:00 +0200
[PATCH 2/2] kprobe: Use _do_fork() in samples to make them work again Petr Mladek <pmladek@suse.com> - 2015-09-23 14:10 +0200
[PATCH 1/2] clone: Declare do_fork() only when available Petr Mladek <pmladek@suse.com> - 2015-09-23 14:10 +0200
Re: [PATCH 1/2] clone: Declare do_fork() only when available Andrew Morton <akpm@linux-foundation.org> - 2015-09-23 22:50 +0200
csiph-web