kmalloc function


 
Thread Tools Search this Thread
Top Forums UNIX for Dummies Questions & Answers kmalloc function
# 1  
Old 12-22-2005
Bug kmalloc function

will kmalloc function allocate memory from kernel space or user space?
what exactly is the difference between kernel api and system call?
can anyone please send me the answer? its urgent.

Last edited by sriram.ec; 12-22-2005 at 09:20 AM..
 
Login or Register to Ask a Question

Previous Thread | Next Thread

10 More Discussions You Might Find Interesting

1. Shell Programming and Scripting

Function - Make your function return an exit status

Hi All, Good Day, seeking for your assistance on how to not perform my 2nd, 3rd,4th etc.. function if my 1st function is in else condition. #Body function1() { if then echo "exist" else echo "not exist" } #if not exist in function1 my all other function will not proceed.... (4 Replies)
Discussion started by: meister29
4 Replies

2. Shell Programming and Scripting

Need help on awk for printing the function name inside each function

Hi, I am having script which contains many functions. Need to print each function name at the starting of the function. Like below, functionname() { echo "functionname" commands.... } I've tried like below, func=`grep "()" scriptname | cut -d "(" -f1` for i in $func do nawk -v... (4 Replies)
Discussion started by: Sumanthsv
4 Replies

3. Shell Programming and Scripting

Will files, creaetd in one function of the same script will be recognized in another function?

Dear All. I have a script, which process files one by one. In the script I have two functions. one sftp files to different server the other from existing file create file with different name. My question is: Will sftp function recognize files names , which are created in another... (1 Reply)
Discussion started by: digioleg54
1 Replies

4. Shell Programming and Scripting

Passing variable value in a function to be used by another function

Hello All, I would like to ask help from you on how to pass variable value from a function that has been called inside the function. I have created below and put the variables in " ". Is there another way I can do this? Thank you in advance. readtasklist() { while read -r mod ver... (1 Reply)
Discussion started by: aderamos12
1 Replies

5. Shell Programming and Scripting

Help to Modify File Name in each function before calling another function.

I have a script which does gunzip, zip and untar. Input to the script is file name and file directory (where file is located) I am reading the input parameters as follows: FILENAME=$1 FILEDIR=$2 I have created 3 functions that are as follows: 1) gunzip file 2) unzip file... (2 Replies)
Discussion started by: pinnacle
2 Replies

6. Programming

How to step in one function after the function be executed in gdb?

In gdb, I can call one function with command "call", but how can I step in the function? I don't want to restart the program, but the function had been executed, gdb will execute next statement, and I don't know how to recall the function. (4 Replies)
Discussion started by: 915086731
4 Replies

7. UNIX for Dummies Questions & Answers

Kmalloc and malloc

Do kmalloc and malloc allocate from same heap ? (3 Replies)
Discussion started by: dragonpoint
3 Replies

8. Shell Programming and Scripting

SHELL SCRIPT Function Calling Another Function Please Help...

