iovisor / gobpf

Go bindings for creating BPF programs.
Apache License 2.0
2.14k stars 313 forks source link

Bcc func load attachtype for bcc > 0.24.0 #311

Closed chantra closed 1 year ago

chantra commented 2 years ago

[bcc] Support for new bcc_func_load signature.

In https://github.com/iovisor/bcc/commit/ffff0edc00ad249cffbf44d855b15020cc968536 a new parameter was added to control the attach type. Subsequently, in https://github.com/iovisor/bcc/commit/815d1b84828c02ce10e1ea5163aede6b5786ba38, -1 was used to signal the default behaviour.

This change adds this new parameter to the call to C.bcc_func_load when LIBBCC_VERSION is greater than 0.24.0, the last cut version which did not introduce this change.

chantra commented 2 years ago

This patch will be needed once BCC cuts a new release and gobpf wants to support it.

Currently, there is no good way to use the right function signature at compile time. All that BCC provide is LIBBCC_VERSION, which is a string and cannot be compared easily.

What is the stand of gobpf in term of bcc library support? Do we want to have gobpf backward compatible? If this is the case, having BCC expose major/minor/patch would probably help as we could add a wrapper for go to call one variant or the other depending on version.

chantra commented 2 years ago

https://github.com/iovisor/bcc/pull/4091 made it upstream, so this should be good as it is.

chantra commented 2 years ago

@schu what do you think of this PR? Anything you would like me to address?

muhammednagy commented 2 years ago

Would love to see this get merged, Thank you @chantra

chantra commented 2 years ago

bcc v0.25.0 was released. I have updated this PR to reflect it.

@schu this should be good to go.

daurnimator commented 2 years ago

Will this solve https://github.com/iovisor/gobpf/issues/314 ?

martinetd commented 2 years ago

Will this solve https://github.com/iovisor/gobpf/issues/314 ?

yes, it should. Also waiting for a release here before we upgrade bcc in nixpkgs :)

daurnimator commented 1 year ago

@schu could you review this?

martinetd commented 1 year ago

hm, @schu does not appear to be a member of https://github.com/orgs/iovisor/people anymore; and there have not been any other committer recently. (Sorry if he has access to the repository in any other way, github does not seem to provide a way of checking if he still has commit access)

please forgive the mass notification -- @iovisor (iirc this notifies everyone in the group) -- is there anyone willing to shepherd gobpf? What would the way forward be here if not? (We can't upgrade bcc in nixpkgs because we need a gobpf upgrade with this first)

martinetd commented 1 year ago

Thank you @4ast!