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
1
vote
0 answers

difference between reading the /proc/stat files via syscall fucntion read () or via glibc function fread()

Program reading /proc/stat files via read(like cat) or via fread (like nl) return different values. read() /proc/stat return right result, while fread() return wrong result. I had write simple C programs that just read or fread /proc/stat. read()…
shaun
  • 21
  • 5
1
vote
2 answers

/proc directory script

I'm looking for a ruby script that accesses the /proc directory and saves the process ID and command line (cmdline) information in a file.
에이바바
  • 1,011
  • 11
  • 36
  • 60
1
vote
0 answers

Debian cifs client suddenly break

Previously, Debian mounted win10 cifs worked fine. Suddenly prompted "input/output error" when accessing the cifs file See ls /proc/fs, cifs are missing Even the nfs server failed to start. I should not do anything to modify the system…
menglongwu
  • 33
  • 4
1
vote
1 answer

could not find /proc/self/maps

I'm using FreeBSD 7.3 (64 bit). When I try the command "cat /proc/self/maps", I get an error as, "cat: /proc/self/maps: No such file or directory". What should I do to resolve this ?
Raj
  • 4,342
  • 9
  • 40
  • 45
1
vote
1 answer

Ordering of /proc/mounts and /etc/mtab

Does anyone know whether /proc/mounts is guaranteed to be in the order in which devices are mounted? For instance: [root@machine proc]# cat /proc/mounts rootfs / rootfs rw 0 0 /dev/root / ext3 rw,data=ordered 0 0 /dev /dev tmpfs rw 0 0 /proc…
deuberger
  • 3,578
  • 6
  • 31
  • 33
1
vote
1 answer

Find out how long a process is sleeping in Linux?

Basically I want to have all processes that have been sleeping for more than one hour. I know that there is etime in ps, but sadly it shows the overall lifetime. How can this be done under linux (preferably with ps)?
JMW
  • 7,151
  • 9
  • 30
  • 37
1
vote
2 answers

Cannot mkdir /proc/sys/somedir, though /proc/sys exists

Trying to create a dir. with the following commands (as root) $mkdir -p /proc/sys/sunrpc Note that /proc/sys already exists. Yet getting error mkdir: cannot create directory ‘/proc/sys/sunrpc’: No such file or directory Getting similar errors,…
lampShadesDrifter
  • 3,925
  • 8
  • 40
  • 102
1
vote
1 answer

How to avoid double creating directories in /proc?

I'm writing a Linux kernel module, and I'd like to create a subdirectory, /proc/foo/, and then expose several artificial files inside it that will be generated on the fly by my module. I know I can use proc_mkdir to create the foo directory, but if…
Joseph Garvin
  • 20,727
  • 18
  • 94
  • 165
1
vote
0 answers

Reading macro value from generated/compile.h

I am trying to create a procfs entry. In linux kernel, I modify the scripts/mkcompile_h file to get timestamp value which is written to temperory generated file include/generated/compile.h. When I try to read that value (Eg: UTS_VERSION) from…
Ivid
  • 203
  • 3
  • 10
1
vote
1 answer

What is the difference between CPU Revision and Revision fields for arm processors?

Making a cat /proc/cpuinfo on Android returns this kind of output: Processor : ARMv7 Processor rev 1 (v7l) processor : 0 BogoMIPS : 38.00 processor : 1 BogoMIPS : 38.00 processor : 2 BogoMIPS : 38.00 …
rsommerard
  • 460
  • 1
  • 6
  • 18
1
vote
1 answer

How to get a list of processes that explains Mapped in /proc/meminfo

For example, I have: % grep '^Mapped:' /proc/meminfo Mapped: 121868 kB I want to generate something like this: PID Mapped Path 123 1234 kB /lib/libX.so 234 23445 kB /bin/bash ... TOTAL 121868…
grygorii
  • 11
  • 1
1
vote
1 answer

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

Can a process read /proc/self/exe using mmap? This program fails to mmap the file: $ cat e.c #include #include #include int main() { int f=open("/proc/self/exe",O_RDONLY); char*p=mmap(NULL,0,PROT_READ,0,f,0); …
effbiae
  • 1,087
  • 1
  • 7
  • 22
1
vote
0 answers

I'm not sure if my netfilter is working or not

I'm trying to make a LKM netfilter that drops incoming packets if the number of packets arrived exceeds a certain limit. There are five ports that the packets comes through, and netfiltering is done for each of those ports. Here's part of my LKM…
Jason J.Y. Kim
  • 183
  • 2
  • 12
1
vote
1 answer

Append to a file in the /proc file system

I'm implementing a file in /proc which I'd like to be a little more file-like than usual. In particular, I'd like to detect that someone is appending to the file and handle that correctly -- that is, I'd like to distinguish between someone…
Steve Summit
  • 45,437
  • 7
  • 70
  • 103
1
vote
1 answer

Dynamically create proc directory entries?

I'm looking for a way to dynamically generate the contents of a directory in the /proc filesystem from a kernel module. This is definitely possible since the root /proc directory does it for each running process (and, indeed, that's actually what I…