Find the answer to your Linux question:
Results 1 to 3 of 3
Enjoy an ad free experience by logging in. Not a member yet? Register.
  1. #1

    How to find your own file descriptor

    Hi everyone,

    I'm quite new to Linux module programming, however circumstance has me writing a socket module for interprocess communication (don't ask ). Like I said, I'm very new to kernel programming and the only variable I'm aware of given to me is "current" which is a task structure. I actually need to find my own file descriptor that was returned to the user in the socket() call. Could someone advise me on how to do this without having the user post it back to the module?


  2. #2
    Linux Enthusiast gerard4143's Avatar
    Join Date
    Dec 2007
    Canada, Prince Edward Island
    I'm not really sure what your asking but I would investigate the /include/linux/sched.h file where the definition of current exist....there are several filesystem and open file structs you should check out...Hope this helps Gerard4143

  3. #3
    Hi Gerard, thanks for the reply. I probably was a little vague explaining what I'm doing.

    So I'm writing a linux module. It is theoretically a network driver, but in actuality it just has a socket interface. From my userspace I can call functions such as bind() listen() recv() and so forth...

    You know when call socket() in userspace it returns an integer known (usually) as a file descriptor? My question is, how can I retrieve that integer value from within the module itself?

  4. $spacer_open

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts