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
7
votes
3 answers

Fetching the TCP RTT in Linux

I need to fetch the RTT for TCP flow. I have looked into the proc file system but not able to get the RTT value of TCP .If any one having any idea regarding it that, in which file RTT would be stored pleae share. Thanks in advance.
Karan_Rana
  • 2,813
  • 2
  • 26
  • 35
7
votes
2 answers

Does RCHAR include READ_BYTES (proc//io)?

I read proc//io to measure the IO-activity of SQL-queries, where is the PID of the database server. I read the values before and after each query to compute the difference and get the number of bytes the request caused to be read and/or…
lupz
  • 3,620
  • 2
  • 27
  • 43
6
votes
2 answers

How can I read large data from proc file?

I'm trying to write a kernel module which writes some data to a proc file. I'm trying to write something like 5000 characters but when I say $>cat /proc/myentry I can read only 1000 characters. int procfile_read(char *buffer, char…
user1078192
6
votes
3 answers

how does /proc/cpuinfo address size information relates to memory page size?

cat /proc/cpuinfo on a cpu flagged -lm gives address sizes : 36 bits physical, 48 bits virtual the page size determined with #include int getpagesize(void); Gives 4096 bytes. Using the latter information I would have thought that the…
ritter
  • 7,447
  • 7
  • 51
  • 84
6
votes
1 answer

What is the correct way to get a consistent snapshot of /proc/pid/smaps?

I am trying to parse the PSS value from /proc//smaps of a process in my C++ binary. According to this SO answer, naively reading the /proc//smaps file for example with ifstream::getLine() will result in an inconsistent dataset. The…
Soukyuu
  • 81
  • 4
6
votes
3 answers

How to create proc entry under /proc/driver?

I want to create a file under a /proc/driver directory. I would like to use a macro like proc_root_driver (or something else provided) rather than use "driver/MODULE_NAME" explicitly. I use create_proc_entry : struct proc_dir_entry…
Mustika_wiguna
6
votes
0 answers

How to obtain the number of mapped memory regions (mm_struct->map_count) from userspace

I'd like add the number of mapped memory regions to the status report of my daemon. There's a number of reasons why you may want this: There's a limit for that (vm.max_map_count) so it's good to monitor the current value. A growing number may be a…
salmin
  • 457
  • 3
  • 12
6
votes
2 answers

Broken symlinks and a mysterious (deleted)

I've been doing stuff with the proc filesystem on linux, and I've come across some behavior I'd like to have clarified. Each process in /proc has a symlink to it's executable file, /proc/{pid}/exe. If a process continues to run after it's executable…
Brian Schlenker
  • 4,966
  • 6
  • 31
  • 44
6
votes
1 answer

setenv/clearenv + procfs environ

Is it possible to get relevant information from /proc/pid/environ file if process modified its environment? My tests show that setenv/putenv/clearenv don't update environ file. However, in bash its possible to call unset ENV and see changes in…
nmikhailov
  • 1,413
  • 14
  • 24
5
votes
7 answers

Unix Proc Directory

I am trying to find the virtual file that contains the current users id. I was told that I could find it in the proc directory, but not quite sure which file.
Jose Vega
  • 10,128
  • 7
  • 40
  • 57
5
votes
4 answers

Export program state to procfs?

Can I create any file mappings in procfs to reflect the internal state of my program? For example, main.c: char *message; ... Assume the pid is 1200, is it possible to create a transient file /proc/1200/variables/message, which will reflect the…
Lenik
  • 13,946
  • 17
  • 75
  • 103
5
votes
1 answer

How to get executable shared library list from C++?

I'd like to programmatically get a list of the shared libraries linked by my binary on Linux and Solaris. Right now I shell out to pmap (I can't use ldd on the binary because it won't include dlopen'd libraries, and I can't use pldd because it's…
Joseph Garvin
  • 20,727
  • 18
  • 94
  • 165
5
votes
2 answers

How to read/write from/to a linux /proc file from kernel space?

I am writing a program consisting of user program and a kernel module. The kernel module needs to gather data that it will then "send" to the user program. This has to be done via a /proc file. Now, I create the file, everything is fine, and spent…
Petar
  • 2,241
  • 1
  • 24
  • 38
5
votes
2 answers

Reading system files with perl without issuing extra seek syscalls on open

I'm trying to use perl to parse some pseudo files from /proc and /sys linux pseudo filesystems (procfs and sysfs). Such files are unlike regular files - they are implemented by custom file operation handlers. Most of them have zero size for stat,…
osgx
  • 90,338
  • 53
  • 357
  • 513
5
votes
2 answers

howto create a filesystem like /proc?

I would like to create a pseudo filesystem like /proc to access an applications configuration. How could i achieve this or where could i find some introductory documentation about it?
matthias krull
  • 4,389
  • 3
  • 34
  • 54
1 2
3
15 16