milk  1.01
Modular Image processing Library toolKit
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 #include <stdint.h>
22 #include <unistd.h> // getpid()
23 
24 
25 /* =============================================================================================== */
26 /* =============================================================================================== */
27 /* DEFINES, MACROS */
28 /* =============================================================================================== */
29 /* =============================================================================================== */
30 
31 #define STRINGLENMAX 32
32 
33 #define streamNBID_MAX 10000
34 #define streamOpenNBpid_MAX 100
35 
36 #define STRINGMAXLEN_STREAMINFO_NAME 100
37 
38 #define PIDnameStringLen 12
39 
40 
41 
42 /* =============================================================================================== */
43 /* =============================================================================================== */
44 /* GLOBAL DATA DECLARATION */
45 /* =============================================================================================== */
46 /* =============================================================================================== */
47 
48 
49 
50 typedef struct
51 {
52  char sname[STRINGMAXLEN_STREAMINFO_NAME]; // stream name
53  int SymLink;
54  char linkname[STRINGMAXLEN_STREAMINFO_NAME]; // if stream is sym link, resolve link name
55 
56  imageID ID;
57 
58  pid_t streamOpenPID[streamOpenNBpid_MAX];
59  int streamOpenPID_cnt;
60  int streamOpenPID_cnt1; // number of processes accessing stream
61  int streamOpenPID_status;
62 
63  int datatype;
64 
65  double updatevalue; // higher value = more actively recent updates [Hz]
66  double updatevalue_frozen;
67 
68  long long cnt0; // used to check if cnt0 has changed
69  long deltacnt0;
70 
71 } STREAMINFO;
72 
73 
74 
75 typedef struct
76 {
77  int twaitus; // sleep time between scans
78  double dtscan; // measured time interval between scans [s]
79 
80  int loop; // 1 : loop 0 : exit
81  long loopcnt;
82 
83  int filter; // 1 if applying filter to name
84  char namefilter[STRINGLENMAX];
85 
86  int WriteFlistToFile; // 1 if output to file
87 
88  STREAMINFO *sinfo;
89  long NBstream;
90  int fuserUpdate;
91  int fuserUpdate0;
92  int sindexscan;
93  char **PIDtable; // stores names of PIDs
94 
96 
97 
98 
99 
100 
101 
102 /* =============================================================================================== */
103 /* =============================================================================================== */
104 /* FUNCTIONS SOURCE CODE */
105 /* =============================================================================================== */
106 /* =============================================================================================== */
107 
108 
109 
110 
111 #ifdef __cplusplus
112 extern "C" {
113 #endif
114 
115 
116 
122 int get_process_name_by_pid(const int pid, char *pname);
123 
124 int streamCTRL_CatchSignals();
125 
126 int find_streams(
127  STREAMINFO *streaminfo,
128  int filter,
129  const char *namefilter
130 );
131 
132 void *streamCTRL_scan(void* thptr);
133 
146 errno_t streamCTRL_CTRLscreen();
147 
148 
149 long image_ID_from_images(IMAGE* images, const char *name);
150 
151 long image_get_first_ID_available_from_images(IMAGE* images);
152 
153 
154 #ifdef __cplusplus
155 }
156 #endif
157 
158 #endif // _STREAMCTRL_H
STREAMINFO
Definition: streamCTRL.h:50
IMAGE
IMAGE structure The IMAGE structure includes :
Definition: ImageStruct.h:366
find_streams
int find_streams(STREAMINFO *streaminfo, int filter, const char *namefilter)
find shared memory streams on system
Definition: streamCTRL.c:360
STREAMINFOPROC
Definition: streamCTRL.h:75
get_process_name_by_pid
int get_process_name_by_pid(const int pid, char *pname)
Definition: streamCTRL.c:249
streamCTRL_CTRLscreen
errno_t streamCTRL_CTRLscreen()
Definition: streamCTRL.c:1395