2014-11-19 00:25:21 +08:00
|
|
|
|
#ifndef ACL_IOSTUFF_INCLUDE_H
|
|
|
|
|
#define ACL_IOSTUFF_INCLUDE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "acl_define.h"
|
|
|
|
|
#include "acl_vstream.h"
|
|
|
|
|
|
|
|
|
|
#define ACL_CLOSE_ON_EXEC 1 /**< <20><>־λ, <20><><EFBFBD><EFBFBD> exec <20><><EFBFBD>Զ<EFBFBD><D4B6>رմ<D5B4><F2BFAAB5><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
|
|
|
|
|
#define ACL_PASS_ON_EXEC 0
|
|
|
|
|
|
|
|
|
|
#define ACL_BLOCKING 0 /**< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>־λ */
|
|
|
|
|
#define ACL_NON_BLOCKING 1 /**< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><D0B4>־λ */
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ӿ<EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} SOCKET <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param on {int} <EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ø<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, ACL_BLOCKING <EFBFBD><EFBFBD> ACL_NON_BLOCKING
|
2016-05-10 21:58:47 +08:00
|
|
|
|
* @return {int} >= 0: <EFBFBD>ɹ<EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ > 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>֮ǰ<EFBFBD>ı<EFBFBD>־λ; -1: ʧ<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_non_blocking(ACL_SOCKET fd, int on);
|
|
|
|
|
|
2015-01-14 23:35:23 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>װ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|
|
|
|
* @param fd {ACL_SOCKET} SOCKET <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} -1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ƽ̨<EFBFBD><EFBFBD>֧<EFBFBD>֣<EFBFBD>1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|
|
|
|
* 0 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ģʽ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_is_blocking(ACL_SOCKET fd);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
|
|
|
|
* д<EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int} <EFBFBD><EFBFBD>ʱʱ<EFBFBD>䣬<EFBFBD><EFBFBD>λΪ<EFBFBD>룬<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD>
|
|
|
|
|
* > 0 : <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* == 0 : <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* < 0 : ʱ<EFBFBD><EFBFBD>ʾֱ<EFBFBD>Ӹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊֹ
|
|
|
|
|
* @return {int} 0: <EFBFBD><EFBFBD>д; -1: ʧ<EFBFBD>ܻ<EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_write_wait(ACL_SOCKET fd, int timeout);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int} <EFBFBD><EFBFBD>ʱʱ<EFBFBD>䣬<EFBFBD><EFBFBD>λΪ<EFBFBD>룬<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD>
|
|
|
|
|
* > 0 : <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* == 0 : <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* < 0 : ʱ<EFBFBD><EFBFBD>ʾֱ<EFBFBD>Ӹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊֹ
|
|
|
|
|
* @return {int} 0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݿɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֳ<EFBFBD><EFBFBD><EFBFBD>; -1: ʧ<EFBFBD>ܻ<EFBFBD><EFBFBD><EFBFBD>ʱ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_read_wait(ACL_SOCKET fd, int timeout);
|
|
|
|
|
|
2017-08-15 12:17:57 +08:00
|
|
|
|
#if defined(ACL_LINUX) && !defined(MINGW)
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> epoll <EFBFBD><EFBFBD>ʽ<EFBFBD>Ķ<EFBFBD><EFBFBD>ȴ<EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param delay {int} <EFBFBD><EFBFBD><EFBFBD>뼶<EFBFBD>ȴ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_read_epoll_wait(ACL_SOCKET fd, int delay);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if defined(ACL_UNIX)
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> poll <EFBFBD><EFBFBD>ʽ<EFBFBD>Ķ<EFBFBD><EFBFBD>ȴ<EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param delay {int} <EFBFBD><EFBFBD><EFBFBD>뼶<EFBFBD>ȴ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_read_poll_wait(ACL_SOCKET fd, int delay);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> select <EFBFBD><EFBFBD>ʽ<EFBFBD>Ķ<EFBFBD><EFBFBD>ȴ<EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param delay {int} <EFBFBD><EFBFBD><EFBFBD>뼶<EFBFBD>ȴ<EFBFBD>ʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͬ<EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_read_select_wait(ACL_SOCKET fd, int delay);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>뼶<EFBFBD><EFBFBD>˯<EFBFBD><EFBFBD>
|
|
|
|
|
* @param delay {unsigned} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
*/
|
|
|
|
|
ACL_API void acl_doze(unsigned delay);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ij<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD>ɶ<EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-12-07 23:48:11 +08:00
|
|
|
|
* @return {int} 0: <EFBFBD><EFBFBD><EFBFBD>ɶ<EFBFBD>; -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 1<EFBFBD><EFBFBD><EFBFBD>ɶ<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_readable(ACL_SOCKET fd);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>ʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {void*} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {unsigned} buf <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param timeout {int} <EFBFBD><EFBFBD>ʱʱ<EFBFBD>䣬<EFBFBD><EFBFBD>λΪ<EFBFBD>룬<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD>
|
|
|
|
|
* > 0 : <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* == 0 : <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* < 0 : ʱ<EFBFBD><EFBFBD>ʾֱ<EFBFBD>Ӹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊֹ
|
|
|
|
|
* @return {int} > 0 <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_timed_read(ACL_SOCKET fd, void *buf, unsigned len,
|
|
|
|
|
int timeout, void *unused_context);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>ʱд<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {void*} <EFBFBD><EFBFBD><EFBFBD>ݴ洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {unsigned} <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD>ȴ<EFBFBD>С
|
|
|
|
|
* @param timeout {int} <EFBFBD><EFBFBD>ʱʱ<EFBFBD>䣬<EFBFBD><EFBFBD>λΪ<EFBFBD>룬<EFBFBD><EFBFBD>ֵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Σ<EFBFBD>
|
|
|
|
|
* > 0 : <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* == 0 : <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD>ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* < 0 : ʱ<EFBFBD><EFBFBD>ʾֱ<EFBFBD>Ӹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֿɶ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊֹ
|
|
|
|
|
* @return {int} > 0 <EFBFBD>ɹ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>; -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_timed_write(ACL_SOCKET fd, void *buf, unsigned len,
|
|
|
|
|
int timeout, void *unused_context);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѭ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݣ<EFBFBD>ֱ<EFBFBD><EFBFBD>д<EFBFBD>ꡢ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱΪֹ
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {void*} <EFBFBD><EFBFBD><EFBFBD>ݴ洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param len {unsigned} <EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD>ȴ<EFBFBD>С
|
|
|
|
|
* @param timeout {int} <EFBFBD><EFBFBD>ʱʱ<EFBFBD>䣬<EFBFBD><EFBFBD>λΪ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param {int} <EFBFBD>ɹ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_write_buf(ACL_SOCKET fd, const char *buf, int len, int timeout);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* ̽<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} ϵͳ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_peekfd(ACL_SOCKET fd);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD>
|
|
|
|
|
* @param fds {ACL_FILE_HANDLE [2]} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_pipe(ACL_FILE_HANDLE fds[2]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>رչܵ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fds {ACL_FILE_HANDLE[2]} <EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_pipe_close(ACL_FILE_HANDLE fds[2]);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD>һ<EFBFBD><EFBFBD><EFBFBD>ܵ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fds {ACL_FILE_HANDLE[2]} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ĺܵ<EFBFBD><EFBFBD>Ե<EFBFBD>ַ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @return 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_duplex_pipe(ACL_FILE_HANDLE fds[2]);
|
|
|
|
|
|
|
|
|
|
#ifdef ACL_UNIX
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>־λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> exec <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Զ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD>
|
|
|
|
|
* @param fd {int} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param on {int} ACL_CLOSE_ON_EXEC <EFBFBD><EFBFBD> 0
|
|
|
|
|
* @return {int} 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_close_on_exec(int fd, int on);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD>ر<EFBFBD>֮<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param lowfd {int} <EFBFBD><EFBFBD><EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @return {int} 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_closefrom(int lowfd);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>趨<EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>̿<EFBFBD><EFBFBD>Դ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @param limit {int} <EFBFBD>趨<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ
|
|
|
|
|
* @return {int} >=0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_open_limit(int limit);
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
* <EFBFBD>жϸ<EFBFBD><EFBFBD><EFBFBD>ij<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {int} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} != 0: <EFBFBD><EFBFBD>; 0: <EFBFBD><EFBFBD>
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_issock(int fd);
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-01-14 22:54:44 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
|
typedef int (__stdcall *acl_select_fn)(int, fd_set*, fd_set*,
|
|
|
|
|
fd_set*, const struct timeval*);
|
2018-01-16 18:24:13 +08:00
|
|
|
|
# if(_WIN32_WINNT >= 0x0600)
|
|
|
|
|
# define ACL_HAS_POLL
|
|
|
|
|
typedef int (__stdcall *acl_poll_fn)(struct pollfd*, unsigned long, int);
|
2018-01-21 18:13:48 +08:00
|
|
|
|
ACL_API void acl_set_poll(acl_poll_fn fn);
|
2018-01-16 18:24:13 +08:00
|
|
|
|
# endif
|
|
|
|
|
|
2018-01-14 22:54:44 +08:00
|
|
|
|
#else
|
|
|
|
|
#include <poll.h>
|
2018-01-16 18:24:13 +08:00
|
|
|
|
# define ACL_HAS_POLL
|
|
|
|
|
|
2018-01-14 22:54:44 +08:00
|
|
|
|
typedef int (*acl_select_fn)(int, fd_set*, fd_set*, fd_set*, struct timeval*);
|
|
|
|
|
typedef int (*acl_poll_fn)(struct pollfd*, nfds_t, int);
|
2018-01-21 18:13:48 +08:00
|
|
|
|
ACL_API void acl_set_poll(acl_poll_fn fn);
|
2018-01-14 22:54:44 +08:00
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
ACL_API void acl_set_select(acl_select_fn fn);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|