PROC dum$DISPLAY_IO_REQUESTS display_io_requests, display_io_request, disir (
  logical_unit, lun, unit, u : integer -281474976710655..281474976710655 = $optional
  cylinder, c, cyl           : integer -281474976710655..281474976710655 = $optional
  track, t, tr, tk           : integer -281474976710655..281474976710655 = $optional
  sector, s, sc              : integer -281474976710655..281474976710655 = $optional
  output, o                  : file = $output
  )

  out = $unique
  out_eoi = out // '.$EOI'
  put_line, l=' IO Requests', o=$fname(out_eoi)
  put_line, l='', o=$fname(out_eoi)

  unit_specified = $specified(logical_unit)
  IF unit_specified THEN
    unit = $value(logical_unit)
  IFEND

  cylinder_specified = $specified(cylinder)
  IF cylinder_specified THEN
    cylinder = $value(cylinder)
  IFEND

  track_specified = $specified(track)
  IF track_specified THEN
    track = $value(track)
  IFEND

  sector_specified = $specified(sector)
  IF sector_specified THEN
    sector = $value(sector)
  IFEND

  request_heap = $sa(iov$request_heap)

  length = 0
  offset = 0

  fetch_field_info iot$io_disk_request,field_name=iot$io_disk_request, length=length, offset=offset
  request_length = (length / 8 + 7) / 8 * 8

  fetch_field_info iot$io_disk_request,field_name=disk_request, length=length, offset=offset
  pp_request_offset = offset / 8
  fetch_field_info iot$disk_request,field_name=request, length=length, offset=offset
  pp_request_offset = pp_request_offset + offset / 8

  fetch_field_info iot$disk_pp_request,field_name=$name('logical_unit'), length=length, offset=offset
  unit_length = length / 8
  unit_offset = offset / 8 + pp_request_offset

  fetch_field_info iot$disk_pp_request,field_name=$name('cylinder'), length=length, offset=offset
  cylinder_length = length / 8
  cylinder_offset = offset / 8 + pp_request_offset

  fetch_field_info iot$disk_pp_request,field_name=$name('track'), length=length, offset=offset
  track_length = length / 8
  track_offset = offset / 8 + pp_request_offset

  fetch_field_info iot$disk_pp_request,field_name=$name('sector'), length=length, offset=offset
  sector_length = length / 8
  sector_offset = offset / 8 + pp_request_offset

  FOR i = 0 TO 254 DO
    request_address = request_heap + request_length * i

    IF unit_specified AND (unit <> $mem(request_address+unit_offset, unit_length)) THEN
      CYCLE
    IFEND

    IF cylinder_specified AND (cylinder <> $mem(request_address+cylinder_offset, cylinder_length)) THEN
      CYCLE
    IFEND

    IF track_specified AND (track <> $mem(request_address+track_offset, track_length)) THEN
      CYCLE
    IFEND

    IF sector_specified AND (sector <> $mem(request_address+sector_offset, sector_length)) THEN
      CYCLE
    IFEND

    iot$io_disk_request, a=request_address, o=$fname(out)
  FOREND

  copy_file, i=$fname(out), o=$value(output)
  delete_file, f=$fname(out)

PROCEND dum$display_io_requests
