Skip to content
BSD syscall#431

svc · unix #431

fileport_makefd

Converts a fileport Mach port received from another process back into a local file descriptor.

Prototype

int fileport_makefd(mach_port_name_t port);

Returns: int

Arguments

NameTypeDirDescription
portmach_port_name_t-

Version history

XNU tagmacOS#
xnu-1699.24.8macOS 10.7 Lion431
xnu-2050.18.24macOS 10.8 Mountain Lion431
xnu-2422.115.4macOS 10.9 Mavericks431
xnu-2782.40.9macOS 10.10 Yosemite431
xnu-3247.1.106macOS 10.11 El Capitan431
xnu-3789.1.32macOS 10.12 Sierra431
xnu-4570.1.46macOS 10.13 High Sierra431
xnu-4903.221.2macOS 10.14 Mojave431
xnu-6153.11.26macOS 10.15 Catalina431
xnu-1504.15.3—433
xnu-1504.7.4—433
xnu-1504.9.17—433
xnu-1504.9.26—433
xnu-1504.9.37—433
xnu-1699.22.73—431
xnu-1699.22.81—431
xnu-1699.24.23—431
xnu-1699.26.8—431
xnu-1699.32.7—431
xnu-2050.22.13—431
xnu-2050.24.15—431
xnu-2050.48.11—431
xnu-2050.7.9—431
xnu-2050.9.2—431
xnu-2422.1.72—431
xnu-2422.100.13—431
xnu-2422.110.17—431
xnu-2422.90.20—431
xnu-2782.1.97—431
xnu-2782.10.72—431
xnu-2782.20.48—431
xnu-2782.30.5—431
xnu-3247.10.11—431
xnu-3248.20.55—431
xnu-3248.30.4—431
xnu-3248.40.184—431
xnu-3248.50.21—431
xnu-3248.60.10—431
xnu-3789.21.4—431
xnu-3789.31.2—431
xnu-3789.41.3—431
xnu-3789.51.2—431
xnu-3789.60.24—431
xnu-3789.70.16—431
xnu-4570.20.62—431
xnu-4570.31.3—431
xnu-4570.41.2—431
xnu-4570.51.1—431
xnu-4570.61.1—431
xnu-4570.71.2—431
xnu-4903.231.4—431
xnu-4903.241.1—431
xnu-4903.270.47—431
xnu-6153.101.6—431
xnu-6153.121.1—431
xnu-6153.141.1—431
xnu-6153.41.3—431
xnu-6153.61.1—431
xnu-6153.81.5—431

Notes

The receiver inherits the same file offset and flags as the sender. After conversion the Mach port name should be deallocated. Combined with fileport_makeport this is the basis for sandboxed services receiving paths they could not open themselves.

Detection

syscall::fileport_makefd:entry in DTrace. The new fd surfaces in the receiver's lsof output afterwards.

Related APIs

fileport_makeportmach_msgdupcloseopenat