Fixed garbage collector being inactive
This commit is contained in:
parent
bd4cedf996
commit
d4a2cb3749
@ -41,6 +41,7 @@
|
|||||||
#include "fuse_operations.h"
|
#include "fuse_operations.h"
|
||||||
#include "proc_operations.h"
|
#include "proc_operations.h"
|
||||||
#include "sourcefs.h"
|
#include "sourcefs.h"
|
||||||
|
#include "temp_permissions_table.h"
|
||||||
#include "ui-socket.h"
|
#include "ui-socket.h"
|
||||||
|
|
||||||
static void *xmp_init(struct fuse_conn_info *conn, struct fuse_config *cfg) {
|
static void *xmp_init(struct fuse_conn_info *conn, struct fuse_config *cfg) {
|
||||||
@ -67,6 +68,7 @@ static void *xmp_init(struct fuse_conn_info *conn, struct fuse_config *cfg) {
|
|||||||
cfg->negative_timeout = 0;
|
cfg->negative_timeout = 0;
|
||||||
fprintf(stderr, "%d\n", getpid());
|
fprintf(stderr, "%d\n", getpid());
|
||||||
assert(get_mountpoint() != NULL);
|
assert(get_mountpoint() != NULL);
|
||||||
|
init_garbage_collector();
|
||||||
|
|
||||||
return NULL;
|
return NULL;
|
||||||
}
|
}
|
||||||
|
@ -93,7 +93,7 @@ void *garbage_collector(void *arg) {
|
|||||||
(void)arg;
|
(void)arg;
|
||||||
|
|
||||||
while (is_gc_active) {
|
while (is_gc_active) {
|
||||||
sleep(10);
|
sleep(1);
|
||||||
pthread_mutex_lock(&temp_permissions_table_lock);
|
pthread_mutex_lock(&temp_permissions_table_lock);
|
||||||
|
|
||||||
vec(pid_t) blacklist;
|
vec(pid_t) blacklist;
|
||||||
@ -102,8 +102,10 @@ void *garbage_collector(void *arg) {
|
|||||||
for_each(&temp_permissions_table, pid, entry) {
|
for_each(&temp_permissions_table, pid, entry) {
|
||||||
if (!is_valid(*pid, entry)) {
|
if (!is_valid(*pid, entry)) {
|
||||||
push(&blacklist, *pid);
|
push(&blacklist, *pid);
|
||||||
cleanup(&(entry->allowed_files));
|
for_each(&entry->allowed_files, allowed_file) { free(*allowed_file); }
|
||||||
cleanup(&(entry->denied_files));
|
cleanup(&entry->allowed_files);
|
||||||
|
for_each(&entry->denied_files, denied_file) { free(*denied_file); }
|
||||||
|
cleanup(&entry->denied_files);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -13,6 +13,13 @@
|
|||||||
*/
|
*/
|
||||||
int init_temp_permissions_table(void);
|
int init_temp_permissions_table(void);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Starts the temporary permissions table garbage_collector.
|
||||||
|
*
|
||||||
|
* @return: 0 on success, -1 on failure (e.g. ENOMEM)
|
||||||
|
*/
|
||||||
|
int init_garbage_collector(void);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Destroys the temporary permissions table.
|
* Destroys the temporary permissions table.
|
||||||
*
|
*
|
||||||
|
@ -210,4 +210,4 @@ fi
|
|||||||
sleep 0.5
|
sleep 0.5
|
||||||
#lsof +f -- $(realpath ./protected)
|
#lsof +f -- $(realpath ./protected)
|
||||||
umount "$(realpath ./protected)"
|
umount "$(realpath ./protected)"
|
||||||
sleep 0.5
|
sleep 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user