* [LTP] [PATCH v2] syscalls/capget02: remove useless getpid()
@ 2020-01-09 7:26 Yang Xu
2020-01-10 13:00 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Yang Xu @ 2020-01-09 7:26 UTC (permalink / raw)
To: ltp
Since pid=0 returns the capabilities for the calling thread,
we can remove getpid. Also we can cover this test point.
Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
-----------------
v1-v2:
remove pid = 0 assignment, because it has been initialized as 0.
add comment
-----------------
---
testcases/kernel/syscalls/capget/capget02.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/testcases/kernel/syscalls/capget/capget02.c b/testcases/kernel/syscalls/capget/capget02.c
index 42c76a011..931632e47 100644
--- a/testcases/kernel/syscalls/capget/capget02.c
+++ b/testcases/kernel/syscalls/capget/capget02.c
@@ -69,15 +69,15 @@ static void verify_capget(unsigned int n)
static void setup(void)
{
- unsigned int i, pid;
-
- pid = getpid();
+ unsigned int i;
+ /*
+ * Don't need to assign value to header.pid and bad_version_header.pid.
+ * Because they have been initialized as 0 that it returns the capabilities
+ * for the calling thread, equivalently to getpid().
+ */
header.version = 0x19980330;
- header.pid = pid;
-
bad_version_header.version = 0;
- bad_version_header.pid = pid;
bad_pid_header.version = 0x19980330;
bad_pid_header.pid = -1;
--
2.18.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [LTP] [PATCH v2] syscalls/capget02: remove useless getpid()
2020-01-09 7:26 [LTP] [PATCH v2] syscalls/capget02: remove useless getpid() Yang Xu
@ 2020-01-10 13:00 ` Petr Vorel
2020-01-10 16:42 ` Petr Vorel
0 siblings, 1 reply; 3+ messages in thread
From: Petr Vorel @ 2020-01-10 13:00 UTC (permalink / raw)
To: ltp
Hi Xu,
> Since pid=0 returns the capabilities for the calling thread,
> we can remove getpid. Also we can cover this test point.
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> -----------------
> v1-v2:
> remove pid = 0 assignment, because it has been initialized as 0.
> add comment
Reviewed-by: Petr Vorel <pvorel@suse.cz>
Note, waiting for merge before current git get's fixed.
(v2 of https://patchwork.ozlabs.org/patch/1220180/).
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
* [LTP] [PATCH v2] syscalls/capget02: remove useless getpid()
2020-01-10 13:00 ` Petr Vorel
@ 2020-01-10 16:42 ` Petr Vorel
0 siblings, 0 replies; 3+ messages in thread
From: Petr Vorel @ 2020-01-10 16:42 UTC (permalink / raw)
To: ltp
Hi Xu,
> > Since pid=0 returns the capabilities for the calling thread,
> > we can remove getpid. Also we can cover this test point.
> > Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
> > -----------------
> > v1-v2:
> > remove pid = 0 assignment, because it has been initialized as 0.
> > add comment
> Reviewed-by: Petr Vorel <pvorel@suse.cz>
> Note, waiting for merge before current git get's fixed.
> (v2 of https://patchwork.ozlabs.org/patch/1220180/).
Thanks for your patch, merged.
Kind regards,
Petr
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-01-10 16:42 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2020-01-09 7:26 [LTP] [PATCH v2] syscalls/capget02: remove useless getpid() Yang Xu
2020-01-10 13:00 ` Petr Vorel
2020-01-10 16:42 ` Petr Vorel
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox