aboutsummaryrefslogtreecommitdiff
path: root/gdb/common/filestuff.h
diff options
context:
space:
mode:
Diffstat (limited to 'gdb/common/filestuff.h')
-rw-r--r--gdb/common/filestuff.h14
1 files changed, 14 insertions, 0 deletions
diff --git a/gdb/common/filestuff.h b/gdb/common/filestuff.h
index 92a2a5f..0e46eb5 100644
--- a/gdb/common/filestuff.h
+++ b/gdb/common/filestuff.h
@@ -19,6 +19,8 @@
#ifndef FILESTUFF_H
#define FILESTUFF_H
+#include <dirent.h>
+
/* Note all the file descriptors which are open when this is called.
These file descriptors will not be closed by close_most_fds. */
@@ -84,4 +86,16 @@ extern int gdb_pipe_cloexec (int filedes[2]);
extern struct cleanup *make_cleanup_close (int fd);
+struct gdb_dir_deleter
+{
+ void operator() (DIR *dir) const
+ {
+ closedir (dir);
+ }
+};
+
+/* A unique pointer to a DIR. */
+
+typedef std::unique_ptr<DIR, gdb_dir_deleter> gdb_dir_up;
+
#endif /* FILESTUFF_H */