gnunet-android

GNUnet for Android
Log | Files | Refs | README

commit f6802645e7d3496f82f59d6e3ad346974b489f95
parent 290b0fecbafd7dc37951134cc1ca3c6d103fb37e
Author: t3sserakt <t3ss@posteo.de>
Date:   Fri, 11 Jul 2025 18:39:17 +0200

Added temporary directory andling without environment variable for Android.

Diffstat:
Mandroid_studio/distribution/libgnunet/lib/arm64-v8a/libgnunet.so | 0
Mandroid_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetutil.so | 0
Mandroid_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_disk_lib.h | 33+++++++++++++--------------------
Mandroid_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_os_lib.h | 43++++++++++++++++++++++++++++++-------------
4 files changed, 43 insertions(+), 33 deletions(-)

diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunet.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunet.so Binary files differ. diff --git a/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetutil.so b/android_studio/distribution/libgnunet/lib/arm64-v8a/libgnunetutil.so Binary files differ. diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_disk_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_disk_lib.h @@ -276,6 +276,7 @@ GNUNET_DISK_handle_invalid (const struct GNUNET_DISK_FileHandle *h); enum GNUNET_GenericReturnValue GNUNET_DISK_file_test (const char *fil); + /** * Check that fil corresponds to a filename and the file has read permissions. * @@ -287,13 +288,15 @@ GNUNET_DISK_file_test (const char *fil); enum GNUNET_GenericReturnValue GNUNET_DISK_file_test_read (const char *fil); + /** * Move a file out of the way (create a backup) by renaming it to "orig.NUM~" * where NUM is the smallest number that is not used yet. * * @param fil name of the file to back up + * @return the backup file name (must be freed by caller) */ -void +char* GNUNET_DISK_file_backup (const char *fil); @@ -358,13 +361,15 @@ GNUNET_DISK_file_get_identifiers (const char *filename, * 6 random characters will be appended to the name to create a unique * filename. * + * @param pd project data to use to determine paths * @param t component to use for the name; * does NOT contain "XXXXXX" or "/tmp/". * @return NULL on error, otherwise name of fresh * file on disk in directory for temporary files */ char * -GNUNET_DISK_mktemp (const char *t); +GNUNET_DISK_mktemp (const struct GNUNET_OS_ProjectData *pd, + const char *t); /** @@ -372,12 +377,14 @@ GNUNET_DISK_mktemp (const char *t); * absolute path, the current 'TMPDIR' will be prepended. In any case, 6 * random characters will be appended to the name to create a unique name. * + * @param pd project data to use to determine paths * @param t component to use for the name; * does NOT contain "XXXXXX" or "/tmp/". * @return NULL on error, otherwise name of freshly created directory */ char * -GNUNET_DISK_mkdtemp (const char *t); +GNUNET_DISK_mkdtemp (const struct GNUNET_OS_ProjectData *pd, + const char *t); /** @@ -573,22 +580,6 @@ GNUNET_DISK_file_read (const struct GNUNET_DISK_FileHandle *h, /** * Read the contents of a binary file into a buffer. - * Guarantees not to block (returns GNUNET_SYSERR and sets errno to EAGAIN - * when no data can be read). - * - * @param h handle to an open file - * @param result the buffer to write the result to - * @param len the maximum number of bytes to read - * @return the number of bytes read on success, #GNUNET_SYSERR on failure - */ -ssize_t -GNUNET_DISK_file_read_non_blocking (const struct GNUNET_DISK_FileHandle *h, - void *result, - size_t len); - - -/** - * Read the contents of a binary file into a buffer. * * @param fn file name * @param result the buffer to write the result to @@ -734,11 +725,13 @@ GNUNET_DISK_directory_remove (const char *filename); * Remove the directory given under @a option in * section [PATHS] in configuration under @a cfg_filename * + * @param pd project data to use to determine paths * @param cfg_filename configuration file to parse * @param option option with the dir name to purge */ void -GNUNET_DISK_purge_cfg_dir (const char *cfg_filename, +GNUNET_DISK_purge_cfg_dir (const struct GNUNET_OS_ProjectData *pd, + const char *cfg_filename, const char *option); diff --git a/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_os_lib.h b/android_studio/distribution/libgnunetutil/lib/arm64-v8a/include/gnunet_os_lib.h @@ -289,13 +289,13 @@ struct GNUNET_OS_ProjectData * Gettext domain for localisation, e.g. the PACKAGE macro. * Setting this field to NULL disables gettext. */ - char *gettext_domain; + const char *gettext_domain; /** * Gettext directory, e.g. the LOCALEDIR macro. * If this field is NULL, the path is automatically inferred. */ - char *gettext_path; + const char *gettext_path; /** * URL pointing to the source code of the application. Required for AGPL. @@ -303,7 +303,13 @@ struct GNUNET_OS_ProjectData * provide it in some other way. If non-NULL, message type 1 and 2 are * reserved. */ - char *agpl_url; + const char *agpl_url; + + /** + * In case we do not have environment variables to determine the install path, + * the install path can be set explicitly. + */ + const char *install_path_override; }; @@ -311,23 +317,28 @@ struct GNUNET_OS_ProjectData * Return default project data used by 'libgnunetutil' for GNUnet. */ const struct GNUNET_OS_ProjectData * -GNUNET_OS_project_data_default (void); +GNUNET_OS_project_data_gnunet (void); /** - * @return current (actual) project data. + * Setting project data used by 'libgnunetutil' for GNUnet. + * + * @param project_data data to set instead of default. */ -const struct GNUNET_OS_ProjectData * -GNUNET_OS_project_data_get (void); +void +GNUNET_OS_project_data_gnunet_set (const struct GNUNET_OS_ProjectData *project_data); /** - * Setup OS subsystem with project data. + * Setup OS subsystem for the given project data and package. + * Initializes GNU Gettext. * - * @param pd project data used to determine paths. + * @param package_name name of the package for GNU gettext + * @param pd project data to use to determine paths */ void -GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd); +GNUNET_OS_init (const char *package_name, + const struct GNUNET_OS_ProjectData *pd); /** @@ -335,11 +346,13 @@ GNUNET_OS_init (const struct GNUNET_OS_ProjectData *pd); * #GNUNET_OS_IPK_SELF_PREFIX, the current running apps installation * directory. * + * @param pd project data to use to determine paths * @param dirkind what kind of directory is desired? * @return a pointer to the dir path (to be freed by the caller) */ char * -GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind); +GNUNET_OS_installation_get_path (const struct GNUNET_OS_ProjectData *pd, + enum GNUNET_OS_InstallationPathKind dirkind); /** @@ -347,11 +360,13 @@ GNUNET_OS_installation_get_path (enum GNUNET_OS_InstallationPathKind dirkind); * binary, try to prefix it with the libexec/-directory to get the * full path. * + * @param pd project data to use to determine paths * @param progname name of the binary * @return full path to the binary, if possible, otherwise copy of 'progname' */ char * -GNUNET_OS_get_libexec_binary_path (const char *progname); +GNUNET_OS_get_libexec_binary_path (const struct GNUNET_OS_ProjectData *pd, + const char *progname); /** @@ -361,13 +376,15 @@ GNUNET_OS_get_libexec_binary_path (const char *progname); * GNUNET_OS_get_libexec_binary_path. If @a progname is an absolute path, a * copy of this path is returned. * + * @param pd project data to use to determine paths * @param cfg configuration to inspect * @param progname name of the binary * @return full path to the binary, if possible, a copy of @a progname * otherwise */ char * -GNUNET_OS_get_suid_binary_path (const struct GNUNET_CONFIGURATION_Handle *cfg, +GNUNET_OS_get_suid_binary_path (const struct GNUNET_OS_ProjectData *pd, + const struct GNUNET_CONFIGURATION_Handle *cfg, const char *progname);