#
# Check functions
#
+CHECK_SYMBOL_EXISTS(CreateHardLink "windows.h" HAVE_CREATEHARDLINK)
+CHECK_SYMBOL_EXISTS(CreateSymbolicLink "windows.h" HAVE_CREATESYMBOLICLINK)
CHECK_FUNCS(chflags chown chroot)
CHECK_FUNCS(fchdir fchflags fchmod fchown fcntl fork)
CHECK_FUNCS(fstat ftruncate futimes geteuid getpid)
/* Define to 1 if you have the `chroot' function. */
#cmakedefine HAVE_CHROOT 1
+/* Define to 1 if you have the `CreateSymbolicLink function. */
+#cmakedefine HAVE_CREATESYMBOLICLINK 1
+
+/* Define to 1 if you have the `CreateHardLink function. */
+#cmakedefine HAVE_CREATEHARDLINK 1
+
/* Define to 1 if you have the <ctype.h> header file. */
#cmakedefine HAVE_CTYPE_H 1
test_assert_is_symlink(const char *file, int line,
const char *pathname, const char *contents)
{
+#if defined(_WIN32) && !defined(__CYGWIN__)
+ return (0);
+#else
char buff[300];
struct stat st;
ssize_t linklen;
return (0);
}
return (1);
+#endif
}
int
int succeeded;
count_assertion(file, line);
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if HAVE_CREATEHARDLINK
succeeded = CreateHardLink(newpath, linkto, NULL);
-#else
+#elif HAVE_LINK
succeeded = !link(linkto, newpath);
+#else
+ succeeded = 0;
#endif
if (succeeded) {
msg[0] = '\0';
{
int succeeded;
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if HAVE_CREATESYMBOLICLINK
int targetIsDir = 0; /* TODO: Fix this. */
count_assertion(file, line);
succeeded = CreateSymbolicLink(newpath, linkto, targetIsDir);
-#else
+#elif HAVE_SYMLINK
count_assertion(file, line);
succeeded = !symlink(linkto, newpath);
+#else
+ succeeded = 0;
#endif
if (succeeded) {
msg[0] = '\0';
#endif
#include <errno.h>
#include <fcntl.h>
+#ifdef HAVE_IO_H
+#include <io.h>
+#endif
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <time.h>
-#if !defined(_WIN32) || defined(__CYGWIN__)
+#ifdef HAVE_UNISTD_H
#include <unistd.h>
#endif
#include <wchar.h>
+#ifdef HAVE_WINDOWS_H
+#include <windows.h>
+#endif
#ifdef __FreeBSD__
#include "test.h"
__FBSDID("$FreeBSD$");
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define open _open
+#define lseek _lseek
+#define close _close
+#endif
DEFINE_TEST(test_open_fd)
{
* had a bug relating to this, fixed in Nov 2006).
*/
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define open _open
+#define close _close
+#endif
+
char buff1[11000000];
char buff2[10000000];
char buff3[10000000];
static unsigned char testdatacopy[10 * 1024 * 1024];
static unsigned char buff[11 * 1024 * 1024];
+#if defined(_WIN32) && !defined(__CYGWIN__)
+#define open _open
+#define close _close
+#endif
+
/* Check correct behavior on large reads. */
DEFINE_TEST(test_read_large)
{
int succeeded;
count_assertion(file, line);
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if HAVE_CREATEHARDLINK
succeeded = CreateHardLink(newpath, linkto, NULL);
-#else
+#elif HAVE_LINK
succeeded = !link(linkto, newpath);
+#else
+ succeeded = 0;
#endif
if (succeeded) {
msg[0] = '\0';
{
int succeeded;
-#if defined(_WIN32) && !defined(__CYGWIN__)
+#if HAVE_CREATESYMBOLICLINK
int targetIsDir = 0; /* TODO: Fix this. */
count_assertion(file, line);
succeeded = CreateSymbolicLink(newpath, linkto, targetIsDir);
-#else
+#elif HAVE_SYMLINK
count_assertion(file, line);
succeeded = !symlink(linkto, newpath);
+#else
+ succeeded = 0;
#endif
if (succeeded) {
msg[0] = '\0';