~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to storage/myisam/my_pread.c

  • Committer: Monty Taylor
  • Date: 2008-07-16 19:10:24 UTC
  • mfrom: (51.1.127 remove-dbug)
  • mto: This revision was merged to the branch mainline in revision 176.
  • Revision ID: monty@inaugust.com-20080716191024-prjgoh7fbri7rx26
MergedĀ fromĀ remove-dbug.

Show diffs side-by-side

added added

removed removed

Lines of Context:
44
44
{
45
45
  size_t readbytes;
46
46
  int error= 0;
47
 
  DBUG_ENTER("my_pread");
48
 
  DBUG_PRINT("my",("Fd: %d  Seek: %lu  Buffer: 0x%lx  Count: %u  MyFlags: %d",
49
 
                   Filedes, (ulong) offset, (long) Buffer, (uint) Count,
50
 
                   MyFlags));
51
47
  for (;;)
52
48
  {
53
49
    errno=0;                                    /* Linux doesn't reset this */
55
51
      my_errno= errno ? errno : -1;
56
52
    if (error || readbytes != Count)
57
53
    {
58
 
      DBUG_PRINT("warning",("Read only %d bytes off %u from %d, errno: %d",
59
 
                            (int) readbytes, (uint) Count,Filedes,my_errno));
60
54
      if ((readbytes == 0 || readbytes == (size_t) -1) && errno == EINTR)
61
55
      {
62
 
        DBUG_PRINT("debug", ("my_pread() was interrupted and returned %d",
63
 
                             (int) readbytes));
64
56
        continue;                              /* Interrupted */
65
57
      }
66
58
      if (MyFlags & (MY_WME | MY_FAE | MY_FNABP))
73
65
                   my_filename(Filedes),my_errno);
74
66
      }
75
67
      if (readbytes == (size_t) -1 || (MyFlags & (MY_FNABP | MY_NABP)))
76
 
        DBUG_RETURN(MY_FILE_ERROR);             /* Return with error */
 
68
        return(MY_FILE_ERROR);          /* Return with error */
77
69
    }
78
70
    if (MyFlags & (MY_NABP | MY_FNABP))
79
 
      DBUG_RETURN(0);                           /* Read went ok; Return 0 */
80
 
    DBUG_RETURN(readbytes);                     /* purecov: inspected */
 
71
      return(0);                                /* Read went ok; Return 0 */
 
72
    return(readbytes);                  /* purecov: inspected */
81
73
  }
82
74
} /* my_pread */
83
75
 
108
100
{
109
101
  size_t writenbytes, written;
110
102
  uint errors;
111
 
  DBUG_ENTER("my_pwrite");
112
 
  DBUG_PRINT("my",("Fd: %d  Seek: %lu  Buffer: 0x%lx  Count: %u  MyFlags: %d",
113
 
                   Filedes, (ulong) offset, (long) Buffer, (uint) Count,
114
 
                   MyFlags));
115
103
  errors= 0;
116
104
  written= 0;
117
105
 
127
115
      Count-=writenbytes;
128
116
      offset+=writenbytes;
129
117
    }
130
 
    DBUG_PRINT("error",("Write only %u bytes", (uint) writenbytes));
131
118
#ifndef NO_BACKGROUND
132
119
    if (my_thread_var->abort)
133
120
      MyFlags&= ~ MY_WAIT_IF_FULL;              /* End if aborted by user */
150
137
        my_error(EE_WRITE, MYF(ME_BELL | ME_WAITTANG),
151
138
                 my_filename(Filedes),my_errno);
152
139
      }
153
 
      DBUG_RETURN(MY_FILE_ERROR);               /* Error on read */
 
140
      return(MY_FILE_ERROR);            /* Error on read */
154
141
    }
155
142
    else
156
143
      break;                                    /* Return bytes written */
157
144
  }
158
 
  DBUG_EXECUTE_IF("check", my_seek(Filedes, -1, SEEK_SET, MYF(0)););
159
145
  if (MyFlags & (MY_NABP | MY_FNABP))
160
 
    DBUG_RETURN(0);                     /* Want only errors */
161
 
  DBUG_RETURN(writenbytes+written); /* purecov: inspected */
 
146
    return(0);                  /* Want only errors */
 
147
  return(writenbytes+written); /* purecov: inspected */
162
148
} /* my_pwrite */