Commit Graph

1843 Commits

Author SHA1 Message Date
Asanka C. Herath
d4379e27de Windows: Interlocked ops work on LONGs
Therefore change the type of the TLS slot id to LONG.
2010-11-24 15:33:35 -05:00
Asanka C. Herath
bd6e3ff7c9 Provide a stdbool.h in roken 2010-11-24 15:33:34 -05:00
Asanka C. Herath
0ae44152b7 Windows: Set error mode before calling LoadLibrary()
Unless SEM_FAILCRITICALERRORS is set, Windows may pop-up a dialog box
if the specified module cannot be loaded.  This is not appropriate for
unattended or batch processes.
2010-11-24 15:33:20 -05:00
Asanka C. Herath
538c7ce29c More compatibility macros
Undefine SLIST_ENTRY to avoid conflict with WinNT.h

Define AI_NUMERICSERV for platforms that don't define it.
2010-11-24 15:33:15 -05:00
Asanka C. Herath
d11917211b Windows: Older Windows SDKs need <winsock2.h>
Older SDKs need <winsock2.h> to be included before <ws2tcpip.h>
2010-11-24 15:33:06 -05:00
Asanka C. Herath
1e365190d0 Windows: Manage thread local storage manually in dlfcn_w32 2010-11-24 15:32:51 -05:00
Asanka C. Herath
e4a2e9cfe0 Windows: Build and export localtime_r 2010-11-24 15:32:49 -05:00
Asanka C. Herath
a87b4e23d6 Windows: Implement gettimeofday() using native APIs
We now use GetSystemTimeAsFileTime() for gettimeofday().  This gives
us a better resolution than one second.
2010-11-24 15:32:26 -05:00
Asanka C. Herath
8f7a1311e1 Windows: Construct search string from directory name
The implementation of opendir() in lib/roken/dirent.c takes as input a
directory name.  For the contents of the specified directory to be
enumerated correctly, this directory name must be converted to a
wildcard.
2010-11-24 15:32:07 -05:00
Simon Wilkinson
9fc90e01b5 roken: Remove multiple prototype for hstrerror
hsterror had two prototypes, one with the Windows magic, and one
without. Remove the one without so Windows can build again.
2010-11-24 10:32:55 +00:00
Jeffrey Altman
f317b91b1b roken: Prototype getopt
Add a prototype for getopt to the roken.h header, and fix the function
definition in getopt.c to be ANSI, rather than K&Rs style.
2010-11-24 09:43:04 +00:00
Asanka C. Herath
0cc7b890e2 Windows: Build getopt.c in roken 2010-11-23 02:25:34 -05:00
Asanka C. Herath
e266044cc4 Declarations for getopt externs 2010-11-23 02:25:24 -05:00
Asanka C. Herath
904d779d06 Windows: Support building roken as a DLL 2010-11-23 02:25:17 -05:00
Asanka C. Herath
1f2dc24b5d Annotate exported variables in getopt.c 2010-11-23 02:24:43 -05:00
Asanka C. Herath
0ee4597aed Always include <config.h> in roken implementation
Remove unnecessary ifdefs and add <config.h> to dlfcn_w32.c.  This is
required for correct export declarations when building roken as a DLL.
2010-11-23 02:24:38 -05:00
Simon Wilkinson
bbd724dad0 roken: getopt should include roken.h
In order to correctly rename the function, getopt.c needs to include
roken.h
2010-11-22 23:33:46 +00:00
Jeffrey Altman
bd78baf668 Windows: Include winsock2.h before ws2tcpip.h
Before we can include ws2tcpip.h, we must have already included
winsock2.h. The latest SDK does this by including winsock2 within
the ws2tcpip header, but the older SDKs do not, and fail to build.
2010-11-22 23:09:07 +00:00
Andrew Bartlett
0225db7152 Don't redefine socket() if socket_wrapper is already in use
In Samba, we may have already included socket_wrapper.h at this point

Andrew Bartlett

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2010-10-02 20:46:16 -07:00
Love Hornquist Astrand
736a08059a spelling 2010-09-14 10:44:33 -07:00
Love Hornquist Astrand
64a2e57029 add arguments to rk_rename to move it into the macro/function namespace 2010-09-14 10:18:08 -07:00
Asanka Herath
4b36b36e0b Add roken/rename.c to fix non-standard rename()
roken/rename.c is for platforms where the native rename()
implementation does not replace the target if it already exists.  This
implementation isn't atomic, but should be close enough for most
purposes.

