summary refs log tree commit diff
diff options
context:
space:
mode:
authorChristian Neukirchen <chneukirchen@gmail.com>2015-08-03 13:53:25 +0200
committerChristian Neukirchen <chneukirchen@gmail.com>2015-08-03 13:53:25 +0200
commit91dae7a9bcc0a73fe684d9def8ca6224c5de0213 (patch)
tree7743bd7c3c5afafe486a1fe559570c083e048552
parenta8c5f2f79d773c98318f5f8708579845c7904140 (diff)
downloadnq-91dae7a9bcc0a73fe684d9def8ca6224c5de0213.tar.gz
nq-91dae7a9bcc0a73fe684d9def8ca6224c5de0213.tar.xz
nq-91dae7a9bcc0a73fe684d9def8ca6224c5de0213.zip
flock(2) is not actually POSIX...
-rw-r--r--Makefile2
-rw-r--r--README.md5
-rw-r--r--nq.c5
3 files changed, 7 insertions, 5 deletions
diff --git a/Makefile b/Makefile
index 4df9cf2..c6cc8d6 100644
--- a/Makefile
+++ b/Makefile
@@ -1,4 +1,4 @@
-CFLAGS=-g -std=c89 -Wall -O2
+CFLAGS=-g -Wall -O2
 all: nq
 nq: nq.c
 clean:
diff --git a/README.md b/README.md
index 15805f7..cc7fe58 100644
--- a/README.md
+++ b/README.md
@@ -4,8 +4,9 @@ These small utilities allow creating very lightweight job queue
 systems which require no setup, maintenance, supervision, or any
 long-running processes.
 
-`nq` should run on any POSIX.1-2008 compliant system using directories
-where flock(2) works.
+`nq` should run on any POSIX.1-2008 compliant system which also
+provides a working flock(2).  Tested on Linux 4.1, OpenBSD 5.7 and
+FreeBSD 10.1.
 
 The intended purpose is ad-hoc queuing of command lines (e.g. for
 building several targets of a Makefile, downloading multiple files one
diff --git a/nq.c b/nq.c
index 0bbb009..ba8dc1c 100644
--- a/nq.c
+++ b/nq.c
@@ -3,7 +3,7 @@
  * -w ...  wait for all jobs/listed jobs queued so far to finish
  * -t ...  exit 0 if no (listed) job needs waiting
  *
- * - requires POSIX.1-2008
+ * - requires POSIX.1-2008 and having flock(2)
  * - enforcing order works like this:
  *   - every job has a flock(2)ed output file ala ",TIMESTAMP.PID"
  *   - every job starts only after all earlier flock(2)ed files finished
@@ -19,7 +19,8 @@
  * http://creativecommons.org/publicdomain/zero/1.0/
 */
 
-#define _POSIX_C_SOURCE 200809L
+/* for FreeBSD.  */
+#define _WITH_DPRINTF
 
 #include <sys/file.h>
 #include <sys/stat.h>