This is the mail archive of the ecos-discuss@sources.redhat.com mailing list for the eCos project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

making netstat () diagnostic function


I want to make a netstat () diagnostic function.  That is if it's not
going to take to long.  If it does, I'll drop it.  I can't imagine it
taking very long if I can find out all the structure information I need.

>From what I understand, there's a global "fds" variable right?  This
holds file descriptors including sockets right?

I assume that these defines below are the file descriptor types for the
"f_type" field in the "file" structure?

Info below is from io/common/current/include/file.h
// Type of "file"
#define	DTYPE_VNODE	1	/* file */
#define	DTYPE_SOCKET	2	/* communications endpoint */
#define	DTYPE_PIPE	3	/* pipe */

struct file {
    short	f_flag;		/* file state */
    short	f_type;		/* descriptor type */
    struct	fileops {
        int	(*fo_read)(struct file *fp, struct uio *uio);
        int	(*fo_write)(struct file *fp, struct uio *uio);
        int	(*fo_ioctl)(struct file *fp, CYG_ADDRWORD com,
                            CYG_ADDRWORD data);
        int	(*fo_select)(struct file *fp, int which);
        int	(*fo_close)(struct file *fp);
    } *f_ops;
    CYG_ADDRWORD	f_offset;
    CYG_ADDRWORD	f_data;		/* vnode or socket */
};


Where would I find what "f_data" is pointing to in the case of a socket?
I assume it's a structure of some sort that holds all the information
about the socket in question, right?

What is "f_offset"?


Trenton D. Adams
Extreme Engineering
#17, 6025 - 12 St. SE
Calgary, Alberta, Canada
T2H 2K1

Phone: 403 640 9494 ext-208
Fax: 403 640 9599

http://www.extremeeng.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]