📄 sysheaders.h~
字号:
#ifndef _SYSHEADERS_H_#define _SYSHEADERS_H_ 0#include "Config.h"#include <sys/types.h> /* basic system data types */#include <time.h> /* timespec{} for pselect() */#include <errno.h>#include <fcntl.h> /* for nonblocking */#include <limits.h> /* PIPE_BUF */#include <signal.h>#include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/stat.h> /* for S_xxx file mode constants */#include <unistd.h>#include <sys/wait.h>#include <stdarg.h>#include <sched.h>#include <features.h>#include <sys/mman.h> /* Posix shared memory */#ifndef MAP_FAILED#define MAP_FAILED ((void *)(-1))#endif#ifdef HAVE_SYS_SEM_H#ifdef __bsdi__#undef HAVE_SYS_SEM_H /* hack: BSDI's semctl() prototype is wrong */#else# include <sys/sem.h> /* System V semaphores */#endif#ifndef HAVE_SEMUN_UNION/* $$.It semun$$ *//*union semun { int val; struct semid_ds *buf; unsigned short *array;};*/#endif#endif /* HAVE_SYS_SEM_H */#ifdef HAVE_SYS_SHM_H# include <sys/shm.h> /* System V shared memory */#endif#ifdef HAVE_SYS_SELECT_H# include <sys/select.h> /* for convenience */#endif#ifdef HAVE_POLL_H# include <poll.h> /* for convenience */#endif#ifdef HAVE_STROPTS_H# include <stropts.h> /* for convenience */#endif#ifdef HAVE_STRINGS_H# include <strings.h> /* for convenience */#endif/* Next three headers are normally needed for socket/file ioctl's: * <sys/ioctl.h>, <sys/filio.h>, and <sys/sockio.h>. */#ifdef HAVE_SYS_IOCTL_H#include <sys/ioctl.h>#endif#ifdef HAVE_SYS_FILIO_H#include <sys/filio.h>#endif#include <pthread.h>#include <features.h>#include <bits/types.h>#include <stddef.h>#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH ) /* default permissions for new files */#define DIR_MODE (FILE_MODE | S_IXUSR | S_IXGRP | S_IXOTH ) /* default permissions for new directories */#define SVSEM_MODE (SEM_R | SEM_A | SEM_R>>3 | SEM_R>>6) /* default permissions for new SV semaphores */#define SVSHM_MODE (SHM_R | SHM_W | SHM_R >>3 | SHM_R>>6 ) /* default permissions for new SV shared memory */#define MAXLINE 4096 /* Max text line length */#define BUFFSIZE 8192 /* buffer size for reads and writes */ #define SEM_MAGIC 0x45678923#ifdef SEM_FAILED#undef SEM_FAILED#define SEM_FAILED ((sem_t *)(-1)) /* avoid complier warnings */#endif#ifndef SEMVMX#define SEMVMX 32767#endif/* Miscellaneous constants */#ifndef PATH_MAX /* should be in <limits.h> */#define PATH_MAX 1024 /* max # of characters in a pathname */#endif#define min(a,b) ((a) < (b) ? (a) : (b))#define max(a,b) ((a) > (b) ? (a) : (b))/* Definition for error processing function */void err_doit( int errnoflag,const char *fmt,va_list ap);
/* Nonfatal error related to a system call
* Print a message and return. */
void err_ret(const char *fmt,... );
/* Fatal error related to a system call.
Print a message and terminate. */
void err_sys( const char *fmt,... );
/* Fatatl error related to a system call.
Print a message ,dump core, and terminate.*/
void err_dump( const char *fmt,... );
/* Nonfatatl error unrelated to a system call.
Print a message return. */
void err_msg( const char *fmt,...);
/* Fatatl error related to a system call.
Print a message ,dump core, and terminate.*/
void err_quit( const char *fmt,... );
/* Print a message and return to caller.
* Caller specifies "errnoflag" and "level". */
/**************** Definition of wrapper function *******************/FILE *Fopen( const char *path,const char *mode );void Fwrite( const void *ptr,size_t size,size_t nmemb,FILE *stream );void Fclose( FILE *stream );/* For POSIX support */int set_concurrency(int level);void Set_concurrency(int level);void Pthread_create(pthread_t *tid, const pthread_attr_t *attr,void * (*func)(void *), void *arg);void Pthread_join(pthread_t tid, void **status);void Pthread_mutexattr_init(pthread_mutexattr_t *attr);void Pthread_mutexattr_destroy(pthread_mutexattr_t *attr);#ifdef _POSIX_THREAD_PROCESS_SHAREDvoid Pthread_mutexattr_setpshared(pthread_mutexattr_t *attr, int flag);#endifvoid Pthread_mutex_init(pthread_mutex_t *mptr, pthread_mutexattr_t *attr);/* include Pthread_mutex_lock */void Pthread_mutex_lock(pthread_mutex_t *mptr);/* end Pthread_mutex_lock */int Pthread_mutex_trylock(pthread_mutex_t *mptr);void Pthread_mutex_unlock(pthread_mutex_t *mptr);void Pthread_condattr_init(pthread_condattr_t *attr);void Pthread_condattr_destroy(pthread_condattr_t *attr);#ifdef _POSIX_THREAD_PROCESS_SHAREDvoid Pthread_condattr_setpshared(pthread_condattr_t *attr, int flag);#endifvoid Pthread_cond_signal(pthread_cond_t *cptr);void Pthread_cond_wait(pthread_cond_t *cptr, pthread_mutex_t *mptr);#endif
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -