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
2 answers

psinfo_t solaris does not contain full process name in its field

Not getting full process name in psinfo_t struct's field pr_fname while reading process info from psinfo data file(/proc/%d/psinfo) into struct psinfo_t from procfs.h in solaris. Full psinfo_t struct definition is present on below…
mSatyam
  • 531
  • 7
  • 25
1
vote
1 answer

Sun Solaris 10/11: get disk i/o rates in machine readable way

I need to get the I/O rates of the disks/drives on Sun Solaris 10 and 11. There is the command-line tool "iostat" which returns exactly what I need. But this output is formatted and not in a clean machine readable way. Beside this, I don't want to…
Semonit
  • 379
  • 3
  • 14
1
vote
2 answers

Linux kernel: How to get dev_t of whole disk from partitioned disk?

I want to retrieve the dev_t structure for a whole disk, given that of a partition on the disk. This is for for a blkext driver, like nvme. Something like: dev_t part_disk; dev_t whole_disk = get_whole_disk_dev_t(part_disk); I would like my the…
1
vote
0 answers

Why is there a 1 kB reserved section of System RAM in /proc/iomem?

I've been looking at the output of cat /proc/iomem and noticed a 1 kB section of reserved addresses at the end of the first block of System RAM. At first, I thought that this was a fluke of my installation, but my research seems to indicate that…
1
vote
1 answer

How does the kernel handle a read operation on proc files when several instances of the same driver are running simultaneously

I have a question regarding the way proc files are handled when several instances of the same driver are running simultaneously. lets assume that a my system runs a couple of instances of the same driver simultaneously, but only one of them…
omer
  • 1,242
  • 4
  • 18
  • 45
1
vote
1 answer

How to set watchpoints via procfs in Linux?

I'm trying to build a debugger-like program under Linux (Ubuntu) and I've run into some problems. From what I've heard, the /proc vfs provides mechanisms to create watchpoints, but I can't seem to find out how. Some man pages pointed me to “control…
aradia
  • 11
  • 1
1
vote
2 answers

How to redirect input from another tty?

When i run cat - in say /dev/pts/2 and try to write to its input from another tty with echo foo > /dev/pts/2 or echo foo > /proc/(pid of cat)/fd/0 it just prints foo in pts/2, cat doesn't repeat it . why? How to send input to cat from another tty so…
shanky061
  • 21
  • 1
  • 6
1
vote
2 answers

OracleSolaris 11.2 -- similar mechanism to Linux procfs

In Linux it is common to use proc FS as a means to talk with a kernel module, receive statistics from the kernel or set up some flags. What can be used for these in Solaris?
Mark
  • 6,052
  • 8
  • 61
  • 129
1
vote
1 answer

Accepted safe/future-proof way to parse /proc/%d/stat?

The second field of Linux /proc/%d/stat files is a command name enclosed in parentheses, which itself might contain parentheses as part of the command. What is the correct way to deal with this when parsing the stat pseudo-files? My inclination…
R.. GitHub STOP HELPING ICE
  • 208,859
  • 35
  • 376
  • 711
1
vote
1 answer

Why is does proc_create mode argument 0 correspond to 0444

I am a newbie to kernel programming and am trying to userstand procfs. I have googled several examples and they all use: proc_create("hello",0,NULL,&proc_fops); where the second argument is the file mode / permission. Per proc_fs.h: static inline…
Jotorious
  • 187
  • 1
  • 11
1
vote
1 answer

proc-fs - single call back function for several files

I have some problems with proc-filesystem. Before Kernel 3.10 the proc-fs read and write functions had an argument void *data which allowed to use a single call back function for several files. In the read and write functions from struct…
hossi
  • 85
  • 6
1
vote
1 answer

how to read last n bytes from a proc file in C

I want to read last n bytes of proc file /proc//status. On regular files, I can fseek from the end of the file like: fseek(proc_file, -BUF_SIZE, SEEK_END); but since the proc file has zero size, this doesn't work. Any suggestions on how to read…
L Lawliet
  • 2,565
  • 4
  • 26
  • 35
1
vote
2 answers

Correct way to detect '/proc' file system?

I'm writing a cross platform bash script. It needs to use this command #1: cat /proc/$PID/cmdline and if the procfs is not available (on OS X for example), it needs to fallback to this command #2: ps -eo "pid command" | grep "^$PID" My question is…
user777337
1
vote
1 answer

How to detect executable or shared object in /proc/self/maps on Linux

I want to list all libraries (.so) loaded into app address space. I use the procfs and read info from /proc/self/maps. I there existing way to detect file is executable or .so? Or I need to compare each found module name with value of…
Bernd Jacobi
  • 571
  • 2
  • 5
  • 18
1
vote
2 answers

how to reuse the variable in linux kernel?

extern unsigned long current_rx_time; EXPORT_SYMBOL(current_rx_time); int netif_rx(struct sk_buff *skb) { current_rx_time = jiffies; } I modified the kernel source code in dev.c as shown above. Later I am creating a loadable kernel module in…
user3458454
  • 291
  • 1
  • 4
  • 20