return g;
}
+void load_free(void)
+{
+ int i;
+ struct load_node *f, *p;
+
+ for (i = 0; i < LOAD_SIZE; i++) {
+ pthread_mutex_lock(&load_hash[i].lock);
+ pthread_rwlock_wrlock(&load_hash[i].rilock);
+ pthread_rwlock_wrlock(&load_hash[i].rdlock);
+ if (load_hash[i].next == NULL) {
+ pthread_mutex_unlock(&load_hash[i].lock);
+ pthread_mutex_destroy(&load_hash[i].lock);
+ pthread_rwlock_unlock(&load_hash[i].rilock);
+ pthread_rwlock_destroy(&load_hash[i].rilock);
+ pthread_rwlock_unlock(&load_hash[i].rdlock);
+ pthread_rwlock_destroy(&load_hash[i].rdlock);
+ continue;
+ }
+ for (f = load_hash[i].next; f; ) {
+ free(f->cg);
+ p = f->next;
+ free(f);
+ f = p;
+ }
+ pthread_mutex_unlock(&load_hash[i].lock);
+ pthread_mutex_destroy(&load_hash[i].lock);
+ pthread_rwlock_unlock(&load_hash[i].rilock);
+ pthread_rwlock_destroy(&load_hash[i].rilock);
+ pthread_rwlock_unlock(&load_hash[i].rdlock);
+ pthread_rwlock_destroy(&load_hash[i].rdlock);
+ }
+}
/* Reserve buffer size to account for file size changes. */
#define BUF_RESERVE_SIZE 512
struct fuse_file_info *fi);
extern int proc_access(const char *path, int mask);
extern pthread_t load_daemon(int load_use);
+extern void load_free(void);
#endif /* __LXCFS_BINDINGS_H */
}
if (!fuse_main(nargs, newargv, &lxcfs_ops, NULL))
ret = EXIT_SUCCESS;
+ if (load_use == true) {
+ s = pthread_cancel(pid);
+ if (s == 0) {
+ s = pthread_join(pid, NULL); /* Make sure sub thread has been canceled. */
+ if (s != 0) {
+ lxcfs_error("%s\n", "load_free error!");
+ goto out;
+ }
+ dlerror(); /* Clear any existing error */
+
+ load_free = (void (*)(void)) dlsym(dlopen_handle, "load_free");
+ error = dlerror();
+ if (error != NULL) {
+ lxcfs_error("load_free error: %s\n", error);
+ goto out;
+ }
+ load_free();
+ } else {
+ lxcfs_error("%s\n", "load_free error!");
+ }
+ }
out:
if (dlopen_handle)