2019-07-28 10:31:56 +08:00
|
|
|
|
#ifndef ACL_SYS_PATCH_INCLUDE_H
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#define ACL_SYS_PATCH_INCLUDE_H
|
|
|
|
|
|
|
|
|
|
# ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
#include "acl_define.h"
|
|
|
|
|
#include "acl_vstream.h"
|
|
|
|
|
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2014-11-19 00:25:21 +08:00
|
|
|
|
struct iovec {
|
|
|
|
|
void *iov_base; /**< Starting address */
|
|
|
|
|
size_t iov_len; /**< Number of bytes */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
#ifdef HAVE_NO_TIMEVAL
|
|
|
|
|
struct timeval {
|
|
|
|
|
long tv_sec; /**< seconds */
|
|
|
|
|
long tv_usec; /**< microseconds */
|
|
|
|
|
};
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
struct timezone {
|
|
|
|
|
int tz_minuteswest; /**< minutes W of Greenwich */
|
|
|
|
|
int tz_dsttime; /**< type of dst correction */
|
|
|
|
|
};
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* ˯<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param sec {int} ˯<EFBFBD>ߵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API void sleep(int sec);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>õ<EFBFBD>ǰʱ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param tv {struct timeval*} <EFBFBD>洢<EFBFBD><EFBFBD>ǰʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param tz {struct timezone*} ʱ<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int gettimeofday(struct timeval *tv, struct timezone *tz);
|
2020-12-29 16:30:12 +08:00
|
|
|
|
ACL_API int gettimeofday1(struct timeval *tv, struct timezone *tz);
|
|
|
|
|
ACL_API int gettimeofday2(struct timeval *tv, struct timezone *tz);
|
|
|
|
|
ACL_API int gettimeofday3(struct timeval *tv, struct timezone *tz);
|
|
|
|
|
ACL_API int gettimeofday4(struct timeval *tv, struct timezone *tz);
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
2015-06-29 17:33:11 +08:00
|
|
|
|
#endif /* _WIN32 */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#ifdef ACL_UNIX
|
|
|
|
|
# include <sys/uio.h>
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ֳ<EFBFBD>ʼ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>_WIN32ƽ̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>WSAStartup<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʼ<EFBFBD><EFBFBD>SOCKET<EFBFBD><EFBFBD>
|
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UNIXƽ̨<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ҫͨ<EFBFBD><EFBFBD> signal(SIGPIPE, SIG_IGN) <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ź<EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int} 0: OK; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_socket_init(void);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +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><EFBFBD><EFBFBD>_WIN32<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int} 0: OK; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_socket_end(void);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD>ر<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int} 0: OK; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_socket_close(ACL_SOCKET fd);
|
|
|
|
|
|
2017-04-07 20:13:08 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>ֹ<EFBFBD>ӿڵķ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2017-04-07 20:13:08 +08:00
|
|
|
|
* @param how {int}
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* @return {int} <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>
|
2017-04-07 20:13:08 +08:00
|
|
|
|
*/
|
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
|
|
|
|
# ifndef SHUT_RD
|
|
|
|
|
# define SHUT_RD SD_RECEIVE
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef SHUT_WR
|
|
|
|
|
# define SHUT_WR SD_SEND
|
|
|
|
|
# endif
|
|
|
|
|
# ifndef SHUT_RDWR
|
|
|
|
|
# define SHUT_RDWR SD_BOTH
|
|
|
|
|
# endif
|
|
|
|
|
#endif
|
|
|
|
|
ACL_API int acl_socket_shutdown(ACL_SOCKET fd, int how);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <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>ַ
|
|
|
|
|
* @param size {size_t} buf <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param timeout {size_t} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param fp {ACL_VSTREAM*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param arg {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѵIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻص<EFBFBD><EFBFBD><EFBFBD>ʽʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int} 0: OK; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_socket_read(ACL_SOCKET fd, void *buf, size_t size,
|
|
|
|
|
int timeout, ACL_VSTREAM *fp, void *arg);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <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>ַ
|
|
|
|
|
* @param size {size_t} buf <EFBFBD><EFBFBD><EFBFBD>ݴ<EFBFBD>С
|
|
|
|
|
* @param timeout {int} д<EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param fp {ACL_VSTREAM*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param arg {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѵIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻص<EFBFBD><EFBFBD><EFBFBD>ʽʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int} 0: OK; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_socket_write(ACL_SOCKET fd, const void *buf,
|
|
|
|
|
size_t size, int timeout, ACL_VSTREAM *fp, void *arg);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fd {ACL_SOCKET} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vec {const struct iovec*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ַ
|
|
|
|
|
* @param count {int} vec <EFBFBD><EFBFBD><EFBFBD>鳤<EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int} д<EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param fp {ACL_VSTREAM*} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param arg {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ѵIJ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ڻص<EFBFBD><EFBFBD><EFBFBD>ʽʱ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int} 0: OK; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_socket_writev(ACL_SOCKET fd, const struct iovec *vec,
|
|
|
|
|
int count, int timeout, ACL_VSTREAM *fp, void *arg);
|
|
|
|
|
|
2018-09-29 11:03:35 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2018-09-29 11:03:35 +08:00
|
|
|
|
* @param fd {ACL_SOCKET}
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ 1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD>쳣
|
2018-09-29 11:03:35 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_socket_alive(ACL_SOCKET fd);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param filepath {cosnt char*} <EFBFBD>ļ<EFBFBD>·<EFBFBD><EFBFBD>
|
|
|
|
|
* @param flags {int} <EFBFBD><EFBFBD>־λ, O_RDONLY | O_WRONLY | O_RDWR,
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* O_CREAT | O_EXCL | O_TRUNC, O_APPEND(for UNIX)
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* @param mode {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ȩ<EFBFBD><EFBFBD>λ, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>UNIX<EFBFBD><EFBFBD>Ч, <EFBFBD>磺0700, 0755
|
|
|
|
|
* @return {ACL_FILE_HANDLE} <EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_FILE_INVALID <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API ACL_FILE_HANDLE acl_file_open(const char *filepath, int flags, int mode);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD>رմ<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fh {ACL_FILE_HANDLE} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int} 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_file_close(ACL_FILE_HANDLE fh);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD>λ<EFBFBD>ļ<EFBFBD>λ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param fh {ACL_FILE_HANDLE} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param offset {acl_off_t} ƫ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param whence {int} λ<EFBFBD>ñ<EFBFBD>־λ<EFBFBD><EFBFBD>SEEK_CUR, SEEK_SET, SEEK_END
|
|
|
|
|
* @return {acl_off_t} <EFBFBD><EFBFBD>ǰ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD>ƫ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API acl_off_t acl_lseek(ACL_FILE_HANDLE fh, acl_off_t offset, int whence);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>ж<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fh {ACL_FILE_HANDLE} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {void*} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param size {size_t} buf <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>С
|
|
|
|
|
* @param timeout {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param fp {ACL_VSTREAM*} <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param arg {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵIJ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>Իص<EFBFBD><EFBFBD><EFBFBD>ʽʹ<EFBFBD><EFBFBD>ʱ<EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
|
|
|
|
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʵ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTREAM_EOF <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_file_read(ACL_FILE_HANDLE fh, void *buf, size_t size,
|
|
|
|
|
int timeout, ACL_VSTREAM *fp, void *arg);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fh {ACL_FILE_HANDLE} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param buf {void*} <EFBFBD><EFBFBD><EFBFBD>ݴ洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param size {size_t} buf <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݳ<EFBFBD><EFBFBD>ȴ<EFBFBD>С
|
|
|
|
|
* @param timeout {int} д<EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param fp {ACL_VSTREAM*} <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param arg {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵIJ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>Իص<EFBFBD><EFBFBD><EFBFBD>ʽʹ<EFBFBD><EFBFBD>ʱ<EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
|
|
|
|
* @return {int} <EFBFBD>ɹ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTREAM_EOF <EFBFBD><EFBFBD>ʾд<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_file_write(ACL_FILE_HANDLE fh, const void *buf, size_t size,
|
|
|
|
|
int timeout, ACL_VSTREAM *fp, void *arg);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>дһ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fh {ACL_FILE_HANDLE} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param vec {const struct iovec*} <EFBFBD><EFBFBD><EFBFBD>ݴ洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param count {int} vec <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ԫ<EFBFBD>ظ<EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param timeout {int} д<EFBFBD><EFBFBD>ʱʱ<EFBFBD><EFBFBD>(<EFBFBD><EFBFBD>)
|
|
|
|
|
* @param fp {ACL_VSTREAM*} <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param arg {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵIJ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>Իص<EFBFBD><EFBFBD><EFBFBD>ʽʹ<EFBFBD><EFBFBD>ʱ<EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
|
|
|
|
* @return {int} <EFBFBD>ɹ<EFBFBD>д<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_VSTREAM_EOF <EFBFBD><EFBFBD>ʾд<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_file_writev(ACL_FILE_HANDLE fh, const struct iovec *vec,
|
|
|
|
|
int count, int timeout, ACL_VSTREAM *fp, void *arg);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>е<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȫ<EFBFBD><EFBFBD>д<EFBFBD><EFBFBD>Ӳ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param fh {ACL_FILE_HANDLE} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fp {ACL_VSTREAM*} <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param arg {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵIJ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>Իص<EFBFBD><EFBFBD><EFBFBD>ʽʹ<EFBFBD><EFBFBD>ʱ<EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {int} 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_file_fflush(ACL_FILE_HANDLE fh, ACL_VSTREAM *fp, void *arg);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ø<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>Ĵ<EFBFBD>С
|
|
|
|
|
* @param filename {const char*} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {acl_int64} >= 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API acl_int64 acl_file_size(const char *filename);
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ȡ<EFBFBD>ø<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD>Ĵ<EFBFBD>С
|
|
|
|
|
* @param fh {ACL_FILE_HANDLE} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @param fp {ACL_VSTREAM*} <EFBFBD><EFBFBD>Ӧ<EFBFBD><EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ϊ<EFBFBD><EFBFBD>
|
|
|
|
|
* @param arg {void*} <EFBFBD>û<EFBFBD><EFBFBD><EFBFBD><EFBFBD>ݵIJ<EFBFBD><EFBFBD><EFBFBD>, <EFBFBD>Իص<EFBFBD><EFBFBD><EFBFBD>ʽʹ<EFBFBD><EFBFBD>ʱ<EFBFBD>˲<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ч
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* @return {acl_int64} >= 0: ok; -1: error
|
|
|
|
|
*/
|
|
|
|
|
ACL_API acl_int64 acl_file_fsize(ACL_FILE_HANDLE fh, ACL_VSTREAM *fp, void *arg);
|
|
|
|
|
|
2016-06-26 12:17:17 +08:00
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> SOCKET <EFBFBD><EFBFBD>
|
2016-06-26 12:17:17 +08:00
|
|
|
|
* @param domain {int}
|
|
|
|
|
* @param type {int}
|
|
|
|
|
* @param protocol {int}
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* @param result {ACL_SOCKET [2]} <EFBFBD>洢<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
|
|
|
|
* @return {int} <EFBFBD>ɹ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0<EFBFBD><EFBFBD>ʧ<EFBFBD>ܷ<EFBFBD><EFBFBD><EFBFBD> -1
|
2016-06-26 12:17:17 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_sane_socketpair(int domain, int type, int protocol,
|
|
|
|
|
ACL_SOCKET result[2]);
|
|
|
|
|
|
2018-01-14 22:54:44 +08:00
|
|
|
|
/* in acl_sys_socket.c */
|
|
|
|
|
|
|
|
|
|
#if defined(_WIN32) || defined(_WIN64)
|
2018-01-22 18:38:50 +08:00
|
|
|
|
typedef int (WINAPI *acl_close_socket_fn)(ACL_SOCKET);
|
|
|
|
|
typedef int (WINAPI *acl_recv_fn)(ACL_SOCKET, char *, int, int);
|
|
|
|
|
typedef int (WINAPI *acl_send_fn)(ACL_SOCKET, const char *, int, int);
|
2018-01-14 22:54:44 +08:00
|
|
|
|
#else
|
2018-01-22 18:38:50 +08:00
|
|
|
|
typedef int (*acl_close_socket_fn)(ACL_SOCKET);
|
2018-01-14 22:54:44 +08:00
|
|
|
|
typedef ssize_t (*acl_read_fn)(ACL_SOCKET, void *, size_t);
|
|
|
|
|
typedef ssize_t (*acl_recv_fn)(ACL_SOCKET, void *, size_t, int);
|
|
|
|
|
typedef ssize_t (*acl_write_fn)(ACL_SOCKET, const void *, size_t);
|
|
|
|
|
typedef ssize_t (*acl_writev_fn)(ACL_SOCKET, const struct iovec *, int);
|
|
|
|
|
typedef ssize_t (*acl_send_fn)(ACL_SOCKET, const void *, size_t, int);
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#if !defined(_WIN32) && !defined(_WIN64)
|
|
|
|
|
ACL_API void acl_set_read(acl_read_fn fn);
|
|
|
|
|
ACL_API void acl_set_write(acl_write_fn fn);
|
|
|
|
|
ACL_API void acl_set_writev(acl_writev_fn fn);
|
|
|
|
|
#endif
|
|
|
|
|
|
2018-01-22 18:38:50 +08:00
|
|
|
|
ACL_API void acl_set_close_socket(acl_close_socket_fn fn);
|
2018-01-14 22:54:44 +08:00
|
|
|
|
ACL_API void acl_set_recv(acl_recv_fn fn);
|
|
|
|
|
ACL_API void acl_set_send(acl_send_fn fn);
|
|
|
|
|
|
2014-11-19 00:25:21 +08:00
|
|
|
|
# ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
# endif
|
|
|
|
|
|
|
|
|
|
#endif
|
|
|
|
|
|