Project: /_project.yaml Book: /_book.yaml

fuchsia.hardware.pty

A PTY (pseudoterminal) emulates terminal devices, with a “server” side (which represents the keyboard+monitor side of the terminal and is obtained by opening /dev/misc/ptmx) and a number of “client” sides which are obtained by calling OpenClient.

Client PTYs are identified by the id used in the OpenClient call. The first Client PTY must be 0, and it is the only Client PTY that is allowed to create additional Client PTYs, receive Events, etc. It is the Controlling PTY.

PROTOCOLS

Device {:#Device}

Defined in fuchsia.hardware.pty/pty.fidl

Clone {:#Clone}

Create another connection to the same remote object.

flags may be any of:

  • OPEN_RIGHT_*
  • OPEN_FLAG_APPEND
  • OPEN_FLAG_NO_REMOTE
  • OPEN_FLAG_DESCRIBE
  • CLONE_FLAG_SAME_RIGHTS

All other flags are ignored.

The OPEN_RIGHT_* bits in flags request corresponding rights over the resulting cloned object. The cloned object must have rights less than or equal to the original object. Alternatively, pass CLONE_FLAG_SAME_RIGHTS to inherit the rights on the source connection. It is invalid to pass any of the OPEN_RIGHT_* flags together with CLONE_FLAG_SAME_RIGHTS.

Request

Close {:#Close}

Terminates connection with object.

This method does not require any rights.

Request

Response

Describe {:#Describe}

Returns extra information about the type of the object. If the Describe operation fails, the connection is closed.

This method does not require any rights.

Request

Response

OnOpen {:#OnOpen}

An event produced eagerly by a FIDL server if requested by OPEN_FLAG_DESCRIBE.

Indicates the success or failure of the open operation, and optionally describes the object. If the status is ZX_OK, info contains descriptive information about the object (the same as would be returned by Describe).

Response

Sync {:#Sync}

Synchronizes updates to the node to the underlying media, if it exists.

This method does not require any rights.

Request

Response

GetAttr {:#GetAttr}

Acquires information about the node.

This method does not require any rights.

Request

Response

SetAttr {:#SetAttr}

Updates information about the node. flags may be any of NODE_ATTRIBUTE_FLAG_*.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Ioctl {:#Ioctl}

Deprecated. Only for use with compatibility with devhost.

Request

Response

Read {:#Read}

Reads ‘count’ bytes at the seek offset. The seek offset is moved forward by the number of bytes read.

This method requires following rights: OPEN_RIGHT_READABLE.

Request

Response

ReadAt {:#ReadAt}

Reads ‘count’ bytes at the provided offset. Does not affect the seek offset.

This method requires following rights: OPEN_RIGHT_READABLE.

Request

Response

Write {:#Write}

Writes data at the seek offset. The seek offset is moved forward by the number of bytes written.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

WriteAt {:#WriteAt}

Writes data to the provided offset. Does not affect the seek offset.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

Seek {:#Seek}

Moves the offset at which the next invocation of Read() or Write() will occur.

This method does not require any rights.

Request

Response

Truncate {:#Truncate}

Shrinks the file size to ‘length’ bytes.

This method requires following rights: OPEN_RIGHT_WRITABLE.

Request

Response

GetFlags {:#GetFlags}

Acquires the Directory::Open rights and flags used to access this file.

This method does not require any rights.

Request

Response

SetFlags {:#SetFlags}

Changes the Directory::Open flags used to access the file. Supported flags which can be turned on / off:

  • OPEN_FLAG_APPEND

This method does not require any rights.

Request

Response

GetBuffer {:#GetBuffer}

Acquires a buffer representing this file, if there is one, with the requested access rights.

flags may be any of VMO_FLAG_*.

This method requires following rights:

  • OPEN_RIGHT_WRITABLE if flags includes VMO_FLAG_WRITE.
  • OPEN_RIGHT_READABLE if flags includes VMO_FLAG_READ or VMO_FLAG_EXEC.

Request

Response

OpenClient {:#OpenClient}

Open a client PTY device with a unique id. client should be a handle to one endpoint of a channel that (on success) will become an open connection to the newly created device. On failure, the channel will be closed. Closing the channel will close the connection and release the device. If the provided id is 0, then the new client is a controlling client and has the capability to open additional clients. If the current device is not a controlling client, ZX_ERR_ACCESS_DENIED will be returned. If id is not unique, ZX_ERR_INVALID_ARGS will be returned. Otherwise the status code from device_add is passed on.

Request

Response

ClrSetFeature {:#ClrSetFeature}

allowed on Client PTYs

Clear and/or Set PTY Features

Request

Response

GetWindowSize {:#GetWindowSize}

Obtain the window size (in character cells)

Request

Response

MakeActive {:#MakeActive}

allowed on the Controlling PTY

Select which Client PTY receives input. Reads will simply block on non-active PTYs.

Request

Response

ReadEvents {:#ReadEvents}

Returns pending OOB events, simultaneously clearing them

Request

Response

SetWindowSize {:#SetWindowSize}

allowed on the Server PTY

Sets the window size

Request

Response

STRUCTS

WindowSize {:#WindowSize}

Defined in fuchsia.hardware.pty/pty.fidl

CONSTANTS