exectd/include/exectd.h

47 lines
1.3 KiB
C
Raw Normal View History

2024-11-16 01:41:47 +00:00
#ifndef FIO_INCLUDED
#define FIO_INCLUDED
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <sys/epoll.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#define SA struct sockaddr
#define SA_IN struct sockaddr_in
#define MAX_EVENTS 10
int fio_open(const char *path, int flags);
int fio_close(int fd);
int fio_invalidate(int *fd);
FILE* fio_fopen(const char *path, const char *mode);
FILE* fio_fdopen(int fd, const char *mode);
int fio_fclose(FILE *stream);
pid_t fio_fork(void);
int fio_dup2(int oldfd, int newfd);
int fio_pipe(int fds[2]);
int bi_popen(const char* const command, FILE** const in, FILE** const out);
int bi_pclose(FILE** const in, FILE** const out, const int to_child[2], const int to_parent[2]);
int execute_job(const char *path, char *const argv[], char *const envp[]);
int fio_socket(int domain, int type, int protocol);
int fio_bind(int sockfd, const SA *addr,socklen_t addrlen);
int fio_listen(int sockfd, int backlog);
int fio_connect(int sockfd,const SA *addr, socklen_t addrlen);
int fio_accept(int socket, SA *addr,socklen_t *addrlen);
// Epoll or Fail
int fio_epoll_create(int flags);
int fio_epoll_ctl(int epfd, int op, int fd, uint32_t events);
int fio_setnonblocking(int fd);
int fio_epoll_wait(int epfd, struct epoll_event *events,int maxevents, int timeout);
#endif