On Fri, Aug 1, 2014 at 3:59 PM, Carlos Torres
<
ctorresk8...@gmail.com> wrote:
>
> I'm trying to understand Go's syscall.Syscall functions.
>
> So, in C, I can do the following:
>
> struct perf_event_attr pe_cycles;
> int pe_cycles_fd;
>
>
> memset(&pe_cycles, 0, sizeof(struct perf_event_attr));
> pe_cycles.type = PERF_TYPE_HARDWARE;
> pe_cycles.size = sizeof(struct perf_event_attr);
> pe_cycles.config = PERF_COUNT_HW_CPU_CYCLES;
>
> ..... // trivial struct setup
>
>
> pe_cycles_fd = syscall(__NR_perf_event_open, 0, -1, -1, 0);
> if (pe_cycles_fd == 1) {
> fprintf(stderr, "Error", pe_cycles_fd.config);
> }
>
> // pe_cycles is populated
>
>
> I want to achieve the same in Go, but I can't find documentation on how to
> pass in a struct by reference to
> syscall.Syscall6(syscall.SYS_PERF_EVENT_OPEN, ?, 0, -1, -1, 0, 0)
is one. That should be straightforward.