Changeset View
Changeset View
Standalone View
Standalone View
head/sys/kern/kern_descrip.c
Show First 20 Lines • Show All 962 Lines • ▼ Show 20 Lines | default: | ||||
KASSERT(0, ("%s unsupported mode %d", __func__, mode)); | KASSERT(0, ("%s unsupported mode %d", __func__, mode)); | ||||
} | } | ||||
KASSERT(old != new, ("new fd is same as old")); | KASSERT(old != new, ("new fd is same as old")); | ||||
newfde = &fdp->fd_ofiles[new]; | newfde = &fdp->fd_ofiles[new]; | ||||
delfp = newfde->fde_file; | delfp = newfde->fde_file; | ||||
oioctls = filecaps_free_prep(&newfde->fde_caps); | |||||
nioctls = filecaps_copy_prep(&oldfde->fde_caps); | nioctls = filecaps_copy_prep(&oldfde->fde_caps); | ||||
/* | /* | ||||
* Duplicate the source descriptor. | * Duplicate the source descriptor. | ||||
*/ | */ | ||||
#ifdef CAPABILITIES | #ifdef CAPABILITIES | ||||
seqc_write_begin(&newfde->fde_seqc); | seqc_write_begin(&newfde->fde_seqc); | ||||
#endif | #endif | ||||
oioctls = filecaps_free_prep(&newfde->fde_caps); | |||||
memcpy(newfde, oldfde, fde_change_size); | memcpy(newfde, oldfde, fde_change_size); | ||||
filecaps_copy_finish(&oldfde->fde_caps, &newfde->fde_caps, | filecaps_copy_finish(&oldfde->fde_caps, &newfde->fde_caps, | ||||
nioctls); | nioctls); | ||||
if ((flags & FDDUP_FLAG_CLOEXEC) != 0) | if ((flags & FDDUP_FLAG_CLOEXEC) != 0) | ||||
newfde->fde_flags = oldfde->fde_flags | UF_EXCLOSE; | newfde->fde_flags = oldfde->fde_flags | UF_EXCLOSE; | ||||
else | else | ||||
newfde->fde_flags = oldfde->fde_flags & ~UF_EXCLOSE; | newfde->fde_flags = oldfde->fde_flags & ~UF_EXCLOSE; | ||||
#ifdef CAPABILITIES | #ifdef CAPABILITIES | ||||
▲ Show 20 Lines • Show All 3,533 Lines • Show Last 20 Lines |