42 Commits
Author SHA1 Message Date
Richard Acayan 435ed1cd68 meson.build: bump to version 0.5.0
No breaking changes

New features:
- systemd unit files
- Android service files and Soong build files
- print access mode in apps_std_fopen_with_env
- run tests in CI and add .editorconfig
- print more detailed error when amount of I/O buffers don't match
  definition

Fixes:
- convert to little endian for I/O buffer coding
2026-08-13 10:48:55 -04:00
Yumi Yukimura dd9ac70c02 data: Add Android service definitions
Signed-off-by: Yumi Yukimura <me.cafebabe@gmail.com>
2026-03-31 15:05:18 +08:00
Yumi Yukimura ffd300c27e hexagonrpcd: Include endian.h where needed
hardware/mainline/qcom/hexagonrpc/hexagonrpcd/iobuffer.c:43:15: error: use of undeclared identifier 'le32toh'
   43 |                 ctx->size = le32toh(ctx->size);
      |                             ^
hardware/mainline/qcom/hexagonrpc/hexagonrpcd/iobuffer.c:218:23: error: use of undeclared identifier 'htole32'
  218 |                 *(uint32_t *) ptr = htole32(outbufs[i].s);
      |                                     ^
2 errors generated.

Signed-off-by: Yumi Yukimura <me.cafebabe@gmail.com>
2026-03-31 15:05:18 +08:00
Yumi Yukimura 5c4e11360d Add Android.bp build rules
Signed-off-by: Yumi Yukimura <me.cafebabe@gmail.com>
2026-03-31 15:05:18 +08:00
Luca Weiss eec389f322 Add .editorconfig
EditorConfig is a file format and collection of text editor plugins for
maintaining consistent coding styles between different editors and IDEs.

Add a config for hexagonrpc with the preferred indentation style, and
some other settings.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
2026-03-29 17:03:32 +02:00
Luca Weiss 196c72e80f listener: Print more info with "Unexpected buffer count" errors
Make sure that the message is useful and doesn't just print a hex number
like "1f050100".

"Unexpected buffer count for method 31: 1f050100 (in: 5 vs 2, out: 1 vs 1)"
is a much more descriptive and helpful error.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
2026-03-29 17:03:32 +02:00
Luca Weiss cfc745ce09 hexagonrpcd: apps_std: Print rw_mode in openat verbose log
This is good to print for completeness, and can be useful when extending
fopen to not just allow read operations.

Signed-off-by: Luca Weiss <luca.weiss@fairphone.com>
2026-03-20 17:11:46 +01:00
J. Neuschäfer 93f3467dcf iobuffer: Fix encoding/decoding on big-endian
It is possible (albeit unusual) to boot a big-endian system on a
smartphone, and it's generally good to have portable code.

le32toh and htole32 are a glibc extension that is also implemented by
musl-libc, uclibc-ng, and bionic.

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
2025-12-31 16:06:35 +01:00
Achill Gilgenast c4109b4502 data: Add systemd system services
Signed-off-by: Achill Gilgenast <achill@achill.org>
2025-11-20 15:13:10 +01:00
J. Neuschäfer 5d3cef4e5b CI: Run tests
The tests don't require access to Hexagon hardware, they currently pass,
and running them will provide a better assurance against regressions.

Signed-off-by: J. Neuschäfer <j.ne@posteo.net>
2025-09-22 13:03:46 +02:00
Richard Acayan 23a69640bf tools: make json-c optional
This shouldn't be a requirement to compile anything else. Stop requiring
it for building anything, and assume the user just wants to compile the
main project.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2025-08-19 22:30:25 -04:00
Richard Acayan 18e2ca3178 CI: depend on libjson-c-dev
This is a dependency of the newly imported sscregistrygen.

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2025-08-19 22:27:14 -04:00
Richard Acayan ffca60917c meson.build: bump to 0.4.0
No breaking changes

