diff options
| author | cvs2svn <admin@example.com> | 2018-11-07 01:08:50 +0000 |
|---|---|---|
| committer | cvs2svn <admin@example.com> | 2018-11-07 01:08:50 +0000 |
| commit | 2035faf3f8aa95b888d9416c3cc7328c0ea18beb (patch) | |
| tree | f08a08d357c5d30455c569890f747c1d9b241316 /src/regress/lib/libc/stdio_threading/fputs | |
| parent | be03b61c1b8f59ccdd34dbe5f6c6b30de697d28b (diff) | |
| download | openbsd-bluhm_20181106.tar.gz openbsd-bluhm_20181106.tar.bz2 openbsd-bluhm_20181106.zip | |
This commit was manufactured by cvs2git to create tag 'bluhm_20181106'.bluhm_20181106
Diffstat (limited to 'src/regress/lib/libc/stdio_threading/fputs')
| -rw-r--r-- | src/regress/lib/libc/stdio_threading/fputs/Makefile | 6 | ||||
| -rwxr-xr-x | src/regress/lib/libc/stdio_threading/fputs/fputs_test.c | 67 |
2 files changed, 0 insertions, 73 deletions
diff --git a/src/regress/lib/libc/stdio_threading/fputs/Makefile b/src/regress/lib/libc/stdio_threading/fputs/Makefile deleted file mode 100644 index e561745581..0000000000 --- a/src/regress/lib/libc/stdio_threading/fputs/Makefile +++ /dev/null | |||
| @@ -1,6 +0,0 @@ | |||
| 1 | TOPDIR=${.CURDIR} | ||
| 2 | PROG=fputs_test | ||
| 3 | CFLAGS+=-I${TOPDIR}/../include/ | ||
| 4 | LDFLAGS+=-lpthread | ||
| 5 | |||
| 6 | .include <bsd.regress.mk> | ||
diff --git a/src/regress/lib/libc/stdio_threading/fputs/fputs_test.c b/src/regress/lib/libc/stdio_threading/fputs/fputs_test.c deleted file mode 100755 index 93d0f0b6c7..0000000000 --- a/src/regress/lib/libc/stdio_threading/fputs/fputs_test.c +++ /dev/null | |||
| @@ -1,67 +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 | |||
| 19 | void | ||
| 20 | fputs_thread(void *v) | ||
| 21 | { | ||
| 22 | FILE *file = v; | ||
| 23 | int i; | ||
| 24 | |||
| 25 | for (i = 0; i < 4096; i++) { | ||
| 26 | if (fputs(TEXT, file) != 0) { | ||
| 27 | |||
| 28 | if (feof(file)) | ||
| 29 | break; | ||
| 30 | |||
| 31 | printf("OMG!!!\n"); | ||
| 32 | fflush(stdout); | ||
| 33 | break; | ||
| 34 | } | ||
| 35 | } | ||
| 36 | } | ||
| 37 | |||
| 38 | int | ||
| 39 | main(void) | ||
| 40 | { | ||
| 41 | char sfn[24]; | ||
| 42 | char buf[sizeof(TEXT)]; | ||
| 43 | FILE *sfp; | ||
| 44 | int fd; | ||
| 45 | |||
| 46 | strlcpy(sfn, "/tmp/barnacles.XXXXXXXX", sizeof(sfn)); | ||
| 47 | if ((fd = mkstemp(sfn)) == -1 || | ||
| 48 | (sfp = fdopen(fd, "w+")) == NULL) { | ||
| 49 | int saved_errno = errno; | ||
| 50 | if (fd != -1) { | ||
| 51 | unlink(sfn); | ||
| 52 | close(fd); | ||
| 53 | } | ||
| 54 | errc(1, saved_errno, "could not open temporary file"); | ||
| 55 | } | ||
| 56 | |||
| 57 | run_threads(fputs_thread, sfp); | ||
| 58 | |||
| 59 | while (fgets(buf, sizeof(buf), sfp) != NULL) /* verify */ | ||
| 60 | if (strcmp(buf, TEXT)) | ||
| 61 | err(1, "Thread writes were not atomic!!!"); | ||
| 62 | |||
| 63 | unlink(sfn); | ||
| 64 | close(fd); | ||
| 65 | |||
| 66 | exit(0); | ||
| 67 | } | ||
