util: introduce os_dupfd_cloexec() helper
[mesa.git] / src / util / os_file.h
index 36f367ea3588b15f603c50779ea39b7641bc6d9c..cf0dc2075952c23a942b33b8b00895947755c060 100644 (file)
@@ -24,6 +24,12 @@ extern "C" {
 FILE *
 os_file_create_unique(const char *filename, int filemode);
 
+/*
+ * Duplicate a file descriptor, making sure not to keep it open after an exec*()
+ */
+int
+os_dupfd_cloexec(int fd);
+
 /*
  * Read a file.
  * Returns a char* that the caller must free(), or NULL and sets errno.