projects
/
platform
/
upstream
/
gstreamer.git
/ blob
commit
grep
author
committer
pickaxe
?
search:
re
d1c36cb5aa97305408a507704f62733852895419
[platform/upstream/gstreamer.git]
/
testsuite
/
bytestream
/
mem.c
1
#include <stdio.h>
2
#include <stdlib.h>
3
#include <fcntl.h>
4
#include <unistd.h>
5
#include <string.h>
6
7
int vmsize() {
8
int pid,fd,size,i,mem;
9
char filename[17], buf[256], *ptr, *end;
10
11
pid = getpid();
12
snprintf(filename,17,"/proc/%d/stat",pid);
13
fd = open(filename,O_RDONLY);
14
size = read(fd,buf,240);
15
ptr = buf;
16
for (i=0;i<22;i++)
17
ptr = (char *)strchr(ptr,' ') + 1;
18
end = (char *)strchr(ptr,' ');
19
*end = 0;
20
sscanf(ptr,"%d",&mem);
21
close(fd);
22
return mem;
23
}