Question

xmalloc can be used in the process environment only when I write a AIX kernel extension.

what's the memory allocation functions can be called from the interrupt environment in AIX?

thanks.

No correct solution

OTHER TIPS

The network memory allocation routines. Look in /usr/include/net/net_malloc.h. The lowest level is net_malloc and net_free.

I don't see much documentation in IBM's pubs nor the internet. There are a few examples in various header files.

There is public no prototype that I can find for these.

If you look in net_malloc.h, you will see MALLOC and NET_MALLOC macros defined that call it. Then if you grep in all the files under /usr/include, you will see uses of these macros. From these uses, you can deduce the arguments to the macros and thus deduce the arguments to net_malloc itself. I would make one routine that is a pass through to net_malloc that you controlled the interface to.

On your target system, do "netstat -m". The last bucket size you see will be the largest size you can call net_malloc with the M_NOWAIT flag. M_WAIT can be used only at process time and waits for netm to allocate more memory if necessary. M_NOWAIT returns with a 0 if there is not enough memory pinned. At interrupt time, you must use M_NOWAIT.

There is no real checking for the "type" but it is good to pick an appropriate type for debugging purposes later on. The netm output from kdb shows the type.

In a similar fashion, you can figure out how to call net_free.

Its sad IBM has chosen not to document this. An alternative to get this information officially is to pay for an "ISV" question. If you are doing serious AIX development, you want to become an ISV / Partner. It will save you lots of heart break. I don't know the cost but it is within reach of small companies and even individuals.

This book is nice to have too.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top