Hi All,
I am having a script in which I am greping some values and storing them from files with .err and .log extensions.
I feel I can do it better.But How?
Below is my piece of code.
oneerrors=`egrep -i -n "one" *.err *.log`
twoerrors=`egrep -i -n "two" *.err *.log` ... (2 Replies)
Hi All,
I have a table with 10 columns. Some columns(2nd,4th,5th,7th,8th and 10th) are Not Null columns. I'll get a tab-delimited file and want to check col by col and generate seperate error code for each col eg:102 if 2nd col value is NULL and 104 if 4th col value is NULL so on... I am a... (7 Replies)
Hello,
I have a log file that outputs the data below. I would like to grep and display the data where column is equal '148.'
I've searched the forum, and couldn't find any answers.
I've tried all the grep switches and I get the same result as the log.
I'm thinking I might have to use an... (4 Replies)
Hi All,
I have a file which is having 3 columns as (string string integer)
a b 1
x y 2
p k 5
y y 4
.....
.....
Question:
I want get the unique value of column 2 in a sorted way(on column 2) and the sum of the 3rd column of the corresponding rows. e.g the above file should return the... (6 Replies)
I need to return all records in a file starting with
a row that says
TABLE: <tabl name>
lists of hexadecimal records
TABLE: <some table>
TABLe is a key word in the file. I know the name of the table I want to start with. I do not know the name of the table that I will end with. I just... (4 Replies)
Hi all,
I want to search the second col of a file as a sub-part of 4th col of another file and produce a joint output. In the example, search if B is contained as a sub-part in E:B:C (sub-parts separated by colons). Note the second row is not found doesnt find a match as F isnt there in col 4... (19 Replies)
I have 3-column tab separated data that looks like the following:
act of+n-a-large+vn-tell-v 0.067427
act_com of+n+n-a-large-manufacturer-n 0.129922
act-act_com-com in+n-j+vn-pass-aux-restate-v 0.364499666667
com nmod+n-j+ns-invader-n 0.527521
act_com-com obj+n-a-j+vd-contribute-v 0.091413... (2 Replies)
Discussion started by: owwow14
2 Replies
LEARN ABOUT SUNOS
kmem_zalloc
kmem_alloc(9F) Kernel Functions for Drivers kmem_alloc(9F)NAME
kmem_alloc, kmem_zalloc, kmem_free - allocate kernel memory
SYNOPSIS
#include <sys/types.h>
#include <sys/kmem.h>
void *kmem_alloc(size_t size, int flag);
void *kmem_zalloc(size_t size, int flag);
void kmem_free(void*buf, size_t size);
INTERFACE LEVEL
Architecture independent level 1 (DDI/DKI).
PARAMETERS
size Number of bytes to allocate.
flag Determines whether caller can sleep for memory. Possible flags are KM_SLEEP to allow sleeping until memory is available,
or KM_NOSLEEP to return NULL immediately if memory is not available.
buf Pointer to allocated memory.
DESCRIPTION
kmem_alloc() allocates size bytes of kernel memory and returns a pointer to the allocated memory. The allocated memory is at least double-
word aligned, so it can hold any C data structure. No greater alignment can be assumed. flag determines whether the caller can sleep for
memory. KM_SLEEP allocations may sleep but are guaranteed to succeed. KM_NOSLEEP allocations are guaranteed not to sleep but may fail
(return NULL) if no memory is currently available. The initial contents of memory allocated using kmem_alloc() are random garbage.
kmem_zalloc() is like kmem_alloc() but returns zero-filled memory.
kmem_free() frees previously allocated kernel memory. The buffer address and size must exactly match the original allocation. Memory can-
not be returned piecemeal.
RETURN VALUES
If successful, kmem_alloc() and kmem_zalloc() return a pointer to the allocated memory. If KM_NOSLEEP is set and memory cannot be allo-
cated without sleeping, kmem_alloc() and kmem_zalloc() return NULL.
CONTEXT
kmem_alloc() and kmem_zalloc() can be called from interrupt context only if the KM_NOSLEEP flag is set. They can be called from user con-
text with any valid flag. kmem_free() can be called from user or interrupt context.
SEE ALSO copyout(9F), freerbuf(9F), getrbuf(9F)
Writing Device Drivers
WARNINGS
Memory allocated using kmem_alloc() is not 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 restrictive constraint on large-memory configurations.
Excessive use of kernel memory is likely to affect overall system performance. Overcommitment of kernel memory will cause the system to
hang or panic.
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 a null or invalid pointer, will corrupt the kernel heap and may cause the system to corrupt data or panic.
The initial contents of memory allocated using kmem_alloc() are random garbage. This random garbage may include secure kernel data. There-
fore, uninitialized kernel memory should be handled carefully. For example, never copyout(9F) a potentially uninitialized buffer.
NOTES
kmem_alloc(0, flag) always returns NULL. kmem_free(NULL, 0) is legal.
SunOS 5.10 24 Mar 2003 kmem_alloc(9F)