Skip to content

Commit 16dec0a

Browse files
committed
selftests: cachestat: use proper syscall number macro
JIRA: https://issues.redhat.com/browse/RHEL-50302 commit 9b1db73 Author: Andre Przywara <andre.przywara@arm.com> Date: Tue Aug 15 16:56:11 2023 +0100 selftests: cachestat: use proper syscall number macro At the moment the cachestat syscall number is hard coded into the test source code. Remove that and replace it with the proper __NR_cachestat macro. That ensures compatibility should other architectures pick a different number. Signed-off-by: Andre Przywara <andre.przywara@arm.com> Reviewed-by: Nhat Pham <nphamcs@gmail.com> Signed-off-by: Shuah Khan <skhan@linuxfoundation.org> Signed-off-by: Eric Chanudet <echanude@redhat.com>
1 parent 64aed7f commit 16dec0a

File tree

1 file changed

+3
-4
lines changed

1 file changed

+3
-4
lines changed

tools/testing/selftests/cachestat/test_cachestat.c

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,6 @@ static const char * const dev_files[] = {
2323
"/dev/zero", "/dev/null", "/dev/urandom",
2424
"/proc/version", "/proc"
2525
};
26-
static const int cachestat_nr = 451;
2726

2827
void print_cachestat(struct cachestat *cs)
2928
{
@@ -144,7 +143,7 @@ static int test_cachestat(const char *filename, bool write_random, bool create,
144143
}
145144
}
146145

147-
syscall_ret = syscall(cachestat_nr, fd, &cs_range, &cs, 0);
146+
syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);
148147

149148
ksft_print_msg("Cachestat call returned %ld\n", syscall_ret);
150149

@@ -172,7 +171,7 @@ static int test_cachestat(const char *filename, bool write_random, bool create,
172171
ksft_print_msg("fsync fails.\n");
173172
ret = KSFT_FAIL;
174173
} else {
175-
syscall_ret = syscall(cachestat_nr, fd, &cs_range, &cs, 0);
174+
syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);
176175

177176
ksft_print_msg("Cachestat call (after fsync) returned %ld\n",
178177
syscall_ret);
@@ -233,7 +232,7 @@ bool test_cachestat_shmem(void)
233232
goto close_fd;
234233
}
235234

236-
syscall_ret = syscall(cachestat_nr, fd, &cs_range, &cs, 0);
235+
syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);
237236

238237
if (syscall_ret) {
239238
ksft_print_msg("Cachestat returned non-zero.\n");

0 commit comments

Comments
 (0)