summarylogtreecommitdiffstats
path: root/mem-suspend.c
blob: d7d18e97e4fb1d3bd9ba6b51ca26b916ca3c7aac (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
#include <stdio.h>
#include <unistd.h>
#include <fcntl.h>
#include <errno.h>

static const char *state_path = "/sys/power/state";

int main(void)
{
  int fd = open(state_path, O_WRONLY | O_TRUNC);
  if (fd != -1)
  {
    write(fd, "mem", 3);
  }
  else
  {
    perror(state_path);
    return errno;
  }
  return 0;
}