GDBus: Add new symbols to gio.symbols
[platform/upstream/glib.git] / gio / gdbusnameowning.c
1 /* GDBus - GLib D-Bus Library
2  *
3  * Copyright (C) 2008-2009 Red Hat, Inc.
4  *
5  * This library is free software; you can redistribute it and/or
6  * modify it under the terms of the GNU Lesser General Public
7  * License as published by the Free Software Foundation; either
8  * version 2 of the License, or (at your option) any later version.
9  *
10  * This library is distributed in the hope that it will be useful,
11  * but WITHOUT ANY WARRANTY; without even the implied warranty of
12  * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
13  * Lesser General Public License for more details.
14  *
15  * You should have received a copy of the GNU Lesser General
16  * Public License along with this library; if not, write to the
17  * Free Software Foundation, Inc., 59 Temple Place, Suite 330,
18  * Boston, MA 02111-1307, USA.
19  *
20  * Author: David Zeuthen <davidz@redhat.com>
21  */
22
23 #include "config.h"
24
25 #include <stdlib.h>
26
27 #include "gdbusutils.h"
28 #include "gdbusnameowning.h"
29 #include "gdbuserror.h"
30 #include "gdbusprivate.h"
31 #include "gdbusconnection.h"
32
33 #include "glibintl.h"
34 #include "gioalias.h"
35
36 /**
37  * SECTION:gdbusnameowning
38  * @title: Owning Bus Names
39  * @short_description: Simple API for owning bus names
40  * @include: gio/gio.h
41  *
42  * Convenience API for owning bus names.
43  *
44  * <example id="gdbus-owning-names"><title>Simple application owning a name</title><programlisting><xi:include xmlns:xi="http://www.w3.org/2001/XInclude" parse="text" href="../../../../gio/tests/gdbus-example-own-name.c"><xi:fallback>FIXME: MISSING XINCLUDE CONTENT</xi:fallback></xi:include></programlisting></example>
45  */
46
47 G_LOCK_DEFINE_STATIC (lock);
48
49 /* ---------------------------------------------------------------------------------------------------- */
50
51 typedef enum
52 {
53   PREVIOUS_CALL_NONE = 0,
54   PREVIOUS_CALL_ACQUIRED,
55   PREVIOUS_CALL_LOST,
56 } PreviousCall;
57
58 typedef struct
59 {
60   volatile gint             ref_count;
61   guint                     id;
62   GBusNameOwnerFlags        flags;
63   gchar                    *name;
64   GBusAcquiredCallback      bus_acquired_handler;
65   GBusNameAcquiredCallback  name_acquired_handler;
66   GBusNameLostCallback      name_lost_handler;
67   gpointer                  user_data;
68   GDestroyNotify            user_data_free_func;
69   GMainContext             *main_context;
70
71   PreviousCall              previous_call;
72
73   GDBusConnection          *connection;
74   gulong                    disconnected_signal_handler_id;
75   guint                     name_acquired_subscription_id;
76   guint                     name_lost_subscription_id;
77
78   gboolean                  cancelled;
79
80   gboolean                  needs_release;
81 } Client;
82
83 static guint next_global_id = 1;
84 static GHashTable *map_id_to_client = NULL;
85
86
87 static Client *
88 client_ref (Client *client)
89 {
90   g_atomic_int_inc (&client->ref_count);
91   return client;
92 }
93
94 static void
95 client_unref (Client *client)
96 {
97   if (g_atomic_int_dec_and_test (&client->ref_count))
98     {
99       if (client->connection != NULL)
100         {
101           if (client->disconnected_signal_handler_id > 0)
102             g_signal_handler_disconnect (client->connection, client->disconnected_signal_handler_id);
103           if (client->name_acquired_subscription_id > 0)
104             g_dbus_connection_signal_unsubscribe (client->connection, client->name_acquired_subscription_id);
105           if (client->name_lost_subscription_id > 0)
106             g_dbus_connection_signal_unsubscribe (client->connection, client->name_lost_subscription_id);
107           g_object_unref (client->connection);
108         }
109       if (client->main_context != NULL)
110         g_main_context_unref (client->main_context);
111       g_free (client->name);
112       if (client->user_data_free_func != NULL)
113         client->user_data_free_func (client->user_data);
114       g_free (client);
115     }
116 }
117
118 /* ---------------------------------------------------------------------------------------------------- */
119
120
121 typedef enum
122 {
123   CALL_TYPE_NAME_ACQUIRED,
124   CALL_TYPE_NAME_LOST
125 } CallType;
126
127 typedef struct
128 {
129   Client *client;
130
131   /* keep this separate because client->connection may
132    * be set to NULL after scheduling the call
133    */
134   GDBusConnection *connection;
135
136   /* set to TRUE to call acquired */
137   CallType call_type;
138 } CallHandlerData;
139
140 static void
141 call_handler_data_free (CallHandlerData *data)
142 {
143   if (data->connection != NULL)
144     g_object_unref (data->connection);
145   client_unref (data->client);
146   g_free (data);
147 }
148
149 static void
150 actually_do_call (Client *client, GDBusConnection *connection, CallType call_type)
151 {
152   switch (call_type)
153     {
154     case CALL_TYPE_NAME_ACQUIRED:
155       if (client->name_acquired_handler != NULL)
156         {
157           client->name_acquired_handler (connection,
158                                          client->name,
159                                          client->user_data);
160         }
161       break;
162
163     case CALL_TYPE_NAME_LOST:
164       if (client->name_lost_handler != NULL)
165         {
166           client->name_lost_handler (connection,
167                                      client->name,
168                                      client->user_data);
169         }
170       break;
171
172     default:
173       g_assert_not_reached ();
174       break;
175     }
176 }
177
178 static gboolean
179 call_in_idle_cb (gpointer _data)
180 {
181   CallHandlerData *data = _data;
182   actually_do_call (data->client, data->connection, data->call_type);
183   return FALSE;
184 }
185
186 static void
187 schedule_call_in_idle (Client *client, CallType  call_type)
188 {
189   CallHandlerData *data;
190   GSource *idle_source;
191
192   data = g_new0 (CallHandlerData, 1);
193   data->client = client_ref (client);
194   data->connection = client->connection != NULL ? g_object_ref (client->connection) : NULL;
195   data->call_type = call_type;
196
197   idle_source = g_idle_source_new ();
198   g_source_set_priority (idle_source, G_PRIORITY_HIGH);
199   g_source_set_callback (idle_source,
200                          call_in_idle_cb,
201                          data,
202                          (GDestroyNotify) call_handler_data_free);
203   g_source_attach (idle_source, client->main_context);
204   g_source_unref (idle_source);
205 }
206
207 static void
208 do_call (Client *client, CallType call_type)
209 {
210   /* only schedule in idle if we're not in the right thread */
211   if (g_main_context_get_thread_default () != client->main_context)
212     schedule_call_in_idle (client, call_type);
213   else
214     actually_do_call (client, client->connection, call_type);
215 }
216
217 static void
218 call_acquired_handler (Client *client)
219 {
220   if (client->previous_call != PREVIOUS_CALL_ACQUIRED)
221     {
222       client->previous_call = PREVIOUS_CALL_ACQUIRED;
223       if (!client->cancelled)
224         {
225           do_call (client, CALL_TYPE_NAME_ACQUIRED);
226         }
227     }
228 }
229
230 static void
231 call_lost_handler (Client  *client)
232 {
233   if (client->previous_call != PREVIOUS_CALL_LOST)
234     {
235       client->previous_call = PREVIOUS_CALL_LOST;
236       if (!client->cancelled)
237         {
238           do_call (client, CALL_TYPE_NAME_LOST);
239         }
240     }
241 }
242
243 /* ---------------------------------------------------------------------------------------------------- */
244
245 static void
246 on_name_lost_or_acquired (GDBusConnection  *connection,
247                           const gchar      *sender_name,
248                           const gchar      *object_path,
249                           const gchar      *interface_name,
250                           const gchar      *signal_name,
251                           GVariant         *parameters,
252                           gpointer          user_data)
253 {
254   Client *client = user_data;
255   const gchar *name;
256
257   if (g_strcmp0 (object_path, "/org/freedesktop/DBus") != 0 ||
258       g_strcmp0 (interface_name, "org.freedesktop.DBus") != 0 ||
259       g_strcmp0 (sender_name, "org.freedesktop.DBus") != 0)
260     goto out;
261
262   if (g_strcmp0 (signal_name, "NameLost") == 0)
263     {
264       g_variant_get (parameters, "(s)", &name);
265       if (g_strcmp0 (name, client->name) == 0)
266         {
267           call_lost_handler (client);
268         }
269     }
270   else if (g_strcmp0 (signal_name, "NameAcquired") == 0)
271     {
272       g_variant_get (parameters, "(s)", &name);
273       if (g_strcmp0 (name, client->name) == 0)
274         {
275           call_acquired_handler (client);
276         }
277     }
278  out:
279   ;
280 }
281
282 /* ---------------------------------------------------------------------------------------------------- */
283
284 static void
285 request_name_cb (GObject      *source_object,
286                  GAsyncResult *res,
287                  gpointer      user_data)
288 {
289   Client *client = user_data;
290   GVariant *result;
291   guint32 request_name_reply;
292   gboolean subscribe;
293
294   request_name_reply = 0;
295   result = NULL;
296
297   result = g_dbus_connection_invoke_method_finish (client->connection,
298                                                    res,
299                                                    NULL);
300   if (result != NULL)
301     {
302       g_variant_get (result, "(u)", &request_name_reply);
303       g_variant_unref (result);
304     }
305
306   subscribe = FALSE;
307
308   switch (request_name_reply)
309     {
310     case 1: /* DBUS_REQUEST_NAME_REPLY_PRIMARY_OWNER */
311       /* We got the name - now listen for NameLost and NameAcquired */
312       call_acquired_handler (client);
313       subscribe = TRUE;
314       client->needs_release = TRUE;
315       break;
316
317     case 2: /* DBUS_REQUEST_NAME_REPLY_IN_QUEUE */
318       /* Waiting in line - listen for NameLost and NameAcquired */
319       call_lost_handler (client);
320       subscribe = TRUE;
321       client->needs_release = TRUE;
322       break;
323
324     default:
325       /* assume we couldn't get the name - explicit fallthrough */
326     case 3: /* DBUS_REQUEST_NAME_REPLY_EXISTS */
327     case 4: /* DBUS_REQUEST_NAME_REPLY_ALREADY_OWNER */
328       /* Some other part of the process is already owning the name */
329       call_lost_handler (client);
330       break;
331     }
332
333   if (subscribe)
334     {
335       /* start listening to NameLost and NameAcquired messages */
336       client->name_lost_subscription_id =
337         g_dbus_connection_signal_subscribe (client->connection,
338                                             "org.freedesktop.DBus",
339                                             "org.freedesktop.DBus",
340                                             "NameLost",
341                                             "/org/freedesktop/DBus",
342                                             client->name,
343                                             on_name_lost_or_acquired,
344                                             client,
345                                             NULL);
346       client->name_acquired_subscription_id =
347         g_dbus_connection_signal_subscribe (client->connection,
348                                             "org.freedesktop.DBus",
349                                             "org.freedesktop.DBus",
350                                             "NameAcquired",
351                                             "/org/freedesktop/DBus",
352                                             client->name,
353                                             on_name_lost_or_acquired,
354                                             client,
355                                             NULL);
356     }
357
358   client_unref (client);
359 }
360
361 /* ---------------------------------------------------------------------------------------------------- */
362
363 static void
364 on_connection_disconnected (GDBusConnection *connection,
365                             gboolean         remote_peer_vanished,
366                             GError          *error,
367                             gpointer         user_data)
368 {
369   Client *client = user_data;
370
371   if (client->disconnected_signal_handler_id > 0)
372     g_signal_handler_disconnect (client->connection, client->disconnected_signal_handler_id);
373   if (client->name_acquired_subscription_id > 0)
374     g_dbus_connection_signal_unsubscribe (client->connection, client->name_acquired_subscription_id);
375   if (client->name_lost_subscription_id > 0)
376     g_dbus_connection_signal_unsubscribe (client->connection, client->name_lost_subscription_id);
377   g_object_unref (client->connection);
378   client->disconnected_signal_handler_id = 0;
379   client->name_acquired_subscription_id = 0;
380   client->name_lost_subscription_id = 0;
381   client->connection = NULL;
382
383   call_lost_handler (client);
384 }
385
386 /* ---------------------------------------------------------------------------------------------------- */
387
388 static void
389 has_connection (Client *client)
390 {
391   /* listen for disconnection */
392   client->disconnected_signal_handler_id = g_signal_connect (client->connection,
393                                                              "closed",
394                                                              G_CALLBACK (on_connection_disconnected),
395                                                              client);
396
397   /* attempt to acquire the name */
398   g_dbus_connection_invoke_method (client->connection,
399                                    "org.freedesktop.DBus",  /* bus name */
400                                    "/org/freedesktop/DBus", /* object path */
401                                    "org.freedesktop.DBus",  /* interface name */
402                                    "RequestName",           /* method name */
403                                    g_variant_new ("(su)",
404                                                   client->name,
405                                                   client->flags),
406                                    G_DBUS_INVOKE_METHOD_FLAGS_NONE,
407                                    -1,
408                                    NULL,
409                                    (GAsyncReadyCallback) request_name_cb,
410                                    client_ref (client));
411 }
412
413
414 static void
415 connection_get_cb (GObject      *source_object,
416                    GAsyncResult *res,
417                    gpointer      user_data)
418 {
419   Client *client = user_data;
420
421   client->connection = g_bus_get_finish (res, NULL);
422   if (client->connection == NULL)
423     {
424       call_lost_handler (client);
425       goto out;
426     }
427
428   /* No need to schedule this in idle as we're already in the thread
429    * that the user called g_bus_own_name() from. This is because
430    * g_bus_get() guarantees that.
431    *
432    * Also, we need to ensure that the handler is invoked *before*
433    * we call RequestName(). Otherwise there is a race.
434    */
435   if (client->bus_acquired_handler != NULL)
436     {
437       client->bus_acquired_handler (client->connection,
438                                     client->name,
439                                     client->user_data);
440     }
441
442   has_connection (client);
443
444  out:
445   client_unref (client);
446 }
447
448 /* ---------------------------------------------------------------------------------------------------- */
449
450 /**
451  * g_bus_own_name_on_connection:
452  * @connection: A #GDBusConnection that is not closed.
453  * @name: The well-known name to own.
454  * @flags: A set of flags from the #GBusNameOwnerFlags enumeration.
455  * @name_acquired_handler: Handler to invoke when @name is acquired or %NULL.
456  * @name_lost_handler: Handler to invoke when @name is lost or %NULL.
457  * @user_data: User data to pass to handlers.
458  * @user_data_free_func: Function for freeing @user_data or %NULL.
459  *
460  * Like g_bus_own_name() but takes a #GDBusConnection instead of a
461  * #GBusType.
462  *
463  * Returns: An identifier (never 0) that an be used with
464  * g_bus_unown_name() to stop owning the name.
465  *
466  * Since: 2.26
467  */
468 guint
469 g_bus_own_name_on_connection (GDBusConnection          *connection,
470                               const gchar              *name,
471                               GBusNameOwnerFlags        flags,
472                               GBusNameAcquiredCallback  name_acquired_handler,
473                               GBusNameLostCallback      name_lost_handler,
474                               gpointer                  user_data,
475                               GDestroyNotify            user_data_free_func)
476 {
477   Client *client;
478
479   g_return_val_if_fail (G_IS_DBUS_CONNECTION (connection), 0);
480   g_return_val_if_fail (!g_dbus_connection_is_closed (connection), 0);
481   g_return_val_if_fail (g_dbus_is_name (name) && !g_dbus_is_unique_name (name), 0);
482
483   G_LOCK (lock);
484
485   client = g_new0 (Client, 1);
486   client->ref_count = 1;
487   client->id = next_global_id++; /* TODO: uh oh, handle overflow */
488   client->name = g_strdup (name);
489   client->flags = flags;
490   client->name_acquired_handler = name_acquired_handler;
491   client->name_lost_handler = name_lost_handler;
492   client->user_data = user_data;
493   client->user_data_free_func = user_data_free_func;
494   client->main_context = g_main_context_get_thread_default ();
495   if (client->main_context != NULL)
496     g_main_context_ref (client->main_context);
497
498   client->connection = g_object_ref (connection);
499
500   if (map_id_to_client == NULL)
501     {
502       map_id_to_client = g_hash_table_new (g_direct_hash, g_direct_equal);
503     }
504   g_hash_table_insert (map_id_to_client,
505                        GUINT_TO_POINTER (client->id),
506                        client);
507
508   G_UNLOCK (lock);
509
510   has_connection (client);
511
512   return client->id;
513 }
514
515 /**
516  * g_bus_own_name:
517  * @bus_type: The type of bus to own a name on.
518  * @name: The well-known name to own.
519  * @flags: A set of flags from the #GBusNameOwnerFlags enumeration.
520  * @bus_acquired_handler: Handler to invoke when connected to the bus of type @bus_type or %NULL.
521  * @name_acquired_handler: Handler to invoke when @name is acquired or %NULL.
522  * @name_lost_handler: Handler to invoke when @name is lost or %NULL.
523  * @user_data: User data to pass to handlers.
524  * @user_data_free_func: Function for freeing @user_data or %NULL.
525  *
526  * Starts acquiring @name on the bus specified by @bus_type and calls
527  * @name_acquired_handler and @name_lost_handler when the name is
528  * acquired respectively lost. Callbacks will be invoked in the <link
529  * linkend="g-main-context-push-thread-default">thread-default main
530  * loop</link> of the thread you are calling this function from.
531  *
532  * You are guaranteed that one of the @name_acquired_handler and @name_lost_handler
533  * callbacks will be invoked after calling this function - there are three
534  * possible cases:
535  * <itemizedlist>
536  *   <listitem><para>
537  *     @name_lost_handler with a %NULL connection (if a connection to the bus can't be made).
538  *   </para></listitem>
539  *   <listitem><para>
540  *     @bus_acquired_handler then @name_lost_handler (if the name can't be obtained)
541  *   </para></listitem>
542  *   <listitem><para>
543  *     @bus_acquired_handler then @name_acquired_handler (if the name was obtained).
544  *   </para></listitem>
545  * </itemizedlist>
546  * When you are done owning the name, just call g_bus_unown_name()
547  * with the owner id this function returns.
548  *
549  * If the name is acquired or lost (for example another application
550  * could acquire the name if you allow replacement or the application
551  * currently owning the name exits), the handlers are also invoked. If the
552  * #GDBusConnection that is used for attempting to own the name
553  * closes, then @name_lost_handler is invoked since it is no
554  * longer possible for other processes to access the process.
555  *
556  * You cannot use g_bus_own_name() several times (unless interleaved
557  * with calls to g_bus_unown_name()) - only the first call will work.
558  *
559  * Another guarantee is that invocations of @name_acquired_handler
560  * and @name_lost_handler are guaranteed to alternate; that
561  * is, if @name_acquired_handler is invoked then you are
562  * guaranteed that the next time one of the handlers is invoked, it
563  * will be @name_lost_handler. The reverse is also true.
564  *
565  * If you plan on exporting objects (using e.g. g_dbus_connection_register_object()), note
566  * that it is generally too late to export the objects in @name_acquired_handler. Instead,
567  * you can do this in @bus_acquired_handler since you are guaranteed that this will
568  * run before @name is requested from the bus.
569  *
570  * This behavior makes it very simple to write applications that wants
571  * to own names and export objects, see <xref linkend="gdbus-owning-names"/>. Simply
572  * register objects to be exported in @bus_acquired_handler and
573  * unregister the objects (if any) in @name_lost_handler.
574  *
575  * Returns: An identifier (never 0) that an be used with
576  * g_bus_unown_name() to stop owning the name.
577  *
578  * Since: 2.26
579  */
580 guint
581 g_bus_own_name (GBusType                  bus_type,
582                 const gchar              *name,
583                 GBusNameOwnerFlags        flags,
584                 GBusAcquiredCallback      bus_acquired_handler,
585                 GBusNameAcquiredCallback  name_acquired_handler,
586                 GBusNameLostCallback      name_lost_handler,
587                 gpointer                  user_data,
588                 GDestroyNotify            user_data_free_func)
589 {
590   Client *client;
591
592   g_return_val_if_fail (bus_type != G_BUS_TYPE_NONE, 0);
593   g_return_val_if_fail (g_dbus_is_name (name) && !g_dbus_is_unique_name (name), 0);
594
595   G_LOCK (lock);
596
597   client = g_new0 (Client, 1);
598   client->ref_count = 1;
599   client->id = next_global_id++; /* TODO: uh oh, handle overflow */
600   client->name = g_strdup (name);
601   client->flags = flags;
602   client->bus_acquired_handler = bus_acquired_handler;
603   client->name_acquired_handler = name_acquired_handler;
604   client->name_lost_handler = name_lost_handler;
605   client->user_data = user_data;
606   client->user_data_free_func = user_data_free_func;
607   client->main_context = g_main_context_get_thread_default ();
608   if (client->main_context != NULL)
609     g_main_context_ref (client->main_context);
610
611   if (map_id_to_client == NULL)
612     {
613       map_id_to_client = g_hash_table_new (g_direct_hash, g_direct_equal);
614     }
615   g_hash_table_insert (map_id_to_client,
616                        GUINT_TO_POINTER (client->id),
617                        client);
618
619   g_bus_get (bus_type,
620              NULL,
621              connection_get_cb,
622              client_ref (client));
623
624   G_UNLOCK (lock);
625
626   return client->id;
627 }
628
629 /**
630  * g_bus_unown_name:
631  * @owner_id: An identifier obtained from g_bus_own_name()
632  *
633  * Stops owning a name.
634  *
635  * Since: 2.26
636  */
637 void
638 g_bus_unown_name (guint owner_id)
639 {
640   Client *client;
641
642   g_return_if_fail (owner_id > 0);
643
644   client = NULL;
645
646   G_LOCK (lock);
647   if (owner_id == 0 || map_id_to_client == NULL ||
648       (client = g_hash_table_lookup (map_id_to_client, GUINT_TO_POINTER (owner_id))) == NULL)
649     {
650       g_warning ("Invalid id %d passed to g_bus_unown_name()", owner_id);
651       goto out;
652     }
653
654   client->cancelled = TRUE;
655   g_warn_if_fail (g_hash_table_remove (map_id_to_client, GUINT_TO_POINTER (owner_id)));
656
657  out:
658   G_UNLOCK (lock);
659
660   /* do callback without holding lock */
661   if (client != NULL)
662     {
663       /* Release the name if needed */
664       if (client->needs_release && client->connection != NULL)
665         {
666           GVariant *result;
667           GError *error;
668           guint32 release_name_reply;
669
670           /* TODO: it kinda sucks having to do a sync call to release the name - but if
671            * we don't, then a subsequent grab of the name will make the bus daemon return
672            * IN_QUEUE which will trigger name_lost().
673            *
674            * I believe this is a bug in the bus daemon.
675            */
676           error = NULL;
677           result = g_dbus_connection_invoke_method_sync (client->connection,
678                                                          "org.freedesktop.DBus",  /* bus name */
679                                                          "/org/freedesktop/DBus", /* object path */
680                                                          "org.freedesktop.DBus",  /* interface name */
681                                                          "ReleaseName",           /* method name */
682                                                          g_variant_new ("(s)", client->name),
683                                                          G_DBUS_INVOKE_METHOD_FLAGS_NONE,
684                                                          -1,
685                                                          NULL,
686                                                          &error);
687           if (result == NULL)
688             {
689               g_warning ("Error releasing name %s: %s", client->name, error->message);
690               g_error_free (error);
691             }
692           else
693             {
694               g_variant_get (result, "(u)", &release_name_reply);
695               if (release_name_reply != 1 /* DBUS_RELEASE_NAME_REPLY_RELEASED */)
696                 {
697                   g_warning ("Unexpected reply %d when releasing name %s", release_name_reply, client->name);
698                 }
699               g_variant_unref (result);
700             }
701         }
702
703       if (client->disconnected_signal_handler_id > 0)
704         g_signal_handler_disconnect (client->connection, client->disconnected_signal_handler_id);
705       if (client->name_acquired_subscription_id > 0)
706         g_dbus_connection_signal_unsubscribe (client->connection, client->name_acquired_subscription_id);
707       if (client->name_lost_subscription_id > 0)
708         g_dbus_connection_signal_unsubscribe (client->connection, client->name_lost_subscription_id);
709       client->disconnected_signal_handler_id = 0;
710       client->name_acquired_subscription_id = 0;
711       client->name_lost_subscription_id = 0;
712       if (client->connection != NULL)
713         {
714           g_object_unref (client->connection);
715           client->connection = NULL;
716         }
717
718       client_unref (client);
719     }
720 }
721
722 #define __G_DBUS_NAME_OWNING_C__
723 #include "gioaliasdef.c"