Subversion Repositories Kolibri OS

Rev

Rev 4874 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
4349 Serge 1
/* Reentrant version of gettimeofday system call
2
   This implementation just calls the times/gettimeofday system calls.
3
   Gettimeofday may not be available on all targets.  It's presence
4
   here is dubious.  Consider it for internal use only.  */
5
 
6
#include 
7
#include 
8
#include 
9
#include 
10
#include <_syslist.h>
11
 
12
/* Some targets provides their own versions of these functions.  Those
13
   targets should define REENTRANT_SYSCALLS_PROVIDED in TARGET_CFLAGS.  */
14
 
15
#ifdef _REENT_ONLY
16
#ifndef REENTRANT_SYSCALLS_PROVIDED
17
#define REENTRANT_SYSCALLS_PROVIDED
18
#endif
19
#endif
20
 
21
#ifdef REENTRANT_SYSCALLS_PROVIDED
22
 
23
int _dummy_gettimeofday_syscalls = 1;
24
 
25
#else
26
 
27
/* We use the errno variable used by the system dependent layer.  */
28
#undef errno
4921 Serge 29
extern int errno;
4349 Serge 30
 
31
/*
32
FUNCTION
33
	<<_gettimeofday_r>>---Reentrant version of gettimeofday
34
 
35
INDEX
36
	_gettimeofday_r
37
 
38
ANSI_SYNOPSIS
39
	#include 
40
	#include 
41
	int _gettimeofday_r(struct _reent *<[ptr]>,
42
		struct timeval *<[ptimeval]>,
43
		void *<[ptimezone]>);
44
 
45
TRAD_SYNOPSIS
46
	#include 
47
	#include 
48
	int _gettimeofday_r(<[ptr]>, <[ptimeval]>, <[ptimezone]>)
49
	struct _reent *<[ptr]>;
50
	struct timeval *<[ptimeval]>;
51
	void *<[ptimezone]>;
52
 
53
DESCRIPTION
54
	This is a reentrant version of <>.  It
55
	takes a pointer to the global data block, which holds
56
	<>.
57
 
58
	This function is only available for a few targets.
59
	Check libc.a to see if its available on yours.
60
*/
61
 
62
int
63
_DEFUN (_gettimeofday_r, (ptr, ptimeval, ptimezone),
64
     struct _reent *ptr _AND
65
     struct timeval *ptimeval _AND
66
     void *ptimezone)
67
{
68
  int ret;
69
 
70
  errno = 0;
71
  if ((ret = _gettimeofday (ptimeval, ptimezone)) == -1 && errno != 0)
72
    ptr->_errno = errno;
73
  return ret;
74
}
75
 
76
#endif /* ! defined (REENTRANT_SYSCALLS_PROVIDED) */