Commit 843747de authored by Cyrill Gorcunov's avatar Cyrill Gorcunov

net: A few changes in headres to follow c99

Since we're not system library

 - no underscopes in functions name until really needed
   and known to not clash with posix namespace
 - empty line between system headers and own headers
   for readability
 - extern for function prototypes
Signed-off-by: 's avatarCyrill Gorcunov <gorcunov@openvz.org>
parent f532e9fe
...@@ -240,7 +240,7 @@ static int dump_one_fd(char *pid_fd_dir, int dir, char *fd_name, unsigned long p ...@@ -240,7 +240,7 @@ static int dump_one_fd(char *pid_fd_dir, int dir, char *fd_name, unsigned long p
fd = openat(dir, fd_name, O_RDONLY); fd = openat(dir, fd_name, O_RDONLY);
if (fd < 0) { if (fd < 0) {
err = __try_dump_socket(pid_fd_dir, fd_name, cr_fdset); err = try_dump_socket(pid_fd_dir, fd_name, cr_fdset);
if (err != 1) if (err != 1)
return err; return err;
......
#ifndef __LINUX_RTNETLINK_H #ifndef LIBNETLINK_H__
#define __LINUX_RTNETLINK_H #define LIBNETLINK_H__
struct rtattr { struct rtattr {
unsigned short rta_len; unsigned short rta_len;
...@@ -59,7 +59,7 @@ struct rtattr { ...@@ -59,7 +59,7 @@ struct rtattr {
#define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */ #define NLMSG_MIN_TYPE 0x10 /* < 0x10: reserved control messages */
int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len); extern int parse_rtattr(struct rtattr *tb[], int max, struct rtattr *rta, int len);
int nlmsg_receive(char *buf, int len, int (*cb)(struct nlmsghdr *)); extern int nlmsg_receive(char *buf, int len, int (*cb)(struct nlmsghdr *));
#endif #endif /* LIBNETLINK_H__ */
#ifndef __CRTOOLS_SOCKETS_H__ #ifndef CR_SOCKETS_H__
#define __CRTOOLS_SOCKETS_H__ #define CR_SOCKETS_H__
int collect_sockets(void);
#include <stdbool.h>
struct cr_fdset; struct cr_fdset;
int __try_dump_socket(char *dir_name, char *fd_name, struct cr_fdset *cr_fdset); extern int try_dump_socket(char *dir_name, char *fd_name, struct cr_fdset *cr_fdset);
int prepare_sockets(int pid);
void show_unixsk(char *name, int fd, bool show_header); extern int collect_sockets(void);
#endif extern int prepare_sockets(int pid);
extern void show_unixsk(char *name, int fd, bool show_header);
#endif /* CR_SOCKETS_H__ */
#ifndef __UNIX_DIAG_H__ #ifndef UNIX_DIAG_H__
#define __UNIX_DIAG_H__ #define UNIX_DIAG_H__
#include "types.h" #include "types.h"
...@@ -44,4 +44,4 @@ struct unix_diag_vfs { ...@@ -44,4 +44,4 @@ struct unix_diag_vfs {
u32 udiag_vfs_dev; u32 udiag_vfs_dev;
}; };
#endif #endif /* UNIX_DIAG_H__ */
#include <linux/types.h> #include <linux/types.h>
#include <linux/netlink.h> #include <linux/netlink.h>
#include <string.h> #include <string.h>
#include "libnetlink.h" #include "libnetlink.h"
#include "util.h" #include "util.h"
......
...@@ -10,13 +10,15 @@ ...@@ -10,13 +10,15 @@
#include <netinet/tcp.h> #include <netinet/tcp.h>
#include <errno.h> #include <errno.h>
#include <unistd.h> #include <unistd.h>
#include <limits.h>
#include "types.h" #include "types.h"
#include "libnetlink.h" #include "libnetlink.h"
#include "sockets.h" #include "sockets.h"
#include "unix_diag.h" #include "unix_diag.h"
#include "util.h"
#include "image.h" #include "image.h"
#include "crtools.h" #include "crtools.h"
#include "util.h"
static char buf[4096]; static char buf[4096];
...@@ -170,7 +172,7 @@ err: ...@@ -170,7 +172,7 @@ err:
return -1; return -1;
} }
int __try_dump_socket(char *dir, char *fd, struct cr_fdset *cr_fdset) int try_dump_socket(char *dir, char *fd, struct cr_fdset *cr_fdset)
{ {
struct statfs fst; struct statfs fst;
struct stat st; struct stat st;
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment