add function fc_ftok
parent
16455133f3
commit
2496e697dc
3
HISTORY
3
HISTORY
|
|
@ -1,8 +1,9 @@
|
|||
|
||||
Version 1.35 2017-02-16
|
||||
Version 1.35 2017-02-20
|
||||
* logger judge log_level in function log_it_ex and log_it_ex1
|
||||
* add php extension function: fastcommon_file_put_contents
|
||||
* add function fc_safe_read and fc_safe_write
|
||||
* add function fc_ftok
|
||||
|
||||
Version 1.34 2017-02-06
|
||||
* ini_file_reader: LOCAL_IP support CIDR addresses
|
||||
|
|
|
|||
|
|
@ -2556,3 +2556,10 @@ ssize_t fc_safe_read(int fd, char *buf, const size_t count)
|
|||
|
||||
return count - remain;
|
||||
}
|
||||
|
||||
key_t fc_ftok(const char *path, const int proj_id)
|
||||
{
|
||||
int hash_code;
|
||||
hash_code = simple_hash(path, strlen(path));
|
||||
return (((proj_id & 0xFF) << 24) | (hash_code & 0xFFFFFF));
|
||||
}
|
||||
|
|
|
|||
|
|
@ -651,6 +651,14 @@ ssize_t fc_lock_write(int fd, const char *buf, const size_t nbyte);
|
|||
*/
|
||||
ssize_t fc_safe_read(int fd, char *buf, const size_t count);
|
||||
|
||||
/** ftok with hash code
|
||||
* parameters:
|
||||
* path: the file path
|
||||
* proj_id: the project id
|
||||
* return: read bytes for success, -1 when fail
|
||||
*/
|
||||
key_t fc_ftok(const char *path, const int proj_id);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
|
|
|||
Loading…
Reference in New Issue