get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/71183/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 71183,
    "url": "http://patches.dpdk.org/api/patches/71183/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/20200610142730.31376-3-dmitry.kozliuk@gmail.com/",
    "project": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/projects/1/?format=api",
        "name": "DPDK",
        "link_name": "dpdk",
        "list_id": "dev.dpdk.org",
        "list_email": "dev@dpdk.org",
        "web_url": "http://core.dpdk.org",
        "scm_url": "git://dpdk.org/dpdk",
        "webscm_url": "http://git.dpdk.org/dpdk",
        "list_archive_url": "https://inbox.dpdk.org/dev",
        "list_archive_url_format": "https://inbox.dpdk.org/dev/{}",
        "commit_url_format": ""
    },
    "msgid": "<20200610142730.31376-3-dmitry.kozliuk@gmail.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/20200610142730.31376-3-dmitry.kozliuk@gmail.com",
    "date": "2020-06-10T14:27:21",
    "name": "[v8,02/11] eal: introduce internal wrappers for file operations",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "df399e030c75e7ee964cbd9c952c2e6b26a7e957",
    "submitter": {
        "id": 1581,
        "url": "http://patches.dpdk.org/api/people/1581/?format=api",
        "name": "Dmitry Kozlyuk",
        "email": "dmitry.kozliuk@gmail.com"
    },
    "delegate": {
        "id": 1,
        "url": "http://patches.dpdk.org/api/users/1/?format=api",
        "username": "tmonjalo",
        "first_name": "Thomas",
        "last_name": "Monjalon",
        "email": "thomas@monjalon.net"
    },
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/20200610142730.31376-3-dmitry.kozliuk@gmail.com/mbox/",
    "series": [
        {
            "id": 10386,
            "url": "http://patches.dpdk.org/api/series/10386/?format=api",
            "web_url": "http://patches.dpdk.org/project/dpdk/list/?series=10386",
            "date": "2020-06-10T14:27:19",
            "name": "Windows basic memory management",
            "version": 8,
            "mbox": "http://patches.dpdk.org/series/10386/mbox/"
        }
    ],
    "comments": "http://patches.dpdk.org/api/patches/71183/comments/",
    "check": "fail",
    "checks": "http://patches.dpdk.org/api/patches/71183/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@inbox.dpdk.org",
        "Delivered-To": "patchwork@inbox.dpdk.org",
        "Received": [
            "from dpdk.org (dpdk.org [92.243.14.124])\n\tby inbox.dpdk.org (Postfix) with ESMTP id 2A9BFA051F;\n\tWed, 10 Jun 2020 16:28:09 +0200 (CEST)",
            "from [92.243.14.124] (localhost [127.0.0.1])\n\tby dpdk.org (Postfix) with ESMTP id 008C21BE91;\n\tWed, 10 Jun 2020 16:27:54 +0200 (CEST)",
            "from mail-lj1-f194.google.com (mail-lj1-f194.google.com\n [209.85.208.194]) by dpdk.org (Postfix) with ESMTP id 84A504C89\n for <dev@dpdk.org>; Wed, 10 Jun 2020 16:27:51 +0200 (CEST)",
            "by mail-lj1-f194.google.com with SMTP id e4so2753572ljn.4\n for <dev@dpdk.org>; Wed, 10 Jun 2020 07:27:51 -0700 (PDT)",
            "from localhost.localdomain (broadband-37-110-65-23.ip.moscow.rt.ru.\n [37.110.65.23])\n by smtp.gmail.com with ESMTPSA id j12sm5051733ljg.15.2020.06.10.07.27.49\n (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256);\n Wed, 10 Jun 2020 07:27:49 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025;\n h=from:to:cc:subject:date:message-id:in-reply-to:references\n :mime-version:content-transfer-encoding;\n bh=JQ10YrDs8o2QWSdAwppUEYn5u9fP5KYE/KDJYqfwLRc=;\n b=UFGIeZw9lvWwYmieq3NG7HZxkQ8ioQG88mscZpi9Sy8c8aXYO1piX9bFu+Hk1ZnNn9\n INgwtxcAZmx5yCywyPAXRDxDt06kVE1vNK18IMX5D4bwiL/JQodLWXc7X+ttg8LR6Ys8\n 2nOb+j7IqDQc7q3AGtDkWEHkmbNiXofQlv/9eUxQvKgMXC0v8UbL5pb4eLmiZ392HszM\n Y/dY3LqTJ0OlCHBpGcTTOfq7NmvNO9MpWIhexBTrXWbQPov7azuOy9o/4gK1U2wovRHf\n M6KN1X/ptl+S6cQ/ukz9zsPj7zu6sms2yaEm4aA59Oh0LQhY/xGriZ3iaRjfP+fhaVIk\n U0rg==",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n d=1e100.net; s=20161025;\n h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n :references:mime-version:content-transfer-encoding;\n bh=JQ10YrDs8o2QWSdAwppUEYn5u9fP5KYE/KDJYqfwLRc=;\n b=m19BPmm+NDF9oNOipf+f+08hb3HAm2pi18960twRyvhhtDwMcAf/GYvpNJFCIcrPM+\n PZB7G0KNyztCdPIsqV0Kllv2XCnyWr/MxMM9kvnx9PE64+JUIGpX4/HJdhstjUhU+37w\n 2vB5cm55et/JQkrfUomxJvdRTyOKczmYcwkXg1GhfBm+DbpvWxhLGZZ6/af4GjLLXerO\n s6/Txx36CvIrwybqCcw/MEI46mbF8mSdzsWRLkx7n8HOI447HausQUvusJdaI1idBnry\n 3BBGc+IY/vjCx/8aWH5TTGrpbSGWESkA7T/Ua3CLKaBkQKtucQi2cpWsXXEeI8kS0I+1\n RIng==",
        "X-Gm-Message-State": "AOAM530DVkzQxI8uFrI+28YypV0nT/KFf0wG8dG4/Uz3wG8F3n7CXUqB\n trmIC10d2v+fRBqEw6cMAgCJHrWACq+DDw==",
        "X-Google-Smtp-Source": "\n ABdhPJzTMcnRFB4BtisYzrMxqYByUqSvRHaQAxMRCcYCrWEoMsVChz96eqz8LnGt+k1YtCZARJmjZA==",
        "X-Received": "by 2002:a2e:309:: with SMTP id 9mr2017385ljd.385.1591799270534;\n Wed, 10 Jun 2020 07:27:50 -0700 (PDT)",
        "From": "Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>",
        "To": "dev@dpdk.org",
        "Cc": "Dmitry Malloy <dmitrym@microsoft.com>,\n Narcisa Ana Maria Vasile <Narcisa.Vasile@microsoft.com>,\n Fady Bader <fady@mellanox.com>, Tal Shnaiderman <talshn@mellanox.com>,\n Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>,\n Thomas Monjalon <thomas@monjalon.net>,\n Anatoly Burakov <anatoly.burakov@intel.com>,\n Bruce Richardson <bruce.richardson@intel.com>",
        "Date": "Wed, 10 Jun 2020 17:27:21 +0300",
        "Message-Id": "<20200610142730.31376-3-dmitry.kozliuk@gmail.com>",
        "X-Mailer": "git-send-email 2.25.4",
        "In-Reply-To": "<20200610142730.31376-1-dmitry.kozliuk@gmail.com>",
        "References": "<20200608074153.29611-1-dmitry.kozliuk@gmail.com>\n <20200610142730.31376-1-dmitry.kozliuk@gmail.com>",
        "MIME-Version": "1.0",
        "Content-Transfer-Encoding": "8bit",
        "Subject": "[dpdk-dev] [PATCH v8 02/11] eal: introduce internal wrappers for\n\tfile operations",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "DPDK patches and discussions <dev.dpdk.org>",
        "List-Unsubscribe": "<https://mails.dpdk.org/options/dev>,\n <mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://mails.dpdk.org/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<https://mails.dpdk.org/listinfo/dev>,\n <mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "Introduce OS-independent wrappers in order to support common EAL code\non Unix and Windows:\n\n* eal_file_open: open or create a file.\n* eal_file_lock: lock or unlock an open file.\n* eal_file_truncate: enforce a given size for an open file.\n\nImplementation for Linux and FreeBSD is placed in \"unix\" subdirectory,\nwhich is intended for common code between the two. These thin wrappers\nrequire no special maintenance.\n\nCommon code supporting multi-process doesn't use the new wrappers,\nbecause it is inherently Unix-specific and would impose excessive\nrequirements on the wrappers.\n\nSigned-off-by: Dmitry Kozlyuk <dmitry.kozliuk@gmail.com>\n---\n MAINTAINERS                                |  3 +\n lib/librte_eal/common/eal_common_fbarray.c | 31 ++++-----\n lib/librte_eal/common/eal_private.h        | 73 ++++++++++++++++++++\n lib/librte_eal/freebsd/Makefile            |  4 ++\n lib/librte_eal/linux/Makefile              |  4 ++\n lib/librte_eal/meson.build                 |  4 ++\n lib/librte_eal/unix/eal_file.c             | 80 ++++++++++++++++++++++\n lib/librte_eal/unix/meson.build            |  6 ++\n 8 files changed, 186 insertions(+), 19 deletions(-)\n create mode 100644 lib/librte_eal/unix/eal_file.c\n create mode 100644 lib/librte_eal/unix/meson.build",
    "diff": "diff --git a/MAINTAINERS b/MAINTAINERS\nindex d2b286701..1d9aff26d 100644\n--- a/MAINTAINERS\n+++ b/MAINTAINERS\n@@ -323,6 +323,9 @@ FreeBSD UIO\n M: Bruce Richardson <bruce.richardson@intel.com>\n F: kernel/freebsd/nic_uio/\n \n+Unix shared files\n+F: lib/librte_eal/unix/\n+\n Windows support\n M: Harini Ramakrishnan <harini.ramakrishnan@microsoft.com>\n M: Omar Cardona <ocardona@microsoft.com>\ndiff --git a/lib/librte_eal/common/eal_common_fbarray.c b/lib/librte_eal/common/eal_common_fbarray.c\nindex 4f8f1af73..c52ddb967 100644\n--- a/lib/librte_eal/common/eal_common_fbarray.c\n+++ b/lib/librte_eal/common/eal_common_fbarray.c\n@@ -8,8 +8,8 @@\n #include <sys/mman.h>\n #include <stdint.h>\n #include <errno.h>\n-#include <sys/file.h>\n #include <string.h>\n+#include <unistd.h>\n \n #include <rte_common.h>\n #include <rte_log.h>\n@@ -85,10 +85,8 @@ resize_and_map(int fd, void *addr, size_t len)\n \tchar path[PATH_MAX];\n \tvoid *map_addr;\n \n-\tif (ftruncate(fd, len)) {\n+\tif (eal_file_truncate(fd, len)) {\n \t\tRTE_LOG(ERR, EAL, \"Cannot truncate %s\\n\", path);\n-\t\t/* pass errno up the chain */\n-\t\trte_errno = errno;\n \t\treturn -1;\n \t}\n \n@@ -772,15 +770,15 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,\n \t\t * and see if we succeed. If we don't, someone else is using it\n \t\t * already.\n \t\t */\n-\t\tfd = open(path, O_CREAT | O_RDWR, 0600);\n+\t\tfd = eal_file_open(path, EAL_OPEN_CREATE | EAL_OPEN_READWRITE);\n \t\tif (fd < 0) {\n \t\t\tRTE_LOG(DEBUG, EAL, \"%s(): couldn't open %s: %s\\n\",\n-\t\t\t\t\t__func__, path, strerror(errno));\n-\t\t\trte_errno = errno;\n+\t\t\t\t__func__, path, rte_strerror(rte_errno));\n \t\t\tgoto fail;\n-\t\t} else if (flock(fd, LOCK_EX | LOCK_NB)) {\n+\t\t} else if (eal_file_lock(\n+\t\t\t\tfd, EAL_FLOCK_EXCLUSIVE, EAL_FLOCK_RETURN)) {\n \t\t\tRTE_LOG(DEBUG, EAL, \"%s(): couldn't lock %s: %s\\n\",\n-\t\t\t\t\t__func__, path, strerror(errno));\n+\t\t\t\t__func__, path, rte_strerror(rte_errno));\n \t\t\trte_errno = EBUSY;\n \t\t\tgoto fail;\n \t\t}\n@@ -789,10 +787,8 @@ rte_fbarray_init(struct rte_fbarray *arr, const char *name, unsigned int len,\n \t\t * still attach to it, but no other process could reinitialize\n \t\t * it.\n \t\t */\n-\t\tif (flock(fd, LOCK_SH | LOCK_NB)) {\n-\t\t\trte_errno = errno;\n+\t\tif (eal_file_lock(fd, EAL_FLOCK_SHARED, EAL_FLOCK_RETURN))\n \t\t\tgoto fail;\n-\t\t}\n \n \t\tif (resize_and_map(fd, data, mmap_len))\n \t\t\tgoto fail;\n@@ -888,17 +884,14 @@ rte_fbarray_attach(struct rte_fbarray *arr)\n \n \teal_get_fbarray_path(path, sizeof(path), arr->name);\n \n-\tfd = open(path, O_RDWR);\n+\tfd = eal_file_open(path, EAL_OPEN_READWRITE);\n \tif (fd < 0) {\n-\t\trte_errno = errno;\n \t\tgoto fail;\n \t}\n \n \t/* lock the file, to let others know we're using it */\n-\tif (flock(fd, LOCK_SH | LOCK_NB)) {\n-\t\trte_errno = errno;\n+\tif (eal_file_lock(fd, EAL_FLOCK_SHARED, EAL_FLOCK_RETURN))\n \t\tgoto fail;\n-\t}\n \n \tif (resize_and_map(fd, data, mmap_len))\n \t\tgoto fail;\n@@ -1025,7 +1018,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)\n \t\t * has been detached by all other processes\n \t\t */\n \t\tfd = tmp->fd;\n-\t\tif (flock(fd, LOCK_EX | LOCK_NB)) {\n+\t\tif (eal_file_lock(fd, EAL_FLOCK_EXCLUSIVE, EAL_FLOCK_RETURN)) {\n \t\t\tRTE_LOG(DEBUG, EAL, \"Cannot destroy fbarray - another process is using it\\n\");\n \t\t\trte_errno = EBUSY;\n \t\t\tret = -1;\n@@ -1042,7 +1035,7 @@ rte_fbarray_destroy(struct rte_fbarray *arr)\n \t\t\t * we're still holding an exclusive lock, so drop it to\n \t\t\t * shared.\n \t\t\t */\n-\t\t\tflock(fd, LOCK_SH | LOCK_NB);\n+\t\t\teal_file_lock(fd, EAL_FLOCK_SHARED, EAL_FLOCK_RETURN);\n \n \t\t\tret = -1;\n \t\t\tgoto out;\ndiff --git a/lib/librte_eal/common/eal_private.h b/lib/librte_eal/common/eal_private.h\nindex 869ce183a..6733a2321 100644\n--- a/lib/librte_eal/common/eal_private.h\n+++ b/lib/librte_eal/common/eal_private.h\n@@ -420,4 +420,77 @@ eal_malloc_no_trace(const char *type, size_t size, unsigned int align);\n \n void eal_free_no_trace(void *addr);\n \n+/** Options for eal_file_open(). */\n+enum eal_open_flags {\n+\t/** Open file for reading. */\n+\tEAL_OPEN_READONLY = 0x00,\n+\t/** Open file for reading and writing. */\n+\tEAL_OPEN_READWRITE = 0x02,\n+\t/**\n+\t * Create the file if it doesn't exist.\n+\t * New files are only accessible to the owner (0600 equivalent).\n+\t */\n+\tEAL_OPEN_CREATE = 0x04\n+};\n+\n+/**\n+ * Open or create a file.\n+ *\n+ * @param path\n+ *  Path to the file.\n+ * @param flags\n+ *  A combination of eal_open_flags controlling operation and FD behavior.\n+ * @return\n+ *  Open file descriptor on success, (-1) on failure and rte_errno is set.\n+ */\n+int\n+eal_file_open(const char *path, int flags);\n+\n+/** File locking operation. */\n+enum eal_flock_op {\n+\tEAL_FLOCK_SHARED,    /**< Acquire a shared lock. */\n+\tEAL_FLOCK_EXCLUSIVE, /**< Acquire an exclusive lock. */\n+\tEAL_FLOCK_UNLOCK     /**< Release a previously taken lock. */\n+};\n+\n+/** Behavior on file locking conflict. */\n+enum eal_flock_mode {\n+\tEAL_FLOCK_WAIT,  /**< Wait until the file gets unlocked to lock it. */\n+\tEAL_FLOCK_RETURN /**< Return immediately if the file is locked. */\n+};\n+\n+/**\n+ * Lock or unlock the file.\n+ *\n+ * On failure @code rte_errno @endcode is set to the error code\n+ * specified by POSIX flock(3) description.\n+ *\n+ * @param fd\n+ *  Opened file descriptor.\n+ * @param op\n+ *  Operation to perform.\n+ * @param mode\n+ *  Behavior on conflict.\n+ * @return\n+ *  0 on success, (-1) on failure.\n+ */\n+int\n+eal_file_lock(int fd, enum eal_flock_op op, enum eal_flock_mode mode);\n+\n+/**\n+ * Truncate or extend the file to the specified size.\n+ *\n+ * On failure @code rte_errno @endcode is set to the error code\n+ * specified by POSIX ftruncate(3) description.\n+ *\n+ * @param fd\n+ *  Opened file descriptor.\n+ * @param size\n+ *  Desired file size.\n+ * @return\n+ *  0 on success, (-1) on failure.\n+ */\n+int\n+eal_file_truncate(int fd, ssize_t size);\n+\n #endif /* _EAL_PRIVATE_H_ */\ndiff --git a/lib/librte_eal/freebsd/Makefile b/lib/librte_eal/freebsd/Makefile\nindex af95386d4..0f8741d96 100644\n--- a/lib/librte_eal/freebsd/Makefile\n+++ b/lib/librte_eal/freebsd/Makefile\n@@ -7,6 +7,7 @@ LIB = librte_eal.a\n \n ARCH_DIR ?= $(RTE_ARCH)\n VPATH += $(RTE_SDK)/lib/librte_eal/$(ARCH_DIR)\n+VPATH += $(RTE_SDK)/lib/librte_eal/unix\n VPATH += $(RTE_SDK)/lib/librte_eal/common\n \n CFLAGS += -I$(SRCDIR)/include\n@@ -74,6 +75,9 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += rte_service.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += rte_random.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += rte_reciprocal.c\n \n+# from unix dir\n+SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += eal_file.c\n+\n # from arch dir\n SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += rte_cpuflags.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_FREEBSD) += rte_hypervisor.c\ndiff --git a/lib/librte_eal/linux/Makefile b/lib/librte_eal/linux/Makefile\nindex 48cc34844..331489f99 100644\n--- a/lib/librte_eal/linux/Makefile\n+++ b/lib/librte_eal/linux/Makefile\n@@ -7,6 +7,7 @@ LIB = librte_eal.a\n \n ARCH_DIR ?= $(RTE_ARCH)\n VPATH += $(RTE_SDK)/lib/librte_eal/$(ARCH_DIR)\n+VPATH += $(RTE_SDK)/lib/librte_eal/unix\n VPATH += $(RTE_SDK)/lib/librte_eal/common\n \n CFLAGS += -I$(SRCDIR)/include\n@@ -81,6 +82,9 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += rte_service.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += rte_random.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += rte_reciprocal.c\n \n+# from unix dir\n+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += eal_file.c\n+\n # from arch dir\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += rte_cpuflags.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUX) += rte_hypervisor.c\ndiff --git a/lib/librte_eal/meson.build b/lib/librte_eal/meson.build\nindex e301f4558..8d492897d 100644\n--- a/lib/librte_eal/meson.build\n+++ b/lib/librte_eal/meson.build\n@@ -6,6 +6,10 @@ subdir('include')\n \n subdir('common')\n \n+if not is_windows\n+\tsubdir('unix')\n+endif\n+\n dpdk_conf.set('RTE_EXEC_ENV_' + exec_env.to_upper(), 1)\n subdir(exec_env)\n \ndiff --git a/lib/librte_eal/unix/eal_file.c b/lib/librte_eal/unix/eal_file.c\nnew file mode 100644\nindex 000000000..1b26475ba\n--- /dev/null\n+++ b/lib/librte_eal/unix/eal_file.c\n@@ -0,0 +1,80 @@\n+/* SPDX-License-Identifier: BSD-3-Clause\n+ * Copyright(c) 2020 Dmitry Kozlyuk\n+ */\n+\n+#include <sys/file.h>\n+#include <sys/mman.h>\n+#include <unistd.h>\n+\n+#include <rte_errno.h>\n+\n+#include \"eal_private.h\"\n+\n+int\n+eal_file_open(const char *path, int flags)\n+{\n+\tstatic const int MODE_MASK = EAL_OPEN_READONLY | EAL_OPEN_READWRITE;\n+\n+\tint ret, sys_flags;\n+\n+\tswitch (flags & MODE_MASK) {\n+\tcase EAL_OPEN_READONLY:\n+\t\tsys_flags = O_RDONLY;\n+\t\tbreak;\n+\tcase EAL_OPEN_READWRITE:\n+\t\tsys_flags = O_RDWR;\n+\t\tbreak;\n+\tdefault:\n+\t\trte_errno = ENOTSUP;\n+\t\treturn -1;\n+\t}\n+\n+\tif (flags & EAL_OPEN_CREATE)\n+\t\tsys_flags |= O_CREAT;\n+\n+\tret = open(path, sys_flags, 0600);\n+\tif (ret < 0)\n+\t\trte_errno = errno;\n+\n+\treturn ret;\n+}\n+\n+int\n+eal_file_truncate(int fd, ssize_t size)\n+{\n+\tint ret;\n+\n+\tret = ftruncate(fd, size);\n+\tif (ret)\n+\t\trte_errno = errno;\n+\n+\treturn ret;\n+}\n+\n+int\n+eal_file_lock(int fd, enum eal_flock_op op, enum eal_flock_mode mode)\n+{\n+\tint sys_flags = 0;\n+\tint ret;\n+\n+\tif (mode == EAL_FLOCK_RETURN)\n+\t\tsys_flags |= LOCK_NB;\n+\n+\tswitch (op) {\n+\tcase EAL_FLOCK_EXCLUSIVE:\n+\t\tsys_flags |= LOCK_EX;\n+\t\tbreak;\n+\tcase EAL_FLOCK_SHARED:\n+\t\tsys_flags |= LOCK_SH;\n+\t\tbreak;\n+\tcase EAL_FLOCK_UNLOCK:\n+\t\tsys_flags |= LOCK_UN;\n+\t\tbreak;\n+\t}\n+\n+\tret = flock(fd, sys_flags);\n+\tif (ret)\n+\t\trte_errno = errno;\n+\n+\treturn ret;\n+}\ndiff --git a/lib/librte_eal/unix/meson.build b/lib/librte_eal/unix/meson.build\nnew file mode 100644\nindex 000000000..21029ba1a\n--- /dev/null\n+++ b/lib/librte_eal/unix/meson.build\n@@ -0,0 +1,6 @@\n+# SPDX-License-Identifier: BSD-3-Clause\n+# Copyright(c) 2020 Dmitry Kozlyuk\n+\n+sources += files(\n+\t'eal_file.c',\n+)\n",
    "prefixes": [
        "v8",
        "02/11"
    ]
}