port: fsync(2) on a POSIX shm fd returns EINVAL on FreeBSD
authorMichael Jeanson <mjeanson@efficios.com>
Wed, 4 Nov 2020 20:42:15 +0000 (15:42 -0500)
committerMathieu Desnoyers <mathieu.desnoyers@efficios.com>
Fri, 13 Nov 2020 20:21:57 +0000 (15:21 -0500)
The POSIX shared memory object implementation on FreeBSD is not file
based and doesn't support fsync(2).

Signed-off-by: Michael Jeanson <mjeanson@efficios.com>
Signed-off-by: Mathieu Desnoyers <mathieu.desnoyers@efficios.com>
Change-Id: Ie170254122aeab858a12c0522dc4e78075f243f9

libringbuffer/shm.c

index 566ed467fe2f715bc60f56449b222964c8b51acd..1ac59f9eee138c2744a5ada5bd58c05476de9800 100644 (file)
@@ -149,12 +149,14 @@ struct shm_object *_shm_object_table_alloc_shm(struct shm_object_table *table,
                PERROR("zero_file");
                goto error_zero_file;
        }
+
        /*
         * Also ensure the file metadata is synced with the storage by using
-        * fsync(2).
+        * fsync(2). Some platforms don't allow fsync on POSIX shm fds, ignore
+        * EINVAL accordingly.
         */
        ret = fsync(shmfd);
-       if (ret) {
+       if (ret && errno != EINVAL) {
                PERROR("fsync");
                goto error_fsync;
        }
This page took 0.025743 seconds and 4 git commands to generate.