diff --git a/pclsync/pcrypto.c b/pclsync/pcrypto.c index 315f026..e9932b0 100644 --- a/pclsync/pcrypto.c +++ b/pclsync/pcrypto.c @@ -42,7 +42,6 @@ #include "pcrypto.h" #include "plibs.h" -#include "pmemlock.h" #include #include @@ -161,7 +160,7 @@ static void copy_iv_and_xor_with_counter(unsigned char *dest, psync_symmetric_key_t pcrypto_key_len(size_t len) { psync_symmetric_key_t key; - key = (psync_symmetric_key_t)pmemlock_malloc( + key = (psync_symmetric_key_t)malloc( offsetof(psync_symmetric_key_struct_t, key) + len); key->keylen = len; pssl_rand_strong(key->key, len); @@ -406,7 +405,7 @@ pcrypto_textenc_create(psync_symmetric_key_t key) { enc = paes_create_encoder(key); if (unlikely_log(enc == PSYNC_INVALID_ENCODER)) return PSYNC_CRYPTO_INVALID_ENCODER; - ret = (pcrypto_textenc_t)pmemlock_malloc( + ret = (pcrypto_textenc_t)malloc( offsetof(pcrypto_key_iv_t, iv) + key->keylen - PSYNC_AES256_KEY_SIZE); ret->encoder = enc; @@ -419,7 +418,7 @@ void pcrypto_textenc_free( pcrypto_textenc_t enc) { paes_free_encoder(enc->encoder); putil_wipe(enc->iv, enc->ivlen); - pmemlock_free(enc); + free(enc); } pcrypto_textdec_t @@ -432,7 +431,7 @@ pcrypto_textdec_create(psync_symmetric_key_t key) { enc = paes_create_decoder(key); if (unlikely_log(enc == PSYNC_INVALID_ENCODER)) return PSYNC_CRYPTO_INVALID_ENCODER; - ret = (pcrypto_textenc_t)pmemlock_malloc( + ret = (pcrypto_textenc_t)malloc( offsetof(pcrypto_key_iv_t, iv) + key->keylen - PSYNC_AES256_KEY_SIZE); ret->encoder = enc; @@ -445,7 +444,7 @@ void pcrypto_textdec_free( pcrypto_textdec_t enc) { paes_free_encoder(enc->encoder); putil_wipe(enc->iv, enc->ivlen); - pmemlock_free(enc); + free(enc); } pcrypto_sector_encdec_t @@ -463,7 +462,7 @@ pcrypto_sec_encdec_create(psync_symmetric_key_t key) { paes_free_encoder(enc); return PSYNC_CRYPTO_INVALID_ENCODER; } - ret = (pcrypto_sector_encdec_t)pmemlock_malloc( + ret = (pcrypto_sector_encdec_t)malloc( offsetof(pcrypto_encdec_iv_t, iv) + key->keylen - PSYNC_AES256_KEY_SIZE); ret->encoder = enc; @@ -478,7 +477,7 @@ void pcrypto_sec_encdec_free( paes_free_encoder(enc->encoder); paes_free_decoder(enc->decoder); putil_wipe(enc->iv, enc->ivlen); - pmemlock_free(enc); + free(enc); } static int memcmp_const(const unsigned char *s1, const unsigned char *s2, diff --git a/pclsync/pcryptofolder.c b/pclsync/pcryptofolder.c index 5b19753..c4fc810 100644 --- a/pclsync/pcryptofolder.c +++ b/pclsync/pcryptofolder.c @@ -47,7 +47,6 @@ #include "pfoldersync.h" #include "pfs.h" #include "plibs.h" -#include "pmemlock.h" #include "pnetlibs.h" #include "psettings.h" #include "pssl.h" @@ -631,7 +630,7 @@ int pcryptofolder_unlock(const char *password) { aeskey = psymkey_generate(password, PSYNC_AES256_KEY_SIZE + PSYNC_AES256_BLOCK_SIZE, salt, saltlen, iterations); enc = pcrypto_ctr_encdec_create(aeskey); psymkey_free(aeskey); - rsaprivdec = (unsigned char *)pmemlock_malloc(rsaprivlen); + rsaprivdec = (unsigned char *)malloc(rsaprivlen); memcpy(rsaprivdec, rsapriv, rsaprivlen); pcrypto_ctr_encdec_decode(enc, rsaprivdec, rsaprivlen, 0); pcrypto_ctr_encdec_free(enc); @@ -641,7 +640,7 @@ int pcryptofolder_unlock(const char *password) { debug(D_NOTICE, "trying to load private key"); crypto_privkey = prsa_load_private(rsaprivdec, rsaprivlen); putil_wipe(rsaprivdec, rsaprivlen); - pmemlock_free(rsaprivdec); + free(rsaprivdec); if (crypto_privkey == PSYNC_INVALID_RSA) { debug(D_NOTICE, "failed to load private key"); prsa_free_public(crypto_pubkey); @@ -1040,7 +1039,7 @@ static void psync_crypto_release_file_symkey_locked(psync_fileid_t fileid, static psync_symmetric_key_t symkeyv1_to_symkey(sym_key_ver1 *v1) { psync_symmetric_key_t key; - key = (psync_symmetric_key_t)pmemlock_malloc( + key = (psync_symmetric_key_t)malloc( offsetof(psync_symmetric_key_struct_t, key) + PSYNC_AES256_KEY_SIZE + PSYNC_CRYPTO_HMAC_SHA512_KEY_LEN); key->keylen = PSYNC_AES256_KEY_SIZE + PSYNC_CRYPTO_HMAC_SHA512_KEY_LEN; diff --git a/pclsync/pmemlock.c b/pclsync/pmemlock.c deleted file mode 100644 index 4fd4508..0000000 --- a/pclsync/pmemlock.c +++ /dev/null @@ -1,408 +0,0 @@ -/* - Copyright (c) 2015 Anton Titov. - - Copyright (c) 2015 pCloud Ltd. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: Redistributions of source code must retain the above - copyright notice, this list of conditions and the following - disclaimer. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. Neither the name of pCloud Ltd nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL pCloud - Ltd BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. -*/ - -#include -#include -#include -#include -#include -#include - -#include "pcryptofolder.h" -#include "pintervaltree.h" -#include "plibs.h" -#include "pmem.h" -#include "pmemlock.h" -#include "ptree.h" -#include - -typedef uintptr_t pageid_t; -typedef struct { - psync_tree tree; - pageid_t pageid; - unsigned long refcnt; -} locked_page_t; - -typedef struct { - psync_tree tree; - psync_interval_tree_t *freeintervals; - char *mem; - size_t size; - int locked; -} allocator_range; - -static int psync_page_size; - -static pthread_mutex_t page_mutex = PTHREAD_MUTEX_INITIALIZER; -static psync_tree *locked_pages = PSYNC_TREE_EMPTY; - -static pthread_mutex_t allocator_mutex; -static psync_tree *allocator_ranges = PSYNC_TREE_EMPTY; - -void pmemlock_init() { - pthread_mutexattr_t mattr; - pthread_mutexattr_init(&mattr); - pthread_mutexattr_settype(&mattr, PTHREAD_MUTEX_RECURSIVE); - pthread_mutex_init(&allocator_mutex, &mattr); - pthread_mutexattr_destroy(&mattr); -} - -static int lock_page(pageid_t pageid, int page_size) { - psync_tree *tr, **addto; - locked_page_t *node; - int found, ret, tryn; - found = 0; - ret = 0; - tryn = 0; -retry: - pthread_mutex_lock(&page_mutex); - tr = locked_pages; - if (tr) { - while (1) { - node = ptree_element(tr, locked_page_t, tree); - if (pageid < node->pageid) { - if (tr->left) - tr = tr->left; - else { - addto = &tr->left; - break; - } - } else if (pageid > node->pageid) { - if (tr->right) - tr = tr->right; - else { - addto = &tr->right; - break; - } - } else { - found = 1; - break; - } - } - } else - addto = &locked_pages; - if (found) { - node->refcnt++; - debug(D_NOTICE, "page %lx is already locked, increasing refcnt to %u", - (unsigned long)pageid * page_size, (unsigned)node->refcnt); - } else { - // Well, we can move the locking out of mutex protected area, but to do - // properly, an status "in progress" should be introduced for new elements - // in the tree that mlock is yet not returned. This will complicate things a - // lot. - if (unlikely(pmem_mlock((void *)(pageid * page_size), page_size))) { - if (!tryn) { - tryn++; - pthread_mutex_unlock(&page_mutex); - debug(D_NOTICE, "mlock failed, trying to clean cache"); - pcryptofolder_cache_clean(); - goto retry; - } else { - debug(D_WARNING, "mlock for page %lx failed even after cache clean", - (unsigned long)pageid * page_size); - ret = -1; - } - } else { - debug(D_NOTICE, "locked page %lx", (unsigned long)pageid * page_size); - node = psync_new(locked_page_t); - node->pageid = pageid; - node->refcnt = 1; - *addto = &node->tree; - ptree_added_at(&locked_pages, tr, &node->tree); - } - } - pthread_mutex_unlock(&page_mutex); - return ret; -} - -static int unlock_page(pageid_t pageid, int page_size) { - psync_tree *tr; - locked_page_t *node; - int ret; - pthread_mutex_lock(&page_mutex); - tr = locked_pages; - while (tr) { - node = ptree_element(tr, locked_page_t, tree); - if (pageid < node->pageid) - tr = tr->left; - else if (pageid > node->pageid) - tr = tr->right; - else - break; - } - if (likely(tr)) { - if (--node->refcnt) { - debug(D_NOTICE, "decreased refcnt of page %lx to %u", - (unsigned long)pageid * page_size, (unsigned)node->refcnt); - ret = 0; - } else { - ptree_del(&locked_pages, tr); - free(node); - // do not move out of the mutex, will create race conditions - if (unlikely(pmem_munlock((void *)(pageid * page_size), page_size))) - ret = PRINT_RETURN(-1); - else { - debug(D_NOTICE, "unlocked page %lx", (unsigned long)pageid * page_size); - ret = 0; - } - } - } else { - ret = -1; - debug(D_WARNING, "unlocking page %lx that is not locked", - (unsigned long)pageid * page_size); - } - pthread_mutex_unlock(&page_mutex); - return ret; -} - -int pmemlock_lock(void *ptr, size_t size) { - pageid_t frompage, topage, i; - int page_size; - page_size = pmemlock_get_pagesize(); - if (page_size == -1) - return PRINT_RETURN(-1); - frompage = (uintptr_t)ptr / page_size; - topage = ((uintptr_t)ptr + size - 1) / page_size; - for (i = frompage; i <= topage; i++) - if (unlikely(lock_page(i, page_size))) { - while (i > frompage) - unlock_page(--i, page_size); - return PRINT_RETURN(-1); - } - return 0; -} - -int pmemlock_unlock(void *ptr, size_t size) { - pageid_t frompage, topage, i; - int page_size, ret; - page_size = pmemlock_get_pagesize(); - if (page_size == -1) - return PRINT_RETURN(-1); - frompage = (uintptr_t)ptr / page_size; - topage = ((uintptr_t)ptr + size - 1) / page_size; - ret = 0; - for (i = frompage; i <= topage; i++) - if (unlikely(unlock_page(i, page_size))) - ret = PRINT_RETURN(-1); - return ret; -} - -#define LM_ALIGN_TO (sizeof(size_t) * 2) -#define LM_OVERHEAD (sizeof(size_t) * 2) -#define LM_RANGE_OVERHEAD (LM_ALIGN_TO - sizeof(size_t)) -#define LM_END_MARKER (~((size_t)0)) - -#if IS_DEBUG -static void mark_aligment_bytes(char *ptr, size_t from, size_t to) { - size_t i; - for (i = from; i < to; i++) - ((unsigned char *)ptr)[i] = ((size_t)0xff + from - i) & 0xff; -} -#endif - -void *pmemlock_malloc(size_t size) { - return malloc(size); - allocator_range *range, *brange; - psync_tree *tr, **addto; - psync_interval_tree_t *interval; - char *ret; - uint64_t boffset; - size_t intsize, bestsize; -#if IS_DEBUG - size_t origsize = size; -#endif - int page_size; - size = ((size + LM_ALIGN_TO - 1)) / LM_ALIGN_TO * LM_ALIGN_TO + LM_OVERHEAD; -#if IS_DEBUG - debug(D_NOTICE, "size=%lu, size with overhead=%lu", (unsigned long)origsize, - (unsigned long)size); -#endif - bestsize = ~((size_t)0); - brange = NULL; - boffset = 0; // just to make compilers happy - // psync_mem_lock may call pcryptofolder_cache_clean(), which in turn can - // call pmemlock_free() on few pointers, therefore allocator_mutex is - // recursive - pthread_mutex_lock(&allocator_mutex); - ptree_for_each_element(range, allocator_ranges, allocator_range, tree) - psync_interval_tree_for_each(interval, range->freeintervals) { - intsize = interval->to - interval->from; - if (intsize >= size && intsize < bestsize) { - bestsize = intsize; - brange = range; - boffset = interval->from; - if (intsize == size) - goto foundneededsize; - } - } - if (brange) { - foundneededsize: - if (unlikely(!brange->locked)) - if (!pmemlock_lock(brange->mem, brange->size)) - brange->locked = 1; - psync_interval_tree_remove(&brange->freeintervals, boffset, boffset + size); - ret = brange->mem + boffset; -#if IS_DEBUG - *((size_t *)ret) = origsize; -#else - *((size_t *)ret) = size; -#endif - *((size_t *)(ret + size - sizeof(size_t))) = LM_END_MARKER; - ret += sizeof(size_t); -#if IS_DEBUG - mark_aligment_bytes(ret, origsize, size - LM_OVERHEAD); -#endif - } else - ret = NULL; - pthread_mutex_unlock(&allocator_mutex); - if (ret) - return ret; - page_size = pmemlock_get_pagesize(); - if (unlikely(page_size == -1)) - page_size = 4096; - intsize = (size + LM_RANGE_OVERHEAD + page_size - 1) / page_size * page_size; - brange = psync_new(allocator_range); - brange->freeintervals = NULL; - brange->mem = pmem_mmap_safe(intsize); - brange->size = intsize; - debug(D_NOTICE, "allocating new locked block of size %lu at %p", - (unsigned long)intsize, brange->mem); - if (unlikely(pmemlock_lock(brange->mem, intsize))) { - brange->locked = 0; - debug(D_WARNING, "could not lock %lu bytes in memory", - (unsigned long)intsize); - } else - brange->locked = 1; - if (intsize > size + LM_RANGE_OVERHEAD) - psync_interval_tree_add(&brange->freeintervals, LM_RANGE_OVERHEAD + size, - intsize); - ret = brange->mem + LM_RANGE_OVERHEAD; -#if IS_DEBUG - *((size_t *)ret) = origsize; -#else - *((size_t *)ret) = size; -#endif - *((size_t *)(ret + size - sizeof(size_t))) = LM_END_MARKER; - ret += sizeof(size_t); -#if IS_DEBUG - mark_aligment_bytes(ret, origsize, size - LM_OVERHEAD); -#endif - pthread_mutex_lock(&allocator_mutex); - tr = allocator_ranges; - if (tr) { - while (1) { - range = ptree_element(tr, allocator_range, tree); - if (brange->mem < range->mem) { - assert(brange->mem + brange->size <= range->mem); - if (tr->left) - tr = tr->left; - else { - addto = &tr->left; - break; - } - } else { - assert(range->mem + range->size <= brange->mem); - if (tr->right) - tr = tr->right; - else { - addto = &tr->right; - break; - } - } - } - } else - addto = &allocator_ranges; - *addto = &brange->tree; - ptree_added_at(&allocator_ranges, tr, &brange->tree); - pthread_mutex_unlock(&allocator_mutex); - return ret; -} - -void pmemlock_free(void *ptr) { - free(ptr); - return; - allocator_range *range; - psync_tree *tr; - char *cptr; - size_t size; -#if IS_DEBUG - size_t origsize, i; -#endif - cptr = ((char *)ptr) - sizeof(size_t); - size = *((size_t *)cptr); -#if IS_DEBUG - origsize = size; - size = ((size + LM_ALIGN_TO - 1)) / LM_ALIGN_TO * LM_ALIGN_TO; - debug(D_NOTICE, "size=%lu", (unsigned long)origsize); - for (i = origsize; i < size; i++) - assert(((unsigned char *)ptr)[i] == (((size_t)0xff + origsize - i) & 0xff)); - size += LM_OVERHEAD; -#endif - assert(*((size_t *)(cptr + size - sizeof(size_t))) == LM_END_MARKER); - pthread_mutex_lock(&allocator_mutex); - tr = allocator_ranges; - while (tr) { - range = ptree_element(tr, allocator_range, tree); - if (cptr < range->mem) - tr = tr->left; - else if (cptr >= range->mem + range->size) - tr = tr->right; - else - goto found; - } - debug(D_CRITICAL, "freeing memory at %p not found in any range", ptr); - abort(); -found: - psync_interval_tree_add(&range->freeintervals, cptr - range->mem, - cptr - range->mem + size); - if (range->freeintervals->from == LM_RANGE_OVERHEAD && - range->freeintervals->to == range->size) - ptree_del(&allocator_ranges, &range->tree); - else - range = NULL; - pthread_mutex_unlock(&allocator_mutex); - if (range) { - debug(D_NOTICE, "freeing block of size %lu at %p", - (unsigned long)range->size, range->mem); - if (range->locked) - pmemlock_unlock(range->mem, range->size); - pmem_munmap(range->mem, range->size); - free(range); - } -} - -int pmemlock_get_pagesize() { - return psync_page_size; -} - -void pmemlock_set_pagesize(int sz) { - psync_page_size = sz; -} diff --git a/pclsync/pmemlock.h b/pclsync/pmemlock.h deleted file mode 100644 index 33c1e3b..0000000 --- a/pclsync/pmemlock.h +++ /dev/null @@ -1,48 +0,0 @@ -/* - Copyright (c) 2015 Anton Titov. - - Copyright (c) 2015 pCloud Ltd. All rights reserved. - - Redistribution and use in source and binary forms, with or without - modification, are permitted provided that the following conditions - are met: Redistributions of source code must retain the above - copyright notice, this list of conditions and the following - disclaimer. Redistributions in binary form must reproduce the - above copyright notice, this list of conditions and the following - disclaimer in the documentation and/or other materials provided - with the distribution. Neither the name of pCloud Ltd nor the - names of its contributors may be used to endorse or promote - products derived from this software without specific prior written - permission. - - THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS - "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT - LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS - FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL pCloud - Ltd BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, - EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, - PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR - PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY - OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT - (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE - USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH - DAMAGE. -*/ - -#ifndef _PSYNC_MEMLOCK_H -#define _PSYNC_MEMLOCK_H - -#include - -void pmemlock_init(); - -int pmemlock_lock(void *ptr, size_t size); -int pmemlock_unlock(void *ptr, size_t size); - -void *pmemlock_malloc(size_t size); -void pmemlock_free(void *ptr); - -int pmemlock_get_pagesize(); -void pmemlock_set_pagesize(int sz); - -#endif diff --git a/pclsync/pssl.c b/pclsync/pssl.c index 0721bea..de3d20a 100644 --- a/pclsync/pssl.c +++ b/pclsync/pssl.c @@ -52,7 +52,6 @@ #include "pcache.h" #include "pcompiler.h" #include "plibs.h" -#include "pmemlock.h" #include "prand.h" #include "psettings.h" #include "pssl.h" @@ -71,7 +70,7 @@ static void ssl_debug(int loglevel, int errnum, const char *msg) { static void free_encrypted(psync_encrypted_data_t e) { putil_wipe(e->data, e->datalen); - pmemlock_free(e); + free(e); } void prsa_free_binary(psync_binary_rsa_key_t bin) { @@ -80,7 +79,7 @@ void prsa_free_binary(psync_binary_rsa_key_t bin) { void psymkey_free(psync_symmetric_key_t key) { putil_wipe(key->key, key->keylen); - pmemlock_free(key); + free(key); } psync_encrypted_symmetric_key_t @@ -545,7 +544,7 @@ prsa_public_to_binary(psync_rsa_publickey_t rsa) { if (len <= 0) return PSYNC_INVALID_BIN_RSA; ret = - pmemlock_malloc(offsetof(psync_encrypted_data_struct_t, data) + len); + malloc(offsetof(psync_encrypted_data_struct_t, data) + len); ret->datalen = len; memcpy(ret->data, buff + sizeof(buff) - len, len); return ret; @@ -566,7 +565,7 @@ prsa_private_to_binary(psync_rsa_privatekey_t rsa) { if (len <= 0) return PSYNC_INVALID_BIN_RSA; ret = - pmemlock_malloc(offsetof(psync_encrypted_data_struct_t, data) + len); + malloc(offsetof(psync_encrypted_data_struct_t, data) + len); ret->datalen = len; memcpy(ret->data, buff + sizeof(buff) - len, len); putil_wipe(buff + sizeof(buff) - len, len); @@ -670,7 +669,7 @@ psync_symmetric_key_t psymkey_generate(const char *password, size_t keylen, const unsigned char *salt, size_t saltlen, size_t iterations) { - psync_symmetric_key_t key = (psync_symmetric_key_t)pmemlock_malloc( + psync_symmetric_key_t key = (psync_symmetric_key_t)malloc( keylen + offsetof(psync_symmetric_key_struct_t, key)); mbedtls_md_context_t ctx; mbedtls_md_init(&ctx); @@ -745,7 +744,7 @@ psync_symmetric_key_t prsa_decrypt_data(psync_rsa_privatekey_t rsa, &rng, NULL, 0, &len, data, buff, sizeof(buff))) return PSYNC_INVALID_SYM_KEY; - ret = (psync_symmetric_key_t)pmemlock_malloc( + ret = (psync_symmetric_key_t)malloc( offsetof(psync_symmetric_key_struct_t, key) + len); ret->keylen = len; memcpy(ret->key, buff, len); diff --git a/pclsync/psynclib.c b/pclsync/psynclib.c index 83810b9..e8bfb8a 100644 --- a/pclsync/psynclib.c +++ b/pclsync/psynclib.c @@ -60,7 +60,6 @@ #include "plist.h" #include "plocalnotify.h" #include "plocalscan.h" -#include "pmemlock.h" #include "pnetlibs.h" #include "pnotify.h" #include "prpc.h" @@ -174,7 +173,6 @@ int psync_init() { return 0; } } - pmemlock_init(); pcache_init(); psys_init(); diff --git a/pclsync/psys.c b/pclsync/psys.c index 50506c4..9406005 100644 --- a/pclsync/psys.c +++ b/pclsync/psys.c @@ -4,7 +4,6 @@ #include #include "plibs.h" -#include "pmemlock.h" #include "psys.h" static uid_t psync_uid; @@ -51,8 +50,7 @@ void psys_init() { psync_gids = psync_new_cnt(gid_t, psync_gids_cnt); if (unlikely_log(getgroups(psync_gids_cnt, psync_gids) != psync_gids_cnt)) psync_gids_cnt = 0; - pmemlock_set_pagesize(sysconf(_SC_PAGESIZE)); - debug(D_NOTICE, "detected page size %d", pmemlock_get_pagesize()); + debug(D_NOTICE, "detected page size %ld", sysconf(_SC_PAGESIZE)); } time_t psys_time_seconds() {