# HG changeset patch # User Paul Boddie # Date 1712433421 -7200 # Node ID ad0e663b28e08421b4a9719b2552c131c5494106 # Parent 1625ea971bf8bfe1bf36d3aa2be942383fc6ecb0# Parent 22f6dcf76657ba9143faa5fc540c215a464ee5b6 Merged changes from the default branch. diff -r 1625ea971bf8 -r ad0e663b28e0 libexec/lib/src/process.cc --- a/libexec/lib/src/process.cc Tue Apr 02 23:59:13 2024 +0200 +++ b/libexec/lib/src/process.cc Sat Apr 06 21:57:01 2024 +0200 @@ -258,9 +258,7 @@ st.set_l4re_env(&_env); /* Reserve some extra space for capabilities used by this thread. - NOTE: Surely the capability allocator should be able to avoid conflicts, - but concurrency issues have been observed before, leading to various - measures in libipc. */ + NOTE: The capability allocator is probably not able to avoid conflicts. */ _env.first_free_cap += 0x20; diff -r 1625ea971bf8 -r ad0e663b28e0 libfsclient/lib/src/client.cc --- a/libfsclient/lib/src/client.cc Tue Apr 02 23:59:13 2024 +0200 +++ b/libfsclient/lib/src/client.cc Sat Apr 06 21:57:01 2024 +0200 @@ -35,11 +35,11 @@ /* Default size of pipe regions. */ -const offset_t DEFAULT_PIPE_SIZE = 4096; +static const offset_t DEFAULT_PIPE_SIZE = 4096; /* Size of the core member region of a directory entry structure. */ -const offset_t DIRENT_CORE_SIZE = (sizeof(struct dirent) - sizeof(((struct dirent *) 0)->d_name)); +static const offset_t DIRENT_CORE_SIZE = (sizeof(struct dirent) - sizeof(((struct dirent *) 0)->d_name)); diff -r 1625ea971bf8 -r ad0e663b28e0 libfsclient/lib/src/file.cc --- a/libfsclient/lib/src/file.cc Tue Apr 02 23:59:13 2024 +0200 +++ b/libfsclient/lib/src/file.cc Sat Apr 06 21:57:01 2024 +0200 @@ -548,7 +548,10 @@ offset_t file_data_available(file_t *file) { - return file_populated_span(file) - file->data_current; + if (file_populated_span(file) > file->data_current) + return file_populated_span(file) - file->data_current; + else + return 0; } /* Return the current data offset in the region. */ diff -r 1625ea971bf8 -r ad0e663b28e0 libsystypes/include/systypes/stat.h --- a/libsystypes/include/systypes/stat.h Tue Apr 02 23:59:13 2024 +0200 +++ b/libsystypes/include/systypes/stat.h Sat Apr 06 21:57:01 2024 +0200 @@ -1,7 +1,7 @@ /* * File metadata abstractions. * - * Copyright (C) 2019, 2022 Paul Boddie + * Copyright (C) 2019, 2022, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -48,6 +48,28 @@ } sys_stat_t; +/* Macros to be used in different C library environments. */ + +#define COPY_STAT(s1, s2) \ + s1->st_dev = s2->st_dev; \ + s1->st_ino = s2->st_ino; \ + s1->st_mode = s2->st_mode; \ + s1->st_nlink = s2->st_nlink; \ + s1->st_uid = s2->st_uid; \ + s1->st_gid = s2->st_gid; \ + s1->st_rdev = s2->st_rdev; \ + s1->st_size = s2->st_size; \ + s1->st_atim.tv_sec = s2->st_atim.tv_sec; \ + s1->st_atim.tv_nsec = s2->st_atim.tv_nsec; \ + s1->st_mtim.tv_sec = s2->st_mtim.tv_sec; \ + s1->st_mtim.tv_nsec = s2->st_mtim.tv_nsec; \ + s1->st_ctim.tv_sec = s2->st_ctim.tv_sec; \ + s1->st_ctim.tv_nsec = s2->st_ctim.tv_nsec; \ + s1->st_blksize = s2->st_blksize; \ + s1->st_blocks = s2->st_blocks; + +/* Functions to be implemented in different C library environments. */ + void systypes_copy_from_sys_stat(struct stat *st, sys_stat_t *sst); void systypes_copy_to_sys_stat(struct stat *st, sys_stat_t *sst); diff -r 1625ea971bf8 -r ad0e663b28e0 libsystypes/lib/src/stat.c --- a/libsystypes/lib/src/stat.c Tue Apr 02 23:59:13 2024 +0200 +++ b/libsystypes/lib/src/stat.c Sat Apr 06 21:57:01 2024 +0200 @@ -1,7 +1,7 @@ /* * Utility functions for stat structures. * - * Copyright (C) 2022 Paul Boddie + * Copyright (C) 2022, 2024 Paul Boddie * * This program is free software; you can redistribute it and/or * modify it under the terms of the GNU General Public License as @@ -21,32 +21,24 @@ #include "stat.h" -#define COPY_STAT(s1, s2) \ - s1->st_dev = s2->st_dev; \ - s1->st_ino = s2->st_ino; \ - s1->st_mode = s2->st_mode; \ - s1->st_nlink = s2->st_nlink; \ - s1->st_uid = s2->st_uid; \ - s1->st_gid = s2->st_gid; \ - s1->st_rdev = s2->st_rdev; \ - s1->st_size = s2->st_size; \ - s1->st_atim.tv_sec = s2->st_atim.tv_sec; \ - s1->st_atim.tv_nsec = s2->st_atim.tv_nsec; \ - s1->st_mtim.tv_sec = s2->st_mtim.tv_sec; \ - s1->st_mtim.tv_nsec = s2->st_mtim.tv_nsec; \ - s1->st_ctim.tv_sec = s2->st_ctim.tv_sec; \ - s1->st_ctim.tv_nsec = s2->st_ctim.tv_nsec; \ - s1->st_blksize = s2->st_blksize; \ - s1->st_blocks = s2->st_blocks; +void (*systypes_copy_from_sys_stat_override)(struct stat *, sys_stat_t *) = NULL; +void (*systypes_copy_to_sys_stat_override)(struct stat *, sys_stat_t *) = NULL; void systypes_copy_from_sys_stat(struct stat *st, sys_stat_t *sst) { - COPY_STAT(st, sst) + if (systypes_copy_from_sys_stat_override != NULL) + systypes_copy_from_sys_stat_override(st, sst); + else + COPY_STAT(st, sst) } void systypes_copy_to_sys_stat(struct stat *st, sys_stat_t *sst) { - COPY_STAT(sst, st) + if (systypes_copy_from_sys_stat_override != NULL) + systypes_copy_to_sys_stat_override(st, sst); + else + COPY_STAT(sst, st) } -// vim: tabstop=2 expandtab shiftwidth=2 +/* vim: tabstop=2 expandtab shiftwidth=2 +*/