Initial commit
This commit is contained in:
27
tests/01_daemon.c
Normal file
27
tests/01_daemon.c
Normal file
@@ -0,0 +1,27 @@
|
||||
#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;
|
||||
}
|
||||
Reference in New Issue
Block a user