]> xenbits.xensource.com Git - xen.git/commit
tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak
authorEdwin Török <edvin.torok@citrix.com>
Tue, 18 Jan 2022 15:04:48 +0000 (15:04 +0000)
committerAndrew Cooper <andrew.cooper3@citrix.com>
Thu, 1 Dec 2022 16:07:17 +0000 (16:07 +0000)
commit22d5affdf0cecfa6faae46fbaec68b8018835220
treee0adeb46bb9cda80534b4a41fdf8299c654cd822
parentee36179371fd4215a43fb179be2165f65c1cd1cd
tools/ocaml/evtchn: OCaml 5 support, fix potential resource leak

There is no binding for xenevtchn_close().  In principle, this is a resource
leak, but the typical usage is as a singleton that lives for the lifetime of
the program.

Ocaml 5 no longer permits storing a naked C pointer in an Ocaml value.

Therefore, use a Custom block.  This allows us to use the finaliser callback
to call xenevtchn_close(), if the Ocaml object goes out of scope.

Signed-off-by: Edwin Török <edvin.torok@citrix.com>
Signed-off-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Christian Lindig <christian.lindig@citrix.com>
tools/ocaml/libs/eventchn/xeneventchn_stubs.c