blob: 2e0704159bb21da98037cc127a1e229ab0b66a33 (
plain)
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
|
<?php
namespace Safe;
use Safe\Exceptions\InotifyException;
/**
* Initialize an inotify instance for use with
* inotify_add_watch
*
* @return resource A stream resource.
* @throws InotifyException
*
*/
function inotify_init()
{
error_clear_last();
$result = \inotify_init();
if ($result === false) {
throw InotifyException::createFromPhpError();
}
return $result;
}
/**
* inotify_rm_watch removes the watch
* watch_descriptor from the inotify instance
* inotify_instance.
*
* @param resource $inotify_instance Resource returned by
* inotify_init
* @param int $watch_descriptor Watch to remove from the instance
* @throws InotifyException
*
*/
function inotify_rm_watch($inotify_instance, int $watch_descriptor): void
{
error_clear_last();
$result = \inotify_rm_watch($inotify_instance, $watch_descriptor);
if ($result === false) {
throw InotifyException::createFromPhpError();
}
}
|