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
1 answer

where will be the output of the user from kernel using procfs?

ssize_t dev_read(struct file *filp,char *buf,size_t count,loff_t *offset) { int len = count >= strlen(chr_arr.array) ? strlen(chr_arr.array) : count; *offset += len; if (*offset >= strlen(chr_arr.array)) return 0; if…
user3458454
  • 291
  • 1
  • 4
  • 20
1
vote
1 answer

error in loadable kernel module as make: nothing to be done for all?

The functions you write to provide procfs interfaces is just code that is part of your LKM source. http://linux.die.net/lkmpg/x769.html has a simple example using procfs, reproduced here: I copied the code from above link - You'll find a tutorial…
user3458454
  • 291
  • 1
  • 4
  • 20
1
vote
2 answers

How can a usage counter in Solaris 10 /proc filesystem decrease?

I'm trying to determine the CPU utilization of specific LWPs in specific processes in Solaris 10 using data from the /proc filesystem. The problem I have is that sometimes a utilization counter decreases. Here's the gist of it: // we'll be reading…
Andrew
  • 636
  • 1
  • 9
  • 16
1
vote
2 answers

how do I get current user in the kernel ie how to call current->uid the right way

I am writing a Loadable Kernel Modules (LKM) . This LKM needs to do some special stuff if the user that just executed cat/proc/ is the current user. so I am trying to figure out how to find this info. My first attempt was to use get_current_user()…
noztol
  • 494
  • 6
  • 25
1
vote
1 answer

read_proc_t and file_operations in procfs

I'm now studying proc file system. I now know that read_proc_t function is called when the proofs file is read, and so for write_proc_t function when the proofs file is written to. But I also find the file_operaitons* field in the definition of…
nrek
  • 271
  • 3
  • 11
1
vote
1 answer

Android Strange bluetooth issue either in API or i m missing something

My problem is that i am not able to find the class of device and device services of my own bluetooth device. Though i am able to find the Connection State, MAC address and other info using the BluetoothAdapter mBluetoothAdapter =…
Karan_Rana
  • 2,813
  • 2
  • 26
  • 35
1
vote
1 answer

Accessing the proc_dir_entry from proc_fops.open?

I writing a linux kernel module that does some work with /proc... I'm trying to use the new seq methods for returning the data for /proc... Anyhow, after I call proc_create_data() I have a proc_dir_entry (whose ->data member is pointing at my…
dicroce
  • 45,396
  • 28
  • 101
  • 140
1
vote
1 answer

Knowing the process status using procf//status

I am working on Solaris. I know that if there is a process running, there is a file called /proc//status, where is the process id, and it contains a field called state. As an example, I used my shell process: > ps PID TTY TIME…
Vijay
  • 65,327
  • 90
  • 227
  • 319
1
vote
1 answer

Linux Kernel Procfs multiple read/writes

How does the Linux kernel handle multiple reads/writes to procfs? For instance, if two processes write to procfs at once, is one process queued (i.e. a kernel trap actually blocks one of the processes), or is there a kernel thread running for each…
reza
  • 1,188
  • 3
  • 17
  • 32
1
vote
3 answers

Linux kernel code that uses procfs: what should I be aware of?

I have a very nice idea for a kernel patch, and I want to conduct some research and see code examples before I shape my idea. I'm looking for interesting code examples that would demonstrate advanced usage of procfs (the Linux /proc file system). By…
Adam Matan
  • 128,757
  • 147
  • 397
  • 562
1
vote
1 answer

Where do the write operations come from?

I do some experiments on databases. In this case, every query selects everything from one of the tables of the TPCH Benchmark (select * from table;). Before and after each query I parse /proc/[pid]/io, where [pid] is the process of the database. The…
lupz
  • 3,620
  • 2
  • 27
  • 43
1
vote
1 answer

What would be the simplest way to interface custom hardware with one input to have switch somewhere in /proc?

I have a device that takes low current 3-12v input signal to do it's magic and I would like to interface it to my linux box. What kind of options do I have on this? It would be great to have some low-cost possibly user-space solution.
JtR
  • 20,568
  • 17
  • 46
  • 60
0
votes
0 answers

procfs file open and read fail

proc_test = create_proc_entry("proc_test", S_IRUGO, NULL); if (proc_test) { proc_test->read_proc = _proc_read_test; } A procfs file is created like the above, but sometimes it couldn't be read like the following. $ ls -l…
corone
  • 1
  • 1
0
votes
2 answers

Linux app sends UDP without socket

fellow coders. I'm monitoring my outgoing traffic using libnetfilter_queue module and an iptables rule ipatbles -I OUTPUT 1 -p all -j NFQUEUE --queue-num 11220 A certain app, called Jitsi (which runs on Java) is exhibiting such a strange behaviour…
abirvalg
  • 128
  • 1
  • 7
0
votes
0 answers

where is the fs/proc/proc.c in Linux Kernel source

in Linux kernel source code, there are below words in fs/proc/Makefile obj-y += proc.o but where is the fs/proc/proc.c file? find the file in Linux source code, but not found.
jaloo
  • 13
  • 3