view TaskManager/kernel/sys_task/Read.cc @ 2051:b79a250b4f99 draft

FileMapReduce (no compile error)
author masa
date Thu, 28 Jan 2016 17:23:45 +0900
parents example/word_count/ppe/Read.cc@8fbe022126e1
children
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 "SysFunc.h"

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

static int
read_task(SchedTask *s, void *rbuf, void *wbuf)
{
    long fd = (long)s->get_param(0);
    long start_read_position = (long)s->get_param(1);
    long end_read_position = (long)s->get_param(2);
    char *read_text = (char*)s->get_output(wbuf,0);

    long read_size = end_read_position - start_read_position;

    pread(fd, read_text, read_size , start_read_position);

    return 0;
}