aboutsummaryrefslogtreecommitdiff
path: root/src/utility/io.h
blob: 363c4584f49d752aa7d67579025aa529fe03dc47 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
#ifndef CHANGE_SRC_UTILITY_IO_H_
#define CHANGE_SRC_UTILITY_IO_H_

#include <string>

namespace utility {

class FileDescriptorGuard {
	public:
		FileDescriptorGuard(const std::string& path);
		~FileDescriptorGuard();

		operator int() const;

	private:
		int fd_;

};

std::string get_file_path(int fd);

bool is_regular_file(int fd);
bool is_regular_file(const char* path);

}

#endif  // CHANGE_SRC_UTILITY_IO_H_