#include "glib.h"#include <sys/types.h>#include <unistd.h>#include <errno.h>Go to the source code of this file.
|
|
|
|
|
|
|
|
Definition at line 309 of file giounix.c. Referenced by g_io_channel_win32_get_fd(). 00310 { 00311 GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel; 00312 return unix_channel->fd; 00313 }
|
|
|
Definition at line 296 of file giounix.c. 00297 { 00298 GIOUnixChannel *unix_channel = g_new (GIOUnixChannel, 1); 00299 GIOChannel *channel = (GIOChannel *)unix_channel; 00300 00301 g_io_channel_init (channel); 00302 channel->funcs = &unix_channel_funcs; 00303 00304 unix_channel->fd = fd; 00305 return channel; 00306 }
|
|
||||||||||||||||||||||||||||
|
Definition at line 271 of file giounix.c. References _GIOUnixWatch::callback, _GIOUnixWatch::channel, _GIOUnixWatch::condition, _GPollFD::events, _GIOUnixChannel::fd, _GPollFD::fd, g_io_channel_ref(), g_main_add_poll(), g_new, g_source_add(), _GIOUnixWatch::pollfd, TRUE, and watch. 00277 { 00278 GIOUnixWatch *watch = g_new (GIOUnixWatch, 1); 00279 GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel; 00280 00281 watch->channel = channel; 00282 g_io_channel_ref (channel); 00283 00284 watch->callback = func; 00285 watch->condition = condition; 00286 00287 watch->pollfd.fd = unix_channel->fd; 00288 watch->pollfd.events = condition; 00289 00290 g_main_add_poll (&watch->pollfd, priority); 00291 00292 return g_source_add (priority, TRUE, &unix_watch_funcs, watch, user_data, notify); 00293 }
|
|
||||||||||||||||
|
Definition at line 118 of file giounix.c. References _GIOUnixWatch::condition, _GIOUnixWatch::pollfd, and _GPollFD::revents. 00121 { 00122 GIOUnixWatch *data = source_data; 00123 00124 return (data->pollfd.revents & data->condition); 00125 }
|
|
|
Definition at line 255 of file giounix.c. References _GIOUnixChannel::fd. 00256 { 00257 GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel; 00258 00259 close (unix_channel->fd); 00260 }
|
|
|
Definition at line 141 of file giounix.c. References _GIOUnixWatch::channel, g_free(), g_io_channel_unref(), g_main_remove_poll(), and _GIOUnixWatch::pollfd. 00142 { 00143 GIOUnixWatch *data = source_data; 00144 00145 g_main_remove_poll (&data->pollfd); 00146 g_io_channel_unref (data->channel); 00147 g_free (data); 00148 }
|
|
||||||||||||||||
|
Definition at line 128 of file giounix.c. References _GIOUnixWatch::callback, _GIOUnixWatch::channel, _GIOUnixWatch::condition, _GIOUnixWatch::pollfd, and _GPollFD::revents. 00132 { 00133 GIOUnixWatch *data = source_data; 00134 00135 return (*data->callback)(data->channel, 00136 data->pollfd.revents & data->condition, 00137 user_data); 00138 }
|
|
|
Definition at line 263 of file giounix.c. References g_free(). 00264 { 00265 GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel; 00266 00267 g_free (unix_channel); 00268 }
|
|
||||||||||||||||||||
|
Definition at line 108 of file giounix.c. References FALSE. 00112 { 00113 *timeout = -1; 00114 return FALSE; 00115 }
|
|
||||||||||||||||||||
|
Definition at line 151 of file giounix.c. References _GIOUnixChannel::fd, G_IO_ERROR_AGAIN, G_IO_ERROR_INVAL, G_IO_ERROR_NONE, and G_IO_ERROR_UNKNOWN. 00155 { 00156 GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel; 00157 gint result; 00158 00159 result = read (unix_channel->fd, buf, count); 00160 00161 if (result < 0) 00162 { 00163 *bytes_read = 0; 00164 switch (errno) 00165 { 00166 case EINVAL: 00167 return G_IO_ERROR_INVAL; 00168 case EAGAIN: 00169 return G_IO_ERROR_AGAIN; 00170 default: 00171 return G_IO_ERROR_UNKNOWN; 00172 } 00173 } 00174 else 00175 { 00176 *bytes_read = result; 00177 return G_IO_ERROR_NONE; 00178 } 00179 }
|
|
||||||||||||||||
|
Definition at line 213 of file giounix.c. References _GIOUnixChannel::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(). 00216 { 00217 GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel; 00218 int whence; 00219 off_t result; 00220 00221 switch (type) 00222 { 00223 case G_SEEK_SET: 00224 whence = SEEK_SET; 00225 break; 00226 case G_SEEK_CUR: 00227 whence = SEEK_CUR; 00228 break; 00229 case G_SEEK_END: 00230 whence = SEEK_END; 00231 break; 00232 default: 00233 g_warning ("g_io_unix_seek: unknown seek type"); 00234 return G_IO_ERROR_UNKNOWN; 00235 } 00236 00237 result = lseek (unix_channel->fd, offset, whence); 00238 00239 if (result < 0) 00240 { 00241 switch (errno) 00242 { 00243 case EINVAL: 00244 return G_IO_ERROR_INVAL; 00245 default: 00246 return G_IO_ERROR_UNKNOWN; 00247 } 00248 } 00249 else 00250 return G_IO_ERROR_NONE; 00251 }
|
|
||||||||||||||||||||
|
Definition at line 182 of file giounix.c. References _GIOUnixChannel::fd, G_IO_ERROR_AGAIN, G_IO_ERROR_INVAL, G_IO_ERROR_NONE, and G_IO_ERROR_UNKNOWN. 00186 { 00187 GIOUnixChannel *unix_channel = (GIOUnixChannel *)channel; 00188 gint result; 00189 00190 result = write (unix_channel->fd, buf, count); 00191 00192 if (result < 0) 00193 { 00194 *bytes_written = 0; 00195 switch (errno) 00196 { 00197 case EINVAL: 00198 return G_IO_ERROR_INVAL; 00199 case EAGAIN: 00200 return G_IO_ERROR_AGAIN; 00201 default: 00202 return G_IO_ERROR_UNKNOWN; 00203 } 00204 } 00205 else 00206 { 00207 *bytes_written = result; 00208 return G_IO_ERROR_NONE; 00209 } 00210 }
|
|
|
Initial value: |
|
|
Initial value: |