view example/fileread/ppe/Read.cc @ 1864:7211816380bd draft

implement my_mmap in fileread
author Masataka Kohagura <e085726@ie.u-ryukyu.ac.jp>
date Tue, 24 Dec 2013 19:16:49 +0900
parents 9e96c8c52574
children 14225fec047c
line wrap: on
line source

#include <stdio.h>
#include <string.h>
#include <unistd.h>
#include <sys/stat.h>
#include <iostream>
#include <vector>
#include <cstdlib>

#include "SchedTask.h"
#include "Print.h"
#include "Func.h"

/* これは必須 */
SchedDefineTask1(Read_task,read_task);

static int
read_task(SchedTask *s, void *rbuf, void *wbuf)
{
    long task_number = (long)s->get_param(0);   //何番目のtaskか
    long division_size = (long)s->get_param(1);
    long read_size = (long)s->get_param(2);
    long fd = (long)s->get_param(3);

    char text[(long)read_size];
    text[(long)read_size] = '\0';

    pread(fd, text, (long)read_size , division_size*task_number);

    //s->printf("[start task No. %d]\n",task_number);
    //s->printf("%s\n",text);
    s->printf("in divide_read\n");
    return 0;
}