summary refs log tree commit diff stats
path: root/lib/js
diff options
context:
space:
mode:
authorc-blake <c-blake@users.noreply.github.com>2020-08-08 01:26:20 -0400
committerGitHub <noreply@github.com>2020-08-08 07:26:20 +0200
commit0bc8dd0b0065534b2dfab53b1844a9f6cc36844e (patch)
treebc0392e2bcf81561e76a6712804f658510039d7b /lib/js
parenteee3b189ff867c0149434e198e89802eca4920ce (diff)
downloadNim-0bc8dd0b0065534b2dfab53b1844a9f6cc36844e.tar.gz
Add `iterator inotify_events` which is *almost always* needed logic for (#15152)
client code since Linux `inotify` is much like Linux `getdents64`.

Expanding on "almost always"..The only time that this `iterator` logic
is ***not*** needed on the output of a `read` from inotify fd's is when
one passes a length to `read` *guaranteed* to only pass one event struct
in the buffer.  That unusual circumstance requires (at least!) knowing
the length of the delivered filename before an event occurs, and the
filename itself is optional for some event types.

It is *far* more common to not know lengths in advance which means one
passes a buffer big enough for at least one maximum length directory
entry (256 bytes) which is then also big enough for *many* "typical"
length entries and therefore many events.  In such more common scenarios
this iterator logic is definitely needed.

Further, not using this logic, yet treating the return from read as "the
whole answer" can test ok on "thin" event streams (e.g. 1 event per ms),
hiding a latent bug of processing only the first event.
Diffstat (limited to 'lib/js')
0 files changed, 0 insertions, 0 deletions
href='#n122'>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 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227