X-Git-Url: http://git.lttng.org./?a=blobdiff_plain;f=libringbuffer%2Fshm.c;h=580504681acc649ef013610cbe26b16967bfc068;hb=864a1eda22ed99266509ac76451c6f27f91aa17e;hp=566ed467fe2f715bc60f56449b222964c8b51acd;hpb=053e6e240f3fb5b2427fb28f8f09c652e2bdb39a;p=lttng-ust.git diff --git a/libringbuffer/shm.c b/libringbuffer/shm.c index 566ed467..58050468 100644 --- a/libringbuffer/shm.c +++ b/libringbuffer/shm.c @@ -1,21 +1,7 @@ /* - * libringbuffer/shm.c + * SPDX-License-Identifier: LGPL-2.1-only * * Copyright (C) 2005-2012 Mathieu Desnoyers - * - * This library is free software; you can redistribute it and/or - * modify it under the terms of the GNU Lesser General Public - * License as published by the Free Software Foundation; only - * version 2.1 of the License. - * - * This library is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU - * Lesser General Public License for more details. - * - * You should have received a copy of the GNU Lesser General Public - * License along with this library; if not, write to the Free Software - * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA */ #define _LGPL_SOURCE @@ -38,7 +24,7 @@ #include #include #endif -#include +#include #include #include "mmap.h" @@ -149,12 +135,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; }