From: Stanislav K. <sta...@or...> - 2014-05-06 11:00:16
|
On 04/30/2014 02:57 PM, shu...@or... wrote: > From: Shuang Qiu <shu...@or...> > > It does not make sense to use stdout as the file description to test the > system call fstatfs().We may get unexpected result(i.e. > errno=38:Function not implemented) if redirect stdout when running ltp. > Using ltp temporary file instead. > > Signed-off-by: Shuang Qiu <shu...@or...> The problem is that with the 2.6.39 series of kernels ENOSYS is returned where EFAULT is expected. The reproducer: #include <error.h> #include <stdio.h> #include <unistd.h> #include <sys/vfs.h> int main(void) { int fds[2]; if (pipe(fds) < 0) { perror("pipe() failed"); return 1; } if (fstatfs(fds[1], (void *)-1) < 0) { perror("fstatfs() failed"); return 1; } return 0; } With 2.6.18, 2.6.32, 3.8.13 this reproducer returns EFAULT, but with 2.6.39 - ENOSYS. If we change '(void *)-1' to a vaild pointer, fstatfs() + 2.6.39 will succeed. So it's a bug in 2.6.39, which is fixed in modern kernels. From one side, the above patch makes fstatfs02 pass by hiding an old (and already fixed) kernel bug. But from the other side, it also enlarges the test scope by allowing to test different file systems. So, personally, I would accept it. Are there any thoughts about it? Thanks. |