Files
daemon/tests/01_daemon.c
2026-04-08 18:44:34 -05:00

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;
}