Daemon implementation.
More...
#include <sys/syslog.h>
#include <stdio.h>
#include <sys/socket.h>
#include <mqueue.h>
#include <sys/types.h>
#include <resolv.h>
#include <netdb.h>
#include <stdlib.h>
#include <string.h>
#include <pthread.h>
#include <signal.h>
#include <sys/time.h>
#include <unistd.h>
#include <sys/stat.h>
#include <errno.h>
#include <fcntl.h>
#include <sys/mman.h>
#include <sys/shm.h>
#include "../inc/microphone.h"
Go to the source code of this file.
|
| void | initThread (int priority, pthread_attr_t *pthread_attr, struct sched_param *pthread_param) |
| | Initializes the thread parameters with defined priority. More...
|
| |
| void | checkErrors (int status) |
| | Check for errors upon creating threads. More...
|
| |
| static void | signalHandler (int signo) |
| | Process signal handler. More...
|
| |
| void * | tDetectCrying (void *local_pid) |
| | Detects crying from microphone. More...
|
| |
| void * | tWatchStreamFlag (void *arg) |
| | Watches message queue for any changes in livestream flag. More...
|
| |
| int | main (int argc, char *args[]) |
| |
Daemon implementation.
- Author
- José Carvalho, João Carneiro
- Date
- 2022-01-13
- Copyright
- Copyright (c) 2022
Definition in file daemon.c.
◆ detectCryingPrio
| #define detectCryingPrio 3 |
tDetectCrying priority
Definition at line 30 of file daemon.c.
◆ MSGQOBJ_NAME
| #define MSGQOBJ_NAME "/mqLocalDaemon" |
Message queue name
Definition at line 33 of file daemon.c.
◆ SHMEMOBJ_NAME
| #define SHMEMOBJ_NAME "/shLocalDaemon" |
Shared memory name
Definition at line 34 of file daemon.c.
◆ watchFlagPrio
tWatchFlag priority
Definition at line 31 of file daemon.c.
◆ checkErrors()
| void checkErrors |
( |
int |
status | ) |
|
Check for errors upon creating threads.
- Parameters
-
| status | : Value returned from functions |
Definition at line 289 of file daemon.c.
◆ initThread()
| void initThread |
( |
int |
priority, |
|
|
pthread_attr_t * |
pthread_attr, |
|
|
struct sched_param * |
pthread_param |
|
) |
| |
Initializes the thread parameters with defined priority.
- Parameters
-
| priority | Thread priority |
| pthread_attr | Thread attributes structure |
| pthread_param | Thread parameters structure |
Definition at line 274 of file daemon.c.
◆ main()
| int main |
( |
int |
argc, |
|
|
char * |
args[] |
|
) |
| |
◆ signalHandler()
| static void signalHandler |
( |
int |
signo | ) |
|
|
static |
Process signal handler.
- Parameters
-
Definition at line 61 of file daemon.c.
◆ tDetectCrying()
| void * tDetectCrying |
( |
void * |
local_pid | ) |
|
Detects crying from microphone.
- Parameters
-
| local_pid | : Local process ID |
Definition at line 76 of file daemon.c.
◆ tWatchStreamFlag()
| void * tWatchStreamFlag |
( |
void * |
arg | ) |
|
Watches message queue for any changes in livestream flag.
Definition at line 123 of file daemon.c.
◆ isStreamActive
Defines if livestream is active in main process
Definition at line 38 of file daemon.c.
◆ msgq_id
Message queue ID
Definition at line 36 of file daemon.c.