Lines Matching refs:fd
29 int fd; in read_msr() local
33 fd = open(msr_file_name, O_RDONLY); in read_msr()
34 if (fd < 0) in read_msr()
36 if (lseek(fd, idx, SEEK_CUR) == -1) in read_msr()
38 if (read(fd, val, sizeof *val) != sizeof *val) in read_msr()
40 close(fd); in read_msr()
43 close(fd); in read_msr()
58 int fd; in write_msr() local
62 fd = open(msr_file_name, O_WRONLY); in write_msr()
63 if (fd < 0) in write_msr()
65 if (lseek(fd, idx, SEEK_CUR) == -1) in write_msr()
67 if (write(fd, &val, sizeof val) != sizeof val) in write_msr()
69 close(fd); in write_msr()
72 close(fd); in write_msr()