Re: [patch] kernel events layer

From: Muli Ben-Yehuda
Date: Fri Jul 23 2004 - 13:33:14 EST


On Fri, Jul 23, 2004 at 01:41:57PM -0400, Robert Love wrote:
> +void send_kmessage(int type, const char *object, const char *signal,
> + const char *fmt, ...)
> +{
> + char *buffer;
> + int len;
> + int ret;
> +
> + if (!object)
> + return;
> +
> + if (!signal)
> + return;
> +
> + if (strlen(object) > PAGE_SIZE)
> + return;
> +
> + buffer = (char *) get_zeroed_page(GFP_ATOMIC);
> + if (!buffer)
> + return;
> +
> + len = sprintf(buffer, "From: %s\n", object);
> + len += sprintf(&buffer[len], "Signal: %s\n", signal);
> +
> + /* possible anxiliary data */
> + if (fmt) {
> + va_list args;
> +
> + va_start(args, fmt);
> + len += vscnprintf(&buffer[len], PAGE_SIZE-len-1, fmt, args);
> + va_end(args);
> + }
> + buffer[len++] = '\0';
> +
> + ret = netlink_send((1 << type), buffer, len);

Should we be ignoring the return value of netlink_send here, or
propogating a possible error to the callers?

> + free_page((unsigned long) buffer);
> +}

Cheers,
Muli
--
Muli Ben-Yehuda
http://www.mulix.org | http://mulix.livejournal.com/

Attachment: signature.asc
Description: Digital signature