-
Notifications
You must be signed in to change notification settings - Fork 292
c_stubs: use 'new' acquire and release runtime functions #6341
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
These functions have a more relevant name than the previous ones, especially with the advent of OCaml 5.0 the runtime lock becomes more important and programmers must be aware of it. These functions were introduced in OCaml 3.12. Signed-off-by: Pau Ruiz Safont <pau.ruizsafont@cloud.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Does not introduce any new problems so all good, but might just as well clean things up. I think @edwintorok has a pending PR doing this and more, but it hit some issues in testing, though.
const char* const hashed = | ||
crypt_r(String_val(key), String_val(setting), &cd); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Not the fault of this (totally correct) commit, but these accesses to OCaml values should be brought out of this section.
@@ -47,7 +47,7 @@ CAMLprim value stub_openfile_direct(value filename, value rw, value perm){ | |||
flags |= O_RDONLY; | |||
} | |||
fd = open(filename_c, flags, Int_val(perm)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here and above with Bool_val too
@@ -256,9 +256,9 @@ CAMLprim value stub_xenctrlext_physdev_map_pirq(value xch_val, | |||
CAMLparam3(xch_val, domid, irq); | |||
xc_interface *xch = xch_of_val(xch_val); | |||
int pirq = Int_val(irq); | |||
caml_enter_blocking_section(); | |||
caml_release_runtime_system(); | |||
int retval = xc_physdev_map_pirq(xch, Int_val(domid), pirq, &pirq); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -269,9 +269,9 @@ CAMLprim value stub_xenctrlext_assign_device(value xch_val, value domid, | |||
{ | |||
CAMLparam4(xch_val, domid, machine_sbdf, flag); | |||
xc_interface *xch = xch_of_val(xch_val); | |||
caml_enter_blocking_section(); | |||
caml_release_runtime_system(); | |||
int retval = xc_assign_device(xch, Int_val(domid), Int_val(machine_sbdf), Int_val(flag)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -281,9 +281,9 @@ CAMLprim value stub_xenctrlext_deassign_device(value xch_val, value domid, value | |||
{ | |||
CAMLparam3(xch_val, domid, machine_sbdf); | |||
xc_interface *xc = xch_of_val(xch_val); | |||
caml_enter_blocking_section(); | |||
caml_release_runtime_system(); | |||
int retval = xc_deassign_device(xc, Int_val(domid), Int_val(machine_sbdf)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same
@@ -299,9 +299,9 @@ CAMLprim value stub_xenctrlext_domain_soft_reset(value xch_val, value domid) | |||
{ | |||
CAMLparam2(xch_val, domid); | |||
xc_interface *xc = xch_of_val(xch_val); | |||
caml_enter_blocking_section(); | |||
caml_release_runtime_system(); | |||
int retval = xc_domain_soft_reset(xc, Int_val(domid)); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same and below
Then I think it's worth leaving the changes to that PR |
The Ocaml libraries in upstream Xen look like they need the same treatment. (We're going to need to take the plunge on Ocaml-5-ing them at some point) |
These functions have a more relevant name than the previous ones, especially with the advent of OCaml 5.0 the runtime lock becomes more important and programmers must be aware of it.
These functions were introduced in OCaml 3.12.