[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120127204707.GS11086@moon>
Date: Sat, 28 Jan 2012 00:47:07 +0400
From: Cyrill Gorcunov <gorcunov@...nvz.org>
To: KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>
Cc: linux-kernel@...r.kernel.org, akpm@...ux-foundation.org,
ebiederm@...ssion.com, xemul@...nvz.org, xemul@...allels.com,
avagin@...nvz.org, kosaki.motohiro@...il.com, mingo@...e.hu,
hpa@...or.com, tglx@...utronix.de, glommer@...allels.com,
andi@...stfloor.org, tj@...nel.org, matthltc@...ibm.com,
penberg@...nel.org, eric.dumazet@...il.com, segoon@...nwall.com,
adobriyan@...il.com, Valdis.Kletnieks@...edu
Subject: Re: [RFC c/r 2/4] [RFC] syscalls, x86: Add __NR_kcmp syscall v7
On Fri, Jan 27, 2012 at 03:19:07PM -0500, KOSAKI Motohiro wrote:
...
> > +
> > + if (filp1 && filp2)
> > + ret = kcmp_ptr((long)filp1, (long)filp2, KCMP_FILE);
> > + else
> > + ret = -ENOENT;
>
> If my remember is correct, Andrew pointed out EINVAL is better than ENOENT.
>
Phphphp :) there a version posted already which
returns -EBADFD (as Eric pointed me).
> > +#ifdef CONFIG_SYSVIPC
> > + ret = kcmp_ptr((long)task1->sysvsem.undo_list,
> > + (long)task2->sysvsem.undo_list,
> > + KCMP_SYSVSEM);
> > +#else
> > + ret = -EINVAL;
>
> ENOTSUP is better, I think. because of, EINVAL implicitly mean _caller_ is wrong.
> but in this case, it is not bad. only the kernel doesn't have enough feature.
>
I see.
>
> > + goto err;
>
> you don't need err label at all.
>
yeah, thanks.
> > +
> > + printf("pid1: %6d pid2: %6d FD: %2d FILES: %2d VM: %2d FS: %2d "
> > + "SIGHAND: %2d IO: %2d SYSVSEM: %2d INV: %2d\n",
> > + pid1, pid2,
> > + sys_kcmp(pid1, pid2, KCMP_FILE, fd1, fd2),
> > + sys_kcmp(pid1, pid2, KCMP_FILES, 0, 0),
> > + sys_kcmp(pid1, pid2, KCMP_VM, 0, 0),
> > + sys_kcmp(pid1, pid2, KCMP_FS, 0, 0),
> > + sys_kcmp(pid1, pid2, KCMP_SIGHAND, 0, 0),
> > + sys_kcmp(pid1, pid2, KCMP_IO, 0, 0),
> > + sys_kcmp(pid1, pid2, KCMP_SYSVSEM, 0, 0),.
>
> The best practice of auto test is
>
> AssertFooBar(expected_value, actual_value);
>
> and, just only print "correct or not". Only you know the correct value.
>
ok
Cyrill
--
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