New features:
- man page for hexagonrpcd
- support for FASTRPC_IOCTL_INIT_CREATE with fastrpc_shell_X
- apps_mem interface (mostly allocating memory for now)
- logic for hexagonfs root directory
- sscregistrygen tool to generate sensor registry
- Github CI (successful compilation only)

Fixes:
- Disabled verbose logging by default
- Documented the paths relative to the root directory
- Made apps_std_stat relative to ADSP libs directory
- Fixed unsigned/signed comparison in reverse tunnel
- Declared minimum meson version for meson.options
- Added soversion to the library build

Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2025-08-19 22:15:27 -04:00
Richard Acayan 6e1281dc8d tools: add sscregistrygen from sensh
From the sensor shell repository, sscregistrygen is a tool for
generating the sensor registry from the sensor config. It is useful when
the sensor registry is not included in device firmware. Add
sscregistrygen here since it is more directly used by hexagonrpc rather
than sensh.

Link: https://gitlab.com/flamingradian/sensh/-/blob/23b7681f3faad422fa5751886f901bf03775243d/tools/sscregistrygen.c
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2025-08-19 22:13:32 -04:00
Jens Reidel 948c5d0d37 hexagonrpcd: Guess directory for hexagonfs from compatible
Signed-off-by: Jens Reidel <adrian@travitia.xyz>
Signed-off-by: Richard Acayan <mailingradian@gmail.com>
2025-08-18 22:49:26 -04:00
Dmitry Baryshkov e52da43a63 apps_mem: specify int argument to fastrpc_apps_mem_init()
Without this building fails with:

../git/hexagonrpcd/rpcd.c: In function 'start_reverse_tunnel':
../git/hexagonrpcd/rpcd.c:275:21: error: too many arguments to function 'fastrpc_apps_mem_init'; expected 0, have 1
  275 |         ifaces[2] = fastrpc_apps_mem_init(fd);
      |                     ^~~~~~~~~~~~~~~~~~~~~ ~~
In file included from ../git/hexagonrpcd/rpcd.c:38:
../git/hexagonrpcd/apps_mem.h:27:27: note: declared here
   27 | struct fastrpc_interface *fastrpc_apps_mem_init();
      |                           ^~~~~~~~~~~~~~~~~~~~~

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
2025-05-13 04:59:23 +03:00
Dmitry Baryshkov 6e5f7d9d54 CI: add simple workflow
Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
2025-05-12 13:32:42 +03:00
Dmitry Baryshkov 9a68ca3abf meson.build: declare minimum meson version
The project uses meson.options rather than meson_options.txt. Document
the minimum meson version that can be used to build the project.

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
2025-05-12 13:32:42 +03:00
Dmitry Baryshkov 146d0e1dab listener: fix Wsign-compare error
Fix warning / error reported by gcc:

