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

Reading memory with GDB vmlinux /proc/kcore

I am trying to use gdb to read memory from vmlinux. The exact syntax is sudo gdb vmlinux-4.18.0-rc1+ /proc/kcore I use this file because vmlinux is a symlink to this file. The result is the following Reading symbols from vmlinux-4.18.0-rc1+...(no…
Jerry9013
  • 1
  • 2
0
votes
0 answers

How do I access the upper half of the 64-bit address space via /proc/x/mem?

No, I don't have a >18 exabyte file anywhere. I'm trying to read from /proc/self/mem. When I do the following in Python: f.seek(0xfe00001de000007f) I get: ValueError: cannot fit 'int' into an offset-sized integer I also tried using os.lseek and…
flarn2006
  • 1,787
  • 15
  • 37
0
votes
1 answer

kernel /proc/pid/stack format, what does the addresses mean?

given a stack like the following: cat /proc/17019/stack [<0>] futex_wait_queue_me+0xc4/0x120 [<0>] futex_wait+0x10a/0x250 [<0>] do_futex+0x325/0x500 [<0>] SyS_futex+0x13b/0x180 [<0>] do_syscall_64+0x73/0x130 [<0>]…
DeanSinaean
  • 2,297
  • 4
  • 16
  • 19
0
votes
1 answer

proper way of writing to /sys or /proc filesystem in c

what is a proper way of writing to /proc or /sys filesystem in linux in c ? Can I write as I would in any other file, or are there special considerations I have to be aware of? For example, I want to emulate echo -n mem > /sys/power/state. Would the…
400 the Cat
  • 266
  • 3
  • 23
0
votes
1 answer

How to capture all generated events with ftrace without any loss

I'm currently doing some experiments, and I need to record all the events that are generated during the execution of normal stress-ng execution cyle like this /usr/bin/stress-ng -c 80 -t 30 --times --exec 50 --exec-ops 50, specifically the ones…
0
votes
1 answer

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…
Emanuele
  • 1,408
  • 1
  • 15
  • 39
0
votes
0 answers

Get 'cmdline' as exported in /proc/$PID/cmdline from Linux Kernel Code

I'm trying to get the cmdline of a process as it is shown in /proc/$PID/cmdline by it's PID from within Kernel Context. I can access the task_struct and it's field "comm", which however only holds 16 characters. What is the best way to achieve…
0
votes
1 answer

Meaning of NULL definition for a macro in C

I was writing a simple code for accessing my driver data through entry in the procfs. While going through the header file proc_fs.h, I came across a macro like: #define proc_create(name, mode, parent, proc_fops) ({NULL;}) How this macro functions,…
atul_pant
  • 99
  • 8
0
votes
0 answers

Read from /proc/

I understand, I think, that when reading from disk, the process gets put into uninterruptible sleep while disk IO is performed. But what happens during procfs readouts? The process goes into D state, but shouldn't it just keep running and complete…
0
votes
0 answers

What is the thread group leader name in the /proc file system?

Is the name of the thread group leader available in /proc? I am looking for the group_leader->comm field for a given task_struct.
anglee
  • 99
  • 2
  • 12
0
votes
1 answer

Is there any limit on the iterations with seq_file

I wrote a basic code which will print process name using seq_file in proc file. #include #include #include #include #include #include #include…
md.jamal
  • 4,067
  • 8
  • 45
  • 108
0
votes
1 answer

Why does my measurement shows that a process consumes more CPU time than available?

I have a program where I measure the consumed CPU time of a process on a specific core (here second CPU core). Sometimes I get values higher than 100%. What is the reason for this value? Does the total CPU time changes so fast when accessing the CPU…
DevJoe
  • 143
  • 1
  • 1
  • 5
0
votes
0 answers

Linux daemon seems hanging at "recvfrom", found process procfs net corrputed and can't be accessed

I have a long running linux daemon which created a 'non-blocking' socket bind on port 65445 waiting for UDP packet. It can work most of time. Right now, I met an issue that the process becomes "D" after a while(not sure which message caused it, but…
Gemini
  • 107
  • 1
  • 9
0
votes
2 answers

Unmounting proc file system

As far as I know proc file system is a virtual file system. Is there any way to unmount the proc file system and even if I do that what will be the consequences after that.
pradeepchhetri
  • 2,899
  • 6
  • 28
  • 50
0
votes
1 answer

procfs is located in memory, but where? Is it possible to obtain its address for DMA?

I'm developing on an FPGA/SoC and need to access procfs via DMA. I understand it's a pseudo filesystem located in memory, and am wondering if it's possible to obtain its address (similar to how the syscall table address is accessible in System.map)…
A. Michael
  • 73
  • 1
  • 1
  • 6