]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/blobdiff - include/linux/fdtable.h
Wrap accesses to the fd_sets in struct fdtable
[mirror_ubuntu-bionic-kernel.git] / include / linux / fdtable.h
index 82163c4b32c9fa89cd2869e369f0a5c39239c5c1..7675da2c18f724c5d6c23de05635d30cb2e467b9 100644 (file)
@@ -38,6 +38,36 @@ struct fdtable {
        struct fdtable *next;
 };
 
+static inline void __set_close_on_exec(int fd, struct fdtable *fdt)
+{
+       FD_SET(fd, fdt->close_on_exec);
+}
+
+static inline void __clear_close_on_exec(int fd, struct fdtable *fdt)
+{
+       FD_CLR(fd, fdt->close_on_exec);
+}
+
+static inline bool close_on_exec(int fd, const struct fdtable *fdt)
+{
+       return FD_ISSET(fd, fdt->close_on_exec);
+}
+
+static inline void __set_open_fd(int fd, struct fdtable *fdt)
+{
+       FD_SET(fd, fdt->open_fds);
+}
+
+static inline void __clear_open_fd(int fd, struct fdtable *fdt)
+{
+       FD_CLR(fd, fdt->open_fds);
+}
+
+static inline bool fd_is_open(int fd, const struct fdtable *fdt)
+{
+       return FD_ISSET(fd, fdt->open_fds);
+}
+
 /*
  * Open file table structure
  */