Skip to content

Commit a8782c0

Browse files
committed
Update xenctrl ocaml bindings used by xenopsd
Update for xenctrl api: domain_get_runstate_info. As this api is not used by xenopsd now, we can update directly without considering backwards compatibility. Signed-off-by: Gang Ji <[email protected]>
1 parent 8942059 commit a8782c0

File tree

3 files changed

+10
-3
lines changed

3 files changed

+10
-3
lines changed

ocaml/xenopsd/c_stubs/xenctrlext_stubs.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -113,11 +113,14 @@ CAMLprim value stub_xenctrlext_get_runstate_info(value xch_val, value domid)
113113
CAMLparam2(xch_val, domid);
114114
#if defined(XENCTRL_HAS_GET_RUNSTATE_INFO)
115115
CAMLlocal1(result);
116-
xc_runstate_info_t info;
116+
xc_runstate_info_t info = { 0 };
117117
int retval;
118118
xc_interface *xch = xch_of_val(xch_val);
119+
uint32_t c_domid = Int_val(domid);
119120

120-
retval = xc_get_runstate_info(xch, Int_val(domid), &info);
121+
caml_release_runtime_system();
122+
retval = xc_get_runstate_info(xch, c_domid, &info);
123+
caml_acquire_runtime_system();
121124
if (retval < 0)
122125
failwith_xc(xch);
123126

@@ -126,8 +129,9 @@ CAMLprim value stub_xenctrlext_get_runstate_info(value xch_val, value domid)
126129
1 : missed_changes (int32)
127130
2 : state_entry_time (int64)
128131
3-8 : times (int64s)
132+
9 : runnable (int64)
129133
*/
130-
result = caml_alloc_tuple(9);
134+
result = caml_alloc_tuple(10);
131135
Store_field(result, 0, caml_copy_int32(info.state));
132136
Store_field(result, 1, caml_copy_int32(info.missed_changes));
133137
Store_field(result, 2, caml_copy_int64(info.state_entry_time));
@@ -137,6 +141,7 @@ CAMLprim value stub_xenctrlext_get_runstate_info(value xch_val, value domid)
137141
Store_field(result, 6, caml_copy_int64(info.time[3]));
138142
Store_field(result, 7, caml_copy_int64(info.time[4]));
139143
Store_field(result, 8, caml_copy_int64(info.time[5]));
144+
Store_field(result, 9, caml_copy_int64(info.runnable));
140145

141146
CAMLreturn(result);
142147
#else

ocaml/xenopsd/xc/xenctrlext.ml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,7 @@ type runstateinfo = {
6363
; time3: int64
6464
; time4: int64
6565
; time5: int64
66+
; runnable: int64
6667
}
6768

6869
external domain_get_runstate_info : handle -> int -> runstateinfo

ocaml/xenopsd/xc/xenctrlext.mli

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ type runstateinfo = {
4545
; time3: int64
4646
; time4: int64
4747
; time5: int64
48+
; runnable: int64
4849
}
4950

5051
external domain_get_runstate_info : handle -> int -> runstateinfo

0 commit comments

Comments
 (0)