~drizzle-trunk/drizzle/development

« back to all changes in this revision

Viewing changes to plugin/innobase/os/os0file.c

  • Committer: Lee Bieber
  • Date: 2010-12-23 23:11:00 UTC
  • mfrom: (2024.1.1 clean)
  • Revision ID: kalebral@gmail.com-20101223231100-0rqirgz7ugkl10yp
Merge Brian - session list cleanup

Show diffs side-by-side

added added

removed removed

Lines of Context:
662
662
                if (errno == EAGAIN || errno == EACCES) {
663
663
                        fprintf(stderr,
664
664
                                "InnoDB: Check that you do not already have"
665
 
                                " another drizzled process\n"
 
665
                                " another mysqld process\n"
666
666
                                "InnoDB: using the same InnoDB data"
667
667
                                " or log files.\n");
668
668
                }
940
940
 
941
941
        strcpy(info->name, ent->d_name);
942
942
 
943
 
        full_path = static_cast<char* >(ut_malloc(strlen(dirname) + strlen(ent->d_name) + 10));
 
943
        full_path = ut_malloc(strlen(dirname) + strlen(ent->d_name) + 10);
944
944
 
945
945
        sprintf(full_path, "%s/%s", dirname, ent->d_name);
946
946
 
1297
1297
void
1298
1298
os_file_set_nocache(
1299
1299
/*================*/
1300
 
        int             fd,             /*!< in: file descriptor to alter */
1301
 
        const char*     file_name,      /*!< in: used in the diagnostic message */
1302
 
        const char*     operation_name)
 
1300
        int             fd              /*!< in: file descriptor to alter */
 
1301
        __attribute__((unused)),
 
1302
        const char*     file_name       /*!< in: used in the diagnostic message */
 
1303
        __attribute__((unused)),
 
1304
        const char*     operation_name __attribute__((unused)))
1303
1305
                                        /*!< in: "open" or "create"; used in the
1304
1306
                                        diagnostic message */
1305
1307
{
1937
1939
        /* Write up to 1 megabyte at a time. */
1938
1940
        buf_size = ut_min(64, (ulint) (desired_size / UNIV_PAGE_SIZE))
1939
1941
                * UNIV_PAGE_SIZE;
1940
 
        buf2 = static_cast<unsigned char *>(ut_malloc(buf_size + UNIV_PAGE_SIZE));
 
1942
        buf2 = ut_malloc(buf_size + UNIV_PAGE_SIZE);
1941
1943
 
1942
1944
        /* Align the buffer for possible raw i/o */
1943
 
        buf = static_cast<unsigned char *>(ut_align(buf2, UNIV_PAGE_SIZE));
 
1945
        buf = ut_align(buf2, UNIV_PAGE_SIZE);
1944
1946
 
1945
1947
        /* Write buffer full of zeros */
1946
1948
        memset(buf, 0, buf_size);
3215
3217
#ifdef WIN_ASYNC_IO
3216
3218
        OVERLAPPED*     over;
3217
3219
#elif defined(LINUX_NATIVE_AIO)
3218
 
        struct io_event*        aio_event = NULL;
 
3220
        struct io_event*        io_event = NULL;
3219
3221
#endif
3220
3222
        ut_a(n > 0);
3221
3223
        ut_a(n_segments > 0);
3222
3224
 
3223
 
        array = static_cast<os_aio_array_t *>(ut_malloc(sizeof(os_aio_array_t)));
 
3225
        array = ut_malloc(sizeof(os_aio_array_t));
3224
3226
 
3225
3227
        array->mutex            = os_mutex_create();
3226
3228
        array->not_full         = os_event_create(NULL);
3232
3234
        array->n_segments       = n_segments;
3233
3235
        array->n_reserved       = 0;
3234
3236
        array->cur_seg          = 0;
3235
 
        array->slots            = static_cast<os_aio_slot_t *>(ut_malloc(n * sizeof(os_aio_slot_t)));
 
3237
        array->slots            = ut_malloc(n * sizeof(os_aio_slot_t));
3236
3238
#ifdef __WIN__
3237
3239
        array->handles          = ut_malloc(n * sizeof(HANDLE));
3238
3240
#endif
3250
3252
        /* Initialize the io_context array. One io_context
3251
3253
        per segment in the array. */
3252
3254
 
3253
 
        array->aio_ctx = (io_context**) ut_malloc(n_segments *
 
3255
        array->aio_ctx = ut_malloc(n_segments *
3254
3256
                                   sizeof(*array->aio_ctx));
3255
3257
        for (i = 0; i < n_segments; ++i) {
3256
3258
                if (!os_aio_linux_create_io_ctx(n/n_segments,
3266
3268
        }
3267
3269
 
3268
3270
        /* Initialize the event array. One event per slot. */
3269
 
        aio_event = (io_event*) ut_malloc(n * sizeof(io_event));
3270
 
        memset(aio_event, 0x0, sizeof(io_event) * n);
3271
 
        array->aio_events = aio_event;
 
3271
        io_event = ut_malloc(n * sizeof(*io_event));
 
3272
        memset(io_event, 0x0, sizeof(*io_event) * n);
 
3273
        array->aio_events = io_event;
3272
3274
 
3273
3275
skip_native_aio:
3274
3276
#endif /* LINUX_NATIVE_AIO */
3410
3412
 
3411
3413
        os_aio_validate();
3412
3414
 
3413
 
        os_aio_segment_wait_events = static_cast<os_event_t *>(ut_malloc(n_segments * sizeof(void*)));
 
3415
        os_aio_segment_wait_events = ut_malloc(n_segments * sizeof(void*));
3414
3416
 
3415
3417
        for (i = 0; i < n_segments; i++) {
3416
3418
                os_aio_segment_wait_events[i] = os_event_create(NULL);
3702
3704
        slot->name     = name;
3703
3705
        slot->len      = len;
3704
3706
        slot->type     = type;
3705
 
        slot->buf      = static_cast<unsigned char *>(buf);
 
3707
        slot->buf      = buf;
3706
3708
        slot->offset   = offset;
3707
3709
        slot->offset_high = offset_high;
3708
3710
        slot->io_already_done = FALSE;
4797
4799
                combined_buf = slot->buf;
4798
4800
                combined_buf2 = NULL;
4799
4801
        } else {
4800
 
                combined_buf2 = static_cast<unsigned char *>(ut_malloc(total_len + UNIV_PAGE_SIZE));
 
4802
                combined_buf2 = ut_malloc(total_len + UNIV_PAGE_SIZE);
4801
4803
 
4802
4804
                ut_a(combined_buf2);
4803
4805
 
4804
 
                combined_buf = static_cast<unsigned char *>(ut_align(combined_buf2, UNIV_PAGE_SIZE));
 
4806
                combined_buf = ut_align(combined_buf2, UNIV_PAGE_SIZE);
4805
4807
        }
4806
4808
 
4807
4809
        /* We release the array mutex for the time of the i/o: NOTE that