pipe_overcommit1_test.c (140558) | pipe_overcommit1_test.c (290914) |
---|---|
1/*- 2 * Copyright (C) 2005 Michael J. Silbersack <silby@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26 * DAMAGE. 27 */ 28 | 1/*- 2 * Copyright (C) 2005 Michael J. Silbersack <silby@freebsd.org> 3 * All rights reserved. 4 * 5 * Redistribution and use in source and binary forms, with or without 6 * modification, are permitted provided that the following conditions 7 * are met: 8 * 1. Redistributions of source code must retain the above copyright --- 12 unchanged lines hidden (view full) --- 21 * (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 22 * SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 23 * CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT 24 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY 25 * OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH 26 * DAMAGE. 27 */ 28 |
29#include <sys/param.h> |
|
29#include <stdio.h> 30#include <stdlib.h> | 30#include <stdio.h> 31#include <stdlib.h> |
32#include <unistd.h> |
|
31 32/* | 33 34/* |
33 * $FreeBSD: head/tools/regression/pipe/pipe-overcommit1.c 140558 2005-01-21 06:46:18Z silby $ | 35 * $FreeBSD: head/tests/sys/kern/pipe/pipe_overcommit1_test.c 290914 2015-11-16 05:38:40Z ngie $ |
34 * This program just allocates as many pipes as it can to ensure 35 * that using up all pipe memory doesn't cause a panic. 36 */ 37 | 36 * This program just allocates as many pipes as it can to ensure 37 * that using up all pipe memory doesn't cause a panic. 38 */ 39 |
38int main (void) 39 | 40int 41main(void) |
40{ | 42{ |
41 int i, returnval; 42 int pipes[10000]; 43 for (i = 0; i < 10000; i++) { | 43 int pipes[10000], returnval; 44 unsigned int i; 45 46 for (i = 0; i < nitems(pipes); i++) { |
44 returnval = pipe(&pipes[i]); 45 } 46 printf("PASS\n"); | 47 returnval = pipe(&pipes[i]); 48 } 49 printf("PASS\n"); |
50 51 exit(0); |
|
47} | 52} |