48 lines
1.4 KiB
C
48 lines
1.4 KiB
C
#ifndef EXT_INCLUDED
|
|
#define EXT_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 ext_open(const char *path, int flags);
|
|
int ext_close(int fd);
|
|
int ext_invalidate(int *fd);
|
|
|
|
FILE* ext_fopen(const char *path, const char *mode);
|
|
FILE* ext_fdopen(int fd, const char *mode);
|
|
int ext_fclose(FILE *stream);
|
|
|
|
pid_t ext_fork(void);
|
|
int ext_dup2(int oldfd, int newfd);
|
|
int ext_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 shell_job(const char *path, char *const argv[], char *const envp[],int outfd, int errfd);
|
|
|
|
int ext_socket(int domain, int type, int protocol);
|
|
int ext_bind(int sockfd, const SA *addr,socklen_t addrlen);
|
|
int ext_listen(int sockfd, int backlog);
|
|
int ext_connect(int sockfd,const SA *addr, socklen_t addrlen);
|
|
int ext_accept(int socket, SA *addr,socklen_t *addrlen);
|
|
|
|
// Epoll or Fail
|
|
int ext_epoll_create(int flags);
|
|
int ext_epoll_ctl(int epfd, int op, int fd, uint32_t events);
|
|
int ext_setnonblocking(int fd);
|
|
int ext_epoll_wait(int epfd, struct epoll_event *events,int maxevents, int timeout);
|
|
|
|
#endif
|