gst-indent run on core
[platform/upstream/gstreamer.git] / tests / old / testsuite / refcounting / mem.c
1 #include <stdio.h>
2 #include <stdlib.h>
3 #include <string.h>
4 #include <fcntl.h>
5 #include <unistd.h>
6
7 int
8 vmsize ()
9 {
10   int pid, fd, size, i, mem;
11   char filename[17], buf[256], *ptr, *end;
12
13   pid = getpid ();
14   snprintf (filename, 17, "/proc/%d/stat", pid);
15   fd = open (filename, O_RDONLY);
16   size = read (fd, buf, 240);
17   ptr = buf;
18   for (i = 0; i < 22; i++)
19     ptr = (char *) strchr (ptr, ' ') + 1;
20   end = (char *) strchr (ptr, ' ');
21   *end = 0;
22   sscanf (ptr, "%d", &mem);
23   close (fd);
24   return mem;
25 }