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

misc.c File Reference

#include <stdio.h>
#include <stdlib.h>
#include <stdarg.h>
#include <pthread.h>
#include <sys/time.h>
#include <time.h>
#include "tcpproxy.h"
#include "misc.h"

Go to the source code of this file.

Functions

void eprintf (const char *template,...)
void * xmalloc (size_t size)
void xfree (void *ptr)
void mutex_lock (char *caller, pthread_mutex_t *mut)
void mutex_unlock (char *caller, pthread_mutex_t *mut)
long get_uclock ()
long get_mclock ()
void safe_exit (int val)
unsigned ceil_div (unsigned a, unsigned b)


Function Documentation

unsigned ceil_div unsigned  a,
unsigned  b
[inline]
 

Definition at line 137 of file misc.c.

void eprintf const char *  template,
  ...
[inline]
 

Definition at line 19 of file misc.c.

long get_mclock  )  [inline]
 

Definition at line 105 of file misc.c.

Referenced by add_tcp_sent(), add_timer(), clear_timer(), and tcp_timer().

long get_uclock  )  [inline]
 

Definition at line 93 of file misc.c.

void mutex_lock char *  caller,
pthread_mutex_t *  mut
[inline]
 

Definition at line 65 of file misc.c.

References EPRINT, EXIT_ERR_MUTEX, and safe_exit().

Referenced by add_timer(), alloc_tcp_queue(), clear_timer(), close_tcp_queue(), handle_tcp(), left_timer(), mh_ack_rcvd(), packet_timeout(), queue_packet(), reset_tcp_queue(), scheduler(), tcp_timeout(), and tcp_timer().

void mutex_unlock char *  caller,
pthread_mutex_t *  mut
[inline]
 

Definition at line 79 of file misc.c.

References EPRINT, EXIT_ERR_MUTEX, and safe_exit().

Referenced by add_timer(), alloc_tcp_queue(), clear_timer(), close_tcp_queue(), handle_tcp(), left_timer(), mh_ack_rcvd(), packet_timeout(), queue_packet(), reset_tcp_queue(), scheduler(), tcp_timeout(), and tcp_timer().

void safe_exit int  val  ) 
 

Definition at line 119 of file misc.c.

References main_thread, and request_exit.

Referenced by init_sched(), mutex_lock(), mutex_unlock(), xfree(), and xmalloc().

void xfree void *  ptr  )  [inline]
 

Definition at line 49 of file misc.c.

References EPRINT, EXIT_ERR_MEM_FREE, and safe_exit().

Referenced by cleanup_sched(), cleanup_timer(), clear_tcp_queue(), clear_timer(), dealloc_packet_data(), mh_ack_rcvd(), packet_timeout(), send_tcp_rst(), and tcp_timer().

void* xmalloc size_t  size  )  [inline]
 

Definition at line 32 of file misc.c.

References EPRINT, EXIT_ERR_MEM_ALLOC, and safe_exit().

Referenced by add_tcp_sent(), add_timer(), alloc_packet_data(), init_sched(), and send_tcp_rst().


Generated on Sun May 14 13:36:52 2006 by  doxygen 1.4.2