lots of work on determinism in the linux driver.
This commit is contained in:
@@ -225,7 +225,25 @@ static int console_read(char *bytes, int nbytes) {
|
||||
return read(0, bytes, nbytes);
|
||||
}
|
||||
|
||||
|
||||
static std::string_view read_file(const char *fn, char *buf, int bufsize, UmmString &err) {
|
||||
int nread;
|
||||
int fd = open(fn, O_RDONLY);
|
||||
if (fd < 0) goto error_errno;
|
||||
nread = read(fd, buf, bufsize);
|
||||
if (nread < 0) goto error_errno;
|
||||
if (nread == bufsize) {
|
||||
err = "file too large";
|
||||
goto error;
|
||||
}
|
||||
buf[nread] = 0;
|
||||
err = "";
|
||||
return std::string_view(buf, nread);
|
||||
error_errno:
|
||||
err = strerror_str(errno);
|
||||
error:
|
||||
buf[0] = 0;
|
||||
return std::string_view(buf, 0);
|
||||
}
|
||||
|
||||
static void disable_randomization(int argc, char *argv[]) {
|
||||
const int old_personality = personality(ADDR_NO_RANDOMIZE);
|
||||
|
||||
Reference in New Issue
Block a user