Embedded Linux Project (sibyl)
Building
Kernel Module
cd kernel
make
sudo make install
Userspace
mkdir build && cd build
cmake ..
make
The binaries will be in:
-
build/daemon/daemon
-
build/clients/*
Communication
Userspace
The client programs that aggregate the desired system data may send them to the daemon process.
This is done via a simple packet, daemon_measurement_t
which is defined in common/include/protocol.h
:
#define MAX_DAEMON_PACKET_SIZE PIPE_BUF
#define DAEMON_PACKET_HEADER_SIZE sizeof(uint8_t) + sizeof(uint16_t)
#define MAX_DAEMON_PACKET_DATA_SIZE MAX_DAEMON_PACKET_SIZE - DAEMON_PACKET_HEADER_SIZE
typedef struct {
uint8_t measurement_id;
uint16_t size;
uint8_t data[MAX_DAEMON_PACKET_DATA_SIZE];
} daemon_measurement_t;
The packet size equals to the size of PIPE_BUF
(4096).
The communication to the deamon is implemented via a named pipe, the size ensure that the packet is atomic, i.e. it is written to the pipe in one go.
- The first byte contains the measurement id, so the maximum number of different measurements client is 255.
- The second and third bytes contain the size of the data in the packet.
- All following bytes contain the data.