HomeFreeBSD

filedesc: make fdinit return with source filedesc locked and new one sized

Description

filedesc: make fdinit return with source filedesc locked and new one sized
appropriately

Assert FILEDESC_XLOCK_ASSERT only for already used tables in fdgrowtable.
We don't have to call it with the lock held if we are just creating new
filedesc.

As a side note, strictly speaking processes can have fdtables with
fd_lastfile = -1, but then they cannot enter fdgrowtable. Very first file
descriptor they get will be 0 and the only syscall allowing to choose fd number
requires an active file descriptor. Should this ever change, we can add an 'init'
(or similar) parameter to fdgrowtable.

Details

Provenance
mjgAuthored on
Parents
rS273894: filedesc: iterate over fd table only once in fdcopy
Branches
Unknown
Tags
Unknown

Event Timeline