Questions tagged [proc]

procfs (or the proc filesystem) is a special filesystem in UNIX-like operating systems that presents information about processes and other system information in a hierarchical file-like structure

Filter by
Sorted by
Tagged with
4
votes
2answers
856 views

Linux Kernel.org misleading about kernel panic

I always have /proc/sys/kernel/panic set up to 0. Looking at description of this option in kernel.org we can see: panic: The value in this file represents the number of seconds the kernel ...
1
vote
1answer
36 views

What are BSDs' equivalents to /proc and /sys?

The amount of information that can be gathered in linux using the procfs and sysfs which are normally mounted at /proc and /sys is quite substantial. Being not on a FreeBSD install I am amazed to ...
0
votes
1answer
43 views

How to view Stack Trace of a process?

I have seen this answer and according to that Stack Trace can be seen like: $ cat /proc/<PID>/stack [<ffffffff81012b72>] save_stack_trace_tsk+0x22/0x40 [<ffffffff81213abe>] ...
0
votes
1answer
52 views

Why are the virtual memory regions for the same program different on every run?

I am studying virtual memory mappings of memory regions in Linux. The executable is a simple counting program. When two instances of the program are run, the following are the mappings shown by /proc/...
4
votes
2answers
109 views

Way to unambiguously parse /proc/<pid>/stat (given arbitrary contents of name field)

In linux procfs, /proc/<pid>/stat includes as its second argument the name of the process in parentheses. As far as I can tell (by experimentation) this is unescaped. For example, I have been ...
1
vote
0answers
52 views

The vmRSS value of /proc/$pid/status seems not accurate? Why?

I wrote a test program to help me understand the output field of different memory utilities such as free,ps,top,/proc/$pid/status,/proc/$pid/smaps,/proc/$pid/statm etc. One question finally rose up ...
0
votes
1answer
32 views

Why we have so many 0's in intr field of /proc/stat

I am looking into intr field of /proc/stat. # cat stat cpu 10438 2056 25767 10098612 2490 0 1846 0 0 0 cpu0 1768 260 4750 1681597 119 0 608 0 0 0 cpu1 1735 67 5119 1683444 342 0 280 0 0 0 cpu2 1908 ...
0
votes
1answer
28 views

use proc info to increase pc's speed

Just to filter the answers, I am a completely beginner trying to understand the basics about Linux Filesystem. According to many resources the proc directory in the filesystem shows information about ...
0
votes
1answer
30 views

watch to remember its last zero exit output

I run a process that takes lot of time. Time is not a problem actually but I would like to know how much RAM memory it requires. Process is already running so /usr/bin/time is not an option. I found ...
0
votes
0answers
27 views

Wanted to check Disk IO Per process/services - per-proc IOP's (no of reads, no of writes), rw wait time, disk busy ness, inodes

I am looking for DISK IO per process/services in the linux machine : need following details: per-proc IOP's (no of reads, no of writes) rw wait time disk busy ness inodes I do not ...
0
votes
1answer
25 views

Get data about system load in an easy-to-process format

Often I feel the need to run some computation on the data about my system load. For instance about the data that top shows. And possibly iotop and htop as well. Some of the things I'd like to do are ...
2
votes
1answer
168 views

file /proc/cmdline is empty

I'm having a problem to boot my system, because the initramfs which should get its values from /proc/cmdline, such as the root device, isn't able to obtain any value, and that's because this file is ...
0
votes
1answer
140 views

Connections in /proc/[pid]/net/tcp which don't appear in /proc/net/tcp

I'm implementing code to fetch all network connections and associate them with the PIDs using them. Say, for tcp4, for each pid, I'm listing /proc/pid/fd, searching there for links to sockets, ...
2
votes
6answers
1k views

Redirect output on-the-fly - looks not possible in Linux, why?

I tried web search but have not found answer by searching for Linux redirect output on the fly. As far as I understand, output to say stdout works by using file descriptor 1: $ ls -l /proc/pid/fd/1 ...
1
vote
0answers
37 views

Arbitrary “files” in /proc/? [duplicate]

Is there a way to create files in /proc/ without actually writing a kernel module? This is for reverse engineering purposes, an app expects certain things in /proc/ and I do not want to write a ...
0
votes
1answer
40 views

Difference between pid_max/ulimit. How to create fake processes?

I am trying to learn the nuances between pid_max and setting user limits through ulimit. My understanding is that, no matter how high you set the user limits (for example setting user max processes to ...
3
votes
1answer
163 views

What are the non-numeric IRQs in /proc/interrupts?

cat /proc/interrupts shows a bunch of IRQs such as NMI and LOC. The per-line comments in the output give clear explanation, but if they do not have a numeric IRQ number, how does the x86 CPU respond ...
1
vote
0answers
25 views

Read per thread network statistics from C/C++

I have a Linux process with let's say 10 threads. Some of them make network traffic. From another thread or it can be even within another process I need to find out which threads have network activity....
1
vote
0answers
51 views

Absolute path to current user's home directory without using bash expansions?

This is a problem that crops up from time to time and annoys me greatly. Sometimes I need to provide an absolute path, normally in a configuration file, that should refer to the current user's home ...
2
votes
1answer
228 views

How to use sysctl on UNIX variants, e.g. macOS, to read information normally found in /proc/self on Linux?

I've been using /proc/self for a long time to read process-related information like /proc/self/maps etc. However, on some UNIX variants, like macOS, the procfs filesystem is not implemented; but as ...
3
votes
1answer
57 views

How to find which mountpoint current working directory of a process correspond to?

I have a program a.out running from /tmp/test. If I list /proc/$(pgrep a.out)/cwd, it is a symbolic link to /tmp/test. Now, I bind /mnt/othertest onto /tmp/test with mount -o bind /mnt/othertest /tmp/...
2
votes
1answer
97 views

How to configure auditd to collect logs from /proc

I've been looking for this for about 2 days and have come up empty-handed. I am looking for a way to build a threat alert for Linux-based credential dumping in Splunk. To do this, I need to be able ...
3
votes
0answers
184 views

Hiding processes on Unix/Linux

I found an interesting article about how to hide specific processes on linux from process monitoring tools like ps, top, lsof, ... Person states that there are several possible ways to hide processes:...
2
votes
0answers
57 views

Linux task state different in /proc/pid/stat compared to Ftrace output of sched events

I'm trying to trace the flow of a piece of code just to understand the points where the tasks go into D/S/R states (uninterruptible/interruptible/running). I do understand the meaning of each state, ...
0
votes
0answers
36 views

`pstree` truncation

Is there a way to limit the depth of pstree? It's very useful, but sometimes I just want to know the ancestors of a particular process without seeing the large number of subprocesses it has. If I do ...
1
vote
1answer
79 views

What (39) processor represents in /proc/[pid[/stat file?

As per procfs man /proc/[pid]/stat (39) processor %d (since Linux 2.2.8) CPU number last executed on. I can see, there is -1 value for some tasks $ cat /proc/1185/task/...
2
votes
2answers
106 views

What sort of file thing do 'namespace files' point to?

I was poking around /proc/*/ns, and noticed that namespace files look unfamiliar: # example from `man namespaces` $ ls -l /proc/$$/ns total 0 lrwxrwxrwx. 1 mtk mtk 0 Apr 28 12:46 cgroup -> cgroup:[...
2
votes
1answer
139 views

Why does opening /proc/cpuinfo take 17 ms?

Running this strace -ff -tt perl -e 'open(A,"<","/proc/cpuinfo");' gives this: 22:36:10.365187 openat(AT_FDCWD, "/proc/cpuinfo", O_RDONLY) = 3 22:36:10.382061 ioctl(3, TCGETS, 0x7fffb127ea50) = -...
0
votes
1answer
184 views

Information on values in /proc/pid/task/tid/sched

can someone help me out with the meanings of the following terms in the output of /proc/pid/task/tid/sched? avg_per_cpu se.avg.util.sum se.avg.load.sum ravg.demand Do any of these values point to ...
0
votes
0answers
41 views

How does a kernel update files in the /proc directory [duplicate]

It's more like if I run the command cat /proc/net/tcp how are the entries being inserted?
1
vote
1answer
783 views

What order is “/proc/net/tcp” being displayed

When you view the /proc/net/tcp or the /proc/net/tcp6 files you are able to see the open ports on the machine itself. But just wondering in what order are these entries being listed in?
0
votes
0answers
67 views

Can I control the ThinkLight through /proc/?

Inside of /proc/acpi/ibm, I see multiple devices provided by kernel module thinkpad_acpi, x230:/proc/acpi/ibm$ ls beep bluetooth cmos driver fan hotkey kbdlight led light video volume Is ...
0
votes
0answers
62 views

Ignore child cpu when reaping (don't add to /proc/[pid]/stat cutime)

I have a program that runs 24/7 and collects resource information on a system. One of the requirements is to cause as little impact to the system as possible, so there are cpu checks to kill it if it ...
0
votes
0answers
25 views

Process in Android making UDP connection not registered anywhere

Google gms is listening on a port using UDP protocol but /proc/net/udp does not display the socket neither /proc/pid/fd displays any socket with inode(only anonpipes) anyone knows why this happens? If ...
0
votes
1answer
119 views

Why are Linux namespace links in /proc red in color?

I inspected the symlinks in an Ubuntu VM for the namespace related directories under /proc/PID/ns. I see all the links are in red color. I even tried to test using unshare to see if I can create a ...
2
votes
1answer
310 views

What units are the values in /proc/partitions and /sys/dev/block/<block>/size?

I have a sample emmc block info from an android device From /proc/partitions major minor #blocks name 179 1 5120 mmcblk0p1 Using my little intelligence I am assuming /proc/partitions ...
0
votes
2answers
795 views

Why does a CentOS Docker container says it is Ubuntu?

I am trying to verify When choosing a Docker container image file for my Ubuntu, what do I need to match between them? On Lubuntu, a CentOS container says it is CentOS, by $ sudo docker run centos ...
2
votes
1answer
194 views

Why do I get different cpu flags in /proc/cpuinfo between CentOS 6 and CentOS 7?

CentOS 6.9 showed the following CPU flags in /proc/cpuinfo: fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss syscall nx pdpe1gb rdtscp lm ...
0
votes
2answers
530 views

Set hidepid=1 persistently at boot

I'd like my system's /proc directory to be mounted with the hidepid=1 option. I know that once the system is already up, I can do that with sudo mount /proc -o remount,hidepid=1. How can I make /proc ...
1
vote
1answer
56 views

Do all virtual files have a size of 0 in Linux?

So far, I have only seen virtual files with a size of 0, for example the virtual file /proc/sys/kernel/hostname has a size of 0. But do all virtual files have a size of 0, or are there some virtual ...
3
votes
1answer
751 views

How long time does a context switch take in Linux (ubuntu 18.04)

I'm interessted in getting the number of context switches a two processes in a KVM vm takes on a singel CPU over some time. Earlier i have used perf, is this best practice? And how much time is used ...
1
vote
1answer
424 views

How should we understand symlinks under `/proc/pid/fd`?

They seems more like a link to inode instead a link to path. What does the readlink() mean to them, the canonical path of the inode from the calling process's root directory? What happened when a ...
0
votes
0answers
423 views

How do i capture /proc/<pid>/stat file of a process | linux kernel

As you may know, the /proc/stat file contain the numbers of ticks the different CPU's have spent their time. Same goes to /proc/pid/stat where the tics are measured based on pid (process id) But when ...
1
vote
1answer
278 views

Memory usage info in /proc/pid/status missing when program is about to terminate

In order to track my program's memory usage, I wrote a script that records /proc/pid/status every 0.01 seconds and extracted memory usage from it. I checked most of the records and everything was fine,...
1
vote
0answers
432 views

Qemu-user : get memory maps while debugging remotely

I am trying to get the memory map of a process I am debugging remotely (peda pull request link), the process is ran with qemu-user, for example: qemu-arm -L /usr/arm-linux-gnueabihf/ -g 1234 ./ch47 ...
3
votes
1answer
421 views

lsof versus /proc/$PID/fd versus ulimit -n

I am trying to find the reason why my long-running app sometimes busts the maximum open file descriptor limit (ulimit -n). I would like to periodically log how many file descriptors the app has open ...
0
votes
1answer
272 views

Whould someone explain procstat output memory information?

I use the command procstat -r $(pidof myprocess) and I get the following output... PID COMM RESOURCE VALUE 84867 myprocess user time 00:...
0
votes
1answer
351 views

Why is the sum of /proc/pid/stat CPU greater than /proc/stat

In /proc/<pid>/stat I add user cpu, system cpu, child user and child system cpu together for all processes. I take a delta from a previous sample. Immediately after I sum the user, nice and ...
5
votes
1answer
2k views

reading TCP connection list from /proc

I'm trying to implement code that enumerate all existing TCP connections per process (similar to netstat -lptn). I prefer to implement it myself and not to rely on netstat. In order to do that, I'm ...
0
votes
1answer
63 views

How to get informations on each type of filesystem in /proc/filesystems

How do we get detailed information (history, what is used for, etc.) on each filesystem or pseudo filesystem displayed by : cat /proc/filesystems Example : nodev, sysfs, rootfs, ramfs, bdev, proc , ...

1 2 3 4 5 9