• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1  /****************************************************************************
2   ****************************************************************************
3   ***
4   ***   This header was automatically generated from a Linux kernel header
5   ***   of the same name, to make information necessary for userspace to
6   ***   call into the kernel available to libc.  It contains only constants,
7   ***   structures, and macros generated from the original header, and thus,
8   ***   contains no copyrightable information.
9   ***
10   ****************************************************************************
11   ****************************************************************************/
12  #ifndef __LINUX_FILE_H
13  #define __LINUX_FILE_H
14  
15  #include <asm/atomic.h>
16  #include <linux/posix_types.h>
17  #include <linux/compiler.h>
18  #include <linux/spinlock.h>
19  #include <linux/rcupdate.h>
20  #include <linux/types.h>
21  
22  #define NR_OPEN_DEFAULT BITS_PER_LONG
23  
24  struct embedded_fd_set {
25   unsigned long fds_bits[1];
26  };
27  
28  #define EMBEDDED_FD_SET_SIZE (BITS_PER_BYTE * sizeof(struct embedded_fd_set))
29  
30  struct fdtable {
31   unsigned int max_fds;
32   int max_fdset;
33   struct file ** fd;
34   fd_set *close_on_exec;
35   fd_set *open_fds;
36   struct rcu_head rcu;
37   struct files_struct *free_files;
38   struct fdtable *next;
39  };
40  
41  struct files_struct {
42  
43   atomic_t count;
44   struct fdtable *fdt;
45   struct fdtable fdtab;
46  
47   spinlock_t file_lock ____cacheline_aligned_in_smp;
48   int next_fd;
49   struct embedded_fd_set close_on_exec_init;
50   struct embedded_fd_set open_fds_init;
51   struct file * fd_array[NR_OPEN_DEFAULT];
52  };
53  
54  #define files_fdtable(files) (rcu_dereference((files)->fdt))
55  
56  struct kmem_cache;
57  
58  #define fcheck(fd) fcheck_files(current->files, fd)
59  
60  struct task_struct;
61  
62  struct files_struct *get_files_struct(struct task_struct *);
63  
64  #endif
65