cacao  Release 0.1.03-dev
Compute And Control For Adaptive Optics
streamCTRL.h
Go to the documentation of this file.
1 
11 #ifndef _STREAMCTRL_H
12 #define _STREAMCTRL_H
13 
14 
15 /* =============================================================================================== */
16 /* =============================================================================================== */
17 /* HEADER FILES */
18 /* =============================================================================================== */
19 /* =============================================================================================== */
20 
21 
22 // #include <string.h>
23 // #include <stdlib.h>
24 // #include <stdio.h>
25 // #include <sys/file.h>
26 // #include <malloc.h>
27 // #include <sys/mman.h> // mmap()
28 
29 // #include <time.h>
30 // #include <signal.h>
31 
32 #include <stdint.h> // int_fast8_t
33 #include <unistd.h> // getpid()
34 // #include <sys/types.h>
35 
36 // #include <sys/stat.h>
37 // #include <sys/types.h>
38 
39 
40 // #include <ncurses.h>
41 // #include <fcntl.h>
42 // #include <ctype.h>
43 
44 // #include <dirent.h>
45 
46 // #include <wchar.h>
47 // #include <locale.h>
48 // #include <errno.h>
49 
50 // #include <pthread.h>
51 
52 /* =============================================================================================== */
53 /* =============================================================================================== */
54 /* DEFINES, MACROS */
55 /* =============================================================================================== */
56 /* =============================================================================================== */
57 
58 #define STRINGLENMAX 32
59 
60 #define streamNBID_MAX 10000
61 #define streamOpenNBpid_MAX 100
62 #define nameNBchar 100
63 #define PIDnameStringLen 12
64 
65 
66 
67 /* =============================================================================================== */
68 /* =============================================================================================== */
69 /* GLOBAL DATA DECLARATION */
70 /* =============================================================================================== */
71 /* =============================================================================================== */
72 
73 
74 
75 typedef struct
76 {
77  char sname[nameNBchar]; // stream name
78 
79  long ID;
80 
81  int SymLink;
82  char linkname[nameNBchar]; // if stream is sym link, resolve link name
83 
84  pid_t streamOpenPID[streamOpenNBpid_MAX];
86  int streamOpenPID_cnt1; // number of processes accessing stream
88 
89  int datatype;
90 
91  double updatevalue; // higher value = more actively recent updates [Hz]
93 
94  long long cnt0; // used to check if cnt0 has changed
95  long deltacnt0;
96 
97 } STREAMINFO;
98 
99 
100 
101 typedef struct
102 {
103  int twaitus; // sleep time between scans
104  double dtscan; // measured time interval between scans [s]
105 
106  int loop; // 1 : loop 0 : exit
107  long loopcnt;
108 
109  int filter; // 1 if applying filter to name
110  char namefilter[STRINGLENMAX];
111 
112  int WriteFlistToFile; // 1 if output to file
113 
115  long NBstream;
119  char **PIDtable; // stores names of PIDs
120 
122 
123 
124 
125 
126 
127 
128 /* =============================================================================================== */
129 /* =============================================================================================== */
130 /* FUNCTIONS SOURCE CODE */
131 /* =============================================================================================== */
132 /* =============================================================================================== */
133 
134 
135 
136 
137 #ifdef __cplusplus
138 extern "C" {
139 #endif
140 
141 
142 
148 int get_process_name_by_pid(const int pid, char *pname);
149 
151 
152 void *streamCTRL_scan(void* thptr);
153 
167 
168 
169 long image_ID_from_images(IMAGE* images, const char *name);
170 
172 
173 
174 #ifdef __cplusplus
175 }
176 #endif
177 
178 #endif // _STREAMCTRL_H
Definition: streamCTRL.h:101
int sindexscan
Definition: streamCTRL.h:118
int loop
Definition: streamCTRL.h:106
char ** PIDtable
Definition: streamCTRL.h:119
long image_get_first_ID_available_from_images(IMAGE *images)
Definition: streamCTRL.c:187
Definition: streamCTRL.h:75
IMAGE structure The IMAGE structure includes :
Definition: ImageStruct.h:330
int streamOpenPID_cnt
Definition: streamCTRL.h:85
int SymLink
Definition: streamCTRL.h:81
long long cnt0
Definition: streamCTRL.h:94
int streamCTRL_CatchSignals()
Definition: streamCTRL.c:238
void * streamCTRL_scan(void *thptr)
Definition: streamCTRL.c:313
#define nameNBchar
Definition: streamCTRL.h:62
int WriteFlistToFile
Definition: streamCTRL.h:112
#define STRINGLENMAX
Definition: streamCTRL.h:58
long image_ID_from_images(IMAGE *images, const char *name)
double updatevalue_frozen
Definition: streamCTRL.h:92
int errno_t
Definition: AOloopControl_IOtools.h:20
int twaitus
Definition: streamCTRL.h:103
int fuserUpdate
Definition: streamCTRL.h:116
int streamOpenPID_cnt1
Definition: streamCTRL.h:86
int fuserUpdate0
Definition: streamCTRL.h:117
#define streamOpenNBpid_MAX
Definition: streamCTRL.h:61
STREAMINFO * sinfo
Definition: streamCTRL.h:114
int filter
Definition: streamCTRL.h:109
long loopcnt
Definition: streamCTRL.h:107
double updatevalue
Definition: streamCTRL.h:91
int streamOpenPID_status
Definition: streamCTRL.h:87
int get_process_name_by_pid(const int pid, char *pname)
Definition: streamCTRL.c:208
int datatype
Definition: streamCTRL.h:89
double dtscan
Definition: streamCTRL.h:104
long deltacnt0
Definition: streamCTRL.h:95
long NBstream
Definition: streamCTRL.h:115
long ID
Definition: streamCTRL.h:79
errno_t streamCTRL_CTRLscreen()
Definition: streamCTRL.c:722