mirror of
https://github.com/jart/cosmopolitan.git
synced 2025-07-05 10:48:29 +00:00
Share file offset across execve() on Windows
This is a breaking change. It defines the new environment variable named _COSMO_FDS_V2 which is used for inheriting non-stdio file descriptors on execve() or posix_spawn(). No effort has been spent thus far integrating with the older variable. If a new binary launches the older ones or vice versa they'll only be able to pass stdin / stdout / stderr to each other therefore it's important that you upgrade all your cosmo binaries if you depend on this functionality. You'll be glad you did because inheritance of file descriptors is more aligned with the POSIX standard than before.
This commit is contained in:
parent
761c6ad615
commit
3f26dfbb31
29 changed files with 572 additions and 249 deletions
|
@ -17,8 +17,6 @@
|
|||
│ PERFORMANCE OF THIS SOFTWARE. │
|
||||
╚─────────────────────────────────────────────────────────────────────────────*/
|
||||
#include "libc/calls/state.internal.h"
|
||||
#include "libc/intrin/fds.h"
|
||||
#include "libc/runtime/runtime.h"
|
||||
#include "libc/thread/thread.h"
|
||||
|
||||
void __fds_lock(void) {
|
||||
|
@ -28,23 +26,3 @@ void __fds_lock(void) {
|
|||
void __fds_unlock(void) {
|
||||
pthread_mutex_unlock(&__fds_lock_obj);
|
||||
}
|
||||
|
||||
void __fd_lock(struct Fd *f) {
|
||||
pthread_mutex_lock(&f->shared->lock);
|
||||
}
|
||||
|
||||
void __fd_unlock(struct Fd *f) {
|
||||
pthread_mutex_unlock(&f->shared->lock);
|
||||
}
|
||||
|
||||
struct Cursor *__cursor_new(void) {
|
||||
struct Cursor *c;
|
||||
if ((c = _mapshared(sizeof(struct Cursor)))) {
|
||||
pthread_mutexattr_t attr;
|
||||
pthread_mutexattr_init(&attr);
|
||||
pthread_mutexattr_setpshared(&attr, PTHREAD_PROCESS_SHARED);
|
||||
pthread_mutex_init(&c->lock, &attr);
|
||||
pthread_mutexattr_destroy(&attr);
|
||||
}
|
||||
return c;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue