~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/my_seek.c

Removed dead variable, sorted authors file.

Show diffs side-by-side

added added

removed removed

Lines of Context:
45
45
my_off_t my_seek(File fd, my_off_t pos, int whence,
46
46
                 myf MyFlags __attribute__((unused)))
47
47
{
48
 
  register off_t newpos= -1;
49
 
  assert(pos != MY_FILEPOS_ERROR);              /* safety check */
 
48
  register os_off_t newpos= -1;
 
49
  DBUG_ENTER("my_seek");
 
50
  DBUG_PRINT("my",("Fd: %d  Hpos: %lu  Pos: %lu  Whence: %d  MyFlags: %d",
 
51
                   fd, (ulong) (((uint64_t) pos) >> 32), (ulong) pos, 
 
52
                   whence, MyFlags));
 
53
  DBUG_ASSERT(pos != MY_FILEPOS_ERROR);         /* safety check */
50
54
 
51
55
  /*
52
56
      Make sure we are using a valid file descriptor!
53
57
  */
54
 
  assert(fd != -1);
 
58
  DBUG_ASSERT(fd != -1);
55
59
#if !defined(HAVE_PREAD)
56
60
  if (MyFlags & MY_THREADSAFE)
57
61
  {
62
66
  else
63
67
#endif
64
68
    newpos= lseek(fd, pos, whence);
65
 
  if (newpos == (off_t) -1)
 
69
  if (newpos == (os_off_t) -1)
66
70
  {
67
71
    my_errno=errno;
68
 
    return(MY_FILEPOS_ERROR);
69
 
  }
70
 
  return((my_off_t) newpos);
 
72
    DBUG_PRINT("error",("lseek: %lu  errno: %d", (ulong) newpos,errno));
 
73
    DBUG_RETURN(MY_FILEPOS_ERROR);
 
74
  }
 
75
  if ((my_off_t) newpos != pos)
 
76
  {
 
77
    DBUG_PRINT("exit",("pos: %lu", (ulong) newpos));
 
78
  }
 
79
  DBUG_RETURN((my_off_t) newpos);
71
80
} /* my_seek */
72
81
 
73
82
 
76
85
 
77
86
my_off_t my_tell(File fd, myf MyFlags __attribute__((unused)))
78
87
{
79
 
  off_t pos;
80
 
  assert(fd >= 0);
 
88
  os_off_t pos;
 
89
  DBUG_ENTER("my_tell");
 
90
  DBUG_PRINT("my",("Fd: %d  MyFlags: %d",fd, MyFlags));
 
91
  DBUG_ASSERT(fd >= 0);
81
92
#ifdef HAVE_TELL
82
93
  pos=tell(fd);
83
94
#else
84
95
  pos=lseek(fd, 0L, MY_SEEK_CUR);
85
96
#endif
86
 
  if (pos == (off_t) -1)
 
97
  if (pos == (os_off_t) -1)
87
98
    my_errno=errno;
88
 
  return((my_off_t) pos);
 
99
  DBUG_PRINT("exit",("pos: %lu", (ulong) pos));
 
100
  DBUG_RETURN((my_off_t) pos);
89
101
} /* my_tell */