3 machine level representation of c programs problem

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: ver helper functions */ int open_clientfd(char *hostname, int portno); int open_listenfd(int portno); code/include/csapp.h A.5. THE CSAPP.C SOURCE FILE 675 A.5 The csapp.c source file code/src/csapp.c 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 #include "csapp.h" /************************** * Error-handling functions **************************/ void unix_error(char *msg) /* unix-style error */ { fprintf(stderr, "%s: %s\n", msg, strerror(errno)); exit(0); } void posix_error(int code, char *msg) /* posix-style error */ { fprintf(stderr, "%s: %s\n", msg, strerror(code)); exit(0); } void dns_error(char *msg) /* dns-style error */ { fprintf(stderr, "%s: %s\n", msg, hstrerror(h_errno)); exit(0); } void app_error(char *msg) /* application error */ { fprintf(stderr, "%s\n", msg); exit(0); } /********************************************* * Wrappers for Unix process control functions ********************************************/ pid_t Fork(void) { pid_t pid; if (...
View Full Document

This note was uploaded on 09/02/2010 for the course ELECTRICAL 360 taught by Professor Schultz during the Spring '10 term at BYU.

Ask a homework question - tutors are online