FreeBSD/sys/contrib/vchiq/interface/vchiq_arm/vchiq_arm.c
/* add an instance (process) to the proc entries */
add an instance (process) to the proc entries
add an instance ( process ) to the proc entries
static int vchiq_proc_add_instance(VCHIQ_INSTANCE_T instance)
{
	char pidstr[32];
	struct proc_dir_entry *top, *use_count;
	struct proc_dir_entry *clients = vchiq_clients_top();
	int pid = instance->pid;
	snprintf(pidstr, sizeof(pidstr), "%d", pid);
	top = proc_mkdir(pidstr, clients);
	if (!top)
		goto fail_top;
	use_count = create_proc_read_entry("use_count",
					   0444, top,
					   proc_read_use_count,
					   instance);
	if (!use_count)
		goto fail_use_count;
	instance->proc_entry = top;
	return 0;
fail_use_count:
	remove_proc_entry(top->name, clients);
fail_top:
	return -ENOMEM;
}
static int vchiq_proc_add_instance ( VCHIQ_INSTANCE_T instance ) { char pidstr [ 32 ] ; struct proc_dir_entry * top , * use_count ; struct proc_dir_entry * clients = vchiq_clients_top ( ) ; int pid = instance -> pid ; snprintf ( pidstr , sizeof ( pidstr ) , " " , pid ) ; top = proc_mkdir ( pidstr , clients ) ; if ( ! top ) goto fail_top ; use_count = create_proc_read_entry ( " " , 0444 , top , proc_read_use_count , instance ) ; if ( ! use_count ) goto fail_use_count ; instance -> proc_entry = top ; return 0 ; fail_use_count : remove_proc_entry ( top -> name , clients ) ; fail_top : return - ENOMEM ; }
add an instance (process) to the proc entries
add an instance ( process ) to the proc entries