Skip to content
Advertisement

Tag: procfs

How do I expose custom files similar to /procfs on Linux?

I have a writer process which outputs its status at regular intervals as a readable chunck of wchar_t. I would need to ensure the following properties: When there’s and update, the readers shouldn’t read partial/corrupted data The file should be volatile in memory so that when the writer quits, the file is gone The file content size is variable Multiple

can /proc/self/exe be mmap’ed?

Can a process read /proc/self/exe using mmap? This program fails to mmap the file: Answer You are making 2 mistakes here: Mapped size must be > 0. Zero-size mappings are invalid. You have to specify, if you want to create a shared (MAP_SHARED) or a private (MAP_PRIVATE) mapping. The following should work for example: If you wish to map the

Linux kernel: get information of page cache distribution over NUMA nodes

When Linux kernel runs on NUMA, each NUMA node has partially separate memory management. There is echo ‘?’ > /proc/sysrq-trigger function “Will dump current memory info to your console.” of SysRq (implemented as sysrq_handle_showmem and show_mem) to get basic memory statistics for every NUMA node to system console, dmesg and system kernel log. As I understand, there is data printed

How does the kernel handle a read operation on proc files when several instances of the same driver are running simultaneously

I have a question regarding the way proc files are handled when several instances of the same driver are running simultaneously. lets assume that a my system runs a couple of instances of the same driver simultaneously, but only one of them (according to some inner decision making) created a proc file and maintains the information that should be written

Linux /proc/pid/smaps proportional swap (like Pss but for swap)

It seems (from looking at the Linux kernel source) that the Swap: metric in /proc/pid/smaps is the total swap accessible by the given pid. In the case where there is shared memory involved, this seems to be an over-approximation of actual swap usage. For example when summing swap usage of a parent pid with its forked children, and if they

thread level memory consumption of process

How do I get per thread based memory consumption of a process in Linux? I understand that we can use /proc/pid/task/tid/statm, but thats not helping my case. All the threads show same value and its same as PID’s statm. We can do valgrind but I am not looking for any invalid read/write or leaks. Valgrind will not tell me any

Advertisement