]>
git.ipfire.org Git - thirdparty/util-linux.git/blob - misc-utils/lsfd-sock.h
2 * lsfd(1) - list file descriptors
4 * Copyright (C) 2022 Red Hat, Inc. All rights reserved.
5 * Written by Masatake YAMATO <yamato@redhat.com>
7 * Very generally based on lsof(8) by Victor A. Abell <abe@purdue.edu>
8 * It supports multiple OSes. lsfd specializes to Linux.
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License as published by
12 * the Free Software Foundation; either version 2 of the License, or
13 * (at your option) any later version.
15 * This program is distributed in the hope that it would be useful,
16 * but WITHOUT ANY WARRANTY; without even the implied warranty of
17 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
18 * GNU General Public License for more details.
20 * You should have received a copy of the GNU General Public License
21 * along with this program; if not, write to the Free Software Foundation,
22 * Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
24 #ifndef UTIL_LINUX_LSFD_SOCK_H
25 #define UTIL_LINUX_LSFD_SOCK_H
30 #include "libsmartcols.h"
33 * xinfo: eXtra inforation about sockets
36 ino_t inode
; /* inode in sockfs */
37 ino_t netns_inode
; /* inode of netns where
38 the socket belongs to */
39 const struct sock_xinfo_class
*class;
45 struct sock_xinfo
*xinfo
;
46 struct ipc_endpoint endpoint
;
49 struct sock_xinfo_class
{
50 /* Methods for filling socket related columns */
51 char * (*get_name
)(struct sock_xinfo
*, struct sock
*);
52 char * (*get_type
)(struct sock_xinfo
*, struct sock
*);
53 char * (*get_state
)(struct sock_xinfo
*, struct sock
*);
54 bool (*get_listening
)(struct sock_xinfo
*, struct sock
*);
55 /* Method for class specific columns.
56 * Return true when the method fills the column. */
57 bool (*fill_column
)(struct proc
*,
60 struct libscols_line
*,
64 struct ipc_class
*(*get_ipc_class
)(struct sock_xinfo
*, struct sock
*);
66 void (*free
)(struct sock_xinfo
*);
69 void initialize_sock_xinfos(void);
70 void finalize_sock_xinfos(void);
72 struct sock_xinfo
*get_sock_xinfo(ino_t inode
);
74 #endif /* UTIL_LINUX_LSFD_SOCK_H */