Skip to content
BSD syscall#13

svc · unix #13

fchdir

Changes the current working directory using an open directory file descriptor.

Prototype

int fchdir(int fd);

Returns: int

Arguments

NameTypeDirDescription
fdint-

Version history

XNU tagmacOS#
xnu-1456.1.26macOS 10.6 Snow Leopard13
xnu-1699.24.8macOS 10.7 Lion13
xnu-2050.18.24macOS 10.8 Mountain Lion13
xnu-2422.115.4macOS 10.9 Mavericks13
xnu-2782.40.9macOS 10.10 Yosemite13
xnu-3247.1.106macOS 10.11 El Capitan13
xnu-3789.1.32macOS 10.12 Sierra13
xnu-4570.1.46macOS 10.13 High Sierra13
xnu-4903.221.2macOS 10.14 Mojave13
xnu-6153.11.26macOS 10.15 Catalina13
xnu-7195.50.7.100.1macOS 11.0 Big Sur13
xnu-8019.41.5macOS 12.0 Monterey13
xnu-8792.41.9macOS 13.0 Ventura13
xnu-10002.1.13macOS 14.0 Sonoma13
xnu-10002.41.9—13
xnu-10002.61.3—13
xnu-10002.81.5—13
xnu-1486.2.11—13
xnu-1504.15.3—13
xnu-1504.3.12—13
xnu-1504.7.4—13
xnu-1504.9.17—13
xnu-1504.9.26—13
xnu-1504.9.37—13
xnu-1699.22.73—13
xnu-1699.22.81—13
xnu-1699.24.23—13
xnu-1699.26.8—13
xnu-1699.32.7—13
xnu-2050.22.13—13
xnu-2050.24.15—13
xnu-2050.48.11—13
xnu-2050.7.9—13
xnu-2050.9.2—13
xnu-2422.1.72—13
xnu-2422.100.13—13
xnu-2422.110.17—13
xnu-2422.90.20—13
xnu-2782.1.97—13
xnu-2782.10.72—13
xnu-2782.20.48—13
xnu-2782.30.5—13
xnu-3247.10.11—13
xnu-3248.20.55—13
xnu-3248.30.4—13
xnu-3248.40.184—13
xnu-3248.50.21—13
xnu-3248.60.10—13
xnu-3789.21.4—13
xnu-3789.31.2—13
xnu-3789.41.3—13
xnu-3789.51.2—13
xnu-3789.60.24—13
xnu-3789.70.16—13
xnu-4570.20.62—13
xnu-4570.31.3—13
xnu-4570.41.2—13
xnu-4570.51.1—13
xnu-4570.61.1—13
xnu-4570.71.2—13
xnu-4903.231.4—13
xnu-4903.241.1—13
xnu-4903.270.47—13
xnu-6153.101.6—13
xnu-6153.121.1—13
xnu-6153.141.1—13
xnu-6153.41.3—13
xnu-6153.61.1—13
xnu-6153.81.5—13
xnu-7195.101.1—13
xnu-7195.121.3—13
xnu-7195.141.2—13
xnu-7195.60.75—13
xnu-7195.81.3—13
xnu-8019.61.5—13
xnu-8019.80.24—13
xnu-8020.101.4—13
xnu-8020.121.3—13
xnu-8020.140.41—13
xnu-8792.61.2—13
xnu-8792.81.2—13
xnu-8796.101.5—13
xnu-8796.121.2—13
xnu-8796.141.3—13

Notes

Avoids path resolution and is the safe choice when racing renames could otherwise move the intended directory. The fd must refer to a directory opened with O_RDONLY or O_DIRECTORY.

Detection

ES NOTIFY_CHDIR is emitted with the resolved vnode regardless of how the directory was identified.

Related APIs

chdirchrootopenopenat