Hi Junjiro-san,

Just want to let you know, when the proc_mount.patch is applied to kernel 5.3 
(I tested 5.3.1), then there is this problem that lseek on it no longer works.

What I mean is, I open the file, read the entire contents, and lseek back to 
the beginning --- and I should be able to read the entire contents again. 
Attached is the code do exactly that.

Without proc_mount.patch, the result is:

read: 1021 bytes
re-read: 1021 bytes

With proc_mount.patch, the result is:
read: 1021 bytes
re-read: 0 bytes

I'm not sure if anyone else has noticed it before, but I thought I'd let you 
know.

cheers!

-- 
James B
#include <unistd.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>

char buf[512*1024];
int main() {
	int fd = open("/proc/mounts", O_RDONLY);
	int rd = read(fd, buf, sizeof(buf));
	printf("read: %d bytes\n",rd);
	lseek(fd, SEEK_SET, 0);
	rd = read(fd, buf, sizeof(buf));
	printf("re-read: %d bytes\n",rd);
	return 0;
}


Reply via email to