windows-tests-torture-20090130
authorJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 31 Jan 2009 06:39:48 +0000 (06:39 +0000)
committerJeffrey Altman <jaltman@secure-endpoints.com>
Sat, 31 Jan 2009 06:39:48 +0000 (06:39 +0000)
LICENSE MIT

Port to Win64

Integrate with OpenAFS build environment

Build without warnings

Add nb_flush() implementation

18 files changed:
src/WINNT/tests/torture/DumpAfsLog/DumpAfsLog.c
src/WINNT/tests/torture/DumpAfsLog/Makefile.src [deleted file]
src/WINNT/tests/torture/DumpAfsLog/NTMakefile [new file with mode: 0644]
src/WINNT/tests/torture/NTMakefile [new file with mode: 0644]
src/WINNT/tests/torture/Source/Makefile.src [deleted file]
src/WINNT/tests/torture/Source/NTMakefile [new file with mode: 0644]
src/WINNT/tests/torture/Source/WinThreads.c
src/WINNT/tests/torture/Source/WinTorture.c
src/WINNT/tests/torture/Source/nbio.c
src/WINNT/tests/torture/Source/output.c
src/WINNT/tests/torture/StopStressTest/Makefile.src [deleted file]
src/WINNT/tests/torture/StopStressTest/NTMakefile [new file with mode: 0644]
src/WINNT/tests/torture/StopStressTest/StopStressTest.c
src/WINNT/tests/torture/Stress/Makefile.src [deleted file]
src/WINNT/tests/torture/Stress/NTMakefile [new file with mode: 0644]
src/WINNT/tests/torture/Stress/Stress.c
src/WINNT/tests/torture/include/common.h
src/WINNT/tests/torture/include/proto.h

index ff0888c..f80a70a 100644 (file)
@@ -2,7 +2,7 @@
 //
 
 #include <windows.h>
-#include <stdio.h>
+#include <stdlib.h>
 #include <time.h>
 #include <stdio.h>
 #include <io.h>
@@ -15,10 +15,10 @@ int main(int argc, char* argv[])
     int     i;
     int     Count;
     int     SecondsDelay;
-    int     SecondsToRun;
+    time_t  SecondsToRun;
     int     NewSessionDeadlock;
     int     NewSessionDeadlockCount;
-    int     SecondsToDelay;
+    time_t  SecondsToDelay;
     int     MiniDump;
     int     rc;
     char    HostName[512];
@@ -183,14 +183,14 @@ int main(int argc, char* argv[])
 */
         ++Count;
         time(&StartTime);
-        if (StartTime > (time_t)SecondsToRun)
+        if (StartTime > SecondsToRun)
             break;
         printf("Type Q to stop DumpAfsLog\n");
         SecondsToDelay = StartTime + SecondsDelay;
         while (1)
         {
             time(&StartTime);
-            if (StartTime > (time_t)SecondsToDelay)
+            if (StartTime > SecondsToDelay)
                 break;
             rc = GetConsoleInput(hStdin);
             Sleep(500);
diff --git a/src/WINNT/tests/torture/DumpAfsLog/Makefile.src b/src/WINNT/tests/torture/DumpAfsLog/Makefile.src
deleted file mode 100644 (file)
index 011ecb7..0000000
+++ /dev/null
@@ -1,25 +0,0 @@
-NAME=DumpAfsLog
-TARGETTYPE=EXE
-TARGETSS=console
-
-OBJS= \
-       $(O)\DumpAfsLog.obj
-
-
-#INCLUDES=$(O);$(MOIRABASE)\include;$(MOIRABASE)\mmc;$(PISMERE)\athena\auth\krb4\include;$(PISMERE)\athena\wshelper\include;$(PISMERE)\athena\auth\krb5\src\include;$(PISMERE)\athena\auth\krb5\src\include\krb5;$(PISMERE)\athena\auth\krb5\src\lib;$(PISMERE)\athena\auth\krb5\src\lib\krb5\asn.1;$(PISMERE)\athena\auth\krb5\src\krb524;$(PISMERE)\athena\auth\krb5\src\lib\krb5\krb
-#LIB_PATHS = $(PISMERE)\athena\auth\krb4\krbv4\krbdll\$(O);$(PISMERE)\athena\wshelper\wshelper\$(O);$(MOIRABASE)\util\et\$(O);$(MOIRABASE)\lib\$(O);$(PISMERE)\athena\auth\krb5\src\lib\krb5\$(O);$(PISMERE)\target\lib\$(T)
-
-
-USE_DEFAULTLIB=1
-
-LIBS= wsock32.lib advapi32.lib user32.lib \
-      dnsapi.lib oleaut32.lib \
-      ole32.lib wldap32.lib
-
-
-USE_LIBC_DLL=1
-
-#####
-
-
-
diff --git a/src/WINNT/tests/torture/DumpAfsLog/NTMakefile b/src/WINNT/tests/torture/DumpAfsLog/NTMakefile
new file mode 100644 (file)
index 0000000..bce1e03
--- /dev/null
@@ -0,0 +1,35 @@
+#                                                                                                                                
+# Copyright (c) 2009 Secure Endpoints Inc.
+#
+
+AFSDEV_AUXCDEFINES=-I..\include
+RELDIR=WINNT\tests\torture\dumpafslog
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+idirs:
+!       if !(exist($(OJT)\WINNT\tests))
+                md $(OJT)\WINNT\tests
+!       endif
+!       if !(exist($(OJT)\WINNT\tests\torture))
+                md $(OJT)\WINNT\tests\torture
+!       endif
+!       if !(exist($(OJT)\WINNT\tests\torture\dumpafslog))
+                md $(OJT)\WINNT\tests\torture\dumpafslog
+!       endif
+
+EXEDIR = $(DESTDIR)\bin
+
+OBJS =         $(OUT)\DumpAfsLog.obj
+
+$(EXEDIR)\DumpAfsLog.exe: $(OBJS)
+        $(EXECONLINK) 
+        $(_VC_MANIFEST_EMBED_EXE)
+        $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install: idirs $(EXEDIR)\DumpAfsLog.exe
+
+clean::
+        
+
diff --git a/src/WINNT/tests/torture/NTMakefile b/src/WINNT/tests/torture/NTMakefile
new file mode 100644 (file)
index 0000000..b1d7d40
--- /dev/null
@@ -0,0 +1,31 @@
+#                                                                                                                                
+# Copyright (c) 2009 Secure Endpoints Inc.
+#
+
+RELDIR=WINNT\tests\torture
+!INCLUDE ..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\config\NTMakefile.version
+
+install:
+        cd Source
+        $(MAKECMD) /nologo /f NTMakefile install
+        cd ..\DumpAfsLog
+        $(MAKECMD) /nologo /f NTMakefile install
+        cd ..\Stress
+        $(MAKECMD) /nologo /f NTMakefile install
+        cd ..\StopStressTest
+        $(MAKECMD) /nologo /f NTMakefile install
+        cd ..
+
+clean::
+        cd Source
+        $(MAKECMD) /nologo /f NTMakefile clean
+        cd ..\DumpAfsLog
+        $(MAKECMD) /nologo /f NTMakefile clean
+        cd ..\Stress
+        $(MAKECMD) /nologo /f NTMakefile clean
+        cd ..\StopStressTest
+        $(MAKECMD) /nologo /f NTMakefile clean
+        cd ..
+        
+
diff --git a/src/WINNT/tests/torture/Source/Makefile.src b/src/WINNT/tests/torture/Source/Makefile.src
deleted file mode 100644 (file)
index 3c0e00a..0000000
+++ /dev/null
@@ -1,32 +0,0 @@
-NAME=WinTorture
-TARGETTYPE=EXE
-TARGETSS=console
-
-OBJS= \
-       $(O)\nbio.obj \
-       $(O)\output.obj \
-       $(O)\ResolveLocker.obj \
-       $(O)\WinThreads.obj \
-       $(O)\WinTorture.obj \
-
-
-INCLUDES=..\include; \
-       $(PISMERE)\athena\wshelper\include; \
-       $(PISMERE)\athena\util\locker\lib
-
-!ifdef NODEBUG
-LIB_PATHS=$(PISMERE)\target\lib\i386\rel
-!else
-LIB_PATHS=$(PISMERE)\target\lib\i386\dbg
-!endif
-
-USE_DEFAULTLIB=1
-
-LIBS=krbv4w32.lib oncrpc.lib Kernel32.lib Psapi.lib wshelp32.lib locker.lib athdir.lib Ws2_32.lib Mpr.lib oleaut32.lib Advapi32.lib ole32.lib User32.lib
-USE_LIBC_DLL=1
-C_DEFINE=-DHAVE_HESOID 
-
-#####
-
-
-
diff --git a/src/WINNT/tests/torture/Source/NTMakefile b/src/WINNT/tests/torture/Source/NTMakefile
new file mode 100644 (file)
index 0000000..3d5468c
--- /dev/null
@@ -0,0 +1,39 @@
+#                                                                                                                                
+# Copyright (c) 2009 Secure Endpoints Inc.
+#
+
+AFSDEV_AUXCDEFINES=-I..\include
+RELDIR=WINNT\tests\torture\source
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+idirs:
+!       if !(exist($(OJT)\WINNT\tests))
+                md $(OJT)\WINNT\tests
+!       endif
+!       if !(exist($(OJT)\WINNT\tests\torture))
+                md $(OJT)\WINNT\tests\torture
+!       endif
+!       if !(exist($(OJT)\WINNT\tests\torture\source))
+                md $(OJT)\WINNT\tests\torture\source
+!       endif
+
+EXEDIR = $(DESTDIR)\bin
+
+OBJS =         $(OUT)\nbio.obj \
+       $(OUT)\output.obj \
+       $(OUT)\ResolveLocker.obj \
+       $(OUT)\WinThreads.obj \
+       $(OUT)\WinTorture.obj \
+
+$(EXEDIR)\torture.exe: $(OBJS)
+        $(EXECONLINK) psapi.lib
+        $(_VC_MANIFEST_EMBED_EXE)
+        $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install: idirs $(EXEDIR)\torture.exe
+
+clean::
+        
+
index 5e3e154..62544ef 100644 (file)
@@ -1,14 +1,15 @@
 #include <windows.h>
-#include <includes.h>
+#include "includes.h"
 #include "common.h"
 #ifdef HAVE_HESOID
     #include "ResolveLocker.h"
     int ResolveLocker(USER_OPTIONS *attachOption);
 #endif
-#ifdef HAVE_AFS_SOURCE
-    #include <smb_iocons.h>
-    #include <afsint.h>
-    #include <pioctl_nt.h>
+#ifndef NO_AFS_SOURCE
+    #include <afs\stds.h>
+    #include <afs\smb_iocons.h>
+    #include <afs\afsint.h>
+    #include <afs\pioctl_nt.h>
 #else
     #define VIOCGETVOLSTAT  0x7
     #define afs_int32   int
@@ -36,8 +37,8 @@
             void *in;
            void *out;
     } viceIoctl_t;
