Re: [patch] kernel events layer

Muli Ben-Yehuda
2004-07-23T18:31:58Z

[-- Attachment #1: Type: text/plain, Size: 1095 bytes --]

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 #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 189 bytes --]