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

glib_os_hnd.c File Reference

#include <config.h>
#include <stdlib.h>
#include <errno.h>
#include <stdio.h>
#include <sys/types.h>
#include <sys/stat.h>
#include <fcntl.h>
#include <unistd.h>
#include <pthread.h>
#include <string.h>
#include <signal.h>
#include <OpenIPMI/os_handler.h>
#include <glib.h>

Go to the source code of this file.

Classes

struct  g_os_hnd_data_s
struct  os_hnd_fd_id_s
struct  os_hnd_timer_id_s
struct  vlog_data_s
struct  os_hnd_lock_s
struct  os_hnd_cond_s

Defines

#define _GNU_SOURCE

Typedefs

typedef g_os_hnd_data_s g_os_hnd_data_t
typedef vlog_data_s vlog_data_t

Functions

static gboolean fd_handler (GIOChannel *source, GIOCondition condition, gpointer data)
static void free_fd_data (gpointer data)
static int add_fd (os_handler_t *handler, int fd, os_data_ready_t data_ready, void *cb_data, os_fd_data_freed_t freed, os_hnd_fd_id_t **id)
static int remove_fd (os_handler_t *handler, os_hnd_fd_id_t *fd_data)
static gboolean timer_handler (gpointer data)
static int start_timer (os_handler_t *handler, os_hnd_timer_id_t *id, struct timeval *timeout, os_timed_out_t timed_out, void *cb_data)
static int stop_timer (os_handler_t *handler, os_hnd_timer_id_t *id)
static int alloc_timer (os_handler_t *handler, os_hnd_timer_id_t **id)
static int free_timer (os_handler_t *handler, os_hnd_timer_id_t *id)
static int get_random (os_handler_t *handler, void *data, unsigned int len)
static void vlog_data_destroy (gpointer data)
static vlog_data_tget_vlog_data (void)
static void add_vlog_data (vlog_data_t *info, const char *format, va_list ap)
static void glib_vlog (os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format, va_list ap)
static void glib_log (os_handler_t *handler, enum ipmi_log_type_e log_type, const char *format,...)
static int create_lock (os_handler_t *handler, os_hnd_lock_t **id)
static int destroy_lock (os_handler_t *handler, os_hnd_lock_t *id)
static int lock (os_handler_t *handler, os_hnd_lock_t *id)
static int unlock (os_handler_t *handler, os_hnd_lock_t *id)
static int create_cond (os_handler_t *handler, os_hnd_cond_t **new_cond)
static int destroy_cond (os_handler_t *handler, os_hnd_cond_t *cond)
static int cond_wait (os_handler_t *handler, os_hnd_cond_t *cond, os_hnd_lock_t *lock)
static int cond_timedwait (os_handler_t *handler, os_hnd_cond_t *cond, os_hnd_lock_t *lock, struct timeval *rtimeout)
static int cond_wake (os_handler_t *handler, os_hnd_cond_t *cond)
static int cond_broadcast (os_handler_t *handler, os_hnd_cond_t *cond)
static gint timeout_callback (gpointer data)
static int perform_one_op (os_handler_t *os_hnd, struct timeval *timeout)
static void operation_loop (os_handler_t *os_hnd)
static void free_os_handler (os_handler_t *os_hnd)
static void * glib_malloc (int size)
static void glib_free (void *data)
static void sset_log_handler (os_handler_t *handler, os_vlog_t log_handler)
os_handler_tipmi_glib_get_os_handler (int priority)
static void glib_handle_log (const gchar *log_domain, GLogLevelFlags log_level, const gchar *message, gpointer user_data)
void ipmi_glib_set_log_handler (void(*hndlr)(const char *domain, const char *pfx, const char *msg))

Variables

static GStaticPrivate vlog_private = G_STATIC_PRIVATE_INIT
static os_handler_t ipmi_glib_os_handler
static void(* log_hndlr )(const char *domain, const char *pfx, const char *msg)


Define Documentation

#define _GNU_SOURCE
 

Definition at line 37 of file glib_os_hnd.c.


Typedef Documentation

typedef struct g_os_hnd_data_s g_os_hnd_data_t
 

typedef struct vlog_data_s vlog_data_t
 


Function Documentation

static int add_fd os_handler_t handler,
int  fd,
os_data_ready_t  data_ready,
void *  cb_data,
os_fd_data_freed_t  freed,
os_hnd_fd_id_t **  id
[static]
 

Definition at line 110 of file glib_os_hnd.c.

References fd_handler(), free_fd_data(), os_handler_s::internal_data, and g_os_hnd_data_s::priority.

00116 {
00117     os_hnd_fd_id_t  *fd_data;
00118     g_os_hnd_data_t *info = handler->internal_data;
00119 
00120     fd_data = g_malloc(sizeof(*fd_data));
00121     if (!fd_data)
00122         return ENOMEM;
00123     memset(fd_data, 0, sizeof(fd_data));
00124     fd_data->chan = g_io_channel_unix_new(fd);
00125     if (!fd_data->chan) {
00126         g_free(fd_data);
00127         return ENOMEM;
00128     }
00129 
00130     fd_data->fd = fd;
00131     fd_data->cb_data = cb_data;
00132     fd_data->data_ready = data_ready;
00133     fd_data->handler = handler;
00134     fd_data->freed = freed;
00135 
00136     fd_data->ev_id = g_io_add_watch_full(fd_data->chan,
00137                                          info->priority,
00138                                          G_IO_IN,
00139                                          fd_handler,
00140                                          fd_data,
00141                                          free_fd_data);
00142 
00143     *id = fd_data;
00144     return 0;
00145 }

static void add_vlog_data vlog_data_t info,
const char *  format,
va_list  ap
[static]
 

Definition at line 335 of file glib_os_hnd.c.

References vlog_data_s::curr, vlog_data_s::data, and vlog_data_s::len.

Referenced by glib_vlog().

00338 {
00339     int len;
00340 
00341     len = vsnprintf(info->data+info->curr, info->len-info->curr, format, ap);
00342     if ((len + info->curr) > info->len) {
00343         char *nd;
00344         int  new_size;
00345 
00346         new_size = info->len + 64;
00347         while (new_size < (len + info->curr))
00348             new_size += 64;
00349 
00350         nd = g_malloc(new_size);
00351         if (!nd)
00352             return;
00353         if (info->data) {
00354             memcpy(nd, info->data, info->curr);
00355             g_free(info->data);
00356         }
00357         info->data = nd;
00358         info->len = new_size;
00359         len = vsnprintf(info->data+info->curr, info->len-info->curr,
00360                         format, ap);
00361     }
00362 
00363     info->curr += len;
00364 }

static int alloc_timer os_handler_t handler,
os_hnd_timer_id_t **  id
[static]
 

Definition at line 220 of file glib_os_hnd.c.

00222 {
00223     os_hnd_timer_id_t *timer_data;
00224 
00225     timer_data = g_malloc(sizeof(*timer_data));
00226     if (!timer_data)
00227         return ENOMEM;
00228 
00229     timer_data->running = 0;
00230     timer_data->timed_out = NULL;
00231     timer_data->handler = handler;
00232 
00233     *id = timer_data;
00234     return 0;
00235 }

static int cond_broadcast os_handler_t handler,
os_hnd_cond_t cond
[static]
 

Definition at line 560 of file glib_os_hnd.c.

References os_hnd_cond_s::cond.

00562 {
00563      g_cond_broadcast(cond->cond);
00564      return 0;
00565 }

static int cond_timedwait os_handler_t handler,
os_hnd_cond_t cond,
os_hnd_lock_t lock,
struct timeval *  rtimeout
[static]
 

Definition at line 528 of file glib_os_hnd.c.

References os_hnd_cond_s::cond, and os_hnd_lock_s::mutex.

00532 {
00533     GTimeVal timeout;
00534     GTimeVal now;
00535     int      rv;
00536 
00537     g_get_current_time(&now);
00538     timeout.tv_sec = rtimeout->tv_sec + now.tv_sec;
00539     timeout.tv_usec = rtimeout->tv_usec + now.tv_usec;
00540     while (timeout.tv_usec > 1000000) {
00541         timeout.tv_sec += 1;
00542         timeout.tv_usec -= 1000000;
00543     }
00544 
00545     rv = g_cond_timed_wait(cond->cond, lock->mutex, &timeout);
00546     if (rv)
00547         return ETIMEDOUT;
00548     return 0;
00549 }

static int cond_wait os_handler_t handler,
os_hnd_cond_t cond,
os_hnd_lock_t lock
[static]
 

Definition at line 519 of file glib_os_hnd.c.

References os_hnd_cond_s::cond, and os_hnd_lock_s::mutex.

00522 {
00523     g_cond_wait(cond->cond, lock->mutex);
00524     return 0;
00525 }

static int cond_wake os_handler_t handler,
os_hnd_cond_t cond
[static]
 

Definition at line 552 of file glib_os_hnd.c.

References os_hnd_cond_s::cond.

00554 {
00555      g_cond_signal(cond->cond);
00556      return 0;
00557 }

static int create_cond os_handler_t handler,
os_hnd_cond_t **  new_cond
[static]
 

Definition at line 491 of file glib_os_hnd.c.

00493 {
00494     os_hnd_cond_t *cond;
00495 
00496     cond = g_malloc(sizeof(*cond));
00497     if (!cond)
00498         return ENOMEM;
00499     cond->cond = g_cond_new();
00500     if (!cond->cond) {
00501         g_free(cond);
00502         return ENOMEM;
00503     }
00504 
00505     *new_cond = cond;
00506     return 0;
00507 }

static int create_lock os_handler_t handler,
os_hnd_lock_t **  id
[static]
 

Definition at line 442 of file glib_os_hnd.c.

References lock().

00444 {
00445     os_hnd_lock_t *lock;
00446 
00447     lock = g_malloc(sizeof(*lock));
00448     if (!lock)
00449         return ENOMEM;
00450     lock->mutex = g_mutex_new();
00451     if (!lock->mutex) {
00452         g_free(lock);
00453         return ENOMEM;
00454     }
00455 
00456     *id = lock;
00457     return 0;
00458 }

static int destroy_cond os_handler_t handler,
os_hnd_cond_t cond
[static]
 

Definition at line 510 of file glib_os_hnd.c.

References os_hnd_cond_s::cond.

00512 {
00513     g_cond_free(cond->cond);
00514     g_free(cond);
00515     return 0;
00516 }

static int destroy_lock os_handler_t handler,
os_hnd_lock_t id
[static]
 

Definition at line 461 of file glib_os_hnd.c.

References os_hnd_lock_s::mutex.

00463 {
00464     g_mutex_free(id->mutex);
00465     g_free(id);
00466     return 0;
00467 }

static gboolean fd_handler GIOChannel *  source,
GIOCondition  condition,
gpointer  data
[static]
 

Definition at line 83 of file glib_os_hnd.c.

References os_hnd_fd_id_s::cb_data, os_hnd_fd_id_s::data_ready, os_hnd_fd_id_s::fd, and handler.

00086 {
00087     os_hnd_fd_id_t  *fd_data = (os_hnd_fd_id_t *) data;
00088     void            *cb_data;
00089     os_data_ready_t handler;
00090     int             fd;
00091 
00092     handler = fd_data->data_ready;
00093     cb_data = fd_data->cb_data;
00094     fd = fd_data->fd;
00095     handler(fd, cb_data, fd_data);
00096     return TRUE;
00097 }

static void free_fd_data gpointer  data  )  [static]
 

