aboutsummaryrefslogtreecommitdiff
path: root/src/utility/io.h
blob: 1015ddb2121a1d06aa600f01895711ef6f935bbf (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();

	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_