This repository has been archived by the owner on Feb 24, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathstreamCTRL.h
180 lines (116 loc) · 4.44 KB
/
streamCTRL.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
/**
* @file streamCTRL.h
* @brief Data streams control panel
*
* Manages data streams
*
*
*/
#ifndef _STREAMCTRL_H
#define _STREAMCTRL_H
/* =============================================================================================== */
/* =============================================================================================== */
/* HEADER FILES */
/* =============================================================================================== */
/* =============================================================================================== */
// #include <string.h>
// #include <stdlib.h>
// #include <stdio.h>
// #include <sys/file.h>
// #include <malloc.h>
// #include <sys/mman.h> // mmap()
// #include <time.h>
// #include <signal.h>
#include <stdint.h> // int_fast8_t
#include <unistd.h> // getpid()
// #include <sys/types.h>
// #include <sys/stat.h>
// #include <sys/types.h>
// #include <ncurses.h>
// #include <fcntl.h>
// #include <ctype.h>
// #include <dirent.h>
// #include <wchar.h>
// #include <locale.h>
// #include <errno.h>
// #include <pthread.h>
/* =============================================================================================== */
/* =============================================================================================== */
/* DEFINES, MACROS */
/* =============================================================================================== */
/* =============================================================================================== */
#define STRINGLENMAX 32
#define streamNBID_MAX 10000
#define streamOpenNBpid_MAX 100
#define STRINGMAXLEN_STREAMINFO_NAME 100
#define PIDnameStringLen 12
/* =============================================================================================== */
/* =============================================================================================== */
/* GLOBAL DATA DECLARATION */
/* =============================================================================================== */
/* =============================================================================================== */
typedef struct
{
char sname[STRINGMAXLEN_STREAMINFO_NAME]; // stream name
long ID;
int SymLink;
char linkname[STRINGMAXLEN_STREAMINFO_NAME]; // if stream is sym link, resolve link name
pid_t streamOpenPID[streamOpenNBpid_MAX];
int streamOpenPID_cnt;
int streamOpenPID_cnt1; // number of processes accessing stream
int streamOpenPID_status;
int datatype;
double updatevalue; // higher value = more actively recent updates [Hz]
double updatevalue_frozen;
long long cnt0; // used to check if cnt0 has changed
long deltacnt0;
} STREAMINFO;
typedef struct
{
int twaitus; // sleep time between scans
double dtscan; // measured time interval between scans [s]
int loop; // 1 : loop 0 : exit
long loopcnt;
int filter; // 1 if applying filter to name
char namefilter[STRINGLENMAX];
int WriteFlistToFile; // 1 if output to file
STREAMINFO *sinfo;
long NBstream;
int fuserUpdate;
int fuserUpdate0;
int sindexscan;
char **PIDtable; // stores names of PIDs
} STREAMINFOPROC;
/* =============================================================================================== */
/* =============================================================================================== */
/* FUNCTIONS SOURCE CODE */
/* =============================================================================================== */
/* =============================================================================================== */
#ifdef __cplusplus
extern "C" {
#endif
/**
* INITIALIZE ncurses
*
*/
int get_process_name_by_pid(const int pid, char *pname);
int streamCTRL_CatchSignals();
void *streamCTRL_scan(void* thptr);
/**
* ## Purpose
*
* Control screen for stream structures
*
* ## Description
*
* Relies on ncurses for display\n
*
*
*/
errno_t streamCTRL_CTRLscreen();
long image_ID_from_images(IMAGE* images, const char *name);
long image_get_first_ID_available_from_images(IMAGE* images);
#ifdef __cplusplus
}
#endif
#endif // _STREAMCTRL_H