Definition at line 100 of file glib_os_hnd.c.

References os_hnd_fd_id_s::cb_data, os_hnd_fd_id_s::fd, and os_hnd_fd_id_s::freed.

00101 {
00102     os_hnd_fd_id_t *fd_data = (void *) data;
00103 
00104     if (fd_data->freed)
00105         fd_data->freed(fd_data->fd, fd_data->cb_data);
00106     g_free(data);
00107 }

static void free_os_handler os_handler_t os_hnd  )  [static]
 

Definition at line 626 of file glib_os_hnd.c.

References os_handler_s::internal_data.

00627 {
00628     g_os_hnd_data_t *info = os_hnd->internal_data;
00629 
00630 #ifdef HAVE_GDBM
00631     g_mutex_free(info->gdbm_lock);
00632     if (info->gdbm_filename)
00633         free(info->gdbm_filename);
00634     if (info->gdbmf)
00635         gdbm_close(info->gdbmf);
00636 #endif
00637     g_free(info);
00638     g_free(os_hnd);
00639 }

static int free_timer os_handler_t handler,
os_hnd_timer_id_t id
[static]
 

Definition at line 238 of file glib_os_hnd.c.

References os_hnd_timer_id_s::running.

00239 {
00240     if (id->running)
00241         return EBUSY;
00242 
00243     g_free(id);
00244     return 0;
00245 }

static int get_random os_handler_t handler,
void *  data,
unsigned int  len
[static]
 

Definition at line 249 of file glib_os_hnd.c.

00250 {
00251 #if GLIB_MAJOR_VERSION < 2
00252     int fd = open("/dev/urandom", O_RDONLY);
00253     int rv = 0;
00254 
00255     if (fd == -1)
00256         return errno;
00257 
00258     while (len > 0) {
00259         rv = read(fd, data, len);
00260         if (rv < 0) {
00261             rv = errno;
00262             goto out;
00263         }
00264         len -= rv;
00265     }
00266 
00267     rv = 0;
00268 
00269  out:
00270     close(fd);
00271     return rv;
00272 #else
00273     gint32 val;
00274     char   *out = data;
00275 
00276     while (len >= sizeof(val)) {
00277         val = g_random_int();
00278         memcpy(out, &val, sizeof(val));
00279         len -= sizeof(val);
00280         out += sizeof(val);
00281     }
00282 
00283     if (len) {
00284         val = g_random_int();
00285         memcpy(out, &val, len);
00286         len -= sizeof(val);
00287     }
00288 
00289     return 0;
00290 #endif
00291 }

static vlog_data_t* get_vlog_data void   )  [static]
 

Definition at line 313 of file glib_os_hnd.c.

References vlog_data_destroy(), and vlog_private.

Referenced by glib_vlog().

00314 {
00315     vlog_data_t *rv;
00316 
00317     rv = g_static_private_get(&vlog_private);
00318     if (!rv) {
00319         rv = g_malloc(sizeof(*rv));
00320         if (rv) {
00321             memset(rv, 0, sizeof(*rv));
00322             rv->data = g_malloc(1024);
00323             if (rv->data)
00324                 rv->len = 1024;
00325             else
00326                 rv->len = 0;
00327             g_static_private_set(&vlog_private, rv, vlog_data_destroy);
00328         }
00329     }
00330 
00331     return rv;
00332 }

static void glib_free void *  data  )  [static]
 

Definition at line 648 of file glib_os_hnd.c.

00649 {
00650     g_free(data);
00651 }

static void glib_handle_log const gchar *  log_domain,
GLogLevelFlags  log_level,
const gchar *  message,
gpointer  user_data
[static]
 

Definition at line 863 of file glib_os_hnd.c.

References log_hndlr.

Referenced by ipmi_glib_set_log_handler(), and main().

