On Wed, Sep 9, 2009 at 5:13 PM, Leonidas .<leonidas137@xxxxxxxxx> wrote: > Why there is no realloc in kernel? > Any specific reason? > > Regards, > Sandeep. > May be because it is not guaranteed that you will be able to allocate more than a page of kernel memory contiguously, you may need to be explicitly aware of the limitation in your code anyways. kmalloc based allocation can be realloced like this, void * realloc(void* old_ptr, size_t old_size, size_t new_size, unsigned int mode) { void *buf; buf = kmalloc(new_size, mode); if (buf) { memcpy(buf, old_ptr, ((old_size < new_size) ? old_size : new_size)); kfree(old_ptr); } return buf; } -Vinit -- To unsubscribe from this list: send an email with "unsubscribe kernelnewbies" to ecartis@xxxxxxxxxxxx Please read the FAQ at http://kernelnewbies.org/FAQ