I like the idea (in fact I had made my own for elf programs that
aren't for the current machine) and was thinking about how to do the
same thing for COFF, since one of my GCC embedded targets is COFF
based. I suspect to provide the least amount of grief, it should add
config options for the current java, em86, and mz that uses this
framework to register the appropriate binaries. This way, you don't
get lots of whining that 'I when up to the newest version and can not
get Java, etc. to work'. It will also allow people to run old kernels
without changing init scripts.
I also had a couple of random thoughts (bear in mind I am not a linux
kernel hacker):
I personally don't tend to like static limits on number of array
elements (since if you decided that the limit should be foo, I might
have a good reason to want 2*foo different formats):
spin_lock(&misc_binfmts_lock);
if (misc_binfmts_last == MAX_BINFMT_MISC_ENTRIES) {
kfree(ek);
spin_unlock(&misc_binfmts_lock);
return -ENOSPC;
}
misc_binfmts[++misc_binfmts_last]=ek;
spin_unlock(&misc_binfmts_lock);
return 1;
Writing it as a linked list would avoid the problem.
In load_misc_binary, I suspect you may want to build the arguments
(using copy_string) outside of the spin lock for misc_binfmts_lock,
particularly on a SMP machine if copy_string blocks awaiting for
memory. Whether or not you want to go to separate spin locks for each
element might be something to think about as the kernel goes away from
one giant spin lock around the kernel.
Not knowing the guts of the Linux kernel, I assume that there is
probably a function to do the strlen code you open code in
binfmt_misc_sysctl:
/* strlen of interpreter */
while (!(res=get_user(c, eu.interpreter+len)) && (c!=0))
len++;
-- Michael Meissner, Cygnus Solutions (East Coast) 4th floor, 955 Massachusetts Avenue, Cambridge, MA 02139, USA meissner@cygnus.com, 617-354-5416 (office), 617-354-7161 (fax)