mirror of
https://github.com/RGBCube/serenity
synced 2025-07-26 05:17:34 +00:00
Add close-on-exec flag for file descriptors.
I was surprised to find that dup()'ed fds don't share the close-on-exec flag. That means it has to be stored separately from the FileDescriptor object.
This commit is contained in:
parent
19b9401487
commit
97c799576a
10 changed files with 74 additions and 35 deletions
|
@ -252,7 +252,14 @@ private:
|
|||
DWORD m_wakeupTime { 0 };
|
||||
TSS32 m_tss;
|
||||
TSS32 m_tss_to_resume_kernel;
|
||||
Vector<RetainPtr<FileDescriptor>> m_file_descriptors;
|
||||
struct FileDescriptorAndFlags {
|
||||
operator bool() const { return !!descriptor; }
|
||||
void clear() { descriptor = nullptr; flags = 0; }
|
||||
void set(RetainPtr<FileDescriptor>&& d, dword f = 0) { descriptor = move(d), flags = f; }
|
||||
RetainPtr<FileDescriptor> descriptor;
|
||||
dword flags { 0 };
|
||||
};
|
||||
Vector<FileDescriptorAndFlags> m_fds;
|
||||
RingLevel m_ring { Ring0 };
|
||||
int m_error { 0 };
|
||||
void* m_kernelStack { nullptr };
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue