X-Git-Url: http://review.tizen.org/git/?a=blobdiff_plain;f=glib%2Fgiounix.c;h=bb773c3c59bf9083a3348ad955b40769e1a89ab4;hb=49a5d0f6f2aed99cd78f25655f137f4448e47d92;hp=0e89d5c15e331e37c0083c55343609e6463d12bd;hpb=a4e38786750d538b334b8a7a7cc9f5a3ff48bc33;p=platform%2Fupstream%2Fglib.git
diff --git a/glib/giounix.c b/glib/giounix.c
index 0e89d5c..bb773c3 100644
--- a/glib/giounix.c
+++ b/glib/giounix.c
@@ -15,19 +15,17 @@
* Lesser General Public License for more details.
*
* You should have received a copy of the GNU Lesser General Public
- * License along with this library; if not, write to the
- * Free Software Foundation, Inc., 59 Temple Place - Suite 330,
- * Boston, MA 02111-1307, USA.
+ * License along with this library; if not, see .
*/
/*
* Modified by the GLib Team and others 1997-2000. See the AUTHORS
* file for a list of people on the GLib Team. See the ChangeLog
* files for a list of changes. These files are distributed with
- * GLib at ftp://ftp.gtk.org/pub/gtk/.
+ * GLib at ftp://ftp.gtk.org/pub/gtk/.
*/
-/*
+/*
* MT safe
*/
@@ -42,9 +40,14 @@
#include
#include
#include
+#include
+
+#include "giochannel.h"
-#include "glib.h"
-#include "galias.h"
+#include "gerror.h"
+#include "gfileutils.h"
+#include "gstrfuncs.h"
+#include "gtestutils.h"
/*
* Unix IO Channels
@@ -344,6 +347,7 @@ g_io_unix_create_watch (GIOChannel *channel,
source = g_source_new (&g_io_watch_funcs, sizeof (GIOUnixWatch));
+ g_source_set_name (source, "GIOChannel (Unix)");
watch = (GIOUnixWatch *)source;
watch->channel = channel;
@@ -449,7 +453,10 @@ g_io_channel_new_file (const gchar *filename,
MODE_R = 1 << 0,
MODE_W = 1 << 1,
MODE_A = 1 << 2,
- MODE_PLUS = 1 << 3
+ MODE_PLUS = 1 << 3,
+ MODE_R_PLUS = MODE_R | MODE_PLUS,
+ MODE_W_PLUS = MODE_W | MODE_PLUS,
+ MODE_A_PLUS = MODE_A | MODE_PLUS
} mode_num;
struct stat buffer;
@@ -500,22 +507,24 @@ g_io_channel_new_file (const gchar *filename,
case MODE_A:
flags = O_WRONLY | O_APPEND | O_CREAT;
break;
- case MODE_R | MODE_PLUS:
+ case MODE_R_PLUS:
flags = O_RDWR;
break;
- case MODE_W | MODE_PLUS:
+ case MODE_W_PLUS:
flags = O_RDWR | O_TRUNC | O_CREAT;
break;
- case MODE_A | MODE_PLUS:
+ case MODE_A_PLUS:
flags = O_RDWR | O_APPEND | O_CREAT;
break;
+ case MODE_PLUS:
default:
g_assert_not_reached ();
flags = 0;
}
create_mode = S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH;
- fid = open (filename, flags, create_mode);
+
+ fid = g_open (filename, flags, create_mode);
if (fid == -1)
{
int err = errno;
@@ -551,12 +560,13 @@ g_io_channel_new_file (const gchar *filename,
channel->is_readable = FALSE;
channel->is_writeable = TRUE;
break;
- case MODE_R | MODE_PLUS:
- case MODE_W | MODE_PLUS:
- case MODE_A | MODE_PLUS:
+ case MODE_R_PLUS:
+ case MODE_W_PLUS:
+ case MODE_A_PLUS:
channel->is_readable = TRUE;
channel->is_writeable = TRUE;
break;
+ case MODE_PLUS:
default:
g_assert_not_reached ();
}
@@ -572,7 +582,6 @@ g_io_channel_new_file (const gchar *filename,
/**
* g_io_channel_unix_new:
* @fd: a file descriptor.
- * @Returns: a new #GIOChannel.
*
* Creates a new #GIOChannel given a file descriptor. On UNIX systems
* this works for plain files, pipes, and sockets.
@@ -594,6 +603,8 @@ g_io_channel_new_file (const gchar *filename,
* in case the argument you pass to this function happens to be both a
* valid file descriptor and socket. If that happens a warning is
* issued, and GLib assumes that it is the file descriptor you mean.
+ *
+ * Returns: a new #GIOChannel.
**/
GIOChannel *
g_io_channel_unix_new (gint fd)
@@ -627,12 +638,13 @@ g_io_channel_unix_new (gint fd)
/**
* g_io_channel_unix_get_fd:
* @channel: a #GIOChannel, created with g_io_channel_unix_new().
- * @Returns: the file descriptor of the #GIOChannel.
*
* Returns the file descriptor of the #GIOChannel.
*
* On Windows this function returns the file descriptor or socket of
* the #GIOChannel.
+ *
+ * Returns: the file descriptor of the #GIOChannel.
**/
gint
g_io_channel_unix_get_fd (GIOChannel *channel)
@@ -640,6 +652,3 @@ g_io_channel_unix_get_fd (GIOChannel *channel)
GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel;
return unix_channel->fd;
}
-
-#define __G_IO_UNIX_C__
-#include "galiasdef.c"