[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <200910211037.38413.arnd@arndb.de>
Date: Wed, 21 Oct 2009 10:37:38 +0200
From: Arnd Bergmann <arndbergmann@...glemail.com>
To: Pavel Machek <pavel@....cz>
Cc: Sukadev Bhattiprolu <sukadev@...ux.vnet.ibm.com>,
linux-kernel@...r.kernel.org, Oren Laadan <orenl@...columbia.edu>,
serue@...ibm.com, "Eric W. Biederman" <ebiederm@...ssion.com>,
Alexey Dobriyan <adobriyan@...il.com>,
Pavel Emelyanov <xemul@...nvz.org>,
Andrew Morton <akpm@...l.org>, torvalds@...ux-foundation.org,
mikew@...gle.com, mingo@...e.hu, hpa@...or.com,
Nathan Lynch <nathanl@...tin.ibm.com>, peterz@...radead.org,
Louis.Rilling@...labs.com, roland@...hat.com,
kosaki.motohiro@...fujitsu.com, randy.dunlap@...cle.com,
linux-api@...r.kernel.org,
Containers <containers@...ts.linux-foundation.org>,
sukadev@...ibm.com
Subject: Re: [RFC][v8][PATCH 10/10]: Document clone3() syscall
>
> > +struct clone_struct {
> > + u64 flags;
> > + u64 child_stack;
>
> u64 seems wrong on 32 bit platforms. ulong?
That would make it incompatible between 64 bit kernels and
32 bit user space, requiring a wrapper. Better leave it at u64.
> > + If a pid in the @pids list is 0, the kernel will assign the next
> > + available pid in the pid namespace, for the process.
> > +
> > + If a pid in the @pids list is non-zero, the kernel tries to assign
> > + the specified pid in that namespace. If that pid is already in use
> > + by another process, the system call fails with -EBUSY.
> ...
> > + On failure, clone3() returns -1 and sets 'errno' to one of following
> > + values (the child process is not created).
>
> Inconsistent with above. Syscalls really return -ERRCODE, errno is
> glibc magic.
Quite the opposite is true.
The man page describes what the user space sees, which is errno. Returning
-ERRCODE to libc from the kernel is part of the architecture specific
kernel ABI and should not be documented in this place but in the architecture
documentation.
> > + pid_t pids[] = { 77, 99 };
> > + struct clone_struct cs;
> > +
> > + cs.flags = (u64) SIGCHLD;
> > + cs.child_stack = (u64) setup_child_stack();
> > + cs.nr_pids = 2;
> > + cs.parent_tid = 0LL;
> > + cs.child_tid = 0LL;
> > +
> > + rc = syscall(__NR_clone3, &cs, pids);
>
> Hmm, is there reason why pids are not at the end of struct
> clone_struct? Passing most parameters in special structure, then pids
> separately is strange...
I suggested doing that, it's a lot easier to handle fixed length data
structures than an array at the end.
Arnd <><
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists