From ae0e6225db6dacb4d4de81245fba8671526dfe90 Mon Sep 17 00:00:00 2001 From: Khem Raj Date: Fri, 3 Feb 2012 20:06:55 -0800 Subject: lstat/stat/fstat: Use 64bit version of syscall if available This is needed for stat'ing loop devices > 255 since otherwise kernel returns EOVERFLOW becasue it needs st_rdev/st_dev to be larger than 16bits but in kernel it uses __old_kernel_stat for stat syscall which has st_rdev/st_dev as unsigned short Add a testcase Signed-off-by: Khem Raj --- test/stat/stat-loop256.c | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) create mode 100644 test/stat/stat-loop256.c (limited to 'test/stat') diff --git a/test/stat/stat-loop256.c b/test/stat/stat-loop256.c new file mode 100644 index 000000000..14284c184 --- /dev/null +++ b/test/stat/stat-loop256.c @@ -0,0 +1,32 @@ +#include +#include +#include +#include +int main() +{ + struct stat statbuf; + int ret = 0; + char* loop255 = "/dev/loop255"; + char* loop256 = "/dev/loop256"; + mode_t mode = 0660; + mknod(loop255, mode, 0x7ff); + mknod(loop256, mode, 0x100700); + ret = stat(loop255, &statbuf); + if(ret < 0) { + printf("stat: Cant stat %s\n",loop255); + unlink(loop255); + exit(1); + } + ret = stat(loop256, &statbuf); + if(ret < 0) { + printf("stat: Cant stat %s\n",loop256); + unlink(loop255); + unlink(loop256); + exit(1); + } + + unlink(loop255); + unlink(loop256); + exit(0); +} + -- cgit v1.2.3