Prototypes of various useful system calls
int fork();
int wait(int *stat_loc);
int dup2(int fildes, int fildes2);
int pipe(int fildes[2]);
int open(const char *path, int oflag, ...);
int close(int fildes);
ssize_t read(int fd, void *buf, size_t count);
ssize_t write(int fd, const void *buf, size_t count);
off_t lseek(int fd, off_t offset, int whence);
| |
typedef void (*sighandler_t)(int);
sighandler_t signal(int signum, sighandler_t handler);
int setjmp(jmp_buf env);
void longjmp(jmp_buf env, int val);
int sigsetjmp(sigjmp_buf env, int savesigs);
void siglongjmp(sigjmp_buf env, int val);
|
|
int execl(const char *path, const char *arg, ...); /* End the argument list with NULL */
int execlp(const char *file, const char *arg, ...); /* End the argument list with NULL */
int execv(const char *path, char *const argv[]);
int execvp(const char *file, char *const argv[]);
Prototypes of Standard IO Library Calls
char *fgets(char *s, int size, FILE *stream); /* Returns NULL on EOF */
int fputs(const char *s, FILE *stream); /* Returns EOF when unsuccessful */
int fflush(FILE *stream); /* Returns 0 on success, EOF on failure */
FILE *fdopen(int fd, char *mode); /* Returns NULL on failure */
int fgetc(FILE *stream); /* Returns EOF on EOF */
int fputc(int c, FILE *stream); /* Returns EOF when unsuccessful */
size_t fread(void *ptr, size_t size, size_t nmemb, FILE *stream);
size_t fwrite(void *ptr, size_t size, size_t nmemb, FILE *stream);
int atoi(char *s); /* Converts a string to an integer - returns zero if unsuccessful */
Prototypes from Pthreads
typedef void *(*pthread_proc)(void *);
int pthread_create(pthread_t *thread, pthread_attr_t *attr,
pthread_proc start_routine, void *arg);
int pthread_join(pthread_t thread, void **value_ptr);
void pthread_exit(void *value_ptr);
int pthread_detach(pthread_t thread);
pthread_t pthread_self();
int pthread_mutex_lock(pthread_mutex_t *mutex);
int pthread_mutex_unlock(pthread_mutex_t *mutex);
int pthread_mutex_init(pthread_mutex_t *mutex, const pthread_mutexattr_t *attr);
int pthread_cond_signal(pthread_cond_t *cond);
int pthread_cond_wait(pthread_cond_t *cond, pthread_mutex_t *mutex);
int pthread_cond_init(pthread_cond_t *cond, const pthread_condattr_t *attr);
Prototypes from sockettome.h
extern int serve_socket(int port);
extern int accept_connection(int s);
extern int request_connection(char *hn, int port);