acl/lib_acl/include/stdlib/acl_myflock.h

50 lines
1.2 KiB
C
Raw Normal View History

2014-11-19 00:25:21 +08:00
#ifndef ACL_FLOCK_INCLUDE_H
#define ACL_FLOCK_INCLUDE_H
#ifdef __cplusplus
extern "C" {
#endif
#include "acl_define.h"
/**
* <EFBFBD>Դ򿪵<EFBFBD><EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>м<EFBFBD><EFBFBD><EFBFBD>
* @param fd {ACL_FILE_HANDLE} <EFBFBD>ļ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>
* @param lock_style {int} ϵͳ<EFBFBD><EFBFBD><EFBFBD>API<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ͣ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>UNIX<EFBFBD><EFBFBD>Ч<EFBFBD><EFBFBD>
* ACL_FLOCK_STYLE_FLOCK or ACL_FLOCK_STYLE_FCNTL
* @param operation {int} <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ, ACL_FLOCK_OP_XXX
* @return {int} 0: <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ɹ<EFBFBD>; -1: <EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʧ<EFBFBD><EFBFBD>
*/
ACL_API int acl_myflock(ACL_FILE_HANDLE fd, int lock_style, int operation);
/*
* Lock styles.
*/
#define ACL_FLOCK_STYLE_FLOCK 1 /**< <20><><EFBFBD><EFBFBD> flock <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(unix) */
#define ACL_FLOCK_STYLE_FCNTL 2 /**< <20><><EFBFBD><EFBFBD> fcntl <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>(unix) */
/*
* Lock request types.
*/
#define ACL_FLOCK_OP_NONE 0 /**< <20><><EFBFBD><EFBFBD> */
#define ACL_FLOCK_OP_SHARED 1 /**< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
#define ACL_FLOCK_OP_EXCLUSIVE 2 /**< <20><><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> */
/**
* <EFBFBD>޵ȴ<EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>, <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_FLOCK_OP_SHARED, <EFBFBD><EFBFBD> ACL_FLOCK_OP_EXCLUSIVE <EFBFBD><EFBFBD><EFBFBD><EFBFBD>,
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD> ACL_FLOCK_OP_SHARED <EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
#define ACL_FLOCK_OP_NOWAIT 4
/**
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
*/
#define ACL_FLOCK_OP_BITS \
(ACL_FLOCK_OP_SHARED | ACL_FLOCK_OP_EXCLUSIVE | ACL_FLOCK_OP_NOWAIT)
#ifdef __cplusplus
}
#endif
#endif