/[dynamips]/upstream/dynamips-0.2.6-RC3/utils.h
This is repository of my old source code which isn't updated any more. Go to git.rot13.org for current projects!
ViewVC logotype

Diff of /upstream/dynamips-0.2.6-RC3/utils.h

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

upstream/dynamips-0.2.5/utils.h revision 1 by dpavlin, Sat Oct 6 16:01:44 2007 UTC upstream/dynamips-0.2.6-RC3/utils.h revision 4 by dpavlin, Sat Oct 6 16:06:49 2007 UTC
# Line 223  static inline m_tmcnt_t m_gettime_usec(v Line 223  static inline m_tmcnt_t m_gettime_usec(v
223     return(((m_tmcnt_t)tvp.tv_sec * 1000000) + (m_tmcnt_t)tvp.tv_usec);     return(((m_tmcnt_t)tvp.tv_sec * 1000000) + (m_tmcnt_t)tvp.tv_usec);
224  }  }
225    
226    #ifdef __CYGWIN__
227    #define GET_TIMEZONE _timezone
228    #else
229    #define GET_TIMEZONE timezone
230    #endif
231    
232    /* Get current time in number of ms (localtime) */
233    static inline m_tmcnt_t m_gettime_adj(void)
234    {
235       struct timeval tvp;
236       struct tm tmx;
237       time_t gmt_adjust;
238       time_t ct;
239    
240       gettimeofday(&tvp,NULL);
241       ct = tvp.tv_sec;
242       localtime_r(&ct,&tmx);
243    
244    #if defined(__CYGWIN__) || defined(SUNOS)
245       gmt_adjust = -(tmx.tm_isdst ? GET_TIMEZONE - 3600 : GET_TIMEZONE);
246    #else
247       gmt_adjust = tmx.tm_gmtoff;
248    #endif
249    
250       tvp.tv_sec += gmt_adjust;
251       return(((m_tmcnt_t)tvp.tv_sec * 1000) + ((m_tmcnt_t)tvp.tv_usec / 1000));
252    }
253    
254  /* Add an element to a list */  /* Add an element to a list */
255  m_list_t *m_list_add(m_list_t **head,void *data);  m_list_t *m_list_add(m_list_t **head,void *data);
256    
# Line 256  ssize_t m_read_file(char *filename,char Line 284  ssize_t m_read_file(char *filename,char
284  /* Allocate aligned memory */  /* Allocate aligned memory */
285  void *m_memalign(size_t boundary,size_t size);  void *m_memalign(size_t boundary,size_t size);
286    
287    /* Block specified signal for calling thread */
288    int m_signal_block(int sig);
289    
290    /* Unblock specified signal for calling thread */
291    int m_signal_unblock(int sig);
292    
293    /* Set non-blocking mode on a file descriptor */
294    int m_fd_set_non_block(int fd);
295    
296    /* Map a memory zone from a file */
297    u_char *memzone_map_file(int fd,size_t len);
298    
299    /* Map a memory zone from a file, with copy-on-write (COW) */
300    u_char *memzone_map_cow_file(int fd,size_t len);
301    
302    /* Create a file to serve as a memory zone */
303    int memzone_create_file(char *filename,size_t len,u_char **ptr);
304    
305    /* Open a file to serve as a COW memory zone */
306    int memzone_open_cow_file(char *filename,size_t len,u_char **ptr);
307    
308    /* Open a file and map it in memory */
309    int memzone_open_file(char *filename,u_char **ptr,off_t *fsize);
310    
311    /* Compute NVRAM checksum */
312    m_uint16_t nvram_cksum(m_uint16_t *ptr,size_t count);
313    
314  #endif  #endif

Legend:
Removed from v.1  
changed lines
  Added in v.4

  ViewVC Help
Powered by ViewVC 1.1.26