diff options
author | Jiri Olsa <jolsa@redhat.com> | 2013-11-28 05:30:14 -0500 |
---|---|---|
committer | Arnaldo Carvalho de Melo <acme@redhat.com> | 2013-12-02 07:22:45 -0500 |
commit | 727ebd544f85285a223ecc6a2a57ef90202cdc7b (patch) | |
tree | 592c0aff7da8b5a51dde7a799a12c52c08171c7f /tools | |
parent | 6233dd5efdf9e2c2da1b003cfb70307b7b2028e8 (diff) |
perf tools: Use correct return type for readn function
Changing readn function return type to ssize_t because read returns
ssize_t not int.
Changing callers holding variable types as well.
Signed-off-by: Jiri Olsa <jolsa@redhat.com>
Cc: Adrian Hunter <adrian.hunter@intel.com>
Cc: David Ahern <dsahern@gmail.com>
Cc: Frederic Weisbecker <fweisbec@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Cc: Mike Galbraith <efault@gmx.de>
Cc: Namhyung Kim <namhyung@kernel.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1385634619-8129-3-git-send-email-jolsa@redhat.com
Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
Diffstat (limited to 'tools')
-rw-r--r-- | tools/perf/util/header.c | 18 | ||||
-rw-r--r-- | tools/perf/util/session.c | 2 | ||||
-rw-r--r-- | tools/perf/util/util.c | 4 | ||||
-rw-r--r-- | tools/perf/util/util.h | 2 |
4 files changed, 13 insertions, 13 deletions
diff --git a/tools/perf/util/header.c b/tools/perf/util/header.c index 1cd035708931..3e755f2bfe8f 100644 --- a/tools/perf/util/header.c +++ b/tools/perf/util/header.c | |||
@@ -1709,7 +1709,7 @@ static int process_nrcpus(struct perf_file_section *section __maybe_unused, | |||
1709 | struct perf_header *ph, int fd, | 1709 | struct perf_header *ph, int fd, |
1710 | void *data __maybe_unused) | 1710 | void *data __maybe_unused) |
1711 | { | 1711 | { |
1712 | size_t ret; | 1712 | ssize_t ret; |
1713 | u32 nr; | 1713 | u32 nr; |
1714 | 1714 | ||
1715 | ret = readn(fd, &nr, sizeof(nr)); | 1715 | ret = readn(fd, &nr, sizeof(nr)); |
@@ -1753,7 +1753,7 @@ static int process_total_mem(struct perf_file_section *section __maybe_unused, | |||
1753 | void *data __maybe_unused) | 1753 | void *data __maybe_unused) |
1754 | { | 1754 | { |
1755 | uint64_t mem; | 1755 | uint64_t mem; |
1756 | size_t ret; | 1756 | ssize_t ret; |
1757 | 1757 | ||
1758 | ret = readn(fd, &mem, sizeof(mem)); | 1758 | ret = readn(fd, &mem, sizeof(mem)); |
1759 | if (ret != sizeof(mem)) | 1759 | if (ret != sizeof(mem)) |
@@ -1822,7 +1822,7 @@ static int process_cmdline(struct perf_file_section *section __maybe_unused, | |||
1822 | struct perf_header *ph, int fd, | 1822 | struct perf_header *ph, int fd, |
1823 | void *data __maybe_unused) | 1823 | void *data __maybe_unused) |
1824 | { | 1824 | { |
1825 | size_t ret; | 1825 | ssize_t ret; |
1826 | char *str; | 1826 | char *str; |
1827 | u32 nr, i; | 1827 | u32 nr, i; |
1828 | struct strbuf sb; | 1828 | struct strbuf sb; |
@@ -1858,7 +1858,7 @@ static int process_cpu_topology(struct perf_file_section *section __maybe_unused | |||
1858 | struct perf_header *ph, int fd, | 1858 | struct perf_header *ph, int fd, |
1859 | void *data __maybe_unused) | 1859 | void *data __maybe_unused) |
1860 | { | 1860 | { |
1861 | size_t ret; | 1861 | ssize_t ret; |
1862 | u32 nr, i; | 1862 | u32 nr, i; |
1863 | char *str; | 1863 | char *str; |
1864 | struct strbuf sb; | 1864 | struct strbuf sb; |
@@ -1914,7 +1914,7 @@ static int process_numa_topology(struct perf_file_section *section __maybe_unuse | |||
1914 | struct perf_header *ph, int fd, | 1914 | struct perf_header *ph, int fd, |
1915 | void *data __maybe_unused) | 1915 | void *data __maybe_unused) |
1916 | { | 1916 | { |
1917 | size_t ret; | 1917 | ssize_t ret; |
1918 | u32 nr, node, i; | 1918 | u32 nr, node, i; |
1919 | char *str; | 1919 | char *str; |
1920 | uint64_t mem_total, mem_free; | 1920 | uint64_t mem_total, mem_free; |
@@ -1974,7 +1974,7 @@ static int process_pmu_mappings(struct perf_file_section *section __maybe_unused | |||
1974 | struct perf_header *ph, int fd, | 1974 | struct perf_header *ph, int fd, |
1975 | void *data __maybe_unused) | 1975 | void *data __maybe_unused) |
1976 | { | 1976 | { |
1977 | size_t ret; | 1977 | ssize_t ret; |
1978 | char *name; | 1978 | char *name; |
1979 | u32 pmu_num; | 1979 | u32 pmu_num; |
1980 | u32 type; | 1980 | u32 type; |
@@ -2534,7 +2534,7 @@ static int check_magic_endian(u64 magic, uint64_t hdr_sz, | |||
2534 | int perf_file_header__read(struct perf_file_header *header, | 2534 | int perf_file_header__read(struct perf_file_header *header, |
2535 | struct perf_header *ph, int fd) | 2535 | struct perf_header *ph, int fd) |
2536 | { | 2536 | { |
2537 | int ret; | 2537 | ssize_t ret; |
2538 | 2538 | ||
2539 | lseek(fd, 0, SEEK_SET); | 2539 | lseek(fd, 0, SEEK_SET); |
2540 | 2540 | ||
@@ -2628,7 +2628,7 @@ static int perf_file_header__read_pipe(struct perf_pipe_file_header *header, | |||
2628 | struct perf_header *ph, int fd, | 2628 | struct perf_header *ph, int fd, |
2629 | bool repipe) | 2629 | bool repipe) |
2630 | { | 2630 | { |
2631 | int ret; | 2631 | ssize_t ret; |
2632 | 2632 | ||
2633 | ret = readn(fd, header, sizeof(*header)); | 2633 | ret = readn(fd, header, sizeof(*header)); |
2634 | if (ret <= 0) | 2634 | if (ret <= 0) |
@@ -2669,7 +2669,7 @@ static int read_attr(int fd, struct perf_header *ph, | |||
2669 | struct perf_event_attr *attr = &f_attr->attr; | 2669 | struct perf_event_attr *attr = &f_attr->attr; |
2670 | size_t sz, left; | 2670 | size_t sz, left; |
2671 | size_t our_sz = sizeof(f_attr->attr); | 2671 | size_t our_sz = sizeof(f_attr->attr); |
2672 | int ret; | 2672 | ssize_t ret; |
2673 | 2673 | ||
2674 | memset(f_attr, 0, sizeof(*f_attr)); | 2674 | memset(f_attr, 0, sizeof(*f_attr)); |
2675 | 2675 | ||
diff --git a/tools/perf/util/session.c b/tools/perf/util/session.c index b0b15e213df5..4ce146bae552 100644 --- a/tools/perf/util/session.c +++ b/tools/perf/util/session.c | |||
@@ -1158,7 +1158,7 @@ static int __perf_session__process_pipe_events(struct perf_session *session, | |||
1158 | void *buf = NULL; | 1158 | void *buf = NULL; |
1159 | int skip = 0; | 1159 | int skip = 0; |
1160 | u64 head; | 1160 | u64 head; |
1161 | int err; | 1161 | ssize_t err; |
1162 | void *p; | 1162 | void *p; |
1163 | 1163 | ||
1164 | perf_tool__fill_defaults(tool); | 1164 | perf_tool__fill_defaults(tool); |
diff --git a/tools/perf/util/util.c b/tools/perf/util/util.c index 28a0a89c1f73..9440481e9092 100644 --- a/tools/perf/util/util.c +++ b/tools/perf/util/util.c | |||
@@ -151,12 +151,12 @@ unsigned long convert_unit(unsigned long value, char *unit) | |||
151 | return value; | 151 | return value; |
152 | } | 152 | } |
153 | 153 | ||
154 | int readn(int fd, void *buf, size_t n) | 154 | ssize_t readn(int fd, void *buf, size_t n) |
155 | { | 155 | { |
156 | void *buf_start = buf; | 156 | void *buf_start = buf; |
157 | 157 | ||
158 | while (n) { | 158 | while (n) { |
159 | int ret = read(fd, buf, n); | 159 | ssize_t ret = read(fd, buf, n); |
160 | 160 | ||
161 | if (ret <= 0) | 161 | if (ret <= 0) |
162 | return ret; | 162 | return ret; |
diff --git a/tools/perf/util/util.h b/tools/perf/util/util.h index c8f362daba87..9f6b928f6b2b 100644 --- a/tools/perf/util/util.h +++ b/tools/perf/util/util.h | |||
@@ -253,7 +253,7 @@ bool strlazymatch(const char *str, const char *pat); | |||
253 | int strtailcmp(const char *s1, const char *s2); | 253 | int strtailcmp(const char *s1, const char *s2); |
254 | char *strxfrchar(char *s, char from, char to); | 254 | char *strxfrchar(char *s, char from, char to); |
255 | unsigned long convert_unit(unsigned long value, char *unit); | 255 | unsigned long convert_unit(unsigned long value, char *unit); |
256 | int readn(int fd, void *buf, size_t size); | 256 | ssize_t readn(int fd, void *buf, size_t n); |
257 | 257 | ||
258 | struct perf_event_attr; | 258 | struct perf_event_attr; |
259 | 259 | ||