Skip to content

Commit

Permalink
Merge pull request iovisor#1363 from navytux/y/probe-read-const
Browse files Browse the repository at this point in the history
bpf_probe_read*: src argument should be const void *.
  • Loading branch information
yonghong-song committed Sep 27, 2017
2 parents fca6607 + 2dc7daa commit a135d89
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 6 deletions.
4 changes: 2 additions & 2 deletions docs/reference_guide.md
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ Examples in situ:

### 1. bpf_probe_read()

Syntax: ```int bpf_probe_read(void *dst, int size, void *src)```
Syntax: ```int bpf_probe_read(void *dst, int size, const void *src)```

Return: 0 on success

Expand All @@ -247,7 +247,7 @@ Examples in situ:

### 2. bpf_probe_read_str()

Syntax: ```int bpf_probe_read_str(void *dst, int size, void *src)```
Syntax: ```int bpf_probe_read_str(void *dst, int size, const void *src)```

Return:
- \> 0 length of the string including the trailing NUL on success
Expand Down
2 changes: 1 addition & 1 deletion src/cc/compat/linux/bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -244,7 +244,7 @@ union bpf_attr {
* int bpf_map_delete_elem(&map, &key)
* Return: 0 on success or negative error
*
* int bpf_probe_read(void *dst, int size, void *src)
* int bpf_probe_read(void *dst, int size, const void *src)
* Return: 0 on success or negative error
*
* u64 bpf_ktime_get_ns(void)
Expand Down
2 changes: 1 addition & 1 deletion src/cc/compat/linux/virtual_bpf.h
Original file line number Diff line number Diff line change
Expand Up @@ -245,7 +245,7 @@ union bpf_attr {
* int bpf_map_delete_elem(&map, &key)
* Return: 0 on success or negative error
*
* int bpf_probe_read(void *dst, int size, void *src)
* int bpf_probe_read(void *dst, int size, const void *src)
* Return: 0 on success or negative error
*
* u64 bpf_ktime_get_ns(void)
Expand Down
4 changes: 2 additions & 2 deletions src/cc/export/helpers.h
Original file line number Diff line number Diff line change
Expand Up @@ -200,15 +200,15 @@ static int (*bpf_map_update_elem)(void *map, void *key, void *value, u64 flags)
(void *) BPF_FUNC_map_update_elem;
static int (*bpf_map_delete_elem)(void *map, void *key) =
(void *) BPF_FUNC_map_delete_elem;
static int (*bpf_probe_read)(void *dst, u64 size, void *unsafe_ptr) =
static int (*bpf_probe_read)(void *dst, u64 size, const void *unsafe_ptr) =
(void *) BPF_FUNC_probe_read;
static u64 (*bpf_ktime_get_ns)(void) =
(void *) BPF_FUNC_ktime_get_ns;
static u32 (*bpf_get_prandom_u32)(void) =
(void *) BPF_FUNC_get_prandom_u32;
static int (*bpf_trace_printk_)(const char *fmt, u64 fmt_size, ...) =
(void *) BPF_FUNC_trace_printk;
static int (*bpf_probe_read_str)(void *dst, u64 size, void *unsafe_ptr) =
static int (*bpf_probe_read_str)(void *dst, u64 size, const void *unsafe_ptr) =
(void *) BPF_FUNC_probe_read_str;
int bpf_trace_printk(const char *fmt, ...) asm("llvm.bpf.extra");
static inline __attribute__((always_inline))
Expand Down

0 comments on commit a135d89

Please sign in to comment.