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
2
votes
1answer
146 views

Does /proc/ contains tid?

I have process id 1234. This process contains thread id 1235. When I use ls -l /proc I see only the pid (1234) but when I open the thread status file using cat /proc/1235/status I can see data. Why is ...
0
votes
1answer
27 views

How to find out on which core a thread is running on?

Let's say we have a CPU-intensive application called multi-threaded-application.out that is running on top of Ubuntu with a PID of 10000. It has 4 threads with tid 10001, 10002, 10003, and 10004. I ...
-1
votes
1answer
35 views

Does /dev, /run and /sys exist on HDD (if so what is there location if it can be meaningfully traced)?

At the time of Linux installation, i have mentioned only one filesystem (/dev/sda1 -> ext4 -> / ). But for dev, run, proc, sys - Linux is creating addition FS which is inferable from mount. $ ...
2
votes
1answer
141 views

zsh: check whether $PWD is on tmpfs mounted filesystem

I would like to change my zsh prompt color, if $PWD is currently on tmpfs mounted filesystem. Lets say for example, /dev/shm is a tmpfs filesystem. I can confirm that: $ grep /dev/shm /proc/mounts ...
0
votes
1answer
30 views

tab completion of /proc/self/fd/ shows different completions compared with listed contents

Using zsh, if I try tab completion of the following command ls /proc/self/fd/ then I see the following: files 0@ 1@ 10@ 11@ 12@ 13 2@ 3 However, when I press enter (without completing) I ...
2
votes
0answers
57 views

How to get unix socket inode given its path?

Let /var/run/mysqld/mysqld.sock/ be an open socket. I can stat it to get inode of the file (here 1200) # stat /var/run/mysqld/mysqld.sock File: /var/run/mysqld/mysqld.sock Size: 0 ...
3
votes
1answer
40 views

What's the meaning of [socket:number] in /proc/pid/fd

UNIX domain sockets opened by given $PID are listed in /proc/$PID/fd/X as symlinks to [socket:ID]. I understand that it's an identifier of that socket, but what exactly is it? Is it an inode in sockfs?...
1
vote
1answer
26 views

Will execute time of kernel thread will be included in /proc/[pid]/stat?

My process accesses a file in disk, which is mounted with iSCSI driver. I knew iSCSI has several kernel modules and some of them run as kernel threads. As my knowledge iSCSI needs a lot of CPU time, ...
0
votes
1answer
35 views

Emulate /proc folder

I've a software that uses a few nasty algorithms to determine, wether it runs in a docker container or not. One example is, that it scans /proc/1/cgroup for non root paths (i.e. /docker/SOME-UUID ...
0
votes
1answer
59 views

Documentation for the meaning of entries in /proc/meminfo and /proc/vmstat

Where can I find documentation explaining the meaning of entries in /proc/meminfo and /proc/vmstat files? I looked up on the web and the man page of proc but could not find much. Many entries are self ...
0
votes
1answer
31 views

What can a debugger do with /proc that cannot be done with ptrace?

The Wikipedia article on ptrace says: Communications between the controller and target take place using repeated calls of ptrace, passing a small fixed-size block of memory between the two (...
0
votes
1answer
105 views

kswapd0 in ubuntu slows down the system

We don't have any service running in the ubuntu but currently, we see the system becomes very slow from the morning, When I tried top command, I see there are two new services running like below, top ...
0
votes
1answer
27 views

Is there any way to recover files from the informations in `/proc`? [duplicate]

I have just asked in an interview that if someone mistakenly deletes apache logfile from /var/log/apache/access.log while it's being written, can you recover it? After my answer interviewer said that ...
1
vote
2answers
61 views

Detailed information on a single process in a greppable format

Utilities such as ps and top are good for looking at many processes side-by-side. However, they are inconvenient for examining many fields of a single process and are not amenable to using grep. For ...
0
votes
1answer
23 views

pidstat %CPU vs htop %CPU of a process

I'm using the pidstat to monitor the cpu usage of a process and it shows 100%. For the same process the htop or top shows 200% for the same process. The system has 16 cores, and the process i am ...
2
votes
1answer
37 views

How do I restore files removed from /usr/bin?

TL;DR at the bottom. Background: The following occured on my CentOS 6.10 production server. I was using a browser based terminal program to run the program Midnight Commander which is a console-...
0
votes
1answer
15 views

Does statting /proc/PID/stat make the kernel generate the contents so that a file size is returned?

I'm implementing an alternative to top, and thought that I should preallocate an appropriately sized buffer to hold the read contents of /proc/PID/stat. However, knowing that it's a pseudo filesystem ...
0
votes
1answer
53 views

How to determine active/passive end of TCP connection

If I inspect information about established TCP connections as returned by sock_diag(7) (or in /proc/net/tcp), how can I determine whether a given connection originated with the local side owning the ...
0
votes
1answer
130 views

permission denied, even when I have permission

This may be a dumb question, but how does symbolic link preserve permission? $ls -ld /proc/1/exe ls: cannot read symbolic link '/proc/1/exe': Permission denied so I look up what the link point to ...
3
votes
0answers
45 views

failure to stat /proc/self/map_files symlink - permission denied?

I am writing some code that checksums executable mappings. Through /proc/$PID/map_files, Linux provides symlinks to the files that back memory mappings. My code is calling "stat()" on one of these ...
0
votes
1answer
20 views

autofs --force unmounts /proc

Historically I've seen autofs get into situtations where systemctl restart autofs will hang indefinitely due to stale nfs handles. As a result I've employed the --force option to make autofs play a ...
1
vote
0answers
23 views

Identify filesystem for each mtd

In /proc/mtd I can see all partition in my device dev: size erasesize name mtd0: 0xxxxx00 0xxxxx00 "yyyy" mtd1: 0xxxxx00 0xxxxx00 "yyyy" mtd2: 0xxxxx00 0xxxxx00 "yyyy" How can I know which ...
0
votes
1answer
35 views

How does OS kernel get known connected hardware configuration to save it in `/proc` files?

In my student assignment I'm asked to track how Linux kernel discovers configurations of any device connected. For instance, the system has a new printer plugged in. As far as I can see, all features ...
19
votes
1answer
621 views

I accidentally backed up /proc/* , and now I'm stuck with a 28Tb file called “cifs2695” that I can't remove!

Recently my boss asked me to backup a Ubuntu 16 workstation. I wanted to preserve all the libraries and system files, since we have C++ code that can only compile on that particular machine. Being ...
-1
votes
1answer
25 views

What do drivers have to do with modules?

I need to research and find out "which drivers are loaded on my system" using /proc. In /proc there is a dir called "driver" so I thought that was it, but reading about it online, I saw I should also ...
2
votes
1answer
123 views

Why procfs mount option only working on remount?

I have written own init process (pid 1) for my system, to improve security I decided to add hidepid=2 while mounting procfs in /proc location (procfs not mounted by default). After mounting the ...
1
vote
1answer
55 views

how to query information from the /proc filesystem?

how would I begin to do this? I want to write a shell script file that would allow me to pull information from the proc filesystem. Information like PID, state of processes, etc... a short code demo ...
0
votes
1answer
43 views

How to find out what function is runnng when reading /proc

I am trying to write a kernel module that hides some sockets from netstat. I checked how netstat is working and saw that it's reading from /proc/net/tcp. Now I am stuck. I am trying to figure out ...
0
votes
1answer
127 views

What is the best way to restrict /proc fs from malicious users (linux)? [closed]

I am trying to make a restriction to procfs like only a certain groups of members can perform read and write actions. kernel document says we can do that by setting hidepid and gid in /etc/fstab. It ...
0
votes
1answer
58 views

Is “/proc/<pid>/map_files” include mapped file of all tid or just include mapped file of tid=pid only?

There is /proc/pid/task/tid/maps file but no corresponding /proc/pid/task/tid/map_files.
0
votes
1answer
74 views

What does the 4th column (root) in /proc/…/mountinfo mean?

From the proc manual it names the 4th column of mountinfo as "root", and describes it as "the pathname of the directory in the filesystem which forms the root of this mount". But how to understand it? ...
2
votes
1answer
94 views

inotifywait not responding to change in /proc/mounts

I'm trying to get notification of the state of a problematic sshfs mount I have tried two bash scripts while inotifywait -e modify /proc/mounts; do echo "modified" done and inotifywait -m /...
1
vote
1answer
207 views

Why does `sudo cat /proc/self/attr/current` return “Invalid argument”?

I have read that the current AppArmor profile should be listed in the /proc/self/attr/current file, and that if it's empty the current profile is "unconfined". But why does cat return "Invalid ...
1
vote
1answer
113 views

How to check the device number of a device in `/proc/1/ns/{ns}`?

How to check the device number of a device in /proc/1/ns/{ns}? I've read the code for a Go library (see below), which states that it's possible to determine, if a container is in the host namespace ...
4
votes
2answers
927 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
103 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
211 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
80 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/...
6
votes
3answers
819 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
166 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
40 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
30 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
31 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
34 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
28 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
385 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 ...
1
vote
1answer
359 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
38 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
60 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 ...

1
2 3 4 5
10