FreeBSD/sys/kern/subr_bus.c
/**
 * @brief Send a 'notification' to userland, using standard ways
 */
@brief Send a 'notification' to userland, using standard ways
@brief Send a ' notification ' to userland using standard ways
void
devctl_notify_f(const char *system, const char *subsystem, const char *type,
    const char *data, int flags)
{
	int len = 0;
	char *msg;
	if (system == NULL)
		return;		
	if (subsystem == NULL)
		return;		
	if (type == NULL)
		return;		
	len += strlen(" system=") + strlen(system);
	len += strlen(" subsystem=") + strlen(subsystem);
	len += strlen(" type=") + strlen(type);
	if (data != NULL)
		len += strlen(data);
	len += 3;	
	msg = malloc(len, M_BUS, flags);
	if (msg == NULL)
		return;		
	if (data != NULL)
		snprintf(msg, len, "!system=%s subsystem=%s type=%s %s\n",
		    system, subsystem, type, data);
	else
		snprintf(msg, len, "!system=%s subsystem=%s type=%s\n",
		    system, subsystem, type);
	devctl_queue_data_f(msg, flags);
}
void devctl_notify_f ( const char * system , const char * subsystem , const char * type , const char * data , int flags ) { int len = 0 ; char * msg ; if ( system == NULL ) return ; if ( subsystem == NULL ) return ; if ( type == NULL ) return ; len += strlen ( " " ) + strlen ( system ) ; len += strlen ( " " ) + strlen ( subsystem ) ; len += strlen ( " " ) + strlen ( type ) ; if ( data != NULL ) len += strlen ( data ) ; len += 3 ; msg = malloc ( len , M_BUS , flags ) ; if ( msg == NULL ) return ; if ( data != NULL ) snprintf ( msg , len , " \n " , system , subsystem , type , data ) ; else snprintf ( msg , len , " \n " , system , subsystem , type ) ; devctl_queue_data_f ( msg , flags ) ; }
@brief Send a 'notification' to userland, using standard ways
@brief Send a ' notification ' to userland using standard ways
/* BOGUS!  Must specify system. */ /* BOGUS!  Must specify subsystem. */ /* BOGUS!  Must specify type. */ /* add in the data message plus newline. */ /* '!', '\n', and NUL */ /* Drop it on the floor */