28 lines
582 B
C
28 lines
582 B
C
#include "../include/daemon.h"
|
|
#include <stdlib.h>
|
|
#include <syslog.h>
|
|
#include <unistd.h>
|
|
int main()
|
|
{
|
|
skeleton_daemon();
|
|
|
|
while (1)
|
|
{
|
|
//TODO: Insert daemon code here.
|
|
syslog (LOG_NOTICE, "First daemon started.");
|
|
// Calculate 1 GB in bytes (1024 * 1024 * 1024)
|
|
size_t mem_size = 1024 * 1024 * 1024;
|
|
|
|
// Allocate the memory
|
|
char *data = (char*)malloc(mem_size);
|
|
sleep (20);
|
|
free(data);
|
|
break;
|
|
}
|
|
|
|
syslog (LOG_NOTICE, "First daemon terminated.");
|
|
closelog();
|
|
|
|
return EXIT_SUCCESS;
|
|
}
|