On Tue, 2 Aug 2016, [email protected] wrote: > The problem is pretty obvious. netbsd kmem_alloc doesn't like allocating > zero-sized things, whereas linux kmalloc does.
Please, forgive my ignorance, I'm just asking out of curiosity. However, if kmalloc() isn't available at all what happened during the port? Did folks convert all the kmalloc() calls to kmem_alloc() ? The only reason I ask is that I'm supposing that one could wrapper kmalloc() to call kmem_alloc(1, KM_NOSLEEP); but I think that could cause more problems later when you tried to kmem_free() it and the code was off-by-one byte. That's probably not even close as a solution, but I whenever I see a chink in the namespace, I go for it :-) I doubt that kind of thing would be considered quality code, anyhow. Incidentally, I noticed that there is a reference to this issue in the man page but related to Solaris: Unlike Solaris, kmem_alloc(0, flags) is illegal. > Now for patching the code to return a sane value provided a zero size... I'm asking myself why that would be OK in the first place, really. I guess I could see someone creating a bunch of pointers with nothing allocated then using realloc() to change them as needed, but is that even possible with wired kernel memory? -Swift
