ReactOS  0.4.15-dev-1150-g593bcce
adns_unix_calls.c File Reference
#include "adns.h"
Include dependency graph for adns_unix_calls.c:

Go to the source code of this file.

Functions

int adns_writev (int FileDescriptor, const struct iovec *iov, int iovCount)
 
int adns_inet_aton (const char *cp, struct in_addr *inp)
 
int adns_getpid ()
 
int gettimeofday (struct timeval *tv, struct timezone *tz)
 

Function Documentation

◆ adns_getpid()

int adns_getpid ( )

Definition at line 75 of file adns_unix_calls.c.

76 {
77  return GetCurrentProcessId();
78 }
DWORD WINAPI GetCurrentProcessId(VOID)
Definition: proc.c:1158

◆ adns_inet_aton()

int adns_inet_aton ( const char cp,
struct in_addr inp 
)

Definition at line 56 of file adns_unix_calls.c.

57 {
58  if (!cp || !*cp || !inp)
59  {
60  errno = EINVAL;
61  return -1;
62  }
63 
64  if (!strcmp(cp, "255.255.255.255"))
65  {
66  // Special case
67  inp->s_addr = INADDR_NONE;
68  return 0;
69  }
70 
71  inp->s_addr = inet_addr(cp);
72  return (inp->s_addr == INADDR_NONE) ? -1 : 0;
73 }
#define inet_addr(cp)
Definition: inet.h:98
Definition: arc.h:39
#define INADDR_NONE
Definition: tcp.c:42
int errno
u32_t s_addr
Definition: inet.h:45
POINT cp
Definition: magnifier.c:59
int strcmp(const char *String1, const char *String2)
Definition: utclib.c:469

◆ adns_writev()

int adns_writev ( int  FileDescriptor,
const struct iovec iov,
int  iovCount 
)

Definition at line 33 of file adns_unix_calls.c.

34 {
35  size_t total_len = 0;
36  int i = 0, r = 0;
37  char *buf = NULL, *p = NULL;
38 
39  for(; i < iovCount; i++)
40  total_len += iov[i].iov_len;
41 
42  p = buf = (char *)_alloca(total_len);
43 
44  for(; i < iovCount; i++)
45  {
46  memcpy(p, iov[i].iov_base, iov[i].iov_len);
47  p += iov[i].iov_len;
48  }
49 
51  r = send(FileDescriptor, buf, total_len, 0);
53  return r;
54 }
GLenum GLuint GLenum GLsizei const GLchar * buf
Definition: glext.h:7751
GLdouble GLdouble GLdouble r
Definition: gl.h:2055
GLsizei GLenum const GLvoid GLsizei GLenum GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLint GLint GLint GLshort GLshort GLshort GLubyte GLubyte GLubyte GLuint GLuint GLuint GLushort GLushort GLushort GLbyte GLbyte GLbyte GLbyte GLdouble GLdouble GLdouble GLdouble GLfloat GLfloat GLfloat GLfloat GLint GLint GLint GLint GLshort GLshort GLshort GLshort GLubyte GLubyte GLubyte GLubyte GLuint GLuint GLuint GLuint GLushort GLushort GLushort GLushort GLboolean const GLdouble const GLfloat const GLint const GLshort const GLbyte const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLdouble const GLfloat const GLfloat const GLint const GLint const GLshort const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort const GLdouble const GLfloat const GLint const GLshort GLenum GLenum GLenum GLfloat GLenum GLint GLenum GLenum GLenum GLfloat GLenum GLenum GLint GLenum GLfloat GLenum GLint GLint GLushort GLenum GLenum GLfloat GLenum GLenum GLint GLfloat const GLubyte GLenum GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLint GLint GLsizei GLsizei GLint GLenum GLenum const GLvoid GLenum GLenum const GLfloat GLenum GLenum const GLint GLenum GLenum const GLdouble GLenum GLenum const GLfloat GLenum GLenum const GLint GLsizei GLuint GLfloat GLuint GLbitfield GLfloat GLint GLuint GLboolean GLenum GLfloat GLenum GLbitfield GLenum GLfloat GLfloat GLint GLint const GLfloat GLenum GLfloat GLfloat GLint GLint GLfloat GLfloat GLint GLint const GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat GLint GLfloat GLfloat const GLdouble const GLfloat const GLdouble const GLfloat GLint i
Definition: glfuncs.h:248
__kernel_size_t iov_len
Definition: linux.h:1702
smooth NULL
Definition: ftsmooth.c:416
#define ADNS_CLEAR_ERRNO
Definition: adns_win32.h:108
INT WSAAPI send(IN SOCKET s, IN CONST CHAR FAR *buf, IN INT len, IN INT flags)
Definition: send.c:23
#define memcpy(s1, s2, n)
Definition: mkisofs.h:878
#define ADNS_CAPTURE_ERRNO
Definition: adns_win32.h:107
GLfloat GLfloat p
Definition: glext.h:8902

◆ gettimeofday()

int gettimeofday ( struct timeval tv,
struct timezone tz 
)

Definition at line 80 of file adns_unix_calls.c.

81 {
82  static __int64 Adjustment;
83  __int64 now = 0;
84 
85  if (!Adjustment)
86  {
87  SYSTEMTIME st = {1970,1,0,1,0,0,0};
89  }
90 
91  if (tz)
92  {
93  errno = EINVAL;
94  return -1;
95  }
96 
98  now -= Adjustment;
99 
100  tv->tv_sec = (long)(now / 10000000);
101  tv->tv_usec = (long)((now % 10000000) / 10);
102 
103  return 0;
104 }
VOID WINAPI GetSystemTimeAsFileTime(OUT PFILETIME lpFileTime)
Definition: time.c:128
Definition: arc.h:39
unsigned long tv_sec
Definition: linux.h:1738
int errno
_In_ KPRIORITY _In_ LONG Adjustment
Definition: kefuncs.h:438
time_t now
Definition: finger.c:65
unsigned long tv_usec
Definition: linux.h:1739
BOOL WINAPI SystemTimeToFileTime(IN CONST SYSTEMTIME *lpSystemTime, OUT LPFILETIME lpFileTime)
Definition: time.c:158
#define long
Definition: qsort.c:33
GLbyte GLbyte tz
Definition: glext.h:8756
#define __int64
Definition: basetyps.h:16