diff options
author | Omar Rizwan <omar.rizwan@gmail.com> | 2019-02-25 19:29:04 -0800 |
---|---|---|
committer | Omar Rizwan <omar.rizwan@gmail.com> | 2019-02-25 19:29:04 -0800 |
commit | a8ce61d9a1b987d18f5deabba0565465be8d4a3a (patch) | |
tree | ee72d5e9bade1c7164ad559bf919d546546a1a39 /fs/common.c | |
parent | 784ec83696d9ecedc10ede022a035e671dd21607 (diff) |
fs: Fix formatting.
Diffstat (limited to 'fs/common.c')
-rw-r--r-- | fs/common.c | 54 |
1 files changed, 27 insertions, 27 deletions
diff --git a/fs/common.c b/fs/common.c index f651009..7281147 100644 --- a/fs/common.c +++ b/fs/common.c @@ -12,51 +12,51 @@ static int tabfs_to_ws[2]; static int ws_to_tabfs[2]; void common_init() { - if (pipe(tabfs_to_ws)) exit(1); - if (pipe(ws_to_tabfs)) exit(1); + if (pipe(tabfs_to_ws)) exit(1); + if (pipe(ws_to_tabfs)) exit(1); } void common_send_tabfs_to_ws(char *request_data) { - write(tabfs_to_ws[1], &request_data, sizeof(request_data)); + write(tabfs_to_ws[1], &request_data, sizeof(request_data)); } char *common_receive_tabfs_to_ws(fd_set_filler_fn_t filler) { - fd_set read_fds, write_fds, except_fds; - FD_ZERO(&read_fds); - FD_ZERO(&write_fds); - FD_ZERO(&except_fds); + fd_set read_fds, write_fds, except_fds; + FD_ZERO(&read_fds); + FD_ZERO(&write_fds); + FD_ZERO(&except_fds); - int max_fd = filler(&read_fds, &write_fds, &except_fds); + int max_fd = filler(&read_fds, &write_fds, &except_fds); - FD_SET(tabfs_to_ws[0], &read_fds); - if (tabfs_to_ws[0] > max_fd) { max_fd = tabfs_to_ws[0]; } + FD_SET(tabfs_to_ws[0], &read_fds); + if (tabfs_to_ws[0] > max_fd) { max_fd = tabfs_to_ws[0]; } - struct timeval timeout; - timeout.tv_sec = 0; - timeout.tv_usec = 200000; + struct timeval timeout; + timeout.tv_sec = 0; + timeout.tv_usec = 200000; - select(max_fd + 1, &read_fds, &write_fds, &except_fds, &timeout); + select(max_fd + 1, &read_fds, &write_fds, &except_fds, &timeout); - if (!FD_ISSET(tabfs_to_ws[0], &read_fds)) { - // We can't read from tabfs_to_ws right now. Could be that it - // timed out, could be that we got a websocket event instead, - // whatever. + if (!FD_ISSET(tabfs_to_ws[0], &read_fds)) { + // We can't read from tabfs_to_ws right now. Could be that it + // timed out, could be that we got a websocket event instead, + // whatever. - return NULL; - } + return NULL; + } - char *request_data; - read(tabfs_to_ws[0], &request_data, sizeof(request_data)); + char *request_data; + read(tabfs_to_ws[0], &request_data, sizeof(request_data)); - return request_data; + return request_data; } void common_send_ws_to_tabfs(char *response_data) { - write(ws_to_tabfs[1], &response_data, sizeof(response_data)); + write(ws_to_tabfs[1], &response_data, sizeof(response_data)); } char *common_receive_ws_to_tabfs() { - char *response_data; - read(ws_to_tabfs[0], &response_data, sizeof(response_data)); + char *response_data; + read(ws_to_tabfs[0], &response_data, sizeof(response_data)); - return response_data; + return response_data; } |