[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <5513BC8C.7090102@intel.com>
Date: Thu, 26 Mar 2015 10:00:12 +0200
From: Adrian Hunter <adrian.hunter@...el.com>
To: Stephane Eranian <eranian@...gle.com>, linux-kernel@...r.kernel.org
CC: acme@...hat.com, peterz@...radead.org, mingo@...e.hu,
ak@...ux.intel.com, jolsa@...hat.com, namhyung@...nel.org,
cel@...ibm.com, sukadev@...ux.vnet.ibm.com, sonnyrao@...omium.org,
johnmccutchan@...gle.com, dsahern@...il.com, pawel.moll@....com
Subject: Re: [PATCH v4 3/4] perf inject: add jitdump mmap injection support
<SNIP>
> +static int
> +jit_open(struct jit_buf_desc *jd, const char *name)
> +{
> + struct jitheader header;
> + struct jr_prefix *prefix;
> + ssize_t bs, bsz = 0;
> + void *n, *buf = NULL;
> + int ret, retval = -1;
> +
> + jd->in = fopen(name, "r");
> + if (!jd->in)
> + return -1;
> +
> + bsz = hmax(sizeof(header), sizeof(*prefix));
> +
> + buf = malloc(bsz);
> + if (!buf)
> + goto error;
> +
> + ret = fread(buf, sizeof(header), 1, jd->in);
> + if (ret != 1)
> + goto error;
> +
> + memcpy(&header, buf, sizeof(header));
> +
> + if (header.magic != JITHEADER_MAGIC) {
> + if (header.magic != JITHEADER_MAGIC_SW)
> + goto error;
> + jd->needs_bswap = 1;
> + }
> +
> + if (jd->needs_bswap) {
> + header.version = bswap_32(header.version);
> + header.total_size = bswap_32(header.total_size);
> + header.pid = bswap_32(header.pid);
> + header.elf_mach = bswap_32(header.elf_mach);
> + header.timestamp = bswap_32(header.timestamp);
timestamp is 64-bit
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists