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

int
main(void)
{
	static const char *path = "/sys/power/state";
	int fd = open(path, O_WRONLY | O_TRUNC);

	if (fd == -1) {
		perror(path);
		return errno;
	}

	write(fd, "mem", 3);
	close(fd);
	return 0;
}