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
0
votes
1 answer

Alternative to create_proc_entry() and read_proc in Linux kernel code

A few years ago, Linux 3.8 was ported to the TI-nSpire graphing calculator (https://github.com/tangrs/linux). While some of the changes were upstreamed, most of them were not. I've been rewriting the patches for the latest kernel sources, but I'm…
Billy
  • 1,177
  • 2
  • 15
  • 35
0
votes
0 answers

docker-compose is trying to access proc files

Docker-compose is giving me this error and I have no idea why: > docker-compose -f local.yml build Step 8/21 : RUN find . -type d -name __pycache__ -exec rm -r {} \+ ---> Running in 9da1be4e2ae5 find: './proc/1/map_files': Operation not…
lab
  • 79
  • 6
0
votes
1 answer

System call interface to /proc information

Can I get the information stored in /proc via system calls instead of processing text from files? I am trying to list inotify watches which are preventing the unmount of a filesystem. Ive written part of a shell script, but it's already too slow.…
Tom Hale
  • 40,825
  • 36
  • 187
  • 242
0
votes
2 answers

How linux handles when a function containing infinte loop is queued in the work queue?

I tried searching the net but couldn't find a perfect answer for this? What is the name of the procedure which is followed to avoid this situation where the other worker function will wait forever for this infinte loop to get over
0
votes
1 answer

Why does the sum of the Rss fields in /proc/$$/smaps differ from the 24th field in /proc/$$/stat?

From my understanding, the value returned from (1) awk '/Rss:/{ sum += $2 } END { print sum }' /proc/$$/smaps and (2) cat /proc/$$/stat | cut -d " " -f24 should be equal, why is this not the case? They are in fact a factor of 4 out, so (1)/4 =…
dippynark
  • 2,743
  • 20
  • 58
0
votes
0 answers

How can i pull two numbers from a string and convert them to two integer value in Linux Kernel?

I have a string variable (It is a input from the user space ) and i need to pull two number inside of it . For example : "123 + 12" i need to create 2 substring from it . "123" and "12" . Format of this string always will be like in the examples :…
anor
  • 43
  • 1
  • 7
0
votes
1 answer

How to skip iteration if linux command fails in C

procfs.c for(i=0;i<10;i++) { //linux command to check process status sprintf(cmd, "cat /proc/%d/status", pid[i]); pf = popen(cmd,"r"); fread(data, 1024, 1, pf); pclose(pf); //......big chunk of code afterwards } This is…
Jason J.Y. Kim
  • 183
  • 2
  • 12
0
votes
0 answers

write_proc is not invoked when written from userspace

I am trying to understand procfs for communication between userspace and kernel module. My module has basic two functions for procfs write_proc, driver_mmap. I call multiple times write_proc by calling fputs("123456789",fd). where fd is file…
0
votes
1 answer

Using ssize_t (*read) function instead of seq_file implementation

I have created a file under proc to read at string but instead of using seq_file implementation I am able to read it using the ssize_t (*read) method in file_operations. Is this approach wrong? Could anyone please explain in what situations I am…
anukalp
  • 2,780
  • 5
  • 15
  • 24
0
votes
0 answers

create_proc_read_entry returns NULL but CONFIG_PROC_FS=y

I am working on 32bit to 64bit kernel module porting project. The old kernel version is 2.6.18 and the target is 2.6.32. The old kernel modules were creating files under /proc/sys/net// path via the following function: if…
0
votes
0 answers

Python module to read /proc/{pid}

I want to write a linux metric agent to gather linux metrics in both System Level and Process Level. I'm pretty like linux command sar and pidstat, both of them come from sysstat.rpm. I want my agent have a similar ability to gather metrics like…
zhihuifan
  • 1,093
  • 2
  • 16
  • 30
0
votes
1 answer

Print Virtual Address of mem_map using a proc file

I have to print the contents of the mem_map variable in the kernel. However when I compile my code by issuing make I see: WARNING: "mem_map" [/home/babak/code/module/mem_map.ko] undefined! from: make -C /home/babak/code/linux-3.19.5…
Bob R
  • 605
  • 1
  • 13
  • 25
0
votes
1 answer

Linux: Listing all of the running processes that were run from executables that no longer exist on disk?

I am trying to list all of the running processes in Linux that were run from executables that no longer exist on disk. From what I have had a looked at, the /proc filesystem contains the /proc/[pid]/exe symbolic link. But this is only when the…
DesiBoyz
  • 130
  • 2
  • 14
0
votes
1 answer

Take data from /proc without text reading

Is it possible to read content of /proc/[pid]/ files through binary struct without parsing text data?
0
votes
3 answers

Linux /proc/PID dir of child stays alive after parent kills child

It seems that if I create a process, fork it and send a SIGHUP from the parent to the child, the child dies but it's "/proc/PID" dir doesn't dissappear until the parent also dies. (See code below). What is the right way to let the parent check if…
Garo
  • 1,339
  • 12
  • 21