diff options
author | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-09-20 12:42:07 +0200 |
---|---|---|
committer | Michał Łyszczek <michal.lyszczek@bofc.pl> | 2018-09-20 12:42:07 +0200 |
commit | b9a8307815f0452a84c06cae0e6324b41703f843 (patch) | |
tree | b62b56a533a0dba127e010be53ddc1736b2e86fc | |
parent | eade84bcf34d681a5897c4198eaf7175d74ebf93 (diff) | |
download | librb-b9a8307815f0452a84c06cae0e6324b41703f843.tar.gz librb-b9a8307815f0452a84c06cae0e6324b41703f843.tar.bz2 librb-b9a8307815f0452a84c06cae0e6324b41703f843.zip |
change O_WRONLY to O_RDWR only on openbsd system
-rw-r--r-- | tests.c | 16 |
1 files changed, 16 insertions, 0 deletions
@@ -177,7 +177,11 @@ static void *multi_pipe_producer(void *arg) unsigned int index; int fd; +#if defined(__OpenBSD__) fd = open(d->pipe, O_RDWR); +#else + fd = open(d->pipe, O_WRONLY); +#endif for (;;) { @@ -251,7 +255,11 @@ static void *multi_pipe_consumer(void *arg) unsigned int index; int fd; +#if defined(__OpenBSD__) fd = open(d->pipe, O_RDWR); +#else + fd = open(d->pipe, O_RDONLY); +#endif for (;;) { @@ -449,7 +457,11 @@ static void multi_file_consumer_producer(void) pthread_create(prod, NULL, multi_producer, &prod_data); cons_data.rb = rb; +#if defined(__OpenBSD__) cons_data.fd = open("./rb-test-fifo", O_RDWR); +#else + cons_data.fd = open("./rb-test-fifo", O_WRONLY); +#endif for (i = 0; i != t_num_consumers; ++i) { pthread_create(&cons[i], NULL, multi_consumer, &cons_data); @@ -468,7 +480,11 @@ static void multi_file_consumer_producer(void) pthread_create(cons, NULL, multi_consumer, &cons_data); prod_data.rb = rb; +#if defined(__OpenBSD__) prod_data.fd = open("./rb-test-fifo", O_RDWR); +#else + prod_data.fd = open("./rb-test-fifo", O_RDONLY); +#endif for (i = 0; i != t_num_producers; ++i) { pthread_create(&prod[i], NULL, multi_producer, &prod_data); |