unix/linux中書中一直提到的“ourhdr.h”檔案內容

來源:互聯網
上載者:User

/*Our own header, to be included after all standard system headers*/<br />#ifndef __ourhdr_h<br />#define __ourhdr_h<br />#include <errno.h>/*for definition of errno */<br />#include <stdarg.h>/*ANSI C header file*/<br />#include <sys/types.h> /* required for some of our prototypes */<br />#include <stdio.h> /* for convenience */<br />#include <stdlib.h> /* for convenience */<br />#include <string.h> /* for convenience */<br />#include <unistd.h> /* for convenience */<br />#define MAXLINE 4096 /* max line length */<br />#define FILE_MODE (S_IRUSR | S_IWUSR | S_IRGRP | S_IROTH)<br /> /* default file access permissions for new files */<br />#define DIR_MODE (FILE_MODE | S_IXUSR | S_IXGRP | S_IXOTH)<br /> /* default permissions for new directoris */<br />typedef void Sigfunc(int); /* for signal handlers */<br /> /* 4.3BSD Reno <signal.h> doesn't define<br />SIG_ERR */<br />#if defined(SIG_IGN) && !defined(SIG_ERR)<br />#define SIG_ERR ((Sigfunc *)-1)<br />#endif<br />#define min(a,b) ((a) < (b) ? (a) : (b))<br />#define max(a,b) ((a) > (b) ? (a) : (b))<br /> /* prototypes for our own functions */<br />char *path_alloc(int *); /* {Prog pathalloc} */<br />int open_max(void); /* {Prog openmax} */<br />void clr_fl(int, int); /* {Prog setfl} */<br />void set_fl(int, int); /* {Prog setfl} */<br />void pr_exit(int); /* {Prog prexit} */<br />void pr_mask(const char *); /* {Prog prmask} */<br />Sigfunc *signal_intr(int, Sigfunc *);/* {Prog signal_intr_function} */<br />int tty_cbreak(int); /* {Prog raw} */<br />int tty_raw(int); /* {Prog raw} */<br />int tty_reset(int); /* {Prog raw} */<br />void tty_atexit(void); /* {Prog raw} */<br />#ifdef ECHO /* only if <termios.h> has been included */<br />struct termios *tty_termios(void); /* {Prog raw} */<br />#endif<br />void sleep_us(unsigned int); /* {Ex sleepus} */<br />ssize_t readn(int, void *, size_t);/* {Prog readn} */<br />ssize_t writen(int, const void *, size_t);/* {Prog writen} */<br />int daemon_init(void); /* {Prog daemoninit} */<br />int s_pipe(int *); /* {Progs svr4_spipe bsd spipe} */<br />int recv_fd(int, ssize_t (*func)(int, const void *, size_t));<br /> /* {Prog recvfd_svr4 recvfd_43bsd} */<br />int send_fd(int, int); /* {Progs sendfd_svr4 se dfd_43bsd} */<br />int send_err(int, int, const char *);/* {Prog senderr} */<br />int serv_listen(const char *); /* {Progs servlisten_svr4 servli ten_4 4bsd} */<br />int serv_accept(int, uid_t *); /* {Progs servaccept_svr4 servac ept_4 4bsd} */<br />int cli_conn(const char *); /* {Progs cliconn_svr4 cliconn_4 bsd} */<br />int buf_args(char *, int (*func)(int, char **));<br /> /* {Prog bufargs} */<br />int ptym_open(char *); /* {Progs ptyopen_svr4 p yopen_44bsd} */<br />int ptys_open(int, char *); /* {Progs ptyopen_svr4 ptyopen_4 bsd} */<br />#ifdef TIOCGWINSZ<br />pid_t pty_fork(int *, char *, const struct termios *,<br /> const struct winsize *); /* {Prog ptyfork */<br />#endif<br />int lock_reg(int, int, int, off_t, int, off_t);<br /> /* {Prog lockreg} */<br />#define read_lock(fd, offset, whence, len) lock_reg(fd, F_SETLK, F_RDLCK, offset, whence, len)<br />#define readw_lock(fd, offset, whence, len) lock_reg(fd, F_SETLKW, F_RDLCK, offset, whence, len)<br />#define write_lock(fd, offset, whence, len) lock_reg(fd, F_SETLK, F_WRLCK, offset, whence, len)<br />#define writew_lock(fd, offset, whence, len) lock_reg(fd, F_SETLKW, F_WRLCK, offset, whence, len)<br />#define un_lock(fd, offset, whence, len) lock_reg(fd, F_SETLK, F_UNLCK, offset, whence, len)<br />pid_t lock_test(int, int, off_t, int, off_t);<br /> /* {Prog locktest} */<br />#define is_readlock(fd, offset, whence, len) lock_test(fd, F_RDLCK, offset, whence, len)<br />#define is_writelock(fd, offset, whence, len) lock_test(fd, F_WRLCK, offset, whence, len)<br />void err_dump(const char *, ...); /* {App misc_source} */<br />void err_msg(const char *, ...);<br />void err_quit(const char *, ...);<br />void err_ret(const char *, ...);<br />void err_sys(const char *, ...);<br />void log_msg(const char *, ...); /* {App misc_source} */<br />void log_open(const char *, int, int);<br />void log_quit(const char *, ...);<br />void log_ret(const char *, ...);<br />void log_sys(const char *, ...);<br />void TELL_WAIT(void); /* parent/child from {Sec race_condition } */<br />void TELL_PARENT(pid_t);<br />void TELL_CHILD(pid_t);<br />void WAIT_PARENT(void);<br />void WAIT_CHILD(void);<br />#endif /* __ourhdr_h */ 

相關文章

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.