github.com/google/syzkaller@v0.0.0-20240517125934-c0f1611a36d6/sys/fuchsia/test/stream (about)

     1  zx_vmo_create(0x100, 0x0, &AUTO=<r0=>0x0)
     2  
     3  # Create a read/write stream and initialize the seek offset to 0.
     4  
     5  zx_stream_create(0x3, r0, 0x0, &AUTO=<r1=>0x0)
     6  
     7  # Write to the stream, first in write mode, then in append mode.
     8  
     9  zx_stream_writev(r1, 0x0, &AUTO=[{&AUTO='abcd', 0x4}, {&AUTO='efg', 0x3}], 0x2, &AUTO)
    10  zx_stream_writev(r1, 0x1, &AUTO=[{&AUTO='hi', 0x2}], 0x1, &AUTO)
    11  
    12  # Attempt to write with an invalid input pointer.
    13  
    14  zx_stream_writev(r1, 0x1, 0x0, 0x1, &AUTO) # ZX_ERR_INVALID_ARGS
    15  
    16  # Read from the stream.
    17  
    18  zx_stream_readv(r1, 0x0, &AUTO, 0x1, &AUTO)
    19  
    20  # Move the cursor back to the beginning of the stream.
    21  # Seek forward 1 byte from the current position in the stream.
    22  # Seeking fails if the offset (after wrapping around) falls before the beginning of the stream.
    23  # Seek to an offset past the current end of the stream.
    24  
    25  zx_stream_seek(r1, 0x0, 0x0, &AUTO)
    26  zx_stream_seek(r1, 0x1, 0x1, &AUTO)
    27  zx_stream_seek(r1, 0x0, 0xffffffffffffffff, &AUTO) # ZX_ERR_INVALID_ARGS
    28  zx_stream_seek(r1, 0x1, 0xfffffffffffffffe, &AUTO) # ZX_ERR_INVALID_ARGS
    29  zx_stream_seek(r1, 0x2, 0x1, &AUTO=<r2=>0x0)
    30  
    31  # With the cursor after the end of the stream, read and write some bytes.
    32  
    33  zx_stream_readv_at(r1, 0x0, r2, &AUTO, 0x1, &AUTO)
    34  zx_stream_writev_at(r1, 0x0, r2, &AUTO=[{&AUTO='jk', 0x2}], 0x1, &AUTO)