acl/lib_acl/include/stdlib/acl_sys_patch.h

264 lines
7.8 KiB
C
Raw Normal View History

#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"
#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 */
};
/**
* ˯<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);
/**
* <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);
#endif /* _WIN32 */
2014-11-19 00:25:21 +08:00
#ifdef ACL_UNIX
# include <sys/uio.h>
#endif
/**
* <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);
/**
* <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);
/**
* <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
/**
* <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}
* @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
/**
* <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);
/**
* <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);
/**
* <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);
/**
* <EFBFBD>ж<EFBFBD><EFBFBD>׽<EFBFBD><EFBFBD><EFBFBD><EFBFBD>Ƿ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param fd {ACL_SOCKET}
* @return {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ֵ 1 <EFBFBD><EFBFBD>ʾ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> 0 <EFBFBD><EFBFBD>ʾ<EFBFBD>
*/
ACL_API int acl_socket_alive(ACL_SOCKET fd);
2014-11-19 00:25:21 +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)
* @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);
/**
* <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);
/**
* <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);
/**
* <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);
/**
* <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);
/**
* <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);
/**
* <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);
/**
* <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);
/**
* <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);
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD> SOCKET <EFBFBD><EFBFBD>
* @param domain {int}
* @param type {int}
* @param protocol {int}
* @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
*/
ACL_API int acl_sane_socketpair(int domain, int type, int protocol,
ACL_SOCKET result[2]);
/* in acl_sys_socket.c */
#if defined(_WIN32) || defined(_WIN64)
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);
#else
typedef int (*acl_close_socket_fn)(ACL_SOCKET);
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
ACL_API void acl_set_close_socket(acl_close_socket_fn fn);
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