]> git.tdb.fi Git - libs/core.git/blobdiff - source/io/mode.h
Implement controls for file descriptor inheritance
[libs/core.git] / source / io / mode.h
index 5500dff613bc5e6a857f66bc9f9e7e4090be9893..0f7bb4fc37650cabe29389021d9c06be0b64bebe 100644 (file)
@@ -13,7 +13,8 @@ enum Mode
        M_WRITE = 2,
        M_RDWR = M_READ|M_WRITE,
        M_APPEND = 4,
-       M_NONBLOCK = 8
+       M_NONBLOCK = 8,
+       M_INHERIT = 16
 };
 
 inline Mode operator|(Mode m, Mode n)
@@ -25,11 +26,15 @@ inline Mode operator&(Mode m, Mode n)
 inline Mode operator~(Mode m)
 { return Mode(~static_cast<int>(m)); }
 
+inline void adjust_mode(Mode &m, Mode f, bool b)
+{ m = b ? (m|f) : (m&~f); }
+
 
 class invalid_access: public std::logic_error
 {
 public:
        invalid_access(Mode);
+       ~invalid_access() throw() { }
 };
 
 } // namespace IO