00867 {
00868     void (*hndlr)(const char *domain, const char *pfx, const char *msg);
00869     char *pfx = "";
00870     if (log_level & G_LOG_LEVEL_ERROR)
00871         pfx = "FATL";
00872     else if (log_level & G_LOG_LEVEL_CRITICAL)
00873         pfx = "SEVR";
00874     else if (log_level & G_LOG_LEVEL_WARNING)
00875         pfx = "WARN";
00876     else if (log_level & G_LOG_LEVEL_MESSAGE)
00877         pfx = "EINF";
00878     else if (log_level & G_LOG_LEVEL_INFO)
00879         pfx = "INFO";
00880     else if (log_level & G_LOG_LEVEL_DEBUG)
00881         pfx = "DEBG";
00882 
00883     hndlr = log_hndlr;
00884     if (hndlr)
00885         hndlr(log_domain, pfx, message);
00886 }

static void glib_log os_handler_t handler,
enum ipmi_log_type_e  log_type,
const char *  format,
  ...
[static]
 

Definition at line 423 of file glib_os_hnd.c.

References glib_vlog().

00427 {
00428     va_list ap;
00429 
00430     va_start(ap, format);
00431     glib_vlog(handler, log_type, format, ap);
00432     va_end(ap);
00433 }

static void* glib_malloc int  size  )  [static]
 

Definition at line 642 of file glib_os_hnd.c.

00643 {
00644     return g_malloc(size);
00645 }

static void glib_vlog os_handler_t handler,
enum ipmi_log_type_e  log_type,
const char *  format,
va_list  ap
[static]
 

Definition at line 367 of file glib_os_hnd.c.

References add_vlog_data(), vlog_data_s::curr, vlog_data_s::data, flags, get_vlog_data(), os_handler_s::internal_data, IPMI_LOG_DEBUG, IPMI_LOG_DEBUG_CONT, IPMI_LOG_DEBUG_END, IPMI_LOG_DEBUG_START, IPMI_LOG_ERR_INFO, IPMI_LOG_FATAL, IPMI_LOG_INFO, IPMI_LOG_SEVERE, IPMI_LOG_WARNING, g_os_hnd_data_s::log_handler, and log_handler.

Referenced by glib_log().

00371 {
00372     GLogLevelFlags  flags;
00373     vlog_data_t     *info;
00374     g_os_hnd_data_t *ginfo = handler->internal_data;
00375     os_vlog_t       log_handler = ginfo->log_handler;
00376 
00377     if (log_handler) {
00378         log_handler(handler, format, log_type, ap);
00379         return;
00380     }
00381 
00382     switch (log_type) {
00383     case IPMI_LOG_INFO:         flags = G_LOG_LEVEL_INFO; break;
00384     case IPMI_LOG_WARNING:      flags = G_LOG_LEVEL_WARNING; break;
00385     case IPMI_LOG_SEVERE:       flags = G_LOG_LEVEL_CRITICAL; break;
00386     case IPMI_LOG_FATAL:        flags = G_LOG_LEVEL_ERROR; break;
00387     case IPMI_LOG_ERR_INFO:     flags = G_LOG_LEVEL_MESSAGE; break;
00388     case IPMI_LOG_DEBUG:        flags = G_LOG_LEVEL_DEBUG; break;
00389 
00390     case IPMI_LOG_DEBUG_END:
00391         info = get_vlog_data();
00392         if (!info)
00393             return;
00394         add_vlog_data(info, format, ap);
00395         g_log("OpenIPMI", G_LOG_LEVEL_DEBUG, "%s", info->data);
00396         info->curr = 0;
00397         return;
00398 
00399     case IPMI_LOG_DEBUG_START:
00400         info = get_vlog_data();
00401         if (!info)
00402             return;
00403         info->curr = 0;
00404         add_vlog_data(info, format, ap);
00405         return;
00406 
00407     case IPMI_LOG_DEBUG_CONT:
00408         info = get_vlog_data();
00409         if (!info)
00410             return;
00411         add_vlog_data(info, format, ap);
00412         return;
00413 
00414     default:
00415         flags = G_LOG_LEVEL_INFO;
00416         break;
00417     }
00418 
00419     g_logv("OpenIPMI", flags, format, ap);
00420 }

os_handler_t* ipmi_glib_get_os_handler int  priority  ) 
 

Definition at line 824 of file glib_os_hnd.c.

Referenced by main().

00825 {
00826     os_handler_t    *rv;
00827     g_os_hnd_data_t *info;
00828 
00829     if (!g_thread_supported ())
00830         g_thread_init(NULL);
00831 
00832     rv = g_malloc(sizeof(*rv));
00833     if (!rv)
00834         return NULL;
00835 
00836     memcpy(rv, &ipmi_glib_os_handler, sizeof(*rv));
00837 
00838     info = g_malloc(sizeof(*info));
00839     if (! info) {
00840         g_free(rv);
00841         return NULL;
00842     }
00843     memset(info, 0, sizeof(*info));
00844 
00845 #ifdef HAVE_GDBM
00846     info->gdbm_lock = g_mutex_new();
00847     if (!info->gdbm_lock) {
00848         free(info);
00849         free(rv);
00850         return NULL;
00851     }
00852 #endif
00853 
00854     info->priority = priority;
00855     rv->internal_data = info;
00856 
00857     return rv;
00858 }

void ipmi_glib_set_log_handler void(*)(const char *domain, const char *pfx, const char *msg)  hndlr  ) 
 

Definition at line 889 of file glib_os_hnd.c.

References glib_handle_log(), and log_hndlr.

00892 {
00893     log_hndlr = hndlr;
00894     g_log_set_handler("OpenIPMI",
00895                       G_LOG_LEVEL_ERROR
00896                       | G_LOG_LEVEL_CRITICAL
00897                       | G_LOG_LEVEL_WARNING
00898                       | G_LOG_LEVEL_MESSAGE
00899                       | G_LOG_LEVEL_INFO
00900                       | G_LOG_LEVEL_DEBUG
00901                       | G_LOG_FLAG_FATAL,
00902                       glib_handle_log,
00903                       NULL);
00904 }

static int lock os_handler_t handler,
os_hnd_lock_t id
[static]
 

Definition at line 470 of file glib_os_hnd.c.

References os_hnd_lock_s::mutex.

Referenced by create_lock(), find_free_lan_fd(), ipmi_create_lock_os_hnd(), ipmi_create_rwlock_os_hnd(), ll_std_lock(), ll_std_unlock(), and locked_list_alloc().

00472 {
00473     g_mutex_lock(id->mutex);
00474     return 0;
00475 }

static void operation_loop os_handler_t os_hnd  )  [static]
 

Definition at line 619 of file glib_os_hnd.c.

00620 {
00621     for (;;)
00622         g_main_iteration(TRUE);
00623 }

static int perform_one_op os_handler_t os_hnd,
struct timeval *  timeout
[static]
 

Definition at line 605 of file glib_os_hnd.c.

References timeout_callback().

00607 {
00608     /* Note that this is not technically 100% correct in a
00609        multi-threaded environment, since another thread may run
00610        it, but it is pretty close, I guess. */
00611     int   time_ms = (timeout->tv_sec * 1000) + ((timeout->tv_usec+500) / 1000);
00612     guint guid = g_timeout_add(time_ms, timeout_callback, NULL);
00613     g_main_iteration(TRUE);
00614     g_source_remove(guid);
00615     return 0;
00616 }

static int remove_fd os_handler_t handler,
os_hnd_fd_id_t fd_data
[static]
 

Definition at line 148 of file glib_os_hnd.c.

References os_hnd_fd_id_s::ev_id.

00149 {
00150     g_source_remove(fd_data->ev_id);
00151     /* fd_data gets freed in the free_fd_data callback registered at
00152        set time. */
00153     return 0;
00154 }

static void sset_log_handler os_handler_t handler,
os_vlog_t  log_handler
[static]
 

