16 #include "mysys_priv.h"
17 #include "mysys_err.h"
46 my_off_t my_seek(File fd, my_off_t pos,
int whence, myf MyFlags)
49 DBUG_ENTER(
"my_seek");
50 DBUG_PRINT(
"my",(
"fd: %d Pos: %llu Whence: %d MyFlags: %d",
51 fd, (ulonglong) pos, whence, MyFlags));
52 DBUG_ASSERT(pos != MY_FILEPOS_ERROR);
57 DBUG_ASSERT(fd != -1);
59 newpos= my_win_lseek(fd, pos, whence);
61 newpos= lseek(fd, pos, whence);
63 if (newpos == (os_off_t) -1)
68 char errbuf[MYSYS_STRERROR_SIZE];
69 my_error(EE_CANT_SEEK, MYF(0), my_filename(fd),
70 my_errno, my_strerror(errbuf,
sizeof(errbuf), my_errno));
72 DBUG_PRINT(
"error", (
"lseek: %llu errno: %d", (ulonglong) newpos, errno));
73 DBUG_RETURN(MY_FILEPOS_ERROR);
75 if ((my_off_t) newpos != pos)
77 DBUG_PRINT(
"exit",(
"pos: %llu", (ulonglong) newpos));
79 DBUG_RETURN((my_off_t) newpos);
86 my_off_t my_tell(File fd, myf MyFlags)
89 DBUG_ENTER(
"my_tell");
90 DBUG_PRINT(
"my",(
"fd: %d MyFlags: %d",fd, MyFlags));
92 #if defined (HAVE_TELL) && !defined (_WIN32)
95 pos= my_seek(fd, 0L, MY_SEEK_CUR,0);
97 if (pos == (os_off_t) -1)
100 if (MyFlags & MY_WME)
102 char errbuf[MYSYS_STRERROR_SIZE];
103 my_error(EE_CANT_SEEK, MYF(0), my_filename(fd),
104 my_errno, my_strerror(errbuf,
sizeof(errbuf), my_errno));
106 DBUG_PRINT(
"error", (
"tell: %llu errno: %d", (ulonglong) pos, my_errno));
108 DBUG_PRINT(
"exit",(
"pos: %llu", (ulonglong) pos));
109 DBUG_RETURN((my_off_t) pos);