Pages

Sunday, August 5, 2012

How to get RAM info in linux?

Simple give cat /proc/meminfo

Sample output

abhi:/sys/class# cat /proc/meminfo
MemTotal:      1036092 kB
MemFree:        600532 kB
Buffers:        150752 kB
Cached:         141268 kB
SwapCached:          0 kB
Active:         233532 kB
Inactive:       161568 kB
HighTotal:      131008 kB
HighFree:          252 kB
LowTotal:       905084 kB
LowFree:        600280 kB
SwapTotal:     2650684 kB
SwapFree:      2650684 kB
Dirty:             360 kB
Writeback:           0 kB
AnonPages:      103064 kB
Mapped:          42420 kB
Slab:            28744 kB
SReclaimable:    23412 kB
SUnreclaim:       5332 kB
PageTables:       1668 kB
NFS_Unstable:        0 kB
Bounce:              0 kB
WritebackTmp:        0 kB
CommitLimit:   3168728 kB
Committed_AS:   274432 kB
VmallocTotal:   114680 kB
VmallocUsed:      4596 kB
VmallocChunk:   109660 kB
HugePages_Total:     0
HugePages_Free:      0
HugePages_Rsvd:      0
HugePages_Surp:      0
Hugepagesize:     4096 kB

Friday, August 3, 2012

Beauty of Life
 One of my best shot
 Cola
 Sunset in Singapore

Tuesday, May 15, 2012




Some more PICS 
























Beauty of nature is irresistible. Of all the beauty nature has, flowers got the most of it 









Thursday, February 9, 2012

Some of the pics I have taken

Well I am not a professional photographer. Not even close to a good photographer. But I am going to share some pics I have taken. All the copyrights for this pics belongs to me alone.

After all Joy of happiness is in sharing it.

A cool evening, empty road and miles ahead left to explore...

Flow of a river...






Saturday, March 19, 2011

Tricky, generic function pointer

#include
/* This is our generic function pointer */
typedef void (*fp)(void);
int func1(int a)
{
printf("Inside Func 1. Received %d\n", a);
return 2;
}

char func2(char b)
{
printf("Inside Func 2. Received %c\n", b);
return 'b';
}

int main()
{
fp ptr1;
int temp1;
char temp2;

ptr1 = (fp) func1;

temp1 = ((int (*)(int)) ptr1)(1);
ptr1 = (fp) func2;
// ptr1('g');
temp2 = ((char (*)(char))ptr1)('a');
printf("Inside Main. Received %d %c\n", temp1, temp2);
return 0;
}

Passing a function pointer to a function

#include

int any_function(int(*pfun)(int, int), int x, int y){
return pfun(x, y);
}

int sum(int x, int y){
return x + y;
}

int product(int x, int y){
return x * y;
}

int difference(int x, int y){
return x - y;
}

int main(void){
int a = 10;
int b = 5;
int result = 0;
int (*pf)(int, int) = sum; /* Pointer to sum function */

result = any_function(pf, a, b);
printf("\nresult = %d", result );

result = any_function(product,a, b);
printf("\nresult = %d", result );

printf("\nresult = %d\n", any_function(difference, a, b));
return 0;
}