Re: An alternative way of populating /proc

From: bert hubert (ahu@ds9a.nl)
Date: Wed Apr 12 2000 - 07:22:19 EST


On Wed, Apr 12, 2000 at 12:43:17PM +0200, Olaf Titz wrote:

> You can even have the compiler check the format string against the
> arguments with some __attribute__ magic. This alone is reason enough
> to keep it as shown above, printf-compatible.

No you can't. It's not printf, it's scanf magic in this case, and gcc does
not appear to feature a % argument that expects a pointer to a function.

If we add this,

        int create_proc_entries(struct proc_dir_entry *parent, char *format, ...)
        __attribute__ ((format (scanf, 2, 3)));

and try to compile procbuild.c, we get:

        procbuild.c: In function nit_module':
        procbuild.c:43: warning: float format, different type arg (arg 6)

If we change %f to %p, gcc expects a pointer to a pointer, which is does not
get. If we change it to %F, we get warnings that our string is incorrect.

Regards,

bert hubert.

-- 
                       |              http://www.rent-a-nerd.nl
                       |                     - U N I X -
                       |          Inspice et cautus eris - D11T'95

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.rutgers.edu Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Sat Apr 15 2000 - 21:00:18 EST