Skip to content

Commit

Permalink
---
Browse files Browse the repository at this point in the history
yaml
---
r: 182344
b: refs/heads/master
c: f92cb24
h: refs/heads/master
v: v3
  • Loading branch information
Arnaldo Carvalho de Melo authored and Ingo Molnar committed Jan 13, 2010
1 parent ba8eaf9 commit 36566da
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 7 deletions.
2 changes: 1 addition & 1 deletion [refs]
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
---
refs/heads/master: 36a3e6461a0dac8e84b8c94877365324010c151b
refs/heads/master: f92cb24c78a7c853435e46a20d1bd5c894378132
22 changes: 16 additions & 6 deletions trunk/tools/perf/util/header.c
Original file line number Diff line number Diff line change
Expand Up @@ -173,6 +173,20 @@ static int do_write(int fd, const void *buf, size_t size)
return 0;
}

#define NAME_ALIGN 64

static int write_padded(int fd, const void *bf, size_t count,
size_t count_aligned)
{
static const char zero_buf[NAME_ALIGN];
int err = do_write(fd, bf, count);

if (!err)
err = do_write(fd, zero_buf, count_aligned - count);

return err;
}

#define dsos__for_each_with_build_id(pos, head) \
list_for_each_entry(pos, head, node) \
if (!pos->has_build_id) \
Expand All @@ -181,9 +195,7 @@ static int do_write(int fd, const void *buf, size_t size)

static int __dsos__write_buildid_table(struct list_head *head, int fd)
{
#define NAME_ALIGN 64
struct dso *pos;
static const char zero_buf[NAME_ALIGN];

dsos__for_each_with_build_id(pos, head) {
int err;
Expand All @@ -197,10 +209,8 @@ static int __dsos__write_buildid_table(struct list_head *head, int fd)
err = do_write(fd, &b, sizeof(b));
if (err < 0)
return err;
err = do_write(fd, pos->long_name, pos->long_name_len + 1);
if (err < 0)
return err;
err = do_write(fd, zero_buf, len - pos->long_name_len - 1);
err = write_padded(fd, pos->long_name,
pos->long_name_len + 1, len);
if (err < 0)
return err;
}
Expand Down

0 comments on commit 36566da

Please sign in to comment.