Deleted Added
full compact
pipe-wraparound.c (225736) pipe-wraparound.c (231832)
1/*
2Copyright (C) 2004 Michael J. Silbersack. All rights reserved.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions
6are met:
71. Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.

--- 14 unchanged lines hidden (view full) ---

23SUCH DAMAGE.
24*/
25
26#include <stdio.h>
27#include <unistd.h>
28#include <sys/stat.h>
29
30/*
1/*
2Copyright (C) 2004 Michael J. Silbersack. All rights reserved.
3
4Redistribution and use in source and binary forms, with or without
5modification, are permitted provided that the following conditions
6are met:
71. Redistributions of source code must retain the above copyright
8 notice, this list of conditions and the following disclaimer.

--- 14 unchanged lines hidden (view full) ---

23SUCH DAMAGE.
24*/
25
26#include <stdio.h>
27#include <unistd.h>
28#include <sys/stat.h>
29
30/*
31 * $FreeBSD: stable/9/tools/regression/pipe/pipe-wraparound.c 132524 2004-07-22 02:46:25Z silby $
31 * $FreeBSD: stable/9/tools/regression/pipe/pipe-wraparound.c 231832 2012-02-16 19:39:49Z eadler $
32 * This program tests to make sure that wraparound writes and reads
33 * are working, assuming that 16K socket buffers are used. In order
34 * to really stress the pipe code with this test, kernel modifications
35 * nay be necessary.
36 */
37
38int main (void)
39{
40char buffer[32768], buffer2[32768];
41int desc[2];
42int buggy, error, i, successes, total;
43struct stat status;
44pid_t new_pid;
45
46buggy = 0;
32 * This program tests to make sure that wraparound writes and reads
33 * are working, assuming that 16K socket buffers are used. In order
34 * to really stress the pipe code with this test, kernel modifications
35 * nay be necessary.
36 */
37
38int main (void)
39{
40char buffer[32768], buffer2[32768];
41int desc[2];
42int buggy, error, i, successes, total;
43struct stat status;
44pid_t new_pid;
45
46buggy = 0;
47total = 0;
47
48error = pipe(desc);
49
50if (error)
51 err(0, "Couldn't allocate fds\n");
52
53buffer[0] = 'A';
54
48
49error = pipe(desc);
50
51if (error)
52 err(0, "Couldn't allocate fds\n");
53
54buffer[0] = 'A';
55
55for (i = 0; i < 32768; i++) {
56for (i = 1; i < 32768; i++) {
56 buffer[i] = buffer[i - 1] + 1;
57 if (buffer[i] > 'Z')
58 buffer[i] = 'A';
59 }
60
61new_pid = fork();
62
63if (new_pid == 0) {

--- 39 unchanged lines hidden ---
57 buffer[i] = buffer[i - 1] + 1;
58 if (buffer[i] > 'Z')
59 buffer[i] = 'A';
60 }
61
62new_pid = fork();
63
64if (new_pid == 0) {

--- 39 unchanged lines hidden ---