I have found a couple of related posts:
https://unix.stackexchange.com/questions/279729/how-to-see-information-inside-inode-data-structure
But nothing quite answers my question. I have a process which continuously reads a file and I would like to get the physical address of the file it is continuously reading. I know which file it is reading. The process in question does not use mmap
.
How can I get the physical address of that file? I presume I can get its address in RAM.
Preferably, if possible, using cmd line utilities instead of having to write a C app.
The process in question:
int main(void)
{
int iFd = open("/some/path/file.txt",O_RDWR);
if (iFd < 0)
{
fprintf(stderr, "Failed to open file: %s\n", strerror(errno));
return -1;
}
while(1)
{
uint8_t tmp[10]={0};
read(iFd, tmp, sizeof tmp);
(void) tmp;
}
close(iFd);
return 0;
}
I looked at /proc
but the file does not appear there:
# cat /proc/<PID of process>/maps
555fa58000-555fa59000 r-xp 00000000 b3:02 34817 /some/path/myProcess
555fa68000-555fa69000 r--p 00000000 b3:02 34817 /some/path/myProcess
555fa69000-555fa6a000 rw-p 00001000 b3:02 34817 /some/path/myProcess
7fb3970000-7fb3ac3000 r-xp 00000000 b3:02 786 /lib/libc-2.31.so
7fb3ac3000-7fb3ad3000 ---p 00153000 b3:02 786 /lib/libc-2.31.so
7fb3ad3000-7fb3ad6000 r--p 00153000 b3:02 786 /lib/libc-2.31.so
7fb3ad6000-7fb3ad9000 rw-p 00156000 b3:02 786 /lib/libc-2.31.so
7fb3ad9000-7fb3adc000 rw-p 00000000 00:00 0
7fb3adc000-7fb3afd000 r-xp 00000000 b3:02 778 /lib/ld-2.31.so
7fb3b04000-7fb3b06000 rw-p 00000000 00:00 0
7fb3b0a000-7fb3b0b000 r--p 00000000 00:00 0 [vvar]
7fb3b0b000-7fb3b0c000 r-xp 00000000 00:00 0 [vdso]
7fb3b0c000-7fb3b0d000 r--p 00020000 b3:02 778 /lib/ld-2.31.so
7fb3b0d000-7fb3b0f000 rw-p 00021000 b3:02 778 /lib/ld-2.31.so
7ff5eb9000-7ff5eda000 rw-p 00000000 00:00 0 [stack]
You need to sign in to view this answers
Leave feedback about this