Skip to content

Commit

Permalink
Increment version of rawbcc
Browse files Browse the repository at this point in the history
  • Loading branch information
parttimenerd committed Feb 11, 2024
1 parent cb83f68 commit 54f3a6d
Show file tree
Hide file tree
Showing 9 changed files with 22 additions and 14 deletions.
3 changes: 1 addition & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -57,9 +57,8 @@ Either a Linux machine with the following:
- Java 21 (exactly this version, as we need [Project Panama](https://openjdk.org/projects/panama/) with is a preview
feature), we'll switch to Java 22 as soon as it is released
- libbcc (see [bcc installation instructions](https://github.com/iovisor/bcc/blob/master/INSTALL.md), be sure to install the libbpfcc-dev package)
- e.g. `apt install bpfcc-tools libbpfcc-dev linux-tools-common linux-tools-$(uname -r)` on Ubuntu
- root privileges (for eBPF programs)
- Maven 3.6.3 (or newer to build the project)

On Mac OS, you can use the [Lima VM](https://lima-vm.io/) (or use the `hello-ebpf.yaml` file as a guide to install the prerequisites):

```sh
Expand Down
2 changes: 1 addition & 1 deletion bcc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@
<dependency>
<groupId>me.bechberger</groupId>
<artifactId>rawbcc</artifactId>
<version>0.1.2</version>
<version>0.1.3</version>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
Expand Down
4 changes: 3 additions & 1 deletion bcc/src/main/java/me/bechberger/ebpf/bcc/PanamaUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
import java.lang.foreign.*;
import java.lang.invoke.MethodHandle;
import java.lang.invoke.VarHandle;
import java.util.NoSuchElementException;

import static java.lang.foreign.ValueLayout.JAVA_BYTE;

Expand Down Expand Up @@ -33,7 +34,8 @@ public static String toString(MemorySegment segment) {
*/
public static MemorySegment lookup(String symbol) {
return Linker.nativeLinker().defaultLookup().find(symbol)
.or(() -> SymbolLookup.loaderLookup().find(symbol)).orElseThrow();
.or(() -> SymbolLookup.loaderLookup().find(symbol))
.orElseThrow(() -> new NoSuchElementException("Symbol not found: " + symbol));
}

/**
Expand Down
5 changes: 5 additions & 0 deletions rawbcc/CHANGELOG
Original file line number Diff line number Diff line change
@@ -1,5 +1,10 @@
# Changelog

## 0.1.3

### Fixed
- Better error messages when PanamaUtil lookup fails

## 0.1.2

### Fixed
Expand Down
14 changes: 8 additions & 6 deletions rawbcc/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ These bindings are regurlarly updated and published on Maven Central:
<dependency>
<groupId>me.bechberger</groupId>
<artifactId>rawbcc</artifactId>
<version>0.1.2</version>
<version>0.1.3</version>
</dependency>
```

Expand All @@ -32,17 +32,19 @@ Requirements
------------
- Java 21 with `--enable-preview`
- Linux 64-bit
- libbcc (see [bcc installation instructions](https://github.com/iovisor/bcc/blob/master/INSTALL.md), be sure to install the libbpfcc-dev package)
- I know that the packages there are outdated for some distributions, but installing the packages from
other repositories crashed my system...
- e.g. `apt install bpfcc-tools libbpfcc-dev linux-tools-common linux-tools-$(uname -r)` on Ubuntu


Build
-----

Requirements:
Additional Requirements:

- Linux 64-bit
- Java 21
- Python 3.8
- Python 3.8+
- clang (for [jextract](https://github.com/openjdk/jextract))
- libbcc (see [bcc installation instructions](https://github.com/iovisor/bcc/blob/master/INSTALL.md), be sure to install the libbpfcc-dev package)
- Maven 3.6.3 (or newer to build the project)

Build the project with `mvn package`.
Expand Down
2 changes: 1 addition & 1 deletion rawbcc/bin/jextract_bpf.py
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ def create_combined_bcc_header():


def create_modified_bcc_header():
"""
r"""
Find lines that match regexp
"union.* __attribute__\(\(aligned\(8\)\)\);" and
replace "__attribute__((aligned(8)))" with
Expand Down
2 changes: 1 addition & 1 deletion rawbcc/misc/bcc_headers.h
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#include "/usr/include/bcc/bcc_common.h"
#include "bcc/bcc_common.h"
#include "/usr/include/bcc/bcc_elf.h"
#include "/usr/include/bcc/bcc_proc.h"
#include "/usr/include/bcc/bcc_syms.h"
Expand Down
2 changes: 1 addition & 1 deletion rawbcc/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
<artifactId>rawbcc</artifactId>
<groupId>me.bechberger</groupId>
<name>Raw bindings for libbcc</name>

<version>0.1.3</version>
<url>https://github.com/parttimenerd/hello-ebpf</url>
<licenses>
<license>
Expand Down
2 changes: 1 addition & 1 deletion testutil/setup-and-run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@ fi
#script_dir="$(dirname "$(realpath "$0")")"
#timeout 5 python3 $script_dir/../pysamples/bcc/hello_world.py

$* && touch /run/output/status
$* && touch /run/output/statusqgitq

0 comments on commit 54f3a6d

Please sign in to comment.