For correct behavior, rk_rename() should be used instead of rename().
rk_rename() is #defined to be rename() on platforms where this fix is
not necessary.
2010-09-14 08:03:34 -04:00
Asanka Herath
7479c855a0 Windows: Don't attempt to copy a string to a zero length buffer
It won't cause harm since strcpy_s() deals with zero length buffers,
but it invokes the invalid parameter handler, which can disrupt
execution on debug builds.
2010-09-14 08:03:33 -04:00
Asanka Herath
d4fc674024 strlcat() isn't supposed to access *dst past dst_sz
Try not to do that on platforms where we can avoid it.
2010-09-14 08:03:32 -04:00
Asanka Herath
7e3bd7f9aa Windows: Fix use of file descriptors as sockets
Sockets and file descriptors are not interchangeable on Windows.  The
test for checking whether a given value is a socket or an FD was
broken for the case where WinSock was not initialized to begin with.
2010-09-14 08:03:31 -04:00
Asanka Herath
738e2ea55b Compress zeros when converting IPv6 addresses
libroken implementation of inet_ntop() was not compressing strings of
zeros.  While it is optional, not doing so was intefering with address
conversion tests in lib/krb5.
2010-09-14 08:03:30 -04:00
Eray Aslan
a1c14b2319 Add --with-berkeley-db-include option
Adds --with-berkeley-db-include=dir option to configure to use berkeley
db headers in dir.  Default is to let configure check.  Also adds
support for checking for and using db5/db.h

Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2010-09-05 18:41:30 -07:00
Asanka Herath
5dcc605f6b Fix calling conventions for Windows 2010-08-20 13:14:10 -04:00
Asanka Herath
2a2a662eca roken/parse_time-test.c: Don't pass in incorrect buffer size 2010-08-20 13:09:51 -04:00
Asanka Herath
aee2a6443d roken/test-mini_inetd.c: Use of rk_SOCK_INIT() etc. 2010-08-20 13:09:51 -04:00
Asanka Herath
745d9bcae7 Windows: Pull required declarations into roken.h.in 2010-08-20 13:09:50 -04:00
Asanka Herath
31b2dc9c48 roken/mini_inetd.c: Don't check against FD_SETSIZE unless necessary 2010-08-20 13:09:50 -04:00
Asanka Herath
481fe5bcf6 Windows: lib/roken tests now depend on DNSAPI 2010-08-20 13:09:48 -04:00
Asanka Herath
0d09c879f3 Reduce compiler warnings on Windows 2010-08-20 13:04:06 -04:00
Asanka Herath
f456b70013 Relocate roken WinSock declarations 2010-08-20 13:03:41 -04:00
Asanka Herath
04a7eaa170 Call ioctlsocket() indirectly
We were calling ioctlsocket() through a macro.  However, due to type
safety issues, we have to call it indirectly through rk_SOCK_IOCTL().
2010-08-20 13:03:40 -04:00
Asanka Herath
6b0baa2a8d Fix call to WSAStringToAddress()
String argument to WSAStringToAddress() is not const, while argument
to inet_pton() is.  Create a non-const string for the purpose of
calling WSAStringToAddress()
2010-08-20 13:03:40 -04:00
Asanka Herath
5f87ea3bbf Let dlfcn.h return a function pointer on Windows 2010-08-20 13:03:38 -04:00
Asanka Herath
24cbddd4b9 Resolve warnings on Windows
Appease the compiler by resolving some of the reported warnings,
including:

- Control paths that don't return.

- Potentially uninitialized variables.

- Unused local variables.

- Unreachable code.

- Type safety.

- Synchronize declarations with definitions for functions.
2010-08-20 13:03:38 -04:00
Asanka Herath
e9160dbcfa Support parallelized builds on Windows 2010-08-20 13:03:32 -04:00
Love Hornquist Astrand
977badd14b fix printf fmt arg warning 2010-08-08 12:29:35 -07:00
Love Hornquist Astrand
dc1baf6ab4 only support DS record conversion if DNS_TYPE_DS is defined 2010-06-01 10:54:47 -07:00
Love Hornquist Astrand
10ad3df8f5 use size_t for lengths 2010-06-01 10:46:57 -07:00
Magnus Holmberg
086885744c Fix argument order of strlcpy
Signed-off-by: Love Hornquist Astrand <lha@h5l.org>
2010-06-01 10:25:01 -07:00
Love Hornquist Astrand
9773655027 catch error from as.*printf 2010-05-30 12:41:06 -07:00
Asanka Herath
3e2b840565 Try both fd and socket ops for net_read() and net_write()
When using WinSock, a socket is not a file descriptor and does not
interoperate with read()/write().  File descriptors do not work with
send()/recv().  However, for net_read() and net_write(), we don't know
whether we are dealing with a socket or a file descriptor.  So try
one, and if it fails, try the other.

This is an ugly hack until we clean up the users of this API so it
doesn't use sockets and fds interchangably.
2010-05-26 10:38:44 -04:00
Asanka Herath
884f5ac627 Use WinDNS on Windows for DNS 2010-05-26 10:38:41 -04:00
Love Hornquist Astrand
eec74bd2fe Wrap SOCK_CLOEXEC in ifdef, from Harald Barth 2010-04-30 15:15:58 +02:00
Love Hornquist Astrand
32d148b2f8 Check for dd_fd in DIR not struct dirent
Pointed out by Ragnnar Sundblad in private mail
2010-03-21 09:08:46 -07:00
Love Hornquist Astrand
b0a79dcd40 Improve the dns retry logic
Bug reported by Richard Silverman on heimdal-bugs
2010-03-19 14:19:43 -07:00