From 6a336d0d3a1e484f21a08161ddbf4c921c2a586f Mon Sep 17 00:00:00 2001 From: Steffen Schulz Date: Wed, 25 May 2022 01:06:50 +0200 Subject: [PATCH] Revert "page_cache: auto-create workdir files or resume based on existing files" This reverts commit b8995723775c5ee75355ef4e87922cec359245e5. --- nyx/interface.c | 24 ++++++++++++++++++++++++ nyx/page_cache.c | 6 +++--- 2 files changed, 27 insertions(+), 3 deletions(-) diff --git a/nyx/interface.c b/nyx/interface.c index 09e57c0209..4294505d99 100644 --- a/nyx/interface.c +++ b/nyx/interface.c @@ -262,6 +262,30 @@ static bool verify_workdir_state(nyx_interface_state *s, Error **errp){ } free(tmp); + assert(asprintf(&tmp, "%s/page_cache.lock", workdir) != -1); + if (!file_exits(tmp)){ + fprintf(stderr, "%s does not exist...", tmp); + free(tmp); + return false; + } + free(tmp); + + assert(asprintf(&tmp, "%s/page_cache.addr", workdir) != -1); + if (!file_exits(tmp)){ + fprintf(stderr, "%s does not exist...\n", tmp); + free(tmp); + return false; + } + free(tmp); + + assert(asprintf(&tmp, "%s/page_cache.dump", workdir) != -1); + if (!file_exits(tmp)){ + fprintf(stderr, "%s does not exist...\n", tmp); + free(tmp); + return false; + } + free(tmp); + assert(asprintf(&tmp, "%s/page_cache", workdir) != -1); init_page_cache(tmp); diff --git a/nyx/page_cache.c b/nyx/page_cache.c index 55689316c8..7d40dff85e 100644 --- a/nyx/page_cache.c +++ b/nyx/page_cache.c @@ -359,12 +359,12 @@ page_cache_t* page_cache_new(const char* cache_file, uint8_t disassembler_word_w self->lookup = kh_init(PC_CACHE); - self->fd_page_file = open(tmp1, O_CLOEXEC | O_CREAT | O_RDWR, 0644); - self->fd_address_file = open(tmp2, O_CLOEXEC | O_CREAT | O_RDWR, 0644); + self->fd_page_file = open(tmp1, O_CLOEXEC | O_RDWR, S_IRWXU); + self->fd_address_file = open(tmp2, O_CLOEXEC | O_RDWR, S_IRWXU); #ifndef STANDALONE_DECODER self->cpu = cpu; - self->fd_lock = open(tmp3, O_CLOEXEC | O_CREAT, 0644); + self->fd_lock = open(tmp3, O_CLOEXEC); assert(self->fd_lock > 0); #else if(self->fd_page_file == -1 || self->fd_address_file == -1){