summaryrefslogtreecommitdiffabout
path: root/src/dropcache.c
blob: 659f00ac90cbe0e7ae6986bb7320452841919342 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>

char const drop_caches[] = "/proc/sys/vm/drop_caches";

int
main(int argc, char **argv)
{
  int fd;
  fd = open(drop_caches, O_WRONLY);
  if (fd == -1)
    {
      perror(drop_caches);
      return 1;
    }
  if (write(fd, "3\n", 2) != 2)
    {
      perror(drop_caches);
      return 1;
    }      
  close(fd);
  return 0;
}

Return to:

Send suggestions and report system problems to the System administrator.