pipe-reverse.c (225736) | pipe-reverse.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-reverse.c 132524 2004-07-22 02:46:25Z silby $ | 31 * $FreeBSD: stable/9/tools/regression/pipe/pipe-reverse.c 231832 2012-02-16 19:39:49Z eadler $ |
32 * This program simply tests writing through the reverse direction of 33 * a pipe. Nothing too fancy, it's only needed because most pipe-using 34 * programs never touch the reverse direction (it doesn't exist on 35 * Linux.) 36 */ 37 38int main (void) 39{ 40char buffer[65535], buffer2[65535]; 41int desc[2]; 42int buggy, error, i, successes, total; 43struct stat status; 44pid_t new_pid; 45 46buggy = 0; | 32 * This program simply tests writing through the reverse direction of 33 * a pipe. Nothing too fancy, it's only needed because most pipe-using 34 * programs never touch the reverse direction (it doesn't exist on 35 * Linux.) 36 */ 37 38int main (void) 39{ 40char buffer[65535], buffer2[65535]; 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 < 65535; i++) { | 56for (i = 1; i < 65535; 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) { --- 49 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) { --- 49 unchanged lines hidden --- |