From: Petr Vorel <pvorel@suse.cz>
To: ltp@lists.linux.it
Subject: [LTP] [PATCH v2 2/2] syscalls/getcpu:Add libc sched_getcpu() detection &&fix compiler errors
Date: Mon, 13 May 2019 10:27:08 +0200 [thread overview]
Message-ID: <20190513082708.GA9928@dell5510> (raw)
In-Reply-To: <1555481102-4158-2-git-send-email-xuyang2018.jy@cn.fujitsu.com>
Hi,
> sched_getcpu() isn't defined on some old distros, so we can add dection
> and fix compiler error.
> Signed-off-by: Yang Xu <xuyang2018.jy@cn.fujitsu.com>
Acked-by: Petr Vorel <pvorel@suse.cz>
@Metan: I'd be for pushing this before new release.
...
> static inline int get_cpu(unsigned *cpu_id,
> unsigned *node_id LTP_ATTRIBUTE_UNUSED,
> void *cache_struct LTP_ATTRIBUTE_UNUSED)
> {
> -#if defined(__i386__)
> - return syscall(__NR_getcpu, cpu_id, node_id, cache_struct);
> +#ifndef HAVE_SCHED_GETCPU
> + return tst_syscall(__NR_getcpu, cpu_id, node_id, cache_struct);
> #else
> *cpu_id = sched_getcpu();
> #endif
BTW: when rewriting into new C API (whenever it happens) it'd be nice to test
both syscall and libc sched_getcpu() (if available) via recently added test_variants [1].
Kind regards,
Petr
[1] https://github.com/linux-test-project/ltp/wiki/Test-Writing-Guidelines#2229-testing-similar-syscalls-in-one-test
next prev parent reply other threads:[~2019-05-13 8:27 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-12 7:03 [LTP] [PATCH] syscalls/getcpu: Add libc sched_getcpu() detection && fix compiler errors Yang Xu
2019-04-12 9:43 ` Cyril Hrubis
2019-04-12 10:46 ` xuyang
2019-04-12 11:46 ` Cyril Hrubis
2019-04-15 5:39 ` xuyang
2019-04-17 6:05 ` [LTP] [PATCH v2 1/2] syscalls/sched_getaffinity: Cleanup && Convert to new API Yang Xu
2019-04-17 6:05 ` [LTP] [PATCH v2 2/2] syscalls/getcpu:Add libc sched_getcpu() detection &&fix compiler errors Yang Xu
2019-05-13 7:54 ` xuyang
2019-05-13 8:27 ` Petr Vorel [this message]
2019-05-13 8:55 ` Cyril Hrubis
2019-05-13 9:40 ` Petr Vorel
2019-04-18 15:27 ` [LTP] [PATCH v2 1/2] syscalls/sched_getaffinity: Cleanup && Convert to new API Cyril Hrubis
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190513082708.GA9928@dell5510 \
--to=pvorel@suse.cz \
--cc=ltp@lists.linux.it \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox