summaryrefslogtreecommitdiff
path: root/mysys
diff options
context:
space:
mode:
authorMonty <monty@mariadb.org>2023-03-01 19:36:13 +0200
committerMonty <monty@mariadb.org>2023-03-02 13:11:54 +0200
commitbf9aa8687f7a00c1abc3b23c33a060a1a076bbda (patch)
tree25e32eee53cde5b45c64e71ffb1e267f69c95990 /mysys
parenta1211a4eda9c7348295ce4a6fdfa8e94860e5e14 (diff)
downloadmariadb-git-bf9aa8687f7a00c1abc3b23c33a060a1a076bbda.tar.gz
Fixes to make dbug traces from Windows easier to compare with Unix traces
- Remove DBUG calls from my_winfile.c where call and parameters are already printed by mysys. - Remove DBUG from my_get_osfhandle() and my_get_open_flags() to remove DBUG noise. - Updated convert-debug-for-diff to take into account windows. - Changed some DBUG_RETURN(function()) to tmp=function(); DBUG_RETURN(tmp); This is needed as Visual C++ prints for DBUG binaries a trace for func_a() { DBUG_ENTER("func_a"); DBUG_RETURN(func_b()) } as >func_a <func_a >func_b <func_b instead of when using gcc: >func_a | >func_b | <func_b <func_a
Diffstat (limited to 'mysys')
-rw-r--r--mysys/my_winfile.c63
1 files changed, 22 insertions, 41 deletions
diff --git a/mysys/my_winfile.c b/mysys/my_winfile.c
index 35bc6b35399..7a1e3e60b12 100644
--- a/mysys/my_winfile.c
+++ b/mysys/my_winfile.c
@@ -89,17 +89,15 @@ static void invalidate_fd(File fd)
/* Get Windows handle for a file descriptor */
HANDLE my_get_osfhandle(File fd)
{
- DBUG_ENTER("my_get_osfhandle");
DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit);
- DBUG_RETURN(my_file_info[fd].fhandle);
+ return (my_file_info[fd].fhandle);
}
static int my_get_open_flags(File fd)
{
- DBUG_ENTER("my_get_open_flags");
DBUG_ASSERT(fd >= MY_FILE_MIN && fd < (int)my_file_limit);
- DBUG_RETURN(my_file_info[fd].oflag);
+ return (my_file_info[fd].oflag);
}
/*
@@ -347,10 +345,8 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset)
OVERLAPPED ov= {0};
LARGE_INTEGER li;
- DBUG_ENTER("my_win_pread");
-
if(!Count)
- DBUG_RETURN(0);
+ return(0);
#ifdef _WIN64
if(Count > UINT_MAX)
Count= UINT_MAX;
@@ -369,11 +365,11 @@ size_t my_win_pread(File Filedes, uchar *Buffer, size_t Count, my_off_t offset)
through e.g. a command pipe in windows : see MSDN on ReadFile.
*/
if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE)
- DBUG_RETURN(0); /*return 0 at EOF*/
+ return(0); /*return 0 at EOF*/
my_osmaperr(lastError);
- DBUG_RETURN((size_t)-1);
+ return((size_t)-1);
}
- DBUG_RETURN(nBytesRead);
+ return(nBytesRead);
}
@@ -382,9 +378,8 @@ size_t my_win_read(File Filedes, uchar *Buffer, size_t Count)
DWORD nBytesRead;
HANDLE hFile;
- DBUG_ENTER("my_win_read");
if(!Count)
- DBUG_RETURN(0);
+ return(0);
#ifdef _WIN64
if(Count > UINT_MAX)
Count= UINT_MAX;
@@ -400,11 +395,11 @@ size_t my_win_read(File Filedes, uchar *Buffer, size_t Count)
through e.g. a command pipe in windows : see MSDN on ReadFile.
*/
if(lastError == ERROR_HANDLE_EOF || lastError == ERROR_BROKEN_PIPE)
- DBUG_RETURN(0); /*return 0 at EOF*/
+ return(0); /*return 0 at EOF*/
my_osmaperr(lastError);
- DBUG_RETURN((size_t)-1);
+ return((size_t)-1);
}
- DBUG_RETURN(nBytesRead);
+ return(nBytesRead);
}
@@ -416,12 +411,8 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count,
OVERLAPPED ov= {0};
LARGE_INTEGER li;
- DBUG_ENTER("my_win_pwrite");
- DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count: %llu, offset: %llu",
- Filedes, Buffer, (ulonglong)Count, (ulonglong)offset));
-
if(!Count)
- DBUG_RETURN(0);
+ return(0);
#ifdef _WIN64
if(Count > UINT_MAX)
@@ -436,10 +427,10 @@ size_t my_win_pwrite(File Filedes, const uchar *Buffer, size_t Count,
if(!WriteFile(hFile, Buffer, (DWORD)Count, &nBytesWritten, &ov))
{
my_osmaperr(GetLastError());
- DBUG_RETURN((size_t)-1);
+ return((size_t)-1);
}
else
- DBUG_RETURN(nBytesWritten);
+ return(nBytesWritten);
}
@@ -448,11 +439,9 @@ my_off_t my_win_lseek(File fd, my_off_t pos, int whence)
LARGE_INTEGER offset;
LARGE_INTEGER newpos;
- DBUG_ENTER("my_win_lseek");
-
/* Check compatibility of Windows and Posix seek constants */
- compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR
- && FILE_END == SEEK_END);
+ compile_time_assert(FILE_BEGIN == SEEK_SET && FILE_CURRENT == SEEK_CUR &&
+ FILE_END == SEEK_END);
offset.QuadPart= pos;
if(!SetFilePointerEx(my_get_osfhandle(fd), offset, &newpos, whence))
@@ -460,7 +449,7 @@ my_off_t my_win_lseek(File fd, my_off_t pos, int whence)
my_osmaperr(GetLastError());
newpos.QuadPart= -1;
}
- DBUG_RETURN(newpos.QuadPart);
+ return(newpos.QuadPart);
}
@@ -474,12 +463,8 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count)
OVERLAPPED *pov= NULL;
HANDLE hFile;
- DBUG_ENTER("my_win_write");
- DBUG_PRINT("my",("Filedes: %d, Buffer: %p, Count %llu", fd, Buffer,
- (ulonglong)Count));
-
if(!Count)
- DBUG_RETURN(0);
+ return(0);
#ifdef _WIN64
if(Count > UINT_MAX)
@@ -502,9 +487,9 @@ size_t my_win_write(File fd, const uchar *Buffer, size_t Count)
if(!WriteFile(hFile, Buffer, (DWORD)Count, &nWritten, pov))
{
my_osmaperr(GetLastError());
- DBUG_RETURN((size_t)-1);
+ return((size_t)-1);
}
- DBUG_RETURN(nWritten);
+ return(nWritten);
}
@@ -512,7 +497,6 @@ int my_win_chsize(File fd, my_off_t newlength)
{
HANDLE hFile;
LARGE_INTEGER length;
- DBUG_ENTER("my_win_chsize");
hFile= (HANDLE) my_get_osfhandle(fd);
length.QuadPart= newlength;
@@ -520,11 +504,11 @@ int my_win_chsize(File fd, my_off_t newlength)
goto err;
if (!SetEndOfFile(hFile))
goto err;
- DBUG_RETURN(0);
+ return(0);
err:
my_osmaperr(GetLastError());
my_errno= errno;
- DBUG_RETURN(-1);
+ return(-1);
}
@@ -555,7 +539,6 @@ File my_win_handle2File(HANDLE hFile)
{
int retval= -1;
uint i;
-
DBUG_ENTER("my_win_handle2File");
for(i= MY_FILE_MIN; i < my_file_limit; i++)
@@ -623,7 +606,6 @@ FILE * my_win_fdopen(File fd, const char *type)
FILE *file;
int crt_fd;
int flags= 0;
-
DBUG_ENTER("my_win_fdopen");
if(strchr(type,'a') != NULL)
@@ -641,8 +623,8 @@ FILE * my_win_fdopen(File fd, const char *type)
int my_win_fclose(FILE *file)
{
File fd;
-
DBUG_ENTER("my_win_fclose");
+
fd= my_fileno(file);
if(fd < 0)
DBUG_RETURN(-1);
@@ -665,7 +647,6 @@ int my_win_fstat(File fd, struct _stati64 *buf)
int crt_fd;
int retval;
HANDLE hFile, hDup;
-
DBUG_ENTER("my_win_fstat");
hFile= my_get_osfhandle(fd);