2019-07-28 10:31:56 +08:00
|
|
|
|
#ifndef ACL_FLOCK_INCLUDE_H
|
2014-11-19 00:25:21 +08:00
|
|
|
|
#define ACL_FLOCK_INCLUDE_H
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
extern "C" {
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#include "acl_define.h"
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <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>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
* ACL_FLOCK_STYLE_FLOCK or ACL_FLOCK_STYLE_FCNTL
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* @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>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
ACL_API int acl_myflock(ACL_FILE_HANDLE fd, int lock_style, int operation);
|
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Lock styles.
|
|
|
|
|
*/
|
2019-07-28 10:31:56 +08:00
|
|
|
|
#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) */
|
2014-11-19 00:25:21 +08:00
|
|
|
|
|
|
|
|
|
/*
|
|
|
|
|
* Lock request types.
|
|
|
|
|
*/
|
2019-07-28 10:31:56 +08:00
|
|
|
|
#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> */
|
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><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>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
#define ACL_FLOCK_OP_NOWAIT 4
|
|
|
|
|
|
|
|
|
|
/**
|
2019-07-28 10:31:56 +08:00
|
|
|
|
* <EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD><EFBFBD>ʽ<EFBFBD><EFBFBD>λ<EFBFBD><EFBFBD><EFBFBD><EFBFBD>
|
2014-11-19 00:25:21 +08:00
|
|
|
|
*/
|
|
|
|
|
#define ACL_FLOCK_OP_BITS \
|
|
|
|
|
(ACL_FLOCK_OP_SHARED | ACL_FLOCK_OP_EXCLUSIVE | ACL_FLOCK_OP_NOWAIT)
|
|
|
|
|
|
|
|
|
|
#ifdef __cplusplus
|
|
|
|
|
}
|
|
|
|
|
#endif
|
|
|
|
|
|
|
|
|
|
#endif
|