SYSLOG(3) Linux Programmer's Manual SYSLOG(3)
NAME
closelog, openlog, syslog, vsyslog - send messages to the system logger
SYNOPSIS
#include<syslog.h>voidopenlog(constchar*ident,int option,int facility);voidsyslog(int priority,constchar*format,...);voidcloselog(void);// exampleopenlog("mark", LOG_CONS | LOG_PID,0);syslog(LOG_DEBUG,"hello logger \n");closelog();
2. epoll
EPOLL_CREATE(2) Linux Programmer's Manual EPOLL_CREATE(2)
NAME
epoll_create, epoll_create1 - open an epoll file descriptor
SYNOPSIS
#include<sys/epoll.h>intepoll_create(int size);intepoll_create1(int flags);
EPOLL_CTL(2) Linux Programmer's Manual EPOLL_CTL(2)
NAME
epoll_ctl - control interface for an epoll descriptor
SYNOPSIS
#include<sys/epoll.h>intepoll_ctl(int epfd,int op,int fd,struct epoll_event *event);
EPOLL_WAIT(2) Linux Programmer's Manual EPOLL_WAIT(2)
NAME
epoll_wait, epoll_pwait - wait for an I/O event on an epoll file descriptor
SYNOPSIS
#include<sys/epoll.h>intepoll_wait(int epfd,struct epoll_event *events,int maxevents,int timeout);intepoll_pwait(int epfd,struct epoll_event *events,int maxevents,int timeout,const sigset_t *sigmask);
模型
驱动方式
内部实现
select / poll
主动轮询
epoll
事件驱动(类似中断)
mmap / epitem 红黑树 / rdllink 双链表
3. POSIX Asynchronous I/O
AIO(7) Linux Programmer's Manual AIO(7)
NAME
aio - POSIX asynchronous I/O overview
DESCRIPTION
The POSIX asynchronous I/O (AIO) interface allows applications to initiate one or more
I/O operations that are performed asynchronously (i.e., in the background). The appli‐
cation can elect to be notified of completion of the I/O operation in a variety of
ways: by delivery of a signal, by instantiation of a thread, or no notification at all.
The POSIX AIO interface consists of the following functions:aio_read(3) Enqueue a read request. This is the asynchronous analog of read(2).aio_write(3) Enqueue a write request. This is the asynchronous analog of write(2).aio_fsync(3) Enqueue a sync request for the I/O operations on a file descriptor.
This is the asynchronous analog of fsync(2) and fdatasync(2).