~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to mysys/mf_iocache.cc

  • Committer: Monty Taylor
  • Date: 2009-12-23 08:01:21 UTC
  • mto: This revision was merged to the branch mainline in revision 1253.
  • Revision ID: mordred@inaugust.com-20091223080121-iveugdrewkp7iqyi
Oy. Bigger change than I normally like - but this stuff is all intertwined.
Moved a bunch of things to public drizzled/ area. Split some files. Made some
convenience libs. EVENTUALLY, some of this will be able to be re-factored, but
for now I'm ok with erring on the side of too many files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
50
50
#include "mysys/mysys_priv.h"
51
51
#include <mystrings/m_string.h>
52
52
#ifdef HAVE_AIOWAIT
53
 
#include "mysys/mysys_err.h"
 
53
#include "drizzled/my_error.h"
54
54
#include <mysys/aio_result.h>
55
55
static void my_aiowait(my_aio_result *result);
56
56
#endif
178
178
  if (file >= 0)
179
179
  {
180
180
    pos= lseek(file, 0, SEEK_CUR);
181
 
    if ((pos == MY_FILEPOS_ERROR) && (my_errno == ESPIPE))
 
181
    if ((pos == MY_FILEPOS_ERROR) && (errno == ESPIPE))
182
182
    {
183
183
      /*
184
184
         This kind of object doesn't support seek() or tell(). Don't set a
470
470
        info->file is a pipe or socket or FIFO.  We never should have tried
471
471
        to seek on that.  See Bugs#25807 and #22828 for more info.
472
472
      */
473
 
      assert(my_errno != ESPIPE);
 
473
      assert(errno != ESPIPE);
474
474
      info->error= -1;
475
475
      return(1);
476
476
    }
1219
1219
      Count                     Number of bytes to read into Buffer
1220
1220
 
1221
1221
  RETURN VALUE
1222
 
    -1          An error has occurred; my_errno is set.
 
1222
    -1          An error has occurred; errno is set.
1223
1223
     0          Success
1224
1224
     1          An error has occurred; IO_CACHE to error state.
1225
1225
*/
1247
1247
        my_error(EE_READ, MYF(ME_BELL+ME_WAITTANG),
1248
1248
                 my_filename(info->file),
1249
1249
                 info->aio_result.result.aio_errno);
1250
 
      my_errno=info->aio_result.result.aio_errno;
 
1250
      errno=info->aio_result.result.aio_errno;
1251
1251
      info->error= -1;
1252
1252
      return(1);
1253
1253
    }
1254
1254
    if (! (read_length= (size_t) info->aio_result.result.aio_return) ||
1255
1255
        read_length == (size_t) -1)
1256
1256
    {
1257
 
      my_errno=0;                               /* For testing */
 
1257
      errno=0;                          /* For testing */
1258
1258
      info->error= (read_length == (size_t) -1 ? -1 :
1259
1259
                    (int) (read_length+left_length));
1260
1260
      return(1);
1331
1331
      {                                 /* Didn't find hole block */
1332
1332
        if (info->myflags & (MY_WME | MY_FAE | MY_FNABP) && Count != org_Count)
1333
1333
          my_error(EE_EOFERR, MYF(ME_BELL+ME_WAITTANG),
1334
 
                   my_filename(info->file),my_errno);
 
1334
                   my_filename(info->file),errno);
1335
1335
        info->error=(int) (read_length+left_length);
1336
1336
        return 1;
1337
1337
      }
1367
1367
                (my_off_t) next_pos_in_file,SEEK_SET,
1368
1368
                &info->aio_result.result))
1369
1369
    {                                           /* Skip async io */
1370
 
      my_errno=errno;
 
1370
      errno=errno;
1371
1371
      if (info->request_pos != info->buffer)
1372
1372
      {
1373
1373
        memmove(info->buffer, info->request_pos,
1409
1409
   RETURN VALUE
1410
1410
    1 On error on write
1411
1411
    0 On success
1412
 
   -1 On error; my_errno contains error code.
 
1412
   -1 On error; errno contains error code.
1413
1413
*/
1414
1414
 
1415
1415
extern "C" int _my_b_write(register IO_CACHE *info, const unsigned char *Buffer, size_t Count)
1418
1418
 
1419
1419
  if (info->pos_in_file+info->buffer_length > info->end_of_file)
1420
1420
  {
1421
 
    my_errno=errno=EFBIG;
 
1421
    errno=errno=EFBIG;
1422
1422
    return info->error = -1;
1423
1423
  }
1424
1424