1.1 --- a/libexec/lib/src/process_creating.cc Thu May 09 21:24:58 2024 +0200
1.2 +++ b/libexec/lib/src/process_creating.cc Fri May 10 15:09:04 2024 +0200
1.3 @@ -327,6 +327,11 @@
1.4 l4_cap_idx_t fsserver_cap = _process.allocate_cap();
1.5 l4_cap_idx_t fsserver = l4re_env_get_cap(ENV_FILESYSTEM_SERVER_NAME);
1.6
1.7 + /* Obtain the process server capability. */
1.8 +
1.9 + l4_cap_idx_t prserver_cap = _process.allocate_cap();
1.10 + l4_cap_idx_t prserver = l4re_env_get_cap(ENV_PROCESS_SERVER_NAME);
1.11 +
1.12 /* Also reserve capabilities for the reader and writer. If the reader or
1.13 writer are invalid capabilities, these will not actually be transferred. */
1.14
1.15 @@ -337,6 +342,7 @@
1.16
1.17 struct ipc_mapped_cap program_mapped_caps[] = {
1.18 {fsserver_cap, fsserver, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.19 + {prserver_cap, prserver, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.20 {reader_cap, reader, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.21 {writer_cap, writer, L4_CAP_FPAGE_RWS, L4_FPAGE_C_OBJ_RIGHTS},
1.22 {L4_INVALID_CAP, L4_INVALID_CAP, 0, 0},
1.23 @@ -361,6 +367,7 @@
1.24
1.25 l4re_env_cap_entry_t program_init_caps[] = {
1.26 l4re_env_cap_entry_t(ENV_FILESYSTEM_SERVER_NAME, fsserver_cap, L4_CAP_FPAGE_RWS),
1.27 + l4re_env_cap_entry_t(ENV_PROCESS_SERVER_NAME, prserver_cap, L4_CAP_FPAGE_RWS),
1.28 l4re_env_cap_entry_t(ENV_INPUT_STREAM_NAME, reader_cap, L4_CAP_FPAGE_R),
1.29 l4re_env_cap_entry_t(ENV_OUTPUT_STREAM_NAME, writer_cap, L4_CAP_FPAGE_W),
1.30 l4re_env_cap_entry_t()
2.1 --- a/libfsclient/include/fsclient/client.h Thu May 09 21:24:58 2024 +0200
2.2 +++ b/libfsclient/include/fsclient/client.h Fri May 10 15:09:04 2024 +0200
2.3 @@ -36,6 +36,7 @@
2.4 /* Stream access operations. */
2.5
2.6 file_t *client_get_stream(const char *name, flags_t flags);
2.7 +long client_sync_stream(file_t *file);
2.8
2.9 /* Opening and closing operations. */
2.10
3.1 --- a/libfsclient/lib/src/client.cc Thu May 09 21:24:58 2024 +0200
3.2 +++ b/libfsclient/lib/src/client.cc Fri May 10 15:09:04 2024 +0200
3.3 @@ -140,12 +140,7 @@
3.4
3.5 else if (position == file->end_pos)
3.6 {
3.7 - err = client_next_region(file);
3.8 - if (err)
3.9 - return err;
3.10 -
3.11 - file->data_current = 0;
3.12 - return L4_EOK;
3.13 + return client_next_region(file);
3.14 }
3.15
3.16 /* Within the current pipe region, synchronise with the pipe object. */
3.17 @@ -283,10 +278,10 @@
3.18 stream->flags = flags;
3.19 stream->ref = ref;
3.20
3.21 - /* Test for pipe-based access, switching to memory mapped access if not
3.22 - supported. */
3.23 + /* Synchronise the state of the stream, testing for pipe-based access and
3.24 + switching to memory mapped access if not supported. */
3.25
3.26 - long err = client_current_region(stream);
3.27 + long err = client_sync_stream(stream);
3.28
3.29 if (err == -L4_EBADPROTO)
3.30 stream->object_flags |= OBJECT_SUPPORTS_MMAP;
3.31 @@ -310,6 +305,19 @@
3.32 return stream;
3.33 }
3.34
3.35 +/* Initialise the stream data position to the end of any existing data. */
3.36 +
3.37 +long client_sync_stream(file_t *file)
3.38 +{
3.39 + long err = client_current_region(file);
3.40 +
3.41 + if (err)
3.42 + return err;
3.43 +
3.44 + file->data_current = file->data_end;
3.45 + return err;
3.46 +}
3.47 +
3.48
3.49
3.50 /* Open a filesystem object. */
3.51 @@ -608,7 +616,13 @@
3.52 if (!client_opened(file))
3.53 return -L4_EINVAL;
3.54
3.55 - return pipe_next(file);
3.56 + long err = pipe_next(file);
3.57 +
3.58 + if (err)
3.59 + return err;
3.60 +
3.61 + file->data_current = 0;
3.62 + return L4_EOK;
3.63 }
3.64
3.65