// Test that we can read memory from our own process char src[1024] = "This is the source buffer containing some data"; char dst[1024] = "";
iovec remote = { src, sizeof src };
iovec local = { dst, sizeof dst };
ASSERT_EQ(ssize_t(sizeof src), process_vm_readv(getpid(), &local, 1, &remote, 1, 0)); // Check whether data was copied (in the correct direction)
ASSERT_EQ('T', dst[0]);
ASSERT_EQ(0, memcmp(src, dst, sizeof src));
// Reading from non-allocated memory should return an error
remote = { nullptr, sizeof dst };
ASSERT_ERRNO_FAILURE(EFAULT, -1, process_vm_readv(getpid(), &local, 1, &remote, 1, 0));
}
// Test that we can read memory from our own process char src[1024] = "This is the source buffer containing some data"; char dst[1024] = "";
iovec remote = { dst, sizeof dst };
iovec local = { src, sizeof src };
ASSERT_EQ(ssize_t(sizeof src), process_vm_writev(getpid(), &local, 1, &remote, 1, 0)); // Check whether data was copied (in the correct direction)
ASSERT_EQ('T', dst[0]);
ASSERT_EQ(0, memcmp(src, dst, sizeof src));
// Writing to non-allocated memory should return an error
remote = { nullptr, sizeof dst };
ASSERT_ERRNO_FAILURE(EFAULT, -1, process_vm_writev(getpid(), &local, 1, &remote, 1, 0));
}
Messung V0.5 in Prozent
¤ Dauer der Verarbeitung: 0.16 Sekunden
(vorverarbeitet am 2026-06-28)
¤
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.