This is my function which is creating three variables based on counter & writing these variable to database by calling another function writeRecord but only one record is getting wrote in DB.... Please advise ASAP...:confused: function InsertFtg { FTGSTR="" echo "Saurabh is GREAT $#" let... (2 Replies)
Discussion started by: omkar.sonawane
2 Replies

9. Shell Programming and Scripting

Return a value from called function to the calling function

I have two scripts. script1.sh looks -------------------------------- #!/bin/bash display() { echo "Welcome to Unix" } display ----------------------------- Script2.sh #!/bin/bash sh script1.sh //simply calling script1.sh ------------------------------ (1 Reply)
Discussion started by: mvictorvijayan
1 Replies

10. Shell Programming and Scripting

Passing global variable to a function which is called by another function

Hi , I have three funcions f1, f2 and f3 . f1 calls f2 and f2 calls f3 . I have a global variable "period" which i want to pass to f3 . Can i pass the variable directly in the definition of f3 ? Pls help . sars (4 Replies)
Discussion started by: sars
4 Replies
Login or Register to Ask a Question
ddi_umem_alloc(9F)					   Kernel Functions for Drivers 					ddi_umem_alloc(9F)

NAME
ddi_umem_alloc, ddi_umem_free - allocate and free page-aligned kernel memory SYNOPSIS
#include <sys/types.h> #include <sys/sunddi.h> void *ddi_umem_alloc(size_t size, int flag, ddi_umem_cookie_t *cookiep); void ddi_umem_free(ddi_umem_cookie_t cookie); INTERFACE LEVEL
Solaris DDI specific (Solaris DDI). PARAMETERS
ddi_umem_alloc() size Number of bytes to allocate. flag Used to determine the sleep and pageable conditions. Possible sleep flags are DDI_UMEM_SLEEP, which allows sleeping until memory is available, and DDI_UMEM_NOSLEEP, which returns NULL immediately if memory is not available. The default condition is to allocate locked memory; this can be changed to allocate pageable memory using the DDI_UMEM_PAGEABLE flag. cookiep Pointer to a kernel memory cookie. ddi_umem_free() cookie A kernel memory cookie allocated in ddi_umem_alloc(). DESCRIPTION
ddi_umem_alloc() allocates page-aligned kernel memory and returns a pointer to the allocated memory. The number of bytes allocated is a multiple of the system page size (roundup of size). The allocated memory can be used in the kernel and can be exported to user space. See devmap(9E) and devmap_umem_setup(9F) for further information. flag determines whether the caller can sleep for memory and whether the allocated memory is locked or not. DDI_UMEM_SLEEP allocations may sleep but are guaranteed to succeed. DDI_UMEM_NOSLEEP allocations do not sleep but may fail (return NULL) if memory is currently unavail- able. If DDI_UMEM_PAGEABLE is set, pageable memory will be allocated. These pages can be swapped out to secondary memory devices. The ini- tial contents of memory allocated using ddi_umem_alloc() is zero-filled. *cookiep is a pointer to the kernel memory cookie that describes the kernel memory being allocated. A typical use of cookiep is in devmap_umem_setup(9F) when the drivers want to export the kernel memory to a user application. To free the allocated memory, a driver calls ddi_umem_free() with the cookie obtained from ddi_umem_alloc(). ddi_umem_free() releases the entire buffer. RETURN VALUES
Non-null Successful completion.ddi_umem_alloc() returns a pointer to the allocated memory. NULL Memory cannot be allocated by ddi_umem_alloc() because DDI_UMEM_NOSLEEP is set and the system is out of resources. CONTEXT
ddi_umem_alloc() can be called from any context if flag is set to DDI_UMEM_NOSLEEP. If DDI_UMEM_SLEEP is set, ddi_umem_alloc() can be called from user and kernel context only. ddi_umem_free() can be called from any context. SEE ALSO
devmap(9E), condvar(9F), devmap_umem_setup(9F), kmem_alloc(9F), mutex(9F), rwlock(9F), semaphore(9F) Writing Device Drivers WARNINGS
Setting the DDI_UMEM_PAGEABLE flag in ddi_umem_alloc() will result in an allocation of pageable memory. Because these pages can be swapped out to secondary memory devices, drivers should use this flag with care. This memory must not be used for the following purposes: o For synchronization objects such as locks and condition variables. See mutex(9F), semaphore(9F), rwlock(9F), and condvar(9F). o For driver interrupt routines. Memory allocated using ddi_umem_alloc() without setting DDI_UMEM_PAGEABLE flag cannot be paged. Available memory is therefore limited by the total physical memory on the system. It is also limited by the available kernel virtual address space, which is often the more restric- tive constraint on large-memory configurations. Excessive use of kernel memory is likely to effect overall system performance. Over-commitment of kernel memory may cause unpredictable consequences. Misuse of the kernel memory allocator, such as writing past the end of a buffer, using a buffer after freeing it, freeing a buffer twice, or freeing an invalid pointer, will cause the system to corrupt data or panic. Do not call ddi_umem_alloc() within DDI_SUSPEND and DDI_RESUME operations. Memory acquired at these times is not reliable. In some cases, such a call can cause a system to hang. NOTES
ddi_umem_alloc(0, flag, cookiep) always returns NULL. ddi_umem_free(NULL) has no effects on system. SunOS 5.10 19 Mar 2002 ddi_umem_alloc(9F)