X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=gio%2Fgunixfdmessage.c;h=12e62c53f5032c9824cfcebb898079d6c087a104;hb=2138deb07ebb7d7e541c0cd35b966e107d1bf800;hp=9d3fa442c769715da8bfd67b929c216de289ca15;hpb=6223341cacc7dfa34a8d60ec1b4828382dee6d07;p=platform%2Fupstream%2Fglib.git diff --git a/gio/gunixfdmessage.c b/gio/gunixfdmessage.c index 9d3fa44..12e62c5 100644 --- a/gio/gunixfdmessage.c +++ b/gio/gunixfdmessage.c @@ -13,7 +13,7 @@ */ /** - * SECTION: gunixfdmessage + * SECTION:gunixfdmessage * @title: GUnixFDMessage * @short_description: A GSocketControlMessage containing a GUnixFDList * @include: gio/gunixfdmessage.h @@ -29,15 +29,13 @@ * stream-oriented UNIX sockets, see g_unix_connection_send_fd() and * g_unix_connection_receive_fd(). * - * Note that <gio/gunixfdmessage.h> belongs to - * the UNIX-specific GIO interfaces, thus you have to use the - * gio-unix-2.0.pc pkg-config file when using it. - **/ + * Note that `` belongs to the UNIX-specific GIO + * interfaces, thus you have to use the `gio-unix-2.0.pc` pkg-config + * file when using it. + */ #include "config.h" -#include -#include #include #include #include @@ -45,19 +43,16 @@ #include "gunixfdmessage.h" #include "gunixfdlist.h" +#include "gnetworking.h" #include "gioerror.h" -#include "gioalias.h" - - -G_DEFINE_TYPE (GUnixFDMessage, g_unix_fd_message, - G_TYPE_SOCKET_CONTROL_MESSAGE); - struct _GUnixFDMessagePrivate { GUnixFDList *list; }; +G_DEFINE_TYPE_WITH_PRIVATE (GUnixFDMessage, g_unix_fd_message, G_TYPE_SOCKET_CONTROL_MESSAGE) + static gsize g_unix_fd_message_get_size (GSocketControlMessage *message) { @@ -102,6 +97,10 @@ g_unix_fd_message_deserialize (int level, fds = data; n = size / sizeof (gint); + /* Note we probably handled this in gsocket.c already if we're on + * Linux and have MSG_CMSG_CLOEXEC, but this code remains as a fallback + * in case the kernel is too old for MSG_CMSG_CLOEXEC. + */ for (i = 0; i < n; i++) { do @@ -158,7 +157,7 @@ g_unix_fd_message_set_property (GObject *object, guint prop_id, * return a reference to the caller, but the returned list is valid for * the lifetime of @message. * - * Returns: the #GUnixFDList from @message + * Returns: (transfer none): the #GUnixFDList from @message * * Since: 2.24 **/ @@ -182,9 +181,7 @@ g_unix_fd_message_get_property (GObject *object, guint prop_id, static void g_unix_fd_message_init (GUnixFDMessage *message) { - message->priv = G_TYPE_INSTANCE_GET_PRIVATE (message, - G_TYPE_UNIX_FD_MESSAGE, - GUnixFDMessagePrivate); + message->priv = g_unix_fd_message_get_instance_private (message); } static void @@ -204,7 +201,6 @@ g_unix_fd_message_class_init (GUnixFDMessageClass *class) GSocketControlMessageClass *scm_class = G_SOCKET_CONTROL_MESSAGE_CLASS (class); GObjectClass *object_class = G_OBJECT_CLASS (class); - g_type_class_add_private (class, sizeof (GUnixFDMessagePrivate)); scm_class->get_size = g_unix_fd_message_get_size; scm_class->get_level = g_unix_fd_message_get_level; scm_class->get_type = g_unix_fd_message_get_msg_type; @@ -258,7 +254,8 @@ g_unix_fd_message_new_with_fd_list (GUnixFDList *fd_list) /** * g_unix_fd_message_steal_fds: * @message: a #GUnixFDMessage - * @length: pointer to the length of the returned array, or %NULL + * @length: (out) (allow-none): pointer to the length of the returned + * array, or %NULL * * Returns the array of file descriptors that is contained in this * object. @@ -278,7 +275,8 @@ g_unix_fd_message_new_with_fd_list (GUnixFDList *fd_list) * This function never returns %NULL. In case there are no file * descriptors contained in @message, an empty array is returned. * - * Returns: an array of file descriptors + * Returns: (array length=length) (transfer full): an array of file + * descriptors * * Since: 2.22 **/ @@ -286,7 +284,7 @@ gint * g_unix_fd_message_steal_fds (GUnixFDMessage *message, gint *length) { - g_return_val_if_fail (G_UNIX_FD_MESSAGE (message), FALSE); + g_return_val_if_fail (G_UNIX_FD_MESSAGE (message), NULL); return g_unix_fd_list_steal_fds (message->priv->list, length); } @@ -317,8 +315,5 @@ g_unix_fd_message_append_fd (GUnixFDMessage *message, { g_return_val_if_fail (G_UNIX_FD_MESSAGE (message), FALSE); - return g_unix_fd_list_append (message->priv->list, fd, error) > 0; + return g_unix_fd_list_append (message->priv->list, fd, error) >= 0; } - -#define __G_UNIX_FD_MESSAGE_C__ -#include "gioaliasdef.c"