summaryrefslogtreecommitdiff
path: root/src/regress/lib/libc/stdio_threading/fgetln
diff options
context:
space:
mode:
Diffstat (limited to 'src/regress/lib/libc/stdio_threading/fgetln')
-rw-r--r--src/regress/lib/libc/stdio_threading/fgetln/Makefile6
-rwxr-xr-xsrc/regress/lib/libc/stdio_threading/fgetln/fgetln_test.c70
2 files changed, 0 insertions, 76 deletions
diff --git a/src/regress/lib/libc/stdio_threading/fgetln/Makefile b/src/regress/lib/libc/stdio_threading/fgetln/Makefile
deleted file mode 100644
index cad51e2b23..0000000000
--- a/src/regress/lib/libc/stdio_threading/fgetln/Makefile
+++ /dev/null
@@ -1,6 +0,0 @@
1TOPDIR=${.CURDIR}
2PROG=fgetln_test
3CFLAGS+=-I${TOPDIR}/../include/
4LDFLAGS+=-lpthread
5
6.include <bsd.regress.mk>
diff --git a/src/regress/lib/libc/stdio_threading/fgetln/fgetln_test.c b/src/regress/lib/libc/stdio_threading/fgetln/fgetln_test.c
deleted file mode 100755
index d5c4db2edf..0000000000
--- a/src/regress/lib/libc/stdio_threading/fgetln/fgetln_test.c
+++ /dev/null
@@ -1,70 +0,0 @@
1/*
2 * Copyright (c) 2008 Bret S. Lambert <blambert@openbsd.org>
3 *
4 * Permission to use, copy, modify, and distribute this software for any
5 * purpose with or without fee is hereby granted, provided that the above
6 * copyright notice and this permission notice appear in all copies.
7 *
8 * THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
9 * WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
10 * MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
11 * ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
12 * WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
13 * ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF
14 * OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
15 */
16
17#include "local.h"
18
19void
20fgetln_thread(void *v)
21{
22 FILE *file = v;
23 size_t len;
24 char *buf;
25 int i;
26
27 for (i = 0; i < 4096; i++) {
28 if ((buf = fgetln(file, &len)) == NULL) {
29
30 if (feof(file))
31 break;
32
33 printf("OMG!!!\n");
34 fflush(stdout);
35 break;
36 }
37 if (strncmp(buf, TEXT_N, sizeof(TEXT_N)))
38 err(1, "fgetln not atomic!!!");
39 }
40}
41
42int
43main(void)
44{
45 char sfn[24];
46 char buf[sizeof(TEXT_N)];
47 FILE *sfp;
48 int fd, i;
49
50 strlcpy(sfn, "/tmp/barnacles.XXXXXXXX", sizeof(sfn));
51 if ((fd = mkstemp(sfn)) == -1 ||
52 (sfp = fdopen(fd, "w+")) == NULL) {
53 if (fd != -1) {
54 unlink(sfn);
55 close(fd);
56 }
57 err(1, "could not open temporary file");
58 }
59
60 for (i = 0; i < 4096 * THREAD_COUNT; i++)
61 if (fwrite(TEXT_N, sizeof(char), strlen(TEXT_N), sfp) == 0)
62 err(1, "Could not populate test file");
63
64 run_threads(fgetln_thread, sfp);
65
66 unlink(sfn);
67 close(fd);
68
69 exit(0);
70}