Skip to content

Commit

Permalink
selftests: cachestat: use proper syscall number macro
Browse files Browse the repository at this point in the history
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 <[email protected]>
Reviewed-by: Nhat Pham <[email protected]>
Signed-off-by: Shuah Khan <[email protected]>
  • Loading branch information
Andre-ARM authored and shuahkh committed Aug 16, 2023
1 parent 7fb1023 commit 9b1db73
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions tools/testing/selftests/cachestat/test_cachestat.c
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ static const char * const dev_files[] = {
"/dev/zero", "/dev/null", "/dev/urandom",
"/proc/version", "/proc"
};
static const int cachestat_nr = 451;

void print_cachestat(struct cachestat *cs)
{
Expand Down Expand Up @@ -126,7 +125,7 @@ bool test_cachestat(const char *filename, bool write_random, bool create,
}
}

syscall_ret = syscall(cachestat_nr, fd, &cs_range, &cs, 0);
syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);

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

Expand All @@ -152,7 +151,7 @@ bool test_cachestat(const char *filename, bool write_random, bool create,
ksft_print_msg("fsync fails.\n");
ret = false;
} else {
syscall_ret = syscall(cachestat_nr, fd, &cs_range, &cs, 0);
syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);

ksft_print_msg("Cachestat call (after fsync) returned %ld\n",
syscall_ret);
Expand Down Expand Up @@ -213,7 +212,7 @@ bool test_cachestat_shmem(void)
goto close_fd;
}

syscall_ret = syscall(cachestat_nr, fd, &cs_range, &cs, 0);
syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);

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

0 comments on commit 9b1db73

Please sign in to comment.