mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-06-27 14:58:30 +00:00
Share file offset across processes
This change ensures that if a file descriptor for an open disk file gets shared by multiple processes within a process tree, then lseek() changes will be visible across processes, and read() / write() are synchronized. Note this only applies to Windows, because UNIX kernels already do this.
This commit is contained in:
parent
a80ab3f8fe
commit
761c6ad615
15 changed files with 256 additions and 63 deletions
|
@ -17,9 +17,9 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/assert.h"
|
||||
#include "libc/intrin/fds.h"
|
||||
#include "libc/calls/syscall_support-nt.internal.h"
|
||||
#include "libc/fmt/itoa.h"
|
||||
#include "libc/intrin/fds.h"
|
||||
#include "libc/intrin/strace.h"
|
||||
#include "libc/mem/mem.h"
|
||||
#include "libc/nt/files.h"
|
||||
|
@ -151,7 +151,12 @@ textwindows char *__describe_fds(const struct Fd *fds, size_t fdslen,
|
|||
*p++ = '_';
|
||||
p = FormatInt64(p, f->mode);
|
||||
*p++ = '_';
|
||||
p = FormatInt64(p, f->pointer);
|
||||
//
|
||||
// - v1 abi: This field was originally the file pointer.
|
||||
//
|
||||
// - v2 abi: This field is the negated shared memory address.
|
||||
//
|
||||
p = FormatInt64(p, -(uintptr_t)f->shared);
|
||||
*p++ = '_';
|
||||
p = FormatInt64(p, f->type);
|
||||
*p++ = '_';
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue