aboutsummaryrefslogtreecommitdiffhomepage
path: root/io.h
diff options
context:
space:
mode:
authorGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-15 15:37:33 +0800
committerGravatar Cheer Xiao <xiaqqaix@gmail.com>2013-01-17 14:58:53 +0800
commit6f35792c74612f4b754125a5cfe9c96baa7854b9 (patch)
treeee721ca7ce434f77e80722eb208e0466e17b5a28 /io.h
parentf1b375b042ad1564d00645579a54bb28ba3e30d1 (diff)
Split out io_fd_t
Diffstat (limited to 'io.h')
-rw-r--r--io.h22
1 files changed, 18 insertions, 4 deletions
diff --git a/io.h b/io.h
index d7ddbd0e..627bfc39 100644
--- a/io.h
+++ b/io.h
@@ -37,8 +37,6 @@ public:
{
/** Fds for IO_PIPE and for IO_BUFFER */
int pipe_fd[2];
- /** fd to redirect specified fd to, for IO_FD */
- int old_fd;
} param1;
@@ -47,8 +45,6 @@ public:
{
/** file creation flags to send to open for IO_FILE */
int flags;
- /** Whether to close old_fd for IO_FD */
- int close_old;
} param2;
/** Filename IO_FILE. malloc'd. This needs to be used after fork, so don't use wcstring here. */
@@ -127,6 +123,24 @@ public:
virtual void print() const;
};
+class io_fd_t : public io_data_t
+{
+public:
+ /** fd to redirect specified fd to */
+ int old_fd;
+ /** Whether to close old_fd */
+ int close_old;
+
+ virtual void print() const;
+
+ io_fd_t(int f, int old, bool close = false) :
+ io_data_t(IO_FD, f),
+ old_fd(old),
+ close_old(close)
+ {
+ }
+};
+
class io_chain_t : public std::vector<shared_ptr<io_data_t> >
{
public: