Main Page | Class List | Directories | File List | Class Members | File Members

giowin32.c File Reference

#include "config.h"
#include "glib.h"
#include <windows.h>
#include <winsock.h>
#include <fcntl.h>
#include <io.h>
#include <errno.h>
#include <sys/types.h>
#include <stdio.h>

Go to the source code of this file.

Classes

struct  _GIOWin32Channel
struct  _GIOWin32Watch

Defines

#define N_WATCHED_PIPES   4

Typedefs

typedef _GIOWin32Channel GIOWin32Channel
typedef _GIOWin32Watch GIOWin32Watch

Enumerations

enum  GIOWin32ChannelType { G_IO_WINDOWS_MESSAGES, G_IO_FILE_DESC, G_IO_PIPE, G_IO_STREAM_SOCKET }

Functions

static gboolean g_io_win32_msg_prepare (gpointer source_data, GTimeVal *current_time, gint *timeout)
static gboolean g_io_win32_msg_check (gpointer source_data, GTimeVal *current_time)
static gboolean g_io_win32_msg_dispatch (gpointer source_data, GTimeVal *current_time, gpointer user_data)
static gboolean g_io_win32_fd_prepare (gpointer source_data, GTimeVal *current_time, gint *timeout)
static gboolean g_io_win32_fd_check (gpointer source_data, GTimeVal *current_time)
static gboolean g_io_win32_fd_dispatch (gpointer source_data, GTimeVal *current_time, gpointer user_data)
static gboolean g_io_win32_pipe_prepare (gpointer source_data, GTimeVal *current_time, gint *timeout)
static gboolean g_io_win32_pipe_check (gpointer source_data, GTimeVal *current_time)
static gboolean g_io_win32_pipe_dispatch (gpointer source_data, GTimeVal *current_time, gpointer user_data)
static void g_io_win32_pipe_destroy (gpointer source_data)
static gboolean g_io_win32_sock_prepare (gpointer source_data, GTimeVal *current_time, gint *timeout)
static gboolean g_io_win32_sock_check (gpointer source_data, GTimeVal *current_time)
static gboolean g_io_win32_sock_dispatch (gpointer source_data, GTimeVal *current_time, gpointer user_data)
static void g_io_win32_destroy (gpointer source_data)
static GIOError g_io_win32_msg_read (GIOChannel *channel, gchar *buf, guint count, guint *bytes_written)
static GIOError g_io_win32_msg_write (GIOChannel *channel, gchar *buf, guint count, guint *bytes_written)
static GIOError g_io_win32_msg_seek (GIOChannel *channel, gint offset, GSeekType type)
static void g_io_win32_msg_close (GIOChannel *channel)
static guint g_io_win32_msg_add_watch (GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify)
static GIOError g_io_win32_fd_read (GIOChannel *channel, gchar *buf, guint count, guint *bytes_written)
static GIOError g_io_win32_fd_write (GIOChannel *channel, gchar *buf, guint count, guint *bytes_written)
static GIOError g_io_win32_fd_seek (GIOChannel *channel, gint offset, GSeekType type)
static void g_io_win32_fd_close (GIOChannel *channel)
static void g_io_win32_free (GIOChannel *channel)
static guint g_io_win32_fd_add_watch (GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify)
static GIOError g_io_win32_no_seek (GIOChannel *channel, gint offset, GSeekType type)
static GIOError g_io_win32_pipe_read (GIOChannel *channel, gchar *buf, guint count, guint *bytes_written)
static GIOError g_io_win32_pipe_write (GIOChannel *channel, gchar *buf, guint count, guint *bytes_written)
static void g_io_win32_pipe_close (GIOChannel *channel)
static guint g_io_win32_pipe_add_watch (GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify)
static void g_io_win32_pipe_free (GIOChannel *channel)
static GIOError g_io_win32_sock_read (GIOChannel *channel, gchar *buf, guint count, guint *bytes_written)
static GIOError g_io_win32_sock_write (GIOChannel *channel, gchar *buf, guint count, guint *bytes_written)
static void g_io_win32_sock_close (GIOChannel *channel)
static guint g_io_win32_sock_add_watch (GIOChannel *channel, gint priority, GIOCondition condition, GIOFunc func, gpointer user_data, GDestroyNotify notify)
GIOChannelg_io_channel_win32_new_messages (guint hwnd)
GIOChannelg_io_channel_unix_new (gint fd)
gint g_io_channel_unix_get_fd (GIOChannel *channel)
GIOChannelg_io_channel_win32_new_pipe_with_wakeups (int fd, guint peer, int peer_fd)
GIOChannelg_io_channel_win32_new_pipe (int fd)
GIOChannelg_io_channel_win32_new_stream_socket (int socket)
gint g_io_channel_win32_get_fd (GIOChannel *channel)
void g_io_channel_win32_pipe_request_wakeups (GIOChannel *channel, guint peer, int peer_fd)
void g_io_channel_win32_pipe_readable (gint fd, guint offset)

Variables

guint g_pipe_readable_msg
GSourceFuncs win32_watch_msg_funcs
GSourceFuncs win32_watch_fd_funcs
GSourceFuncs win32_watch_pipe_funcs
GSourceFuncs win32_watch_sock_funcs
GIOFuncs win32_channel_msg_funcs
GIOFuncs win32_channel_fd_funcs
GIOFuncs win32_channel_pipe_funcs
GIOFuncs win32_channel_sock_funcs
struct {
   gint   fd
   GIOWin32Watch *   watch
   GIOWin32Channel *   channel
   gpointer   user_data
watched_pipes [N_WATCHED_PIPES]


Define Documentation

#define N_WATCHED_PIPES   4
 

Definition at line 263 of file giowin32.c.

Referenced by g_io_win32_pipe_add_watch().


Typedef Documentation

typedef struct _GIOWin32Channel GIOWin32Channel
 

Definition at line 42 of file giowin32.c.

typedef struct _GIOWin32Watch GIOWin32Watch
 

Definition at line 43 of file giowin32.c.


Enumeration Type Documentation

enum GIOWin32ChannelType
 

Enumerator:
G_IO_WINDOWS_MESSAGES 
G_IO_FILE_DESC 
G_IO_PIPE 
G_IO_STREAM_SOCKET 

Definition at line 47 of file giowin32.c.

00047              {
00048   G_IO_WINDOWS_MESSAGES,        /* Windows messages */
00049   G_IO_FILE_DESC,               /* Unix-like file descriptors from _open*/
00050   G_IO_PIPE,                    /* pipe, with windows messages for signalling */
00051   G_IO_STREAM_SOCKET            /* Stream sockets */
00052 } GIOWin32ChannelType;


Function Documentation

gint g_io_channel_unix_get_fd GIOChannel channel  ) 
 

Definition at line 943 of file giowin32.c.

References _GIOUnixChannel::fd, and _GIOWin32Channel::fd.

00944 {
00945   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00946 
00947   return win32_channel->fd;
00948 }

GIOChannel* g_io_channel_unix_new gint  fd  ) 
 

Definition at line 929 of file giowin32.c.

References channel, _GIOUnixChannel::fd, _GIOWin32Channel::fd, _GIOChannel::funcs, g_io_channel_init(), G_IO_FILE_DESC, g_new, and _GIOWin32Channel::type.

00930 {
00931   GIOWin32Channel *win32_channel = g_new (GIOWin32Channel, 1);
00932   GIOChannel *channel = (GIOChannel *) win32_channel;
00933 
00934   g_io_channel_init (channel);
00935   channel->funcs = &win32_channel_fd_funcs;
00936   win32_channel->fd = fd;
00937   win32_channel->type = G_IO_FILE_DESC;
00938 
00939   return channel;
00940 }

gint g_io_channel_win32_get_fd GIOChannel channel  ) 
 

Definition at line 1003 of file giowin32.c.

References g_io_channel_unix_get_fd().

01004 {
01005   return g_io_channel_unix_get_fd (channel);
01006 }

GIOChannel* g_io_channel_win32_new_messages guint  hwnd  ) 
 

Definition at line 914 of file giowin32.c.

References channel, _GIOWin32Channel::fd, _GIOChannel::funcs, g_io_channel_init(), G_IO_WINDOWS_MESSAGES, g_new, _GIOWin32Channel::hwnd, and _GIOWin32Channel::type.

00915 {
00916   GIOWin32Channel *win32_channel = g_new (GIOWin32Channel, 1);
00917   GIOChannel *channel = (GIOChannel *) win32_channel;
00918 
00919   g_io_channel_init (channel);
00920   channel->funcs = &win32_channel_msg_funcs;
00921   win32_channel->fd = -1;
00922   win32_channel->type = G_IO_WINDOWS_MESSAGES;
00923   win32_channel->hwnd = (HWND) hwnd;
00924 
00925   return channel;
00926 }

GIOChannel* g_io_channel_win32_new_pipe int  fd  ) 
 

Definition at line 973 of file giowin32.c.

References channel, FALSE, _GIOWin32Channel::fd, _GIOChannel::funcs, g_io_channel_init(), G_IO_PIPE, g_new, _GIOWin32Channel::need_wakeups, _GIOWin32Channel::offset, and _GIOWin32Channel::type.

00974 {
00975   GIOWin32Channel *win32_channel = g_new (GIOWin32Channel, 1);
00976   GIOChannel *channel = (GIOChannel *) win32_channel;
00977 
00978   g_io_channel_init (channel);
00979   channel->funcs = &win32_channel_pipe_funcs;
00980   win32_channel->fd = fd;
00981   win32_channel->type = G_IO_PIPE;
00982   win32_channel->offset = 0;
00983   win32_channel->need_wakeups = FALSE;
00984 
00985   return channel;
00986 }

GIOChannel* g_io_channel_win32_new_pipe_with_wakeups int  fd,
guint  peer,
int  peer_fd
 

Definition at line 951 of file giowin32.c.

References channel, _GIOWin32Channel::fd, _GIOChannel::funcs, g_io_channel_init(), G_IO_PIPE, g_new, _GIOWin32Channel::need_wakeups, _GIOWin32Channel::offset, _GIOWin32Channel::peer, _GIOWin32Channel::peer_fd, TRUE, and _GIOWin32Channel::type.

00954 {
00955   GIOWin32Channel *win32_channel = g_new (GIOWin32Channel, 1);
00956   GIOChannel *channel = (GIOChannel *) win32_channel;
00957 
00958   /* g_print ("g_io_channel_win32_new_pipe_with_wakeups %d %#x %d\n", fd, peer, peer_fd); */
00959 
00960   g_io_channel_init (channel);
00961   channel->funcs = &win32_channel_pipe_funcs;
00962   win32_channel->fd = fd;
00963   win32_channel->type = G_IO_PIPE;
00964   win32_channel->peer = peer;
00965   win32_channel->peer_fd = peer_fd;
00966   win32_channel->offset = 0;
00967   win32_channel->need_wakeups = TRUE;
00968 
00969   return channel;
00970 }

GIOChannel* g_io_channel_win32_new_stream_socket int  socket  ) 
 

Definition at line 989 of file giowin32.c.

References channel, _GIOWin32Channel::fd, _GIOChannel::funcs, g_io_channel_init(), G_IO_STREAM_SOCKET, g_new, and _GIOWin32Channel::type.

00990 {
00991   GIOWin32Channel *win32_channel = g_new (GIOWin32Channel, 1);
00992   GIOChannel *channel = (GIOChannel *) win32_channel;
00993 
00994   g_io_channel_init (channel);
00995   channel->funcs = &win32_channel_sock_funcs;
00996   win32_channel->fd = socket;
00997   win32_channel->type = G_IO_STREAM_SOCKET;
00998 
00999   return channel;
01000 }

void g_io_channel_win32_pipe_readable gint  fd,
guint  offset
 

Definition at line 1021 of file giowin32.c.

References channel, n_watched_pipes, _GIOWin32Channel::offset, and watched_pipes.

01023 {
01024   gint i;
01025 
01026   for (i = 0; i < n_watched_pipes; i++)
01027     if (watched_pipes[i].fd == fd)
01028       {
01029         if (watched_pipes[i].channel->offset < offset)
01030           (*watched_pipes[i].watch->callback) (watched_pipes[i].watch->channel,
01031                                                G_IO_IN,
01032                                                watched_pipes[i].user_data);
01033         break;
01034       }
01035 }

void g_io_channel_win32_pipe_request_wakeups GIOChannel channel,
guint  peer,
int  peer_fd
 

Definition at line 1009 of file giowin32.c.

References _GIOWin32Channel::need_wakeups, _GIOWin32Channel::peer, _GIOWin32Channel::peer_fd, and TRUE.

01012 {
01013   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
01014 
01015   win32_channel->peer = peer;
01016   win32_channel->peer_fd = peer_fd;
01017   win32_channel->need_wakeups = TRUE;
01018 }

static void g_io_win32_destroy gpointer  source_data  )  [static]
 

Definition at line 313 of file giowin32.c.

References _GIOWin32Watch::channel, g_free(), g_io_channel_unref(), g_main_remove_poll(), and _GIOWin32Watch::pollfd.

00314 {
00315   GIOWin32Watch *data = source_data;
00316 
00317   g_main_remove_poll (&data->pollfd);
00318   g_io_channel_unref (data->channel);
00319   g_free (data);
00320 }

static guint g_io_win32_fd_add_watch GIOChannel channel,
gint  priority,
GIOCondition  condition,
GIOFunc  func,
gpointer  user_data,
GDestroyNotify  notify
[static]
 

Definition at line 630 of file giowin32.c.

References _GIOWin32Watch::callback, _GIOWin32Watch::channel, _GIOWin32Watch::condition, _GPollFD::events, _GIOWin32Channel::fd, _GPollFD::fd, g_io_channel_ref(), g_main_add_poll(), g_new, g_source_add(), _GIOWin32Watch::pollfd, TRUE, and watch.

00636 {
00637   GIOWin32Watch *watch = g_new (GIOWin32Watch, 1);
00638   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00639   
00640   watch->channel = channel;
00641   g_io_channel_ref (channel);
00642 
00643   watch->callback = func;
00644   watch->condition = condition;
00645 
00646   /* This probably does not work, except for CONIN$. */
00647   watch->pollfd.fd = _get_osfhandle (win32_channel->fd);
00648   watch->pollfd.events = condition;
00649 
00650   g_main_add_poll (&watch->pollfd, priority);
00651 
00652   return g_source_add (priority, TRUE, &win32_watch_fd_funcs,
00653                        watch, user_data, notify);
00654 }

static gboolean g_io_win32_fd_check gpointer  source_data,
GTimeVal current_time
[static]
 

Definition at line 333 of file giowin32.c.

References _GIOWin32Watch::condition, _GIOWin32Watch::pollfd, and _GPollFD::revents.

00335 {
00336   GIOWin32Watch *data = source_data;
00337 
00338   return (data->pollfd.revents & data->condition);
00339 }

static void g_io_win32_fd_close GIOChannel channel  )  [static]
 

Definition at line 621 of file giowin32.c.

References _GIOWin32Channel::fd.

00622 {
00623   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00624 
00625   close (win32_channel->fd);
00626   return;
00627 }

static gboolean g_io_win32_fd_dispatch gpointer  source_data,
GTimeVal current_time,
gpointer  user_data
[static]
 

Definition at line 342 of file giowin32.c.

References _GIOWin32Watch::callback, _GIOWin32Watch::channel, _GIOWin32Watch::condition, _GIOWin32Watch::pollfd, and _GPollFD::revents.

00346 {
00347   GIOWin32Watch *data = source_data;
00348 
00349   return (*data->callback)(data->channel,
00350                            data->pollfd.revents & data->condition,
00351                            user_data);
00352 }

static gboolean g_io_win32_fd_prepare gpointer  source_data,
GTimeVal current_time,
gint timeout
[static]
 

Definition at line 323 of file giowin32.c.

References FALSE.

00326 {
00327   *timeout = -1;
00328 
00329   return FALSE;
00330 }

static GIOError g_io_win32_fd_read GIOChannel channel,
gchar buf,
guint  count,
guint bytes_written
[static]
 

Definition at line 519 of file giowin32.c.

References _GIOWin32Channel::fd, G_IO_ERROR_AGAIN, G_IO_ERROR_INVAL, G_IO_ERROR_NONE, and G_IO_ERROR_UNKNOWN.

00523 {
00524   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00525   gint result;
00526 
00527   result = read (win32_channel->fd, buf, count);
00528   if (result < 0)
00529     {
00530       *bytes_read = 0;
00531       switch (errno)
00532         {
00533         case EINVAL:
00534           return G_IO_ERROR_INVAL;
00535         case EAGAIN:
00536           return G_IO_ERROR_AGAIN;
00537         default:
00538           return G_IO_ERROR_UNKNOWN;
00539         }
00540     }
00541   else
00542     {
00543       *bytes_read = result;
00544       return G_IO_ERROR_NONE;
00545     }
00546 }

static GIOError g_io_win32_fd_seek GIOChannel channel,
gint  offset,
GSeekType  type
[static]
 

Definition at line 580 of file giowin32.c.

References _GIOWin32Channel::fd, G_IO_ERROR_INVAL, G_IO_ERROR_NONE, G_IO_ERROR_UNKNOWN, G_SEEK_CUR, G_SEEK_END, G_SEEK_SET, and g_warning().

00583 {
00584   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00585   int whence;
00586   off_t result;
00587 
00588   switch (type)
00589     {
00590     case G_SEEK_SET:
00591       whence = SEEK_SET;
00592       break;
00593     case G_SEEK_CUR:
00594       whence = SEEK_CUR;
00595       break;
00596     case G_SEEK_END:
00597       whence = SEEK_END;
00598       break;
00599     default:
00600       g_warning ("g_io_win32_fd_seek: unknown seek type");
00601       return G_IO_ERROR_UNKNOWN;
00602     }
00603   
00604   result = lseek (win32_channel->fd, offset, whence);
00605   
00606   if (result < 0)
00607     {
00608       switch (errno)
00609         {
00610         case EINVAL:
00611           return G_IO_ERROR_INVAL;
00612         default:
00613           return G_IO_ERROR_UNKNOWN;
00614         }
00615     }
00616   else
00617     return G_IO_ERROR_NONE;
00618 }

static GIOError g_io_win32_fd_write GIOChannel channel,
gchar buf,
guint  count,
guint bytes_written
[static]
 

Definition at line 549 of file giowin32.c.

References _GIOWin32Channel::fd, G_IO_ERROR_AGAIN, G_IO_ERROR_INVAL, G_IO_ERROR_NONE, and G_IO_ERROR_UNKNOWN.

00553 {
00554   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00555   gint result;
00556 
00557   result = write (win32_channel->fd, buf, count);
00558       
00559   if (result < 0)
00560     {
00561       *bytes_written = 0;
00562       switch (errno)
00563         {
00564         case EINVAL:
00565           return G_IO_ERROR_INVAL;
00566         case EAGAIN:
00567           return G_IO_ERROR_AGAIN;
00568         default:
00569           return G_IO_ERROR_UNKNOWN;
00570         }
00571     }
00572   else
00573     {
00574       *bytes_written = result;
00575       return G_IO_ERROR_NONE;
00576     }
00577 }

static void g_io_win32_free GIOChannel channel  )  [static]
 

Definition at line 413 of file giowin32.c.

References g_free().

Referenced by g_io_win32_pipe_free().

00414 {
00415   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00416 
00417   g_free (win32_channel);
00418 }

static guint g_io_win32_msg_add_watch GIOChannel channel,
gint  priority,
GIOCondition  condition,
GIOFunc  func,
gpointer  user_data,
GDestroyNotify  notify
[static]
 

Definition at line 421 of file giowin32.c.

References _GIOWin32Watch::callback, _GIOWin32Watch::channel, _GIOWin32Watch::condition, _GPollFD::events, _GPollFD::fd, g_io_channel_ref(), g_main_add_poll(), g_new, g_source_add(), _GIOWin32Watch::pollfd, TRUE, and watch.

00427 {
00428   GIOWin32Watch *watch = g_new (GIOWin32Watch, 1);
00429   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00430   
00431   watch->channel = channel;
00432   g_io_channel_ref (channel);
00433 
00434   watch->callback = func;
00435   watch->condition = condition;
00436 
00437   watch->pollfd.fd = G_WIN32_MSG_HANDLE;
00438   watch->pollfd.events = condition;
00439 
00440   g_main_add_poll (&watch->pollfd, priority);
00441 
00442   return g_source_add (priority, TRUE, &win32_watch_msg_funcs,
00443                        watch, user_data, notify);
00444 }

static gboolean g_io_win32_msg_check gpointer  source_data,
GTimeVal current_time
[static]
 

Definition at line 289 of file giowin32.c.

References _GIOWin32Watch::channel, _GIOWin32Channel::hwnd, and TRUE.

00291 {
00292   GIOWin32Watch *data = source_data;
00293   GIOWin32Channel *win32_channel = (GIOWin32Channel *) data->channel;
00294   MSG msg;
00295 
00296   return PeekMessage (&msg, win32_channel->hwnd, 0, 0, PM_NOREMOVE) == TRUE;
00297 }

static void g_io_win32_msg_close GIOChannel channel  )  [static]
 

Definition at line 407 of file giowin32.c.

00408 {
00409   /* Nothing to be done. Or should we set hwnd to some invalid value? */
00410 }

static gboolean g_io_win32_msg_dispatch gpointer  source_data,
GTimeVal current_time,
gpointer  user_data
[static]
 

Definition at line 300 of file giowin32.c.

References _GIOWin32Watch::callback, _GIOWin32Watch::channel, _GIOWin32Watch::condition, _GIOWin32Watch::pollfd, and _GPollFD::revents.

00304 {
00305   GIOWin32Watch *data = source_data;
00306 
00307   return (*data->callback)(data->channel,
00308                            data->pollfd.revents & data->condition,
00309                            user_data);
00310 }

static gboolean g_io_win32_msg_prepare gpointer  source_data,
GTimeVal current_time,
gint timeout
[static]
 

Definition at line 275 of file giowin32.c.

References _GIOWin32Watch::channel, _GIOWin32Channel::hwnd, and TRUE.

00278 {
00279   GIOWin32Watch *data = source_data;
00280   GIOWin32Channel *win32_channel = (GIOWin32Channel *) data->channel;
00281   MSG msg;
00282 
00283   *timeout = -1;
00284 
00285   return PeekMessage (&msg, win32_channel->hwnd, 0, 0, PM_NOREMOVE) == TRUE;
00286 }

static GIOError g_io_win32_msg_read GIOChannel channel,
gchar buf,
guint  count,
guint bytes_written
[static]
 

Definition at line 355 of file giowin32.c.

References G_IO_ERROR_AGAIN, G_IO_ERROR_INVAL, G_IO_ERROR_NONE, and _GIOWin32Channel::hwnd.

00359 {
00360   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00361   MSG msg;                      /* In case of alignment problems */
00362 
00363   if (count < sizeof (MSG))
00364     return G_IO_ERROR_INVAL;
00365   
00366   if (!PeekMessage (&msg, win32_channel->hwnd, 0, 0, PM_REMOVE))
00367     return G_IO_ERROR_AGAIN;
00368 
00369   memmove (buf, &msg, sizeof (MSG));
00370   *bytes_read = sizeof (MSG);
00371   return G_IO_ERROR_NONE;
00372 }

static GIOError g_io_win32_msg_seek GIOChannel channel,
gint  offset,
GSeekType  type
[static]
 

static GIOError g_io_win32_msg_write GIOChannel channel,
gchar buf,
guint  count,
guint bytes_written
[static]
 

Definition at line 375 of file giowin32.c.

References G_IO_ERROR_INVAL, G_IO_ERROR_NONE, G_IO_ERROR_UNKNOWN, and _GIOWin32Channel::hwnd.

00379 {
00380   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00381   MSG msg;
00382   gint result;
00383 
00384   if (count != sizeof (MSG))
00385     return G_IO_ERROR_INVAL;
00386 
00387   /* In case of alignment problems */
00388   memmove (&msg, buf, sizeof (MSG));
00389   if (!PostMessage (win32_channel->hwnd, msg.message, msg.wParam, msg.lParam))
00390     return G_IO_ERROR_UNKNOWN;
00391 
00392   *bytes_written = sizeof (MSG);
00393   return G_IO_ERROR_NONE; 
00394 }

static GIOError g_io_win32_no_seek GIOChannel channel,
gint  offset,
GSeekType  type
[static]
 

Definition at line 397 of file giowin32.c.

References G_IO_ERROR_UNKNOWN, and g_warning().

00400 {
00401   g_warning ("g_io_win32_no_seek: unseekable IO channel type");
00402   return G_IO_ERROR_UNKNOWN;
00403 }

static guint g_io_win32_pipe_add_watch GIOChannel channel,
gint  priority,
GIOCondition  condition,
GIOFunc  func,
gpointer  user_data,
GDestroyNotify  notify
[static]
 

Definition at line 761 of file giowin32.c.

References _GIOWin32Watch::callback, _GIOWin32Watch::channel, _GIOWin32Watch::condition, _GPollFD::events, FALSE, fd, _GIOWin32Channel::fd, _GPollFD::fd, g_error(), g_io_channel_ref(), g_new, g_source_add(), MAX, N_WATCHED_PIPES, n_watched_pipes, _GIOWin32Watch::pollfd, watch, and watched_pipes.

00767 {
00768   GIOWin32Watch *watch = g_new (GIOWin32Watch, 1);
00769   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00770   gint i;
00771   
00772   /* g_print ("g_io_win32_pipe_add_watch: %d\n", win32_channel->fd); */
00773 
00774   watch->channel = channel;
00775   g_io_channel_ref (channel);
00776 
00777   watch->callback = func;
00778   watch->condition = condition;
00779 
00780   watch->pollfd.fd = win32_channel->fd;
00781   watch->pollfd.events = condition;
00782 
00783   for (i = 0; i < n_watched_pipes; i++)
00784     if (watched_pipes[i].fd == -1)
00785       break;
00786   if (i == N_WATCHED_PIPES)
00787     g_error ("Too many watched pipes");
00788   else
00789     {
00790       watched_pipes[i].fd = win32_channel->fd;
00791       watched_pipes[i].watch = watch;
00792       watched_pipes[i].channel = win32_channel;
00793       watched_pipes[i].user_data = user_data;
00794       n_watched_pipes = MAX (i + 1, n_watched_pipes);
00795     }
00796   return g_source_add (priority, FALSE, &win32_watch_pipe_funcs, watch, user_data, notify);
00797 }

static gboolean g_io_win32_pipe_check gpointer  source_data,
GTimeVal current_time
[static]
 

Definition at line 457 of file giowin32.c.

References FALSE.

00459 {
00460   GIOWin32Watch *data = source_data;
00461   return FALSE;
00462 }

static void g_io_win32_pipe_close GIOChannel channel  )  [static]
 

Definition at line 750 of file giowin32.c.

References _GIOWin32Channel::fd.

00751 {
00752   GIOWin32Channel *win32_channel = (GIOWin32Channel *) channel;
00753 
00754   /* g_print ("g_io_win32_pipe_close: %#x %d\n", channel, win32_channel->fd); */
00755 
00756   close (win32_channel->fd);
00757   return;
00758 }

static void g_io_win32_pipe_destroy gpointer  source_data  )  [stati