-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathcsapp.h
83 lines (53 loc) · 1.68 KB
/
csapp.h
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
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
#include <stdio.h>
#include <netinet/in.h>
#include <arpa/inet.h>
#include <stdlib.h>
#include <netdb.h>
#include <sys/socket.h>
#include <sys/types.h>
#include <string.h>
#include <errno.h>
#include <stdlib.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/mman.h>
#include <wait.h>
#define RIO_BUFSIZE 8192
#define MAXLINE 8192
#define MAXBUF 8192
#define LISTENQ 1024
typedef struct sockaddr SA;
typedef struct {
int rio_fd;
int rio_cnt;
char *rio_bufptr;
char rio_buf[RIO_BUFSIZE];
} rio_t;
struct hostent *Gethostbyname(const char *name);
struct hostent *Gethostbyaddr(const char *addr, int len, int type);
extern char **environ;
void dns_error(char *msg);
void unix_error(char *msg);
void app_error(char *msg);
int open_clientfd(char *hostname, int port);
int open_listenfd(int port);
int Open_clientfd(char *hostname, int port);
int Open_listenfd(int port);
void rio_readinitb(rio_t *rp, int fd);
void Rio_readinitb(rio_t *rp, int fd);
char *Fgets(char *ptr, int n, FILE *stream);
ssize_t rio_writen(int fd, void *buf, size_t n);
void Rio_writen(int fd, void *buf, size_t n);
ssize_t rio_readlineb(rio_t *rp, void *buf, size_t maxlen);
ssize_t Rio_readlineb(rio_t *rp, void *buf, size_t maxlen);
void Fputs(const char *ptr, FILE *stream);
void Close(int fd);
int Accept(int s, struct sockaddr *addr, socklen_t *len);
int Open(const char *pathname, int flags, mode_t mode);
void *Mmap(void *addr, size_t len, int port, int flags, int fd, off_t offet);
void Munmap(void *start, size_t length);
pid_t Fork(void);
int Dup2(int fd1, int fd2);
void Execve(const char *filename, char * const argv[], char * const envp[]);
pid_t Wait(int *status);