Using the device node

6.10 z/VM guest

You can send a command to z/VM® CP by writing to the vmcp device node.

Observe the following rules for writing to the device node:
  • Omit the newline character at the end of the command string. For example, use echo -n if you are writing directly from a terminal session.
  • Write the command in the same case as required on z/VM.
  • Escape characters that need escaping in the environment where you issue the command.

Example

The following command attaches a device to your z/VM guest virtual machine. The asterisk (*) is escaped to prevent the command shell from interpreting it.
# echo -n ATTACH 1234 \* > /dev/vmcp

Application programmers

You can also use the vmcp device node directly from an application using open, write (to issue the command), read (to get the response), ioctl (to get and set status), and close. The following ioctls are supported:

Table 1. The vmcp ioctls
Name Code definition Description
VMCP_GETCODE _IOR (0x10, 1, int) Queries the return code of z/VM.
VMCP_SETBUF _IOW(0x10, 2, int) Sets the buffer size (the device driver has a default of 4 KB; vmcp calls this ioctl to set it to 8 KB instead).
VMCP_GETSIZE _IOR(0x10, 3, int) Queries the size of the response.