Contents

xpc_fd_create(_:)

Creates an XPC object that represents a POSIX file descriptor.

Declaration

func xpc_fd_create(_ fd: Int32) -> xpc_object_t?

Parameters

  • fd:

    The file descriptor which is to be boxed.

Return Value

A new file descriptor object. NULL if sufficient memory could not be allocated or if the given file descriptor was not valid.

Discussion

This method performs the equivalent of a dup(2) on the descriptor, so it is safe to call close(2) on the descriptor after boxing it with a file descriptor object.

This also implies that two collections containing file descriptor objects cannot be equal unless the exact same object was inserted into both.

See Also

File Descriptor objects