Skip to content

Commit 9b1db73

Browse files
Andre-ARMshuahkh
authored andcommitted
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>
1 parent 7fb1023 commit 9b1db73

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
@@ -19,7 +19,6 @@ static const char * const dev_files[] = {
1919
"/dev/zero", "/dev/null", "/dev/urandom",
2020
"/proc/version", "/proc"
2121
};
22-
static const int cachestat_nr = 451;
2322

2423
void print_cachestat(struct cachestat *cs)
2524
{
@@ -126,7 +125,7 @@ bool test_cachestat(const char *filename, bool write_random, bool create,
126125
}
127126
}
128127

129-
syscall_ret = syscall(cachestat_nr, fd, &cs_range, &cs, 0);
128+
syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);
130129

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

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

157156
ksft_print_msg("Cachestat call (after fsync) returned %ld\n",
158157
syscall_ret);
@@ -213,7 +212,7 @@ bool test_cachestat_shmem(void)
213212
goto close_fd;
214213
}
215214

216-
syscall_ret = syscall(cachestat_nr, fd, &cs_range, &cs, 0);
215+
syscall_ret = syscall(__NR_cachestat, fd, &cs_range, &cs, 0);
217216

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

0 commit comments

Comments
 (0)