../git/hexagonrpcd/listener.c:115:25: warning: comparison of integer expressions of different signedness: 'uint32_t' {aka 'unsigned int'} and 'int' [-Wsign-compare]
         if (inbufs[0].s != 4 * (def->in_nums
                         ^~

Signed-off-by: Dmitry Baryshkov <dmitry.baryshkov@oss.qualcomm.com>
2025-05-12 13:32:42 +03:00
Richard Acayan 2377fd46f0 hexagonrpcd: add apps_mem interface implementation
The apps_mem interface enables the FastRPC shell to load skel ELFs,
such as libhexagon_nn_skel.so.
2025-05-09 19:36:50 -04:00
Richard Acayan 372ca67d7a hexagonrpcd: interfaces: add apps_mem interface
The apps_mem interface is the interface that allows the DSP to map
memory and to allocate more memory. Add a method definition for it.
2025-05-09 19:36:50 -04:00
Richard Acayan 4b1ecd8505 hexagonrpcd: apps_std: perform stat relative to ADSP libs directory
When loading a new skel file, the DSP may access a testsig.so file. This
calls apps_std_fopen_with_env which is relative to a specified
directory, but also apps_std_stat. Since the same "testsig.so"
path is accessed relative to ADSP_LIBRARY_PATH and to the current
working directory, infer that the current working directory should be
ADSP_LIBRARY_PATH.
2025-05-09 19:36:50 -04:00
Richard Acayan 53e347f39d hexagonrpcd.1: add -c option 2025-05-09 19:36:50 -04:00
Richard Acayan 75150d4860 hexagonrpcd: add -c option to start with pd 2025-05-09 19:36:49 -04:00
Richard Acayan 5620db43a7 hexagonrpcd.1: document the paths relative to the root directory
The files shouldn't be installed right in /usr/share/qcom except for
testing. Rather, they should be installed in some device-specific
directory to make packaging easier on some distros. Document the paths
relative to the root directory for served files.
2024-11-05 21:41:35 -05:00
Richard Acayan 0e9e03b37b README: document the paths relative to the root directory
The absolute paths shouldn't be installed right in /usr/share/qcom
except for testing. Document the modifiable directory where served files
are retrieved from and the convention of where this directory should be
located.

Link: https://gitlab.com/flamingradian/sensh/-/issues/1
2024-11-05 21:41:26 -05:00
Alexandre Viard 61bb51bbc9 Use Major.Minor for the lib soversion derived from project version
[richard: rebase and squash; remove leading whitespace in commit message]
2024-11-01 19:15:29 -04:00
Alexandre Viard ffbc4da830 Add man page for hexagonrpcd
[richard: remove trailing whitespace under -s; squash]
2024-10-21 19:06:54 -04:00
Alex 2415d5f90d Add soversion to the library build 2024-10-16 17:53:03 -04:00
Richard Acayan 7aab0f2c42 meson.options: disable verbose logging by default
Verbose logging can be useful when something goes wrong, but HexagonRPCD
already works well on some devices. Disable verbose logging by default.

Reported by Adrian on the SDM845 Mainline Matrix channel.

Fixes: 30fa49eb20 ("build: add hexagonrpcd_verbose option")
2024-05-16 16:00:13 -04:00
Joel Selvaraj b7eff23db1 hexagonrpcd/rpcd_builder: introduce /system/vendor mapping
Needed for some Xiaomi phones such as the Poco F1.
Based on https://gitlab.com/sdm670-mainline/hexagonrpc/-/merge_requests/1.
Thanks to the initial work of @longnoserob in the above MR!
2024-05-14 02:03:35 -05:00
Joel Selvaraj 716e1e27c7 README: add socinfo sysfs mapping to HexagonFS table
Introduced in https://gitlab.com/sdm670-mainline/hexagonrpc/-/merge_requests/2.
2024-05-14 02:03:35 -05:00
Joel Selvaraj 54ba43fbc3 hexagonrpcd/rpcd_builder: add mapping for socinfo sysfs
Needed for some Xiaomi phones such as Poco F1.
Based on https://gitlab.com/sdm670-mainline/hexagonrpc/-/merge_requests/1.
Thanks to the initial findings of @longnoserob in the above MR!
2024-05-14 01:49:46 -05:00
Richard Acayan f6d8a0e686 tests: add initial hexagonfs test
The virtual filesystem is important, but is only tested in the full
program. Add the initial test for it.
2024-04-26 17:50:58 -04:00
Richard Acayan 9db873f24f hexagonrpcd: hexagonfs: constify dirent data
The data in the directory entry structure is meant to be used in opening
a file. It should not change during the program.

For the virtual directory, the pointer to constant data must be wrapped
because the data for the open file is not constant.
2024-04-17 17:03:07 -04:00
Richard Acayan 3f46980dc9 hexagonrpcd: correct -d default in help text
The name of the DSP defaults to none, but the -d option is wrongly
documented as having a default of "adsp". Correct this in the help text.
2024-04-15 18:35:46 -04:00
Richard Acayan 30fa49eb20 build: add hexagonrpcd_verbose option
There is extra debug logging in the code which can be activated by
`meson configure build -Dc_args=-DHEXAGONRPC_VERBOSE`. This may be
difficult to trigger, since it requires -D twice in the same argument.
Add the hexagonrpcd_verbose option to make it easier to configure the
extra logging.

This can be activated with `-Dhexagonrpcd_verbose=true` and deactivated
with `-Dhexagonrpcd_verbose=false`.
2024-04-11 17:59:03 -04:00
Richard Acayan b7ad1021a2 build: apply default C flags to all targets
The warning flags should be applied to the entire C codebase in order to
help ensure correct code. No extra warnings are emitted by doing this.
2024-04-11 17:45:47 -04:00
Richard Acayan f23297f962 tests: set warning flags
Most subdirectories in this project have all, pedantic, and some extra
warnings enabled. Set this for tests as well, as there is no real
justification otherwise.
2024-04-09 19:18:44 -04:00
Richard Acayan c4c469bd8a tests: iobuffer: convert binary data to unsigned char arrays
Signed character arrays can overflow when specifying values greater than
127. The actual data is not affected, but this can cause compiler
warnings. Use unsigned character arrays so the compiler does not
complain about overflows.
2024-04-09 19:16:04 -04:00
Richard Acayan 6840e1dcfa tests: iobuffer: exit with code 0 on success
This file seems to implicitly return 0 when everything is successful,
but this is unclear when reading it. Explicitly return zero when all
tests are successful.
2024-04-09 19:10:30 -04:00
Richard Acayan aaef8a1e28 hexagonrpcd: use the dsp directory as the default for libraries
This variable represents the subdirectory in the dsp/ directory where
libraries should be searched. This is the argument to the optional `-d`
and is used when creating the filesystem. Initialize it to an empty
string so HexagonFS searches in /usr/share/qcom/dsp/ by default.
2024-04-09 17:05:21 -04:00
42 changed files with 1305 additions and 60 deletions

No files matched your search

+10
View File
@@ -0,0 +1,10 @@
# SPDX-License-Identifier: GPL-3.0-or-later
root = true
[*.{c,h}]
charset = utf-8
end_of_line = lf
insert_final_newline = true
indent_style = tab
indent_size = 8
+33
View File
@@ -0,0 +1,33 @@
name: Build+test
on:
pull_request:
push:
jobs:
build-linux:
strategy:
fail-fast: false
matrix:
include:
- runner: ubuntu-24.04
# 22.04 has old meson
# - runner: ubuntu-22.04
runs-on: ${{ matrix.runner }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Dependencies
run: |
sudo apt update
sudo apt install -y meson ninja-build libjson-c-dev
- name: build
run: |
meson setup build
ninja -C build
- name: run tests
run: |
ninja -C build test
+10
View File
@@ -0,0 +1,10 @@
cc_defaults {
name: "hexagonrpc_defaults",
cflags: [
"-Wno-unused-parameter",
],
header_libs: [
"device_kernel_headers",
"hexagonrpc_headers",
],
}
+15 -7
View File
@@ -125,18 +125,26 @@ Interfaces are initialized in the `start_reverse_tunnel` function, in hexagonrpc
## HexagonFS
The reverse tunnel's `apps_std` interface serves files to the remote processor.
These files are searched for in:
These files are searched for in a directory tree, starting at the location
defined by the `-R` option, or in `/usr/share/qcom` by default:
Physical file/dir Android file/dir
/usr/share/qcom/acdb /vendor/etc/acdbdata
/usr/share/qcom/dsp /vendor/dsp
/usr/share/qcom/sensors/config /vendor/etc/sensors/config
/usr/share/qcom/sensors/registry /mnt/vendor/persist/sensors/registry/registry
/usr/share/qcom/sensors/sns_reg.conf /vendor/etc/sensors/sns_reg_config
HexagonRPCD file/dir Android file/dir
acdb /vendor/etc/acdbdata
dsp /vendor/dsp
sensors/config /vendor/etc/sensors/config
sensors/registry /mnt/vendor/persist/sensors/registry/registry
sensors/sns_reg.conf /vendor/etc/sensors/sns_reg_config
socinfo /sys/devices/soc0
These files and directories should be populated with files from your device's
Android firmware.
If you can pass the `-R` option, the convention is to pass `-R
/usr/share/qcom/SOC/VENDOR/DEVICE`, where SOC is the SoC name in lowercase,
VENDOR is the capitalized name of the device vendor, and DEVICE is the device
name (e.g. `-R /usr/share/qcom/sdm845/SHIFT/axolotl` or `-R
/usr/share/qcom/sdm845/Thundercomm/db845c`).
# Future plans
Reverse tunnels are separated by the process that opens the file descriptor and
+12
View File
@@ -0,0 +1,12 @@
cc_binary {
name: "chrecd",
defaults: ["hexagonrpc_defaults"],
srcs: [
"interfaces.c",
"main.c",
],
shared_libs: [
"libhexagonrpc",
],
vendor: true,
}
+1 -1
View File
@@ -1,7 +1,7 @@
executable('chrecd',
'interfaces.c',
'main.c',
c_args : ['-Wall', '-Wextra', '-Wpedantic'],
c_args : cflags,
include_directories : include,
install : true,
link_with : libhexagonrpc,
+20
View File
@@ -0,0 +1,20 @@
prebuilt_etc {
name: "hexagonrpcd-adsp-rootpd.rc",
src: "hexagonrpcd-adsp-rootpd.rc",
sub_dir: "init",
vendor: true,
}
prebuilt_etc {
name: "hexagonrpcd-adsp-sensorspd.rc",
src: "hexagonrpcd-adsp-sensorspd.rc",
sub_dir: "init",
vendor: true,
}
prebuilt_etc {
name: "hexagonrpcd-sdsp.rc",
src: "hexagonrpcd-sdsp.rc",
sub_dir: "init",
vendor: true,
}
+5
View File
@@ -0,0 +1,5 @@
service vendor.hexagonrpcd-adsp-rootpd /vendor/bin/hexagonrpcd -f /dev/fastrpc-adsp -d adsp -R /vendor/etc/hexagonrpcd-root
class core
user system
group system
stdio_to_kmsg
+18
View File
@@ -0,0 +1,18 @@
[Unit]
Description=Server for FastRPC remote procedure calls from Qualcomm ADSP - RootPD
Conflicts=suspend.target
Before=suspend.target
# FIXME: Remove this once hexagonrpcd can serve rootpd on the ADSP
# of the SDM845 devices
ConditionPathExists=!/dev/fastrpc-sdsp
ConditionPathExists=/dev/fastrpc-adsp
[Service]
ExecStart=@bindir@/hexagonrpcd -f /dev/fastrpc-adsp -d adsp
Restart=always
RestartSec=3
User=fastrpc
Group=fastrpc
[Install]
WantedBy=multi-user.target
+4
View File
@@ -0,0 +1,4 @@
service vendor.hexagonrpcd-adsp-sensorspd /vendor/bin/hexagonrpcd -f /dev/fastrpc-adsp -d adsp -s -R /vendor/etc/hexagonrpcd-root
class core
user system
group system
@@ -0,0 +1,17 @@
[Unit]
Description=Server for FastRPC remote procedure calls from Qualcomm ADSP - sensorspd
Conflicts=suspend.target
Before=suspend.target
# This service shouldn't be run on devices with an SDSP
ConditionPathExists=!/dev/fastrpc-sdsp
ConditionPathExists=/dev/fastrpc-adsp
[Service]
ExecStart=@bindir@/hexagonrpcd -f /dev/fastrpc-adsp -d adsp -s
Restart=always
RestartSec=3
User=fastrpc
Group=fastrpc
[Install]
WantedBy=multi-user.target
+4
View File
@@ -0,0 +1,4 @@
service vendor.hexagonrpcd-sdsp /vendor/bin/hexagonrpcd -f /dev/fastrpc-sdsp -d sdsp -s -R /vendor/etc/hexagonrpcd-root
class core
user system
group system
+13
View File
@@ -0,0 +1,13 @@
[Unit]
Description=Server for FastRPC remote procedure calls from Qualcomm SDSP
ConditionPathExists=/dev/fastrpc-sdsp
[Service]
ExecStart=@bindir@/hexagonrpcd -f /dev/fastrpc-sdsp -d sdsp -s
Restart=always
RestartSec=3
User=fastrpc
Group=fastrpc
[Install]
WantedBy=multi-user.target
+15
View File
@@ -0,0 +1,15 @@
systemd_units = [
'hexagonrpcd-adsp-rootpd.service',
'hexagonrpcd-adsp-sensorspd.service',
'hexagonrpcd-sdsp.service',
]
foreach unit : systemd_units
configure_file(
input: unit + '.in',
output: unit,
configuration: { 'bindir': get_option('prefix') / get_option('bindir') },
install: true,
install_dir: get_option('libdir') / 'systemd/system',
)
endforeach
+23
View File
@@ -0,0 +1,23 @@
cc_binary {
name: "hexagonrpcd",
defaults: ["hexagonrpc_defaults"],
srcs: [
"aee_error.c",
"apps_mem.c",
"apps_std.c",
"hexagonfs.c",
"hexagonfs_mapped.c",
"hexagonfs_plat_subtype_name.c",
"hexagonfs_virt_dir.c",
"interfaces.c",
"iobuffer.c",
"listener.c",
"localctl.c",
"rpcd.c",
"rpcd_builder.c",
],
shared_libs: [
"libhexagonrpc",
],
vendor: true,
}
+143
View File
@@ -0,0 +1,143 @@
/*
* FastRPC memory mapping interface implementation
*
* Copyright (C) 2024 The Sensor Shell Contributors
*
* This file is part of sensh.
*
* Sensh is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#include <inttypes.h>
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <misc/fastrpc.h>
#include <sys/ioctl.h>
#include "aee_error.h"
#include "apps_mem.h"
#include "interfaces/apps_mem.def"
#include "listener.h"
// See fastrpc.git/src/apps_mem_imp.c
#define ADSP_MMAP_HEAP_ADDR 4
#define ADSP_MMAP_REMOTE_HEAP_ADDR 8
#define ADSP_MMAP_ADD_PAGES 0x1000
struct apps_mem_ctx {
int fd;
};
static uint32_t apps_mem_request_map64(void *data,
const struct fastrpc_io_buffer *inbufs,
struct fastrpc_io_buffer *outbufs)
{
struct apps_mem_ctx *ctx = data;
const struct {
uint32_t heap_id;
uint32_t lflags;
uint32_t rflags;
uint32_t padding;
uint64_t vin;
uint64_t len;
} *first_in = inbufs[0].p;
struct {
uint64_t vapps;
uint64_t vadsp;
} *first_out = outbufs[0].p;
struct fastrpc_req_mmap mmap;
int ret;
if (!(first_in->rflags & ADSP_MMAP_ADD_PAGES)) {
fprintf(stderr, "Unsupported mmap operation: DMA buffer request\n");
return AEE_EUNSUPPORTED;
}
mmap.fd = -1;
mmap.flags = first_in->rflags;
mmap.vaddrin = 0;
mmap.size = first_in->len;
ret = ioctl(ctx->fd, FASTRPC_IOCTL_MMAP, &mmap);
if (ret == -1) {
perror("Memory map failed");
return AEE_EFAILED;
} else if (ret) {
fprintf(stderr, "Memory map failed: %s\n", aee_strerror[ret]);
return ret;
}
#if HEXAGONRPC_VERBOSE
printf("mmap(%d, %x, %x, %lu, %lu) -> %" PRIx64 "\n",
first_in->heap_id,
first_in->lflags,
first_in->rflags,
first_in->vin,
first_in->len,
mmap.vaddrout);
#endif
first_out->vapps = 0;
first_out->vadsp = mmap.vaddrout & 0xFFFFFFFF;
return 0;
}
struct fastrpc_interface *fastrpc_apps_mem_init(int fd)
{
struct fastrpc_interface *iface;
struct apps_mem_ctx *ctx;
iface = malloc(sizeof(*iface));
if (iface == NULL)
return NULL;
ctx = calloc(1, sizeof(*ctx));
if (ctx == NULL)
goto err_free_iface;
memcpy(iface, &apps_mem_interface, sizeof(*iface));
ctx->fd = fd;
iface->data = ctx;
return iface;
err_free_iface:
free(iface);
return NULL;
}
void fastrpc_apps_mem_deinit(struct fastrpc_interface *iface)
{
free(iface->data);
free(iface);
}
static const struct fastrpc_function_impl apps_mem_procs[] = {
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{ .def = &apps_mem_request_map64_def, .impl = apps_mem_request_map64, },
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
{ .def = NULL, .impl = NULL, },
};
const struct fastrpc_interface apps_mem_interface = {
.name = "apps_mem",
.n_procs = 6,
.procs = apps_mem_procs,
};
+30
View File
@@ -0,0 +1,30 @@
/*
* FastRPC operating system interface - context initialization
*
* Copyright (C) 2024 The Sensor Shell Contributors
*
* This file is part of HexagonRPC.
*
* HexagonRPC is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation, either version 3 of the License, or
* (at your option) any later version.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <https://www.gnu.org/licenses/>.
*/
#ifndef APPS_MEM_H
#define APPS_MEM_H
#include "listener.h"
struct fastrpc_interface *fastrpc_apps_mem_init(int fd);
void fastrpc_apps_mem_deinit(struct fastrpc_interface *iface);
#endif
+5 -4
View File
@@ -197,9 +197,10 @@ static uint32_t apps_std_fopen_with_env(void *data,
}
#ifdef HEXAGONRPC_VERBOSE
printf("openat($%s, %s) -> %d\n", (const char *) inbufs[1].p,
(const char *) inbufs[3].p,
fd);
printf("openat($%s, %s, %c) -> %d\n", (const char *) inbufs[1].p,
(const char *) inbufs[3].p,
rw_mode,
fd);
#endif
*out = fd;
@@ -312,7 +313,7 @@ static uint32_t apps_std_stat(void *data,
if (((const char *) inbufs[1].p)[inbufs[1].s - 1] != 0)
return AEE_EBADPARM;
fd = hexagonfs_openat(ctx->fds, ctx->rootfd, ctx->rootfd, pathname);
fd = hexagonfs_openat(ctx->fds, ctx->rootfd, ctx->adsp_library_dirfd, pathname);
if (fd < 0) {
fprintf(stderr, "Could not open %s: %s\n",
pathname, strerror(-fd));
+1 -1
View File
@@ -33,7 +33,7 @@ struct hexagonfs_fd;
struct hexagonfs_file_ops {
void (*close)(void *fd_data);
int (*from_dirent)(void *dirent_data, bool dir, void **fd_data);
int (*from_dirent)(const void *dirent_data, bool dir, void **fd_data);
int (*openat)(struct hexagonfs_fd *dir,
const char *segment,
bool expect_dir,
+2 -2
View File
@@ -47,7 +47,7 @@ static void mapped_close(void *fd_data)
free(ctx);
}
static int mapped_from_dirent(void *dirent_data, bool dir, void **fd_data)
static int mapped_from_dirent(const void *dirent_data, bool dir, void **fd_data)
{
struct mapped_ctx *ctx;
const char *name = dirent_data;
@@ -222,7 +222,7 @@ static void mapped_or_empty_close(void *fd_data)
mapped_close(fd_data);
}
static int mapped_or_empty_from_dirent(void *dirent_data, bool dir, void **fd_data)
static int mapped_or_empty_from_dirent(const void *dirent_data, bool dir, void **fd_data)
{
int ret;
Loaded 20 of 42 files, more files were not shown because too many files have changed in this diff. Show more