Hello Samuel, Thank you for the clarification.
Just a small note on operator precedence in the proposed expression: since subtraction binds more tightly than the shift operator, the trailing - 1 would apply to the shift count rather than the shifted value. Perhaps we could write it as: vm_size_t max = ((vm_size_t) 1 << (sizeof (mach_msg_type_number_t) * CHAR_BIT - 1)) - 1; This would require <limits.h> for CHAR_BIT. C operator precedence always finds a way to catch us off guard. :) Best regards, Alperen Erkan On Sat, Nov 28, 2026 at 4:27 PM Samuel Thibault <[email protected]> wrote: > Alperen Erkan, le sam. 28 nov. 2026 10:05:28 +0300, a ecrit: > > Thank you for the patch. I reviewed the supplied diff statically and > have a few > > concerns about splitting a single write request into multiple RPCs. I > have not > > compiled or tested the changes. > > > > 1. Concurrent writes between chunks > > > > Each chunk is submitted through a separate __io_write() call. Another > > writer may therefore run between chunks. With a shared file > position, this > > can affect the placement of subsequent chunks; with append mode, > another > > writer’s data may appear between them. > > > > Could we instead cap the request size and return the result of a > single RPC > > as a short write? > > Mmm, yes that can be done and won't hurt performance. Event for > non-append mode (offset is specified), writes are supposed to be atomic > against threads, so if it's not, the split should be explicited through > a short write. > > To be noted: we need the same kind of change for _hurd_fd_read. Short > reads might be interpreted by applications as an end of file, but posix > clearly says that short reads can happen on interruptions, sockets and > pipes, so I'd say we should be fine with it. > > > 4. Rationale for INT32_MAX > > > > Please document which interface constraint establishes this limit. > If it > > derives from the maximum encoded RPC message size, any applicable > message > > overhead should also be considered. > > The constraint is the parameter of __io_write: mach_msg_type_number_t > dataCnt. We don't currently have a macro for its maximum signed value, > but using vm_size_t max = 1 << (sizeof(mach_msg_type_number_t)*8-1) - 1; > should be fine enough. > > Samuel >
