op_deviceio.c

Go to the documentation of this file.
00001 
00012 #include "op_deviceio.h"
00013 
00014 #include <sys/types.h>
00015 #include <fcntl.h>
00016 
00017 #include <stdio.h>
00018 #include <stdlib.h>
00019 #include <string.h>
00020 #include <errno.h>
00021 
00022 fd_t op_open_device(char const * name)
00023 {
00024     return open(name, O_RDONLY);
00025 }
00026 
00027 
00028 ssize_t op_read_device(fd_t devfd, void * buf, size_t size)
00029 {
00030     ssize_t count;
00031 
00032     lseek(devfd, 0, SEEK_SET);
00033 
00034     count = read(devfd, buf, size);
00035 
00036     if (count < 0 && errno != EINTR && errno != EAGAIN) {
00037         perror("oprofiled:op_read_device: ");
00038         exit(EXIT_FAILURE);
00039     }
00040 
00041     return count;
00042 }

Generated on 8 Nov 2012 for Oprofile by  doxygen 1.6.1