Re: getting fd from pointer to sock

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On Wed, Aug 14, 2002 at 04:41:50PM +0530, Amit Shah spoke out thus:
> hello,
>     i wanted to know if there is any function which can from the pointer to
> the sock structure or the pointer to the socket structure give me the
> corressponding socket descriptor value.
> Or even if it can give me the descriptor value from the pointer to the file
> structure...that would be helpful too.
> thanks,
> amit.

If you are refering to these values in userspace apps., fileno() should
solve the second problem [descriptor value from pointer to the file
structure]

For the first problem, the value returned by socket() function itself
is the integer socket descriptor value. What socket struct are you
refering to in this case? sockaddr? If so, remember that is the sturct
containing a socket address, not a pointer to a structure containg
socket information.

Regards,
-Varun
-- 
---------------------------------------
Mindframe Software & Services Pvt. Ltd.

http://www.mindsw.com
---------------------------------------
--
Kernelnewbies: Help each other learn about the Linux kernel.
Archive:       http://mail.nl.linux.org/kernelnewbies/
FAQ:           http://kernelnewbies.org/faq/


[Index of Archives]     [Newbies FAQ]     [Linux Kernel Mentors]     [Linux Kernel Development]     [IETF Annouce]     [Git]     [Networking]     [Security]     [Bugtraq]     [Yosemite]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux SCSI]     [Linux ACPI]
  Powered by Linux