Displaying 20 results from an estimated 129 matches for "mlvalues".
2023 Jun 27
1
[PATCH libguestfs 1/4] ocaml: Replace old enter/leave_blocking_section calls
...c | 5 +++--
2 files changed, 6 insertions(+), 4 deletions(-)
diff --git a/generator/OCaml.ml b/generator/OCaml.ml
index 02d9ee2e91..07ccd26924 100644
--- a/generator/OCaml.ml
+++ b/generator/OCaml.ml
@@ -429,6 +429,7 @@ and generate_ocaml_c () =
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/signals.h>
+#include <caml/threads.h>
#include <guestfs.h>
#include \"guestfs-utils.h\"
@@ -689,12 +690,12 @@ copy_table (char * const * argv)
pr "\n";
if blocking then
- pr " caml_enter_blocking_section ()...
2017 Jul 18
1
Re: [PATCH 01/27] build: Make OCaml compiler required for all builds.
On Friday, 14 July 2017 15:39:09 CEST Richard W.M. Jones wrote:
> +dnl Check for <caml/unixsupport.h> header.
> +old_CPPFLAGS="$CPPFLAGS"
> +CPPFLAGS="$CPPFLAGS -I`$OCAMLC -where`"
> +AC_CHECK_HEADERS([caml/unixsupport.h],[],[],[#include <caml/mlvalues.h>])
> +CPPFLAGS="$old_CPPFLAGS"
The minimum version of OCaml is 3.11, and it seems to have this header
already; since at least patch #2 uses it unconditionally, I'd add a
patch after this to drop its search, and all the HAVE_CAML_UNIXSUPPORT_H
blocks all around.
--
Pino Tosc...
2018 Jan 29
1
[PATCH] customize: Correctly handle crypt(3) returning NULL.
...c.c
+++ b/customize/crypt-c.c
@@ -21,6 +21,7 @@
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
+#include <errno.h>
#if HAVE_CRYPT_H
#include <crypt.h>
@@ -29,6 +30,7 @@
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
+#include <caml/unixsupport.h>
#pragma GCC diagnostic ignored "-Wmissing-prototypes"
@@ -44,6 +46,8 @@ virt_customize_crypt (value keyv, value saltv)
* is not thread safe.
*/
r = crypt (String_val (keyv), String_val (saltv));
+ if (r == NULL)
+ unix_error (...
2017 Oct 09
1
[PATCH] build: build mlaugeas with -Wno-shift-negative-value
The embedded copy of ocaml-augeas does Val_int(-1), which in turns
triggers warnings in newer GCC versions about "left shift of negative
value". The issue actually lies in the OCaml headers (mlvalues.h in
particular), and it was fixed in newer OCaml versions.
Since the code is actually correct, disable -Wshift-negative-value with
-Wno-shift-negative-value (checking whether the compiler has it).
---
common/mlaugeas/Makefile.am | 2 +-
m4/guestfs-c.m4 | 6 ++++++
2 files changed, 7...
2023 Jun 27
4
[PATCH libguestfs 0/4] Fix ups for OCaml 5
No action required here as I have pushed this already, this is
just for your information.
Rich.
2016 Apr 14
1
Re: [PATCH v2] customize/perl_edit-c.c: Don't use internal APIs.
...gt;
> diff --git a/customize/perl_edit-c.c b/customize/perl_edit-c.c
> index 753d990..7191bef 100644
> --- a/customize/perl_edit-c.c
> +++ b/customize/perl_edit-c.c
> @@ -25,30 +25,24 @@
> #include <caml/alloc.h>
> #include <caml/memory.h>
> #include <caml/mlvalues.h>
> +#include <caml/fail.h>
>
> #include "file-edit.h"
>
> -/**
> - * We try to reuse the internals of the OCaml binding (for extracting
> - * the guestfs handle, and raising errors); hopefully this should be safe,
> - * as long as it's kept inte...
2016 Apr 12
3
[PATCH v2] customize/perl_edit-c.c: Don't use internal APIs.
In v1 of this patch, there was the (small) possibility that 'g' might
have been garbage collected while we were in the C function.
Avoid this by passing 'g' to the function as well as the C pointer, so
that 'g' is pinned as a garbage collector root [by CAMLparam5] so it
cannot be collected while we're in the function.
Rich.
2019 Jun 12
4
[libnbd PATCH] Fix building with for ocaml < 4.06.0
...s preferred, then I can send that one instead.
ocaml/nbd-c.h | 5 +++++
1 file changed, 5 insertions(+)
diff --git a/ocaml/nbd-c.h b/ocaml/nbd-c.h
index 558581850807..45ae64d77209 100644
--- a/ocaml/nbd-c.h
+++ b/ocaml/nbd-c.h
@@ -27,6 +27,11 @@
#include <caml/memory.h>
#include <caml/mlvalues.h>
+// Workaround for OCaml < 4.06.0
+#ifndef Bytes_val
+#define Bytes_val(x) String_val(x)
+#endif
+
extern void libnbd_finalize (value);
extern void nbd_buffer_finalize (value);
--
2.21.0
2017 Jul 14
0
[PATCH 01/27] build: Make OCaml compiler required for all builds.
...g/download])
- ])
-])
-
-AS_IF([test "x$OCAMLC" != "xno"],[
- dnl Check for <caml/unixsupport.h> header.
- old_CPPFLAGS="$CPPFLAGS"
- CPPFLAGS="$CPPFLAGS -I`$OCAMLC -where`"
- AC_CHECK_HEADERS([caml/unixsupport.h],[],[],[#include <caml/mlvalues.h>])
- CPPFLAGS="$old_CPPFLAGS"
-])
+dnl Check for <caml/unixsupport.h> header.
+old_CPPFLAGS="$CPPFLAGS"
+CPPFLAGS="$CPPFLAGS -I`$OCAMLC -where`"
+AC_CHECK_HEADERS([caml/unixsupport.h],[],[],[#include <caml/mlvalues.h>])
+CPPFLAGS="$old_CPPFLAGS...
2017 Feb 22
4
[PATCH 0/3] v2v: vCenter: Remove proxy environment variables
Fix for:
https://bugzilla.redhat.com/show_bug.cgi?id=1354507
Main explanation is in patch #3.
Rich.
2016 Apr 11
0
[PATCH] customize/perl_edit-c.c: Don't use internal APIs.
...s changed, 6 insertions(+), 11 deletions(-)
diff --git a/customize/perl_edit-c.c b/customize/perl_edit-c.c
index 753d990..dd92b5a 100644
--- a/customize/perl_edit-c.c
+++ b/customize/perl_edit-c.c
@@ -25,16 +25,10 @@
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
+#include <caml/fail.h>
#include "file-edit.h"
-/**
- * We try to reuse the internals of the OCaml binding (for extracting
- * the guestfs handle, and raising errors); hopefully this should be safe,
- * as long as it's kept internal within the libguestfs sources.
- */...
2016 Apr 12
0
[PATCH v2] customize/perl_edit-c.c: Don't use internal APIs.
...changed, 14 insertions(+), 14 deletions(-)
diff --git a/customize/perl_edit-c.c b/customize/perl_edit-c.c
index 753d990..7191bef 100644
--- a/customize/perl_edit-c.c
+++ b/customize/perl_edit-c.c
@@ -25,30 +25,24 @@
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
+#include <caml/fail.h>
#include "file-edit.h"
-/**
- * We try to reuse the internals of the OCaml binding (for extracting
- * the guestfs handle, and raising errors); hopefully this should be safe,
- * as long as it's kept internal within the libguestfs sources.
- */...
2016 Jul 18
0
[PATCH v3 1/3] mllib: getopt: Further fix int parsing.
Don't allow suffixes on integers, and fix the bounds to match the
definitions of Min_long and Max_long in <caml/mlvalues.h>.
Fixes commit 66b54bfefe42f2996d1b42c3646511bbd4349317.
---
mllib/getopt-c.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/mllib/getopt-c.c b/mllib/getopt-c.c
index bf40f91..13852c2 100644
--- a/mllib/getopt-c.c
+++ b/mllib/getopt-c.c
@@ -124,13 +124,13 @@ strtoint...
2017 Jul 14
0
[PATCH 16/27] daemon: Generate OCaml wrappers for optgroup_*_available functions.
.../daemon.ml
@@ -976,6 +976,10 @@ let generate_daemon_optgroups_c () =
generate_header CStyle GPLv2plus;
pr "#include <config.h>\n";
+ pr "#include <stdio.h>\n";
+ pr "#include <stdlib.h>\n";
+ pr "\n";
+ pr "#include <caml/mlvalues.h>\n";
pr "\n";
pr "#include \"daemon.h\"\n";
pr "#include \"optgroups.h\"\n";
@@ -999,7 +1003,24 @@ let generate_daemon_optgroups_c () =
pr " { \"%s\", optgroup_%s_available },\n" group group
) optg...
2018 Jan 23
1
[PATCH] customize: Use libxcrypt if available to provide crypt(3).
....c
index 70e6ea7f5..d5425cfaa 100644
--- a/customize/crypt-c.c
+++ b/customize/crypt-c.c
@@ -22,6 +22,10 @@
#include <stdlib.h>
#include <unistd.h>
+#if HAVE_CRYPT_H
+#include <crypt.h>
+#endif
+
#include <caml/alloc.h>
#include <caml/memory.h>
#include <caml/mlvalues.h>
diff --git a/m4/guestfs-misc-libraries.m4 b/m4/guestfs-misc-libraries.m4
index 2f371873f..f05a56fb8 100644
--- a/m4/guestfs-misc-libraries.m4
+++ b/m4/guestfs-misc-libraries.m4
@@ -17,14 +17,25 @@
dnl Miscellaneous libraries used by other programs.
-dnl Check if crypt() is provided by a...
2009 Nov 18
1
R_NilValue and segfault.
...ta in OCaml data
> CAMLprim value Val_sexp (SEXP sexp)
> {
> CAMLparam0();
> CAMLlocal1(result);
> result = caml_alloc(1, Abstract_tag);
> Field(result, 0) = (value) sexp;
> /* Do not use Val_long in the above statement,
> as it will drop the top bit. See mlvalues.h. */
> CAMLreturn(result);
> }
and a function taking no argument (in the sense of OCaml), and returning
an OCaml object encapsulating a pointer which is R_NilValue. (R_NilValue
is already a pointer, so we just copy it).
> /* The NULL constant in R... */
>
> CAMLprim value r_n...
2019 Mar 22
0
[PATCH 3/4] common/mltools: allow fd for machine readable output
...les changed, 31 insertions(+), 1 deletion(-)
diff --git a/common/mltools/tools_utils-c.c b/common/mltools/tools_utils-c.c
index c88c95082..553aa6631 100644
--- a/common/mltools/tools_utils-c.c
+++ b/common/mltools/tools_utils-c.c
@@ -29,6 +29,9 @@
#include <caml/memory.h>
#include <caml/mlvalues.h>
#include <caml/unixsupport.h>
+/* Evil ... */
+#define CAML_INTERNALS
+#include <caml/io.h>
#include <guestfs.h>
@@ -37,6 +40,7 @@
extern value guestfs_int_mllib_inspect_decrypt (value gv, value gpv, value keysv);
extern value guestfs_int_mllib_set_echo_keys (value u...
2016 Aug 03
3
[PATCH] mllib: move _exit from v2v as Exit module
...l Public License along
+ * with this program; if not, write to the Free Software Foundation, Inc.,
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+#include <unistd.h>
+
+#include <caml/mlvalues.h>
+
+extern int guestfs_int_mllib_exit (value rv) __attribute__((noreturn));
+
+int
+guestfs_int_mllib_exit (value rv)
+{
+ _exit (Int_val (rv));
+}
diff --git a/mllib/exit.ml b/mllib/exit.ml
new file mode 100644
index 0000000..e752bfe
--- /dev/null
+++ b/mllib/exit.ml
@@ -0,0 +1,19 @@
+(* lib...
2020 Mar 10
1
[PATCH common] common: Use LIBGUESTFS_CFLAGS when compiling.
Allows virt-v2v to be compiled against the libguestfs build directory.
We don't actually need to link these libraries, so LIBGUESTFS_LIBS is
not needed here.
---
mltools/Makefile.am | 4 +++-
mlutils/Makefile.am | 3 ++-
options/Makefile.am | 3 ++-
utils/Makefile.am | 3 ++-
4 files changed, 9 insertions(+), 4 deletions(-)
diff --git a/mltools/Makefile.am b/mltools/Makefile.am
index
2017 Jul 14
0
[PATCH 02/27] daemon: Allow parts of the daemon and APIs to be written in OCaml.
...ed a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
+ */
+
+#include <config.h>
+
+#include <stdio.h>
+#include <stdlib.h>
+
+#include <caml/mlvalues.h>
+
+#include "daemon.h"
+
+extern value guestfs_int_daemon_get_verbose_flag (value unitv);
+
+/* NB: This is a "noalloc" call. */
+value
+guestfs_int_daemon_get_verbose_flag (value unitv)
+{
+ return Val_bool (verbose);
+}
diff --git a/daemon/daemon.ml b/daemon/daemon.ml
n...