Fix warning when building Python bindings
[lttng-tools.git] / extras / bindings / swig / python / lttng.i.in
index 0d6d1e952634c0fcc5bbc1ef9045081d87bd558b..4349d93d000ea7270c75fc008527b4f0ed0eeea1 100644 (file)
@@ -9,12 +9,21 @@ multiple concurrent processes and threads. Tracing across multiple systems is al
 %module(docstring=DOCSTRING) lttng
 
 %include "typemaps.i"
+%include "stdint.i"
 %include "pyabc.i"
 %{
 #define SWIG_FILE_WITH_INIT
 #include <lttng/lttng.h>
 %}
 
+%{
+#if PY_MAJOR_VERSION >= 3
+// The PyInt and PyLong types were unified as of Python 3
+// This makes the typemap code useable with both Python 2 and 3.
+#define PyInt_AsSsize_t PyLong_AsSsize_t
+#endif
+%}
+
 typedef unsigned int uint32_t;
 typedef int int32_t;
 typedef unsigned long long uint64_t;
@@ -306,6 +315,7 @@ enum lttng_calibrate_type {
 // =============================================
 
 %rename("create") lttng_create_session(const char *name, const char *path);
+%rename("create_snapshot") lttng_create_session_snapshot(const char *name, const char *snapshot_url);
 %rename("destroy") lttng_destroy_session(const char *name);
 %rename("_lttng_create_handle") lttng_create_handle(const char *session_name, struct lttng_domain *domain);
 %rename("_lttng_destroy_handle") lttng_destroy_handle(struct lttng_handle *handle);
@@ -353,14 +363,20 @@ int lttng_list_domains(const char *session_name, struct lttng_domain **domains);
 %feature("docstring")"create(str name, str path) -> int
 
 Create a new tracing session using name and path.
-Returns size of returned session payload data or a negative error code."
+Returns 0 on success or a negative error code."
 int lttng_create_session(const char *name, const char *path);
 
+%feature("docstring")"create_snapshot(str name, str snapshot_url) -> int
+
+Create a new tracing session using name and snapshot_url in snapshot
+mode (flight recorder).
+Returns 0 on success or a negative error code."
+int lttng_create_session_snapshot(const char *name, const char *path);
 
 %feature("docstring")"destroy(str name) -> int
 
 Tear down tracing session using name.
-Returns size of returned session payload data or a negative error code."
+Returns 0 on success or a negative error code."
 int lttng_destroy_session(const char *name);
 
 
@@ -707,7 +723,7 @@ def calibrate(handle, calibrate):
 
 %pythoncode %{
 class Handle:
-        """
+       """
        Manages a handle.
        Takes two arguments: (str session_name, Domain domain)
        """
@@ -984,8 +1000,8 @@ struct lttng_channel_attr {
                                sprintf(evout, "%i", $self->output);
                                break;
                        }
-                       sprintf(temp, "lttng.ChannelAttr; overwrite(%i), subbuf_size(%lu), "
-                               "num_subbuf(%lu), switch_timer_interval(%u), "
+                       sprintf(temp, "lttng.ChannelAttr; overwrite(%i), subbuf_size(%"PRIu64"), "
+                               "num_subbuf(%"PRIu64"), switch_timer_interval(%u), "
                                "read_timer_interval(%u), output(%s)",
                                $self->overwrite, $self->subbuf_size, $self->num_subbuf,
                                $self->switch_timer_interval, $self->read_timer_interval,
This page took 0.023845 seconds and 4 git commands to generate.