Questions tagged [procfs]

The proc filesystem is a virtual filesystem through which kernels of Unix-like operating systems, including Linux, expose process and kernel information. It is commonly mounted at /proc and implements a view of the system process table inside the file system. It provides a two-level view of process space.

Procfs, also known as the proc filesystem, is a virtual filesystem normally mounted at /proc. The details vary between unix variants, but on most, /proc/PID is a file or a directory that exposes information about the running process whose id is PID.

In addition, /proc can expose information about other aspects on the system. Linux, in particular, exposes information about mounted filesystems, network status, connected devices and more. This use is partly phased out in favor of the newer .

234 questions
2
votes
1 answer

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…
osgx
  • 90,338
  • 53
  • 357
  • 513
2
votes
0 answers

cgroup cpuacct.stat doesn't match /proc/pid/stat

Recently did some perf testing of a process running in a docker container. CPU usage was gathered via the cpuacct.stat file found in the /sys/fs container directory. When monitoring the process by hand, using a tool such as top, I noticed that the…
2
votes
1 answer

How to write nothing into a virtual file

I created a virtual file driver that takes input from a file. This input is saved internally (besides other things that happen) and written out on a reading file access. Now when I write an empty string or datablock to this file, it seems the write…
Droidum
  • 440
  • 2
  • 9
2
votes
0 answers

Process State replication

I Need to create process state replication between two processes. I am using a simple bash script that count to infinity. I am running it on server 1 and server 2 and making the process on server 2 always paused and i need to copy the state (memory)…
2
votes
1 answer

Why is it allowed to modify argv[0]?

I have been working on a project that uses PIDs, /proc and command line analysis to validate processes on a system. My code had to be checked by the security guys who manage to break it with a single line... embarrassing! #!/usr/bin/env perl $0="I…
urban
  • 5,392
  • 3
  • 19
  • 45
2
votes
5 answers

Linux kernel /proc FIFO/pipe

I'm currently trying to create a kernel module that will produce data based on kernel events and push them to a file. After reading that this is bad (and I agree), I decided it would make more sense to have the data in a /proc file that a user…
Dan Fego
  • 13,644
  • 6
  • 48
  • 59
2
votes
0 answers

how to use single platform device driver for multiple devices

I have 3 devices which are working in the similar way. I have a driver designed for one of the devices. I have added compatibility with .compatible = "xyz,hmcSPI-0.00.a" .compatible = "xyz,hmcSPI-1.00.a" and .compatible = "xyz,hmcSPI-2.00.a" It…
2
votes
4 answers

Linux: Reading the output of readlink /proc/pid/exe within a Bash Script

So I am writing a bash script which will run through all of the process ids in /proc/[pid] and read the executable that was used to run it. From what I have had a looked at, the /proc filesystem contains the /proc/[pid]/exe symbolic link. Within the…
DesiBoyz
  • 130
  • 2
  • 14
2
votes
2 answers

Load state of a module in /proc/modules

From the answer to this question, it is given that the fifth field of /proc/modules is the load state of the module and can be either Live or Loading or Unloading. However in my Ubuntu 14.04 system and some other systems, I could find only the value…
Jackzz
  • 1,417
  • 4
  • 24
  • 53
2
votes
1 answer

FreeBSD: How to check how many threads are running in a process by PID?

In Linux I can do this by checking the /proc/pid/status file and looking for a line: Threads: 1 (or any number). How can I achieve the same in FreeBSD? I am not interested in any interactive tool. Is there any C function, or a system file? I have…
2
votes
0 answers

dereferencing proc_dir_entry pointer causing compilation error on linux version 3.11 and above

I am trying to follow an example rootkit given here https://github.com/ivyl/rootkit I modified this example so that I can compile it on linux version 3.11. I found that latest linux versions stopped supporting few API's such as create_proc_entry,…
user3736163
  • 31
  • 1
  • 4
2
votes
2 answers

How is run queue length computed in linux proc filesystem

I'm trying to obtain number of runnable processes from linux kernel. sar -q gives this information readily. However I'm trying to get this value from /proc filesystem. There is no file in /proc that gives this value directly, then how is runq-sz…
marc
  • 949
  • 14
  • 33
2
votes
1 answer

Will re-reading a file being updated in /proc without closing work?

I am re-reading the /proc/stat file to get the updated values. First I opened the file, read each line, closed the file and re-opened to get the updated values. I want to know if closing a file is necessary or I can achieve the same effect by…
phoxis
  • 60,131
  • 14
  • 81
  • 117
2
votes
2 answers

Create ProcFS entry in /proc/net

I try to create an entry inside /proc/net from a kernel module, like this: struct file *filp = filp_open("/proc/net", O_RDONLY, 0); struct proc_dir_entry *parent = PDE(filp->f_dentry->d_inode); filp_close(filp, NULL); proc_file =…
Iulius Curt
  • 4,984
  • 4
  • 31
  • 55
2
votes
0 answers

Auditing procfs

I want to keep track on important system changes on GNU/Linux boxes, like disabling PaX, enabling traffic forwarding, ICMP redirects, changing printk verbosity level and so on. At general all these operations base on changes on /proc/sys/kernel/*…
overfail
  • 51
  • 3