67398

How to access the number of threads currently reading/writing form the userspace?

Question:

I have written a module where a user can read or write to a proc file - how do I determine the number of threads in a user process that is reading or writing in kernel-level programming?

Answer1:

Use current as a pointer to the current task (current task_struct) inside your read/write function:

#include <linux/sched.h> struct task_struct * t; for (t = next_thread(current); t != current; t = next_thread(t)) { // do the stuff }

Recommend

  • Mocking Non-Standard Events in F# Foq
  • Configuring Ninject
  • In Akka, is ActorContext thread safe?
  • How to determine the CCSID used in CPYFRMIMPF command?
  • How do I change the kernel/python version for iPython?
  • How to discover Font Type?
  • triggering user space with kernel
  • JSR-330 support in Picocontainer : @Inject … @Named(\"xxx)
  • Azure table store snapshot/backup capability
  • How to make JSON.NET deserialize to Microsoft Date Time?
  • How to get current document uri in XSLT?
  • SharedPreferences or SQLite Database?
  • Insert new calendar with SyncAdapter- Calendar API Android
  • Installed module is empty
  • Ensure fsync did its job
  • How do I exclude a dependency in provided scope when running in Maven test scope?
  • Is there a perl module to validate passwords stored in “{crypt}hashedpassword” “{ssha}hashedpassword
  • How can I sort a a table with VBA with given text condition?
  • Record samples being played with OpenAL
  • Meteor helpers not available in Angular template
  • Reading JSON from a file using C++ REST SDK (Casablanca)
  • The plugin 'org.apache.maven.plugins:maven-jboss-as-plugin' does not exist or no valid ver
  • How to rebase a series of branches?
  • Is there a javascript serializer for JSON.Net?
  • Spray.io: When (not) to use non-blocking route handling?
  • Where to put my custom functions in Wordpress?
  • Transpose CSV data with awk (pivot transformation)
  • How to disable jQuery.jplayer autoplay?
  • Buffer size for converting unsigned long to string
  • using HTMLImports.whenReady not working in chrome
  • What are the advantages and disadvantages of reading an entire file into a single String as opposed
  • Understanding cpu registers
  • How do I configure my settings file to work with unit tests?
  • Authorize attributes not working in MVC 4
  • Busy indicator not showing up in wpf window [duplicate]
  • Binding checkboxes to object values in AngularJs
  • How can i traverse a binary tree from right to left in java?
  • Python/Django TangoWithDjango Models and Databases
  • Net Present Value in Excel for Grouped Recurring CF
  • How do I use LINQ to get all the Items that have a particular SubItem?