Subversion Repositories shark

Rev

Blame | Last modification | View Log | RSS feed

/*
 *
 *
 *
 */


#include <kernel/func.h>

#include <fs/bdevinit.h>
#include <fs/fsinit.h>
#include <fs/bdev.h>

#include <drivers/keyb.h>

#include <sys/mount.h>

#include <fcntl.h>
#include <unistd.h>
#include <errno.h>
#include <string.h>

#include "common.h"

#define FILENAME "/TEMP/ALFA1.TXT"

#include <trace/trace.h>
#include <trace/queues.h>

int __register_sub_init_prologue(void)
{
  TRC_init_phase1(NULL);
  trc_register_fixed_queue();
  trc_create_queue(TRC_FIXED_QUEUE,NULL);
  return 0;
}

int main(int argc,char *argv[])
{
  int h;

  showmessage("A file is opened for reading while the tracer\n"
              "with a fixed queue is runnig\n");
 
  cprintf("OPENING %s\n",FILENAME);  
  h=open(FILENAME,O_RDONLY);
  if (h>=0) {
    char buffer[128];
    int len;
    cprintf("OPENED!\n");

    cprintf("READING...\n");
    len=read(h,buffer,sizeof(buffer));
    cprintf("READ %i bytes\n",len);
    memset(buffer,'\0',sizeof(buffer));
    cprintf("buffer='%s'\n",buffer);

    cprintf("READING...\n");
    len=read(h,buffer,sizeof(buffer));
    cprintf("READ %i bytes\n",len);
    memset(buffer,'\0',sizeof(buffer));
    cprintf("buffer='%s'\n",buffer);

    close(h);
   
  } else
    cprintf("FAILED!\n");
 
  waitend();
 
  return 0;
}