+extern long pioctl(char *pathp, long opcode, struct ViceIoctl *blob, int follow);
 #endif
-long pioctl(char *pathp, long opcode, struct ViceIoctl *blob, int follow);
 
 #define MAX_PARAMS 20
 #define ival(s) strtol(s, NULL, 0)
@@ -75,6 +76,7 @@ __declspec( thread ) int    LogID = 0;
 __declspec( thread ) int    LineCount = 0;
 __declspec( thread ) int    *pThreadStatus;
 __declspec( thread ) DWORD  TickCount1,TickCount2, MilliTickStart;
+__declspec( thread ) int    BufferSize = 4096;
 __declspec( thread ) char   *IoBuffer = NULL;
 __declspec( thread ) char   AfsLocker[256];
 __declspec( thread ) char   OriginalAfsLocker[256];
@@ -90,8 +92,7 @@ DWORD WINAPI StressTestThread(LPVOID lpThreadParameter)
 {
     int         j;
     int         rc;
-    int         count;
-    int         BufferSize;
+    size_t      count;
     int         ProcessID;
     char        EventName[64];
     char        FileName[256];
@@ -154,24 +155,24 @@ DWORD WINAPI StressTestThread(LPVOID lpThreadParameter)
     {
         LastKnownError = 0;
         for (j = 0; j <= CMD_MAX_CMD; j++)
-            {
-                WinCommandInfo[j].count = 0;
-                WinCommandInfo[j].min_sec = 0;
-                WinCommandInfo[j].max_sec = 0;
-                WinCommandInfo[j].MilliSeconds = 0;
-                WinCommandInfo[j].total_sec = 0;
-                WinCommandInfo[j].total_sum_of_squares = 0;
-                WinCommandInfo[j].ErrorCount = 0;
-                WinCommandInfo[j].ErrorTime = 0;
-                ThreadCommandInfo[j].count = 0;
-                ThreadCommandInfo[j].min_sec = 1000;
-                ThreadCommandInfo[j].max_sec = 0;
-                ThreadCommandInfo[j].MilliSeconds = 0;
-                ThreadCommandInfo[j].total_sec = 0;
-                ThreadCommandInfo[j].total_sum_of_squares = 0;
-                ThreadCommandInfo[j].ErrorCount = 0;
-                ThreadCommandInfo[j].ErrorTime = 0;
-            }
+        {
+            WinCommandInfo[j].count = 0;
+            WinCommandInfo[j].min_sec = 0;
+            WinCommandInfo[j].max_sec = 0;
+            WinCommandInfo[j].MilliSeconds = 0;
+            WinCommandInfo[j].total_sec = 0;
+            WinCommandInfo[j].total_sum_of_squares = 0;
+            WinCommandInfo[j].ErrorCount = 0;
+            WinCommandInfo[j].ErrorTime = 0;
+            ThreadCommandInfo[j].count = 0;
+            ThreadCommandInfo[j].min_sec = 1000;
+            ThreadCommandInfo[j].max_sec = 0;
+            ThreadCommandInfo[j].MilliSeconds = 0;
+            ThreadCommandInfo[j].total_sec = 0;
+            ThreadCommandInfo[j].total_sum_of_squares = 0;
+            ThreadCommandInfo[j].ErrorCount = 0;
+            ThreadCommandInfo[j].ErrorTime = 0;
+        }
 
         run_netbench(ProcessNumber, ClientText, PathToSecondDir);
         if (LastKnownError != ERROR_NETNAME_DELETED)
@@ -308,7 +309,7 @@ BOOL run_netbench(int client, char *ClientText, char *PathToSecondDir)
                 (*(pPtr - 1)) = '\0';
             }
         }
-        TotalBytesRead += (strlen(line) + IncreaseBy);
+        TotalBytesRead += (DWORD)(strlen(line) + IncreaseBy);
         SetFilePointer(hFile, TotalBytesRead, 0, FILE_BEGIN);
         strcpy(line1, line);
         if (rc = WaitForSingleObject(PauseEventHandle, 0) == WAIT_OBJECT_0)
index 444f808..a1aa318 100644 (file)
@@ -37,9 +37,8 @@ char    *ClientText = "streamfiles.txt";
 char    PathToSecondDir[256];
 int     ThreadStatus[MAX_HANDLES];
 int     verbose;
-int     BufferSize = 256*1024;
+static int     BufferSize = 256*1024;
 int     UseLocker = 0;
-//int     UseUnicode = 0;
 int     EndOnError;
 int     AfsTrace;
 int     ChronLog;
@@ -299,7 +298,7 @@ int main(int argc, char *argv[])
 {
     int         i;
     int         LoopCount;
-    int         SecondsToRun;
+    time_t      SecondsToRun;
     int         NumberOfIterations;
     int         StressTestUsed = 0;
     int         rc;
@@ -596,7 +595,7 @@ int main(int argc, char *argv[])
         if (SecondsToRun != 0)
         {
             time(&StartTime);
-            if (StartTime > (time_t)SecondsToRun)
+            if (StartTime > SecondsToRun)
             {
                 break;
             }
index f4140d6..19000ab 100644 (file)
@@ -42,13 +42,13 @@ __declspec( thread ) extern EXIT_STATUS *pExitStatus;
 __declspec( thread ) extern DWORD   LastKnownError;
 extern void LogMessage(int ProcessNumber, char *HostName, char *FileName, char *message, int LogID);
 
-int  CreateObject(const char *fname, uint32 DesiredAccess,
+HANDLE CreateObject(const char *fname, uint32 DesiredAccess,
                   uint32 FileAttributes, uint32 ShareAccess,
                   uint32 CreateDisposition, uint32 CreateOptions);
 void DumpAFSLog(char * HostName, int LogID);
 int  FindHandle(int handle);
 int  GetFileList(char *Mask, void (*fn)(file_info *, const char *, void *), void *state);
-BOOL GetFileInfo(char *FileName, int fnum, uint16 *mode, size_t *size,
+BOOL GetFileInfo(char *FileName, HANDLE fd, uint16 *mode, size_t *size,
                        time_t *c_time, time_t *a_time, time_t *m_time, 
                        time_t *w_time);
 BOOL GetPathInfo(const char *fname, time_t *c_time, time_t *a_time, time_t *m_time, 
@@ -59,7 +59,7 @@ void EndFirstTimer(int cmd, int Type);
 void StartSecondTime(int cmd);
 void EndSecondTime(int cmd);
 void SubstituteString(char *s,const char *pattern,const char *insert, size_t len);
-int  SystemCall(char *command);
+intptr_t  SystemCall(char *command);
 HANDLE WinFindFirstFile(char *Mask, void **FileData, char *cFileName, int *dwFileAttributes);
 int  WinFindNextFile(HANDLE hFind, void **FileData, char *cFileName, int *dwFileAttributes);
 
@@ -394,7 +394,7 @@ int nb_DeleteFile(char *path)
 
 int nb_xcopy(char *Source, char *Destination)
 {
-    DWORD   rc;
+    intptr_t   rc;
     char    FileName[128];
     char    temp[512];
     char    command[256];
@@ -464,7 +464,7 @@ int nb_Move(char *Source, char *Destination)
 
 int nb_createx(char *fname, unsigned create_options, unsigned create_disposition, int handle)
 {
-    int     fd;
+    HANDLE  fd;
     int     i;
     uint32  desired_access;
     char    FileName[128];
@@ -486,21 +486,18 @@ int nb_createx(char *fname, unsigned create_options, unsigned create_disposition
 
     StartFirstTimer();
     fd = CreateObject(path, 
-                        desired_access,
-                        0x0,
-                        FILE_SHARE_READ|FILE_SHARE_WRITE, 
-                        create_disposition, 
-                        create_options);
+                       desired_access,
+                       0x0,
+                       FILE_SHARE_READ|FILE_SHARE_WRITE, 
+                       create_disposition, 
+                       create_options);
 
-    if (fd == -1 && handle != -1)
+    if (fd == INVALID_HANDLE_VALUE && handle != -1)
     {
         if (create_options & FILE_DIRECTORY_FILE)
         {
-            int rc;
-
-            rc = GetLastError();
-        if ((rc != ERROR_FILE_NOT_FOUND) && (rc != ERROR_PATH_NOT_FOUND))
-            if (rc != ERROR_ALREADY_EXISTS)
+            DWORD rc = GetLastError();
+            if ((rc != ERROR_FILE_NOT_FOUND) && (rc != ERROR_PATH_NOT_FOUND) && (rc != ERROR_ALREADY_EXISTS))
             {
                 EndFirstTimer(CMD_NTCREATEX, 0);
                 SetLastError(rc);
@@ -530,15 +527,14 @@ int nb_createx(char *fname, unsigned create_options, unsigned create_disposition
     if (create_options & FILE_DIRECTORY_FILE)
         fd = 0;
 
-    if (fd != -1 && handle == -1)
+    if (fd != INVALID_HANDLE_VALUE && handle == -1)
     {
-        if (fd > 1)
-            CloseHandle((HANDLE)fd);
+        CloseHandle(fd);
         nb_unlink(fname);
         return(0);
     }
 
-    if (fd == -1 && handle == -1)
+    if (fd == INVALID_HANDLE_VALUE && handle == -1)
         return(0);
 
     for (i = 0; i < MAX_FILES; i++) 
@@ -563,7 +559,7 @@ int nb_createx(char *fname, unsigned create_options, unsigned create_disposition
 int nb_writex(int handle, int offset, int size, int ret_size)
 {
     int     i;
-    int     status;
+    ssize_t status;
     char    FileName[128];
     char    temp[512];
 
@@ -576,7 +572,6 @@ int nb_writex(int handle, int offset, int size, int ret_size)
         return(-1);
     StartFirstTimer();
     status = nb_write(ftable[i].fd, IoBuffer, offset, size);
-
     if (status != ret_size) 
     {
         EndFirstTimer(CMD_WRITEX, 0);
@@ -640,7 +635,7 @@ int nb_lock(int handle, int offset, int size, int timeout, unsigned char locktyp
 int nb_readx(int handle, int offset, int size, int ret_size)
 {
     int     i;
-    int     ret;
+    ssize_t ret;
     char    FileName[128];
     char    temp[512];
 
@@ -657,7 +652,7 @@ int nb_readx(int handle, int offset, int size, int ret_size)
         EndFirstTimer(CMD_READX, 0);
         LeaveThread(0, "", CMD_READX);
         if (ret == 0)
-            sprintf(temp, "File: read failed on index=%d, offset=%d ReadSize=%d ActualRead=%d handle=%d\n",
+            sprintf(temp, "File: read failed on index=%d, offset=%d ReadSize=%d ActualRead=%d handle=%p\n",
                     handle, offset, size, ret, ftable[i].fd);
         if (ret == -1)
             sprintf(temp, "File: %s. On read, cannot set file pointer\n", ftable[i].name);
@@ -816,7 +811,7 @@ if (!Flag)
     return(0);
 }
 
-int nb_qfileinfo(int fnum)
+int nb_qfileinfo(int handle)
 {
     int     i;
     int     rc;
@@ -825,7 +820,7 @@ int nb_qfileinfo(int fnum)
 
     sprintf(FileName, "Thread_%05d.log", ProcessNumber);
 
-    if ((i = FindHandle(fnum)) == -1)
+    if ((i = FindHandle(handle)) == -1)
         return(-1);
 
     StartFirstTimer();
@@ -919,14 +914,15 @@ int nb_findfirst(char *mask)
     return(0);
 }
 
-int nb_flush(int fnum)
+int nb_flush(int handle)
 {
     int i;
 
-    if ((i = FindHandle(fnum)) == -1)
+    if ((i = FindHandle(handle)) == -1)
         return(-1);
+
+    FlushFileBuffers(ftable[i].fd);
     return(0);
-       /* hmmm, we don't have cli_flush() yet */
 }
 
 static int total_deleted;
@@ -1151,9 +1147,9 @@ void EndSecondTime(int cmd)
 }
 
 
-int SystemCall(char *command)
+intptr_t SystemCall(char *command)
 {
-    int     rc;
+    intptr_t rc;
     char    *argv[6];
 
     argv[0] = getenv("COMSPEC");
@@ -1167,20 +1163,21 @@ int SystemCall(char *command)
     return(rc);
 }
 
-int CreateObject(const char *fname, uint32 DesiredAccess,
+HANDLE CreateObject(const char *fname, uint32 DesiredAccess,
                 uint32 FileAttributes, uint32 ShareAccess,
                 uint32 CreateDisposition, uint32 CreateOptions)
 {
-    int   fd;
+    HANDLE   fd;
     DWORD dwCreateDisposition = 0;
     DWORD dwDesiredAccess = 0;
     DWORD dwShareAccess = 0;
 
     if (CreateOptions & FILE_DIRECTORY_FILE)
     {
-        fd = CreateDirectory(fname, NULL);
-        if (fd == 0)
-            fd = -1;
+        if (!CreateDirectory(fname, NULL))
+            fd = INVALID_HANDLE_VALUE;
+        else 
+            fd = 0;
     }
     else
     {
@@ -1194,21 +1191,21 @@ int CreateObject(const char *fname, uint32 DesiredAccess,
         dwCreateDisposition = OPEN_ALWAYS;
         if (CreateDisposition == 1)
             dwCreateDisposition = OPEN_EXISTING;
-        fd = (int)CreateFile(fname, dwDesiredAccess, ShareAccess, NULL, dwCreateDisposition, FILE_ATTRIBUTE_NORMAL, NULL);
+        fd = CreateFile(fname, dwDesiredAccess, ShareAccess, NULL, dwCreateDisposition, FILE_ATTRIBUTE_NORMAL, NULL);
     }
 
     return(fd);
 }
 
-BOOL nb_close1(int fnum)
+BOOL nb_close1(HANDLE fd)
 {
     int dwFlags = 0;
     int rc = 1;
 
-    if (fnum > 0)
+    if (fd != INVALID_HANDLE_VALUE)
     {
-        if (rc = GetHandleInformation((HANDLE)fnum, &dwFlags))
-            CloseHandle((HANDLE)fnum);
+        if (rc = GetHandleInformation(fd, &dwFlags))
+            CloseHandle(fd);
     }
     return(rc);
 }
@@ -1361,7 +1358,6 @@ BOOL GetPathInfo(const char *fname,
     SYSTEMTIME  SystemTime;
     struct tm   tm_time;
 
-//    rc = WinGetFileAttributesEx(UseUnicode, (char *)fname, &FileInfo);
     rc = GetFileAttributesEx(fname, GetFileExInfoStandard, &FileInfo);
     if (rc != 0)
     {
@@ -1401,7 +1397,7 @@ BOOL GetPathInfo(const char *fname,
 /****************************************************************************
 send a qfileinfo call
 ****************************************************************************/
-BOOL GetFileInfo(char *FileName, int fnum, 
+BOOL GetFileInfo(char *FileName, HANDLE fd, 
                    uint16 *mode, size_t *size,
                    time_t *c_time, time_t *a_time, time_t *m_time, 
                    time_t *w_time)
@@ -1451,23 +1447,23 @@ BOOL GetFileInfo(char *FileName, int fnum,
   Read size bytes at offset offset using SMBreadX.
 ****************************************************************************/
 
-ssize_t nb_read(int fnum, char *IoBuffer, off_t offset, size_t size)
+ssize_t nb_read(HANDLE fd, char *IoBuffer, off_t offset, size_t size)
 {
-       ssize_t total = 0;
+    DWORD   total = 0;
     int     rc;
     DWORD   LowDword;
 
-       if (size == 0) 
-               return(0);
+    if (size == 0) 
+        return(0);
 
-    LowDword = SetFilePointer((HANDLE)fnum, offset, 0, FILE_BEGIN);
+    LowDword = SetFilePointer(fd, offset, 0, FILE_BEGIN);
 
     if (LowDword == INVALID_SET_FILE_POINTER)
         return(-1);
-    rc = ReadFile((HANDLE)fnum, IoBuffer, size, &total, NULL);
-
+    rc = ReadFile(fd, IoBuffer, (DWORD)size, &total, NULL);
     if (!rc)
         return(rc);
+
     return(total);
 }
 
@@ -1475,19 +1471,19 @@ ssize_t nb_read(int fnum, char *IoBuffer, off_t offset, size_t size)
   write to a file
 ****************************************************************************/
 
-ssize_t nb_write(int fnum, char *IoBuffer, off_t offset, size_t size)
+ssize_t nb_write(HANDLE fd, char *IoBuffer, off_t offset, size_t size)
 {
-       int     bwritten = 0;
+    DWORD   bwritten = 0;
     int     rc;
     DWORD   LowDword;
 
-    LowDword = SetFilePointer((HANDLE)fnum, offset, 0, FILE_BEGIN);
+    LowDword = SetFilePointer(fd, offset, 0, FILE_BEGIN);
     if (LowDword == INVALID_SET_FILE_POINTER)
         return(-1);
-    rc = WriteFile((HANDLE)fnum, IoBuffer, size, &bwritten, NULL);
-
+    rc = WriteFile(fd, IoBuffer, (DWORD)size, &bwritten, NULL);
     if (!rc)
         return(rc);
-    FlushFileBuffers((HANDLE)fnum);
+    FlushFileBuffers(fd);
     return(bwritten);
 }
+
index b7c69dd..67e4c90 100644 (file)
@@ -1,5 +1,5 @@
 #include <windows.h>
-#include <includes.h>
+#include "includes.h"
 #include "common.h"
 
 extern int  ChronLog;
@@ -12,11 +12,11 @@ void LogStats(char *FileName, int ToLog, int Iteration, int NumberOfProcesses, i
               char *HostName, int ProcessNumber, struct cmd_struct CommandInfo[],
               char *CommandLine, char *TargetDirectory)
 {
-       struct cmd_struct TotalCommandInfo[CMD_MAX_CMD + 1];
-       int         i;
+    struct cmd_struct TotalCommandInfo[CMD_MAX_CMD + 1];
+    int         i;
     int         j;
     int         LineCount;
-       unsigned    grand_total = 0;
+    unsigned    grand_total = 0;
     char        AsciiTime[32];
     FILE        *fp;
     struct tm   *newtime;
@@ -32,18 +32,18 @@ void LogStats(char *FileName, int ToLog, int Iteration, int NumberOfProcesses, i
     if (ToLog)
         fp = fopen(FileName, "a+");
 
-       for (j = 0; j <= CMD_MAX_CMD; j++)
+    for (j = 0; j <= CMD_MAX_CMD; j++)
     {
-               TotalCommandInfo[j].count = 0;
-               TotalCommandInfo[j].min_sec = 0;
-               TotalCommandInfo[j].ErrorTime = 0;
-               TotalCommandInfo[j].max_sec = 0;
-               TotalCommandInfo[j].MilliSeconds = 0;
-               TotalCommandInfo[j].total_sec = 0;
-               TotalCommandInfo[j].total_sum_of_squares = 0;
-               TotalCommandInfo[j].ErrorCount = 0;
-               TotalCommandInfo[j].ErrorTime = 0;
-       }
+        TotalCommandInfo[j].count = 0;
+        TotalCommandInfo[j].min_sec = 0;
+        TotalCommandInfo[j].ErrorTime = 0;
+        TotalCommandInfo[j].max_sec = 0;
+        TotalCommandInfo[j].MilliSeconds = 0;
+        TotalCommandInfo[j].total_sec = 0;
+        TotalCommandInfo[j].total_sum_of_squares = 0;
+        TotalCommandInfo[j].ErrorCount = 0;
+        TotalCommandInfo[j].ErrorTime = 0;
+    }
 
     for (i = 0; i <= CMD_MAX_CMD; i++)
     {
diff --git a/src/WINNT/tests/torture/StopStressTest/Makefile.src b/src/WINNT/tests/torture/StopStressTest/Makefile.src
deleted file mode 100644 (file)
index 5f5a443..0000000
+++ /dev/null
@@ -1,24 +0,0 @@
-NAME=StopStressTest
-TARGETTYPE=EXE
-TARGETSS=console
-
-OBJS= \
-       $(O)\StopStressTest.obj
-
-
-#INCLUDES=$(O);$(MOIRABASE)\include;$(MOIRABASE)\mmc;$(PISMERE)\athena\auth\krb4\include;$(PISMERE)\athena\wshelper\include;$(PISMERE)\athena\auth\krb5\src\include;$(PISMERE)\athena\auth\krb5\src\include\krb5;$(PISMERE)\athena\auth\krb5\src\lib;$(PISMERE)\athena\auth\krb5\src\lib\krb5\asn.1;$(PISMERE)\athena\auth\krb5\src\krb524;$(PISMERE)\athena\auth\krb5\src\lib\krb5\krb
-#LIB_PATHS = $(PISMERE)\athena\auth\krb4\krbv4\krbdll\$(O);$(PISMERE)\athena\wshelper\wshelper\$(O);$(MOIRABASE)\util\et\$(O);$(MOIRABASE)\lib\$(O);$(PISMERE)\athena\auth\krb5\src\lib\krb5\$(O);$(PISMERE)\target\lib\$(T)
-
-
-USE_DEFAULTLIB=1
-
-#LIBS= wsock32.lib advapi32.lib user32.lib \
-#      dnsapi.lib oleaut32.lib \
-#      ole32.lib wldap32.lib
-
-USE_LIBC_DLL=1
-
-#####
-
-
-
diff --git a/src/WINNT/tests/torture/StopStressTest/NTMakefile b/src/WINNT/tests/torture/StopStressTest/NTMakefile
new file mode 100644 (file)
index 0000000..d26625d
--- /dev/null
@@ -0,0 +1,35 @@
+#                                                                                                                                
+# Copyright (c) 2009 Secure Endpoints Inc.
+#
+
+AFSDEV_AUXCDEFINES=-I..\include
+RELDIR=WINNT\tests\torture\stopstresstest
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+idirs:
+!       if !(exist($(OJT)\WINNT\tests))
+                md $(OJT)\WINNT\tests
+!       endif
+!       if !(exist($(OJT)\WINNT\tests\torture))
+                md $(OJT)\WINNT\tests\torture
+!       endif
+!       if !(exist($(OJT)\WINNT\tests\torture\stopstresstest))
+                md $(OJT)\WINNT\tests\torture\stopstresstest
+!       endif
+
+EXEDIR = $(DESTDIR)\bin
+
+OBJS =         $(OUT)\StopStressTest.obj
+
+$(EXEDIR)\StopStressTest.exe: $(OBJS)
+        $(EXECONLINK) 
+        $(_VC_MANIFEST_EMBED_EXE)
+        $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install: idirs $(EXEDIR)\StopStressTest.exe
+
+clean::
+        
+
index 905e300..da48695 100644 (file)
@@ -2,7 +2,7 @@
 //
 
 #include <windows.h>
-#include <stdio.h>
+#include <stdlib.h>
 #include <time.h>
 #include <stdio.h>
 #include <io.h>
diff --git a/src/WINNT/tests/torture/Stress/Makefile.src b/src/WINNT/tests/torture/Stress/Makefile.src
deleted file mode 100644 (file)
index 1db39da..0000000
+++ /dev/null
@@ -1,18 +0,0 @@
-NAME=Stress
-TARGETTYPE=EXE
-TARGETSS=console
-
-OBJS= \
-       $(O)\Stress.obj
-
-INCLUDES=..\include
-
-USE_DEFAULTLIB=1
-
-USE_LIBC_DLL=1
-C_DEFINE=-DHAVE_HESOID 
-
-#####
-
-
-
diff --git a/src/WINNT/tests/torture/Stress/NTMakefile b/src/WINNT/tests/torture/Stress/NTMakefile
new file mode 100644 (file)
index 0000000..f9c2530
--- /dev/null
@@ -0,0 +1,35 @@
+#                                                                                                                                
+# Copyright (c) 2009 Secure Endpoints Inc.
+#
+
+AFSDEV_AUXCDEFINES=-I..\include
+RELDIR=WINNT\tests\torture\stress
+!INCLUDE ..\..\..\..\config\NTMakefile.$(SYS_NAME)
+!INCLUDE ..\..\..\..\config\NTMakefile.version
+
+idirs:
+!       if !(exist($(OJT)\WINNT\tests))
+                md $(OJT)\WINNT\tests
+!       endif
+!       if !(exist($(OJT)\WINNT\tests\torture))
+                md $(OJT)\WINNT\tests\torture
+!       endif
+!       if !(exist($(OJT)\WINNT\tests\torture\stress))
+                md $(OJT)\WINNT\tests\torture\stress
+!       endif
+
+EXEDIR = $(DESTDIR)\bin
+
+OBJS =         $(OUT)\Stress.obj
+
+$(EXEDIR)\Stress.exe: $(OBJS)
+        $(EXECONLINK) 
+        $(_VC_MANIFEST_EMBED_EXE)
+        $(EXEPREP)
+        $(CODESIGN_USERLAND)
+
+install: idirs $(EXEDIR)\Stress.exe
+
+clean::
+        
+
index 49702b9..ae6253c 100644 (file)
@@ -2,6 +2,7 @@
 //
 
 #include <windows.h>
+#include <stdlib.h>
 #include <stdio.h>
 
 int opterr = 1;
index 488a636..51d2778 100644 (file)
@@ -140,9 +140,9 @@ typedef struct {
         } PARAMETERLIST;
 
 typedef struct {
-       int fd;
-       int handle;
-    char *name; 
+        HANDLE fd;
+        int handle;
+        char *name; 
        int reads, writes;
 } FTABLE;
 
index 5a947d1..eb64e15 100644 (file)
@@ -17,19 +17,19 @@ int nb_CopyFile(char *source, char *destination);
 int nb_DeleteFile(char *fname);
 int nb_Move(char *Source, char *Destination);
 int nb_xcopy(char *Source, char *Destination);
-ssize_t nb_write(int fnum, char *buf, DWORD offset, size_t size);
+ssize_t nb_write(HANDLE fd, char *buf, DWORD offset, size_t size);
 int nb_writex(int handle, int offset, int size, int ret_size);
-ssize_t nb_read(int fnum, char *buf, DWORD offset, size_t size);
+ssize_t nb_read(HANDLE fd, char *buf, DWORD offset, size_t size);
 int nb_readx(int handle, int offset, int size, int ret_size);
 int nb_close(int handle);
-BOOL nb_close1(int fnum);
+BOOL nb_close1(HANDLE fd);
 int nb_rmdir(char *fname);
 int nb_rename(char *old, char *new);
 int nb_qpathinfo(char *fname, int Type);
-int nb_qfileinfo(int fnum);
+int nb_qfileinfo(int handle);
 int nb_qfsinfo(int level);
 int nb_findfirst(char *mask);
-int nb_flush(int fnum);
+int nb_flush(int handle);
 int nb_deltree(char *dname);
 int nb_cleanup(char *cname);
 int nb_lock(int handle, int offset, int size, int timeout, unsigned char locktype, NTSTATUS exp);