polybar/include/utils/io.hpp

28 lines
655 B
C++
Raw Normal View History

#pragma once
2016-05-19 14:41:06 +00:00
2016-06-15 03:32:35 +00:00
#include "common.hpp"
2016-11-19 05:22:44 +00:00
POLYBAR_NS
2016-06-15 03:32:35 +00:00
namespace io_util {
string read(int read_fd, size_t bytes_to_read);
2016-11-02 19:22:45 +00:00
string readline(int read_fd);
2016-06-15 03:32:35 +00:00
size_t write(int write_fd, size_t bytes_to_write, const string& data);
2016-11-25 12:55:15 +00:00
size_t writeline(int write_fd, const string& data);
2016-05-19 14:41:06 +00:00
2016-11-25 12:55:15 +00:00
void tail(int read_fd, const function<void(string)>& callback);
2016-11-02 19:22:45 +00:00
void tail(int read_fd, int writeback_fd);
2016-05-19 14:41:06 +00:00
2016-11-02 19:22:45 +00:00
bool poll(int fd, short int events, int timeout_ms = 1);
bool poll_read(int fd, int timeout_ms = 1);
bool poll_write(int fd, int timeout_ms = 1);
2016-05-19 14:41:06 +00:00
2016-11-03 18:01:45 +00:00
bool interrupt_read(int write_fd);
void set_block(int fd);
void set_nonblock(int fd);
2016-05-19 14:41:06 +00:00
}
2016-06-15 03:32:35 +00:00
2016-11-19 05:22:44 +00:00
POLYBAR_NS_END