-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathfragments.c
More file actions
36 lines (31 loc) · 819 Bytes
/
fragments.c
File metadata and controls
36 lines (31 loc) · 819 Bytes
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
#include "csapp.h"
void *thread(void *vptr)
{
return NULL;
}
void fragments()
{
int pid, retcode;
pthread_t tid;
struct addrinfo hints, *result;
char *host="stuff", *service="stuff";
/* $begin unixcheck */
if ((pid = wait(NULL)) < 0) {
fprintf(stderr, "wait error: %s\n", strerror(errno));
exit(0);
}
/* $end unixcheck */
/* $begin posixcheck */
if ((retcode = pthread_create(&tid, NULL, thread, NULL)) != 0) {
fprintf(stderr, "pthread_create error: %s\n", strerror(retcode));
exit(0);
}
/* $end posixcheck */
/* $begin gaicheck */
if ((retcode = getaddrinfo(host, service, &hints, &result)) != 0) {
fprintf(stderr, "getaddrinfo error: %s\n", gai_strerror(retcode));
exit(0);
}
/* $end gaicheck */
exit(0);
}