Added in version 184.108.40.206 of package base.
(unsafe-file-descriptor->port fd name mode)
→ (or/c port? (values input-port? output-port?)) fd : exact-integer? name : any/c mode : (listof (or/c 'read 'write 'text 'regular-file))
(unsafe-socket->port socket name mode) →
input-port? output-port? socket : exact-integer? name : bytes? mode : (listof (or/c 'no-close))
The name argument determines the port’s name as reported by object-name. The name must be a UTF-8 encoding that is converted to a symbol for the socket name.
For a file descriptor, the mode list must include at least one of 'read or 'write, and two ports are returned if mode includes both 'read and 'write. The 'text mode affects only Windows ports. The 'regular-file mode indicates that the file descriptor corresponds to a regular file (which has the property, for example, that reading never blocks). Closing all returned file-descriptor ports closes the file descriptor.
For a socket, the mode list can include 'no-close, in which case closing both of the returned ports does not close the socket.
For any kind of result port, closing the resulting ports readies and unregisters any semaphores for the file descriptor or socket that were previously created with unsafe-file-descriptor->semaphore unsafe-socket->semaphore.
(unsafe-file-descriptor->semaphore fd mode)
→ (or/c semaphore? #f) fd : exact-integer? mode : (or/c 'read 'write 'check-read 'check-write 'remove)
socket : exact-integer? mode : (or/c 'read 'write 'check-read 'check-write 'remove)
The 'read-check and 'write-check modes are like 'read and 'write, but the result if #f if a semaphore is not already generated for the specified file descriptor or socket in the specified mode.
The 'remove mode readies and unregisters any semaphores previously created for the given file descriptor or socket. Semaphores must be unregistered before the file descriptor or socket is closed. Beware that closing a port from unsafe-file-descriptor->port or unsafe-socket->port will also ready and unregister semaphores.