This event is generated whenever a libguestfs function is called.
";
+ (* Generate code for enter events. *)
+ let enter_event shortname =
+ pr " guestfs___call_callbacks_message (g, GUESTFS_EVENT_ENTER,\n";
+ pr " \"%s\", %d);\n"
+ shortname (String.length shortname)
+ in
+
(* Generate code to check String-like parameters are not passed in
* as NULL (returning an error if they are).
*)
pr " struct guestfs_%s_list *r;\n" typ
);
pr "\n";
+ enter_event shortname;
check_null_strings shortname style;
reject_unknown_optargs shortname style;
trace_call shortname style;
pr " const uint64_t progress_hint = 0;\n";
pr "\n";
+ enter_event shortname;
check_null_strings shortname style;
reject_unknown_optargs shortname style;
trace_call shortname style;
qemu / kernel / guestfsd / tools *)
"library"; (* log messages from library *)
"trace"; (* call trace messages *)
+
+ "enter"; (* enter a function *)
]
let events = mapi (fun i name -> name, 1 lsl i) events
count++;
}
- /* If nothing was registered and we're verbose or tracing, then we
- * print the message on stderr. This essentially emulates the
- * behaviour of the old-style handlers, while allowing callers to
- * override print-on-stderr simply by registering a callback.
+ /* Emulate the old-style handlers. Callers can override
+ * print-on-stderr simply by registering a callback.
*/
- if (count == 0 && (g->verbose || event == GUESTFS_EVENT_TRACE)) {
+ if (count == 0 &&
+ (event == GUESTFS_EVENT_APPLIANCE ||
+ event == GUESTFS_EVENT_LIBRARY ||
+ event == GUESTFS_EVENT_TRACE) &&
+ (g->verbose || event == GUESTFS_EVENT_TRACE)) {
int from_appliance = event == GUESTFS_EVENT_APPLIANCE;
size_t i;
char c;
can override the printing of trace messages to stderr by setting up a
callback.
+=item GUESTFS_EVENT_ENTER
+(payload type: function name)
+
+The callback function is called whenever a libguestfs function
+is entered.
+
+The payload is a string which contains the name of the function
+that we are entering (not including C<guestfs_> prefix).
+
+Note that libguestfs functions can call themselves, so you may
+see many events from a single call. A few libguestfs functions
+do not generate this event.
+
+If no callback is registered: the event is ignored.
+
=back
=head3 guestfs_set_event_callback