summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2004-07-20 15:54:59 (GMT)
committerH. Peter Anvin <hpa@zytor.com>2004-07-20 15:54:59 (GMT)
commit095c6340527985684522a87b95b72eb321651b0e (patch)
treefeb65139ca92a25e5bef81d402233952765a73f9
parent617fe056218b7ae3b67ac73ce739c3df8942ea40 (diff)
downloadmsr-tools-095c6340527985684522a87b95b72eb321651b0e.zip
msr-tools-095c6340527985684522a87b95b72eb321651b0e.tar.gz
msr-tools-095c6340527985684522a87b95b72eb321651b0e.tar.bz2
msr-tools-095c6340527985684522a87b95b72eb321651b0e.tar.xz
Update to work with largefiles, and use pread/pwritemsr-tools-1.1.2
-rw-r--r--Makefile2
-rw-r--r--rdmsr.c9
-rw-r--r--version.h2
-rw-r--r--wrmsr.c12
4 files changed, 7 insertions, 18 deletions
diff --git a/Makefile b/Makefile
index c5adc16..7f3c9e1 100644
--- a/Makefile
+++ b/Makefile
@@ -16,7 +16,7 @@
#
CC = gcc -Wall
-CFLAGS = -g -O2 -fomit-frame-pointer
+CFLAGS = -g -O2 -fomit-frame-pointer -D_GNU_SOURCE -D_FILE_OFFSET_BITS=64
LDFLAGS =
BIN = wrmsr rdmsr
diff --git a/rdmsr.c b/rdmsr.c
index 2f937e6..ccdc151 100644
--- a/rdmsr.c
+++ b/rdmsr.c
@@ -182,13 +182,8 @@ int main(int argc, char *argv[])
}
}
- if ( lseek(fd, reg, SEEK_SET) != reg ) {
- perror("rdmsr:seek");
- exit(127);
- }
-
- if ( read(fd, &data, sizeof data) != sizeof data ) {
- perror("rdmsr:read");
+ if ( pread(fd, &data, sizeof data, reg) != sizeof data ) {
+ perror("rdmsr:pread");
exit(127);
}
diff --git a/version.h b/version.h
index 97c0a59..b31fc46 100644
--- a/version.h
+++ b/version.h
@@ -1,4 +1,4 @@
#ifndef MSR_TOOLS_VERSION_H
#define MSR_TOOLS_VERSION_H
-#define VERSION_STRING "msr-tools-1.1.1"
+#define VERSION_STRING "msr-tools-1.1.2"
#endif
diff --git a/wrmsr.c b/wrmsr.c
index 0c8cb24..c797839 100644
--- a/wrmsr.c
+++ b/wrmsr.c
@@ -105,15 +105,10 @@ int main(int argc, char *argv[])
}
}
- if ( lseek(fd, reg, SEEK_SET) != reg ) {
- perror("wrmsr:seek");
- exit(127);
- }
-
while ( optind < argc ) {
- data = strtouq(argv[optind++], NULL, 0);
- if ( write(fd, &data, sizeof data) != sizeof data ) {
- perror("wrmsr:write");
+ data = strtoull(argv[optind++], NULL, 0);
+ if ( pwrite(fd, &data, sizeof data, reg) != sizeof data ) {
+ perror("wrmsr:pwrite");
exit(127);
}
}
@@ -122,4 +117,3 @@ int main(int argc, char *argv[])
exit(0);
}
-