Subversion Repositories shark

Rev

Details | Last modification | View Log | RSS feed

Rev Author Line No. Line
1655 giacomo 1
/*
2
 *
3
 *
4
 *
5
 */
6
 
7
#include <kernel/func.h>
8
 
9
#include <fs/bdevinit.h>
10
#include <fs/fsinit.h>
11
#include <fs/bdev.h>
12
 
13
#include <drivers/keyb.h>
14
 
15
#include <sys/mount.h>
16
 
17
#include <fcntl.h>
18
#include <unistd.h>
19
#include <errno.h>
20
#include <string.h>
21
 
22
#include "common.h"
23
 
24
#define FILENAME "/TEMP/ALFA1.TXT"
25
 
26
#include <trace/trace.h>
27
#include <trace/queues.h>
28
 
29
int __register_sub_init_prologue(void)
30
{
31
  TRC_init_phase1(NULL);
32
  trc_register_fixed_queue();
33
  trc_create_queue(TRC_FIXED_QUEUE,NULL);
34
  return 0;
35
}
36
 
37
int main(int argc,char *argv[])
38
{
39
  int h;
40
 
41
  showmessage("A file is opened for reading while the tracer\n"
42
              "with a fixed queue is runnig\n");
43
 
44
  cprintf("OPENING %s\n",FILENAME);  
45
  h=open(FILENAME,O_RDONLY);
46
  if (h>=0) {
47
    char buffer[128];
48
    int len;
49
    cprintf("OPENED!\n");
50
 
51
    cprintf("READING...\n");
52
    len=read(h,buffer,sizeof(buffer));
53
    cprintf("READ %i bytes\n",len);
54
    memset(buffer,'\0',sizeof(buffer));
55
    cprintf("buffer='%s'\n",buffer);
56
 
57
    cprintf("READING...\n");
58
    len=read(h,buffer,sizeof(buffer));
59
    cprintf("READ %i bytes\n",len);
60
    memset(buffer,'\0',sizeof(buffer));
61
    cprintf("buffer='%s'\n",buffer);
62
 
63
    close(h);
64
 
65
  } else
66
    cprintf("FAILED!\n");
67
 
68
  waitend();
69
 
70
  return 0;
71
}