Definition at line 766 of file glib_os_hnd.c.

References os_handler_s::internal_data, and g_os_hnd_data_s::log_handler.

00768 {
00769     g_os_hnd_data_t *info = handler->internal_data;
00770 
00771     info->log_handler = log_handler;
00772 }

static int start_timer os_handler_t handler,
os_hnd_timer_id_t id,
struct timeval *  timeout,
os_timed_out_t  timed_out,
void *  cb_data
[static]
 

Definition at line 182 of file glib_os_hnd.c.

References os_handler_s::internal_data, g_os_hnd_data_s::priority, os_hnd_timer_id_s::running, and timer_handler().

00187 {
00188     g_os_hnd_data_t *info = handler->internal_data;
00189     guint           interval;
00190 
00191     if (id->running)
00192         return EBUSY;
00193 
00194     id->running = 1;
00195     id->cb_data = cb_data;
00196     id->timed_out = timed_out;
00197 
00198     interval = (timeout->tv_sec * 1000) | ((timeout->tv_usec + 999) / 1000);
00199     id->ev_id = g_timeout_add_full(info->priority,
00200                                    interval,
00201                                    timer_handler,
00202                                    id,
00203                                    NULL);
00204     return 0;
00205 }

static int stop_timer os_handler_t handler,
os_hnd_timer_id_t id
[static]
 

Definition at line 208 of file glib_os_hnd.c.

References os_hnd_timer_id_s::ev_id, and os_hnd_timer_id_s::running.

00209 {
00210     if (!id->running)
00211         return EINVAL;
00212 
00213     id->running = 0;
00214     g_source_remove(id->ev_id);
00215 
00216     return 0;
00217 }

static gint timeout_callback gpointer  data  )  [static]
 

Definition at line 598 of file glib_os_hnd.c.

Referenced by perform_one_op().

00599 {
00600     /* We continually run the timer until it is cancelled. */
00601     return TRUE;
00602 }

static gboolean timer_handler gpointer  data  )  [static]
 

Definition at line 166 of file glib_os_hnd.c.

References os_hnd_timer_id_s::cb_data, os_hnd_timer_id_s::running, and os_hnd_timer_id_s::timed_out.

00167 {
00168     os_hnd_timer_id_t *timer_data = (os_hnd_timer_id_t *) data;
00169     /* Make a copy of this, because the handler may delete the timer
00170        data. */
00171     void              *cb_data;
00172     os_timed_out_t    timed_out;
00173 
00174     timed_out = timer_data->timed_out;
00175     cb_data = timer_data->cb_data;
00176     timer_data->running = 0;
00177     timed_out(cb_data, timer_data);
00178     return FALSE;
00179 }

static int unlock os_handler_t handler,
os_hnd_lock_t id
[static]
 

Definition at line 478 of file glib_os_hnd.c.

References os_hnd_lock_s::mutex.

00480 {
00481     g_mutex_unlock(id->mutex);
00482     return 0;
00483 }

static void vlog_data_destroy gpointer  data  )  [static]
 

Definition at line 303 of file glib_os_hnd.c.

References vlog_data_s::data.

Referenced by get_vlog_data().

00304 {
00305     vlog_data_t *info = data;
00306 
00307     if (info->data)
00308         g_free(info->data);
00309     g_free(info);
00310 }


Variable Documentation

os_handler_t ipmi_glib_os_handler [static]
 

Definition at line 774 of file glib_os_hnd.c.

void(* log_hndlr)(const char *domain, const char *pfx, const char *msg) [static]
 

Definition at line 860 of file glib_os_hnd.c.

Referenced by glib_handle_log(), and ipmi_glib_set_log_handler().

GStaticPrivate vlog_private = G_STATIC_PRIVATE_INIT [static]
 

Definition at line 293 of file glib_os_hnd.c.

Referenced by get_vlog_data().


© sourcejam.com 2005-2008