[SOLVED] CS代考计算机代写 /* This test checks that the stack is properly extended even if

30 $

File Name: CS代考计算机代写_/*_This_test_checks_that_the_stack_is_properly_extended_even_if.zip
File Size: 819.54 KB

SKU: 8299580623 Category: Tags: , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Or Upload Your Assignment Here:


/* This test checks that the stack is properly extended even if
the first access to a stack location occurs inside a system
call.

From Godmar Back. */

#include
#include
#include “tests/vm/sample.inc”
#include “tests/lib.h”
#include “tests/main.h”

void
test_main (void)
{
int handle;
int slen = strlen (sample);
char buf2[65536];

/* Write file via write(). */
CHECK (create (“sample.txt”, slen), “create ”sample.txt””);
CHECK ((handle = open (“sample.txt”)) > 1, “open ”sample.txt””);
CHECK (write (handle, sample, slen) == slen, “write ”sample.txt””);
close (handle);

/* Read back via read(). */
CHECK ((handle = open (“sample.txt”)) > 1, “2nd open ”sample.txt””);
CHECK (read (handle, buf2 + 32768, slen) == slen, “read ”sample.txt””);

CHECK (!memcmp (sample, buf2 + 32768, slen), “compare written data against read data”);
close (handle);
}

Reviews

There are no reviews yet.

Only logged in customers who have purchased this product may leave a review.

Shopping Cart
[SOLVED] CS代考计算机代写 /* This test checks that the stack is properly extended even if
30 $