Пример #1
0
// remove interface from run file
void bandwidth_remove(pid_t pid, const char *dev) {
	bandwidth_create_run_file(pid);
	
	// read bandwidth file
	read_bandwidth_file(pid);
	
	// find the element and remove it
	IFBW *elem = ifbw_find(dev);
	if (elem) {
		ifbw_remove(elem);
		write_bandwidth_file(pid) ;
	}
	
	// remove the file if there are no entries in the list
	if (ifbw == NULL) {
		 bandwidth_del_run_file(pid);
	}
}
Пример #2
0
// remove interface from shm file
void bandwidth_shm_remove(pid_t pid, const char *dev) {
	// create bandwidth directory & file in case they are not in the filesystem yet
	shm_create_firejail_dir();
	shm_create_bandwidth_file(pid);
	
	// read bandwidth file
	shm_read_bandwidth_file(pid);
	
	// find the element and remove it
	IFBW *elem = ifbw_find(dev);
	if (elem) {
		ifbw_remove(elem);
		shm_write_bandwidth_file(pid) ;
	}
	
	// remove the file if there are no entries in the list
	if (ifbw == NULL) {
		bandwidth_shm_del_file(pid);
	}
}