2012-01-10 18:03:00 +04:00
|
|
|
#ifndef FILES_H_
|
|
|
|
#define FILES_H_
|
|
|
|
|
2012-02-22 13:46:36 +04:00
|
|
|
#include "compiler.h"
|
|
|
|
#include "types.h"
|
2012-03-26 23:11:00 +04:00
|
|
|
#include "lock.h"
|
2012-02-22 13:46:36 +04:00
|
|
|
#include "list.h"
|
|
|
|
#include "image.h"
|
|
|
|
|
2012-03-29 16:40:10 +04:00
|
|
|
struct fd_parms {
|
|
|
|
unsigned long fd_name;
|
|
|
|
unsigned long pos;
|
|
|
|
unsigned int flags;
|
|
|
|
unsigned int type;
|
|
|
|
struct stat stat;
|
|
|
|
u32 id;
|
|
|
|
pid_t pid;
|
|
|
|
};
|
|
|
|
|
2012-02-22 13:46:36 +04:00
|
|
|
enum fdinfo_states {
|
|
|
|
FD_STATE_PREP, /* Create unix sockets */
|
|
|
|
FD_STATE_CREATE, /* Create and send fd */
|
|
|
|
FD_STATE_RECV, /* Receive fd */
|
|
|
|
|
|
|
|
FD_STATE_MAX
|
|
|
|
};
|
|
|
|
|
|
|
|
struct fmap_fd {
|
|
|
|
struct fmap_fd *next;
|
|
|
|
unsigned long start;
|
|
|
|
int pid;
|
|
|
|
int fd;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct fdinfo_list_entry {
|
|
|
|
struct list_head list;
|
|
|
|
int fd;
|
|
|
|
int pid;
|
2012-03-26 23:11:00 +04:00
|
|
|
futex_t real_pid;
|
2012-02-22 13:46:36 +04:00
|
|
|
};
|
|
|
|
|
2012-04-05 20:02:00 +04:00
|
|
|
extern void transport_name_gen(struct sockaddr_un *addr,
|
|
|
|
int *len, int pid, long fd);
|
|
|
|
static inline struct fdinfo_list_entry *file_master(struct list_head *fd_list)
|
|
|
|
{
|
|
|
|
return list_first_entry(fd_list, struct fdinfo_list_entry, list);
|
|
|
|
}
|
|
|
|
|
2012-04-05 12:48:57 +04:00
|
|
|
void show_saved_files(void);
|
2012-04-03 00:50:50 +04:00
|
|
|
extern int collect_reg_files(void);
|
2012-01-10 18:03:00 +04:00
|
|
|
extern int prepare_fds(int pid);
|
2012-01-11 15:45:00 +04:00
|
|
|
extern int prepare_fd_pid(int pid);
|
2012-02-22 18:51:27 +04:00
|
|
|
extern int prepare_shared_fdinfo(void);
|
2012-03-21 19:38:00 +04:00
|
|
|
extern int get_filemap_fd(int pid, struct vma_entry *vma_entry);
|
2012-01-10 18:03:00 +04:00
|
|
|
|
2012-03-24 13:22:37 +04:00
|
|
|
extern int self_exe_fd;
|
|
|
|
|
2012-04-05 20:02:00 +04:00
|
|
|
extern int collect_pipes(void);
|
|
|
|
extern void mark_pipe_master(void);
|
2012-04-05 20:02:00 +04:00
|
|
|
extern int open_pipe(struct list_head *l);
|
2012-04-05 20:02:00 +04:00
|
|
|
struct list_head *find_pipe_fd(int id);
|
2012-04-05 20:02:00 +04:00
|
|
|
extern int pipe_should_open_transport(struct fdinfo_entry *fe,
|
|
|
|
struct list_head *fd_list);
|
2012-04-05 20:02:00 +04:00
|
|
|
|
2012-01-10 18:03:00 +04:00
|
|
|
#endif /* FILES_H_ */
|