get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 11289,
    "url": "https://patches.dpdk.org/api/patches/11289/?format=api",
    "web_url": "https://patches.dpdk.org/project/dpdk/patch/1457530645-14776-3-git-send-email-harry.van.haaren@intel.com/",
    "project": {
        "id": 1,
        "url": "https://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": "<1457530645-14776-3-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1457530645-14776-3-git-send-email-harry.van.haaren@intel.com",
    "date": "2016-03-09T13:37:25",
    "name": "[dpdk-dev,v9,2/2] eal: add function to check if primary proc alive",
    "commit_ref": null,
    "pull_url": null,
    "state": "accepted",
    "archived": true,
    "hash": "8b1ebfca6d05276d996f131ad912fa539fc86adc",
    "submitter": {
        "id": 317,
        "url": "https://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": null,
    "mbox": "https://patches.dpdk.org/project/dpdk/patch/1457530645-14776-3-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "https://patches.dpdk.org/api/patches/11289/comments/",
    "check": "pending",
    "checks": "https://patches.dpdk.org/api/patches/11289/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<dev-bounces@dpdk.org>",
        "X-Original-To": "patchwork@dpdk.org",
        "Delivered-To": "patchwork@dpdk.org",
        "Received": [
            "from [92.243.14.124] (localhost [IPv6:::1])\n\tby dpdk.org (Postfix) with ESMTP id 1C1892E41;\n\tWed,  9 Mar 2016 14:37:43 +0100 (CET)",
            "from mga04.intel.com (mga04.intel.com [192.55.52.120])\n\tby dpdk.org (Postfix) with ESMTP id D030E2C5F\n\tfor <dev@dpdk.org>; Wed,  9 Mar 2016 14:37:38 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga104.fm.intel.com with ESMTP; 09 Mar 2016 05:37:38 -0800",
            "from sie-lab-212-120.ir.intel.com (HELO\n\tsilpixa00394367.ir.intel.com) ([10.237.212.120])\n\tby orsmga001.jf.intel.com with ESMTP; 09 Mar 2016 05:37:37 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.24,311,1455004800\"; d=\"scan'208\";a=\"906018658\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "david.marchand@6wind.com",
        "Date": "Wed,  9 Mar 2016 13:37:25 +0000",
        "Message-Id": "<1457530645-14776-3-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.5.0",
        "In-Reply-To": "<1457530645-14776-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1457518362-32762-1-git-send-email-harry.van.haaren@intel.com>\n\t<1457530645-14776-1-git-send-email-harry.van.haaren@intel.com>",
        "Cc": "dev@dpdk.org",
        "Subject": "[dpdk-dev] [PATCH v9 2/2] eal: add function to check if primary\n\tproc alive",
        "X-BeenThere": "dev@dpdk.org",
        "X-Mailman-Version": "2.1.15",
        "Precedence": "list",
        "List-Id": "patches and discussions about DPDK <dev.dpdk.org>",
        "List-Unsubscribe": "<http://dpdk.org/ml/options/dev>,\n\t<mailto:dev-request@dpdk.org?subject=unsubscribe>",
        "List-Archive": "<http://dpdk.org/ml/archives/dev/>",
        "List-Post": "<mailto:dev@dpdk.org>",
        "List-Help": "<mailto:dev-request@dpdk.org?subject=help>",
        "List-Subscribe": "<http://dpdk.org/ml/listinfo/dev>,\n\t<mailto:dev-request@dpdk.org?subject=subscribe>",
        "Errors-To": "dev-bounces@dpdk.org",
        "Sender": "\"dev\" <dev-bounces@dpdk.org>"
    },
    "content": "This patch adds a new function to the EAL API:\nint rte_eal_primary_proc_alive(const char *path);\n\nThe function indicates if a primary process is alive right now.\nThis functionality is implemented by testing for a write-\nlock on the config file, and the function tests for a lock.\n\nThe use case for this functionality is that a secondary\nprocess can wait until a primary process starts by polling\nthe function and waiting. When the primary is running, the\nsecondary continues to poll to detect if the primary process\nhas quit unexpectedly, the secondary process can detect this.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\nAcked-by: Maryam Tahhan <maryam.tahhan@intel.com>\n---\n doc/guides/rel_notes/release_16_04.rst          |  8 ++++\n lib/librte_eal/bsdapp/eal/Makefile              |  1 +\n lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  1 +\n lib/librte_eal/common/eal_common_proc.c         | 61 +++++++++++++++++++++++++\n lib/librte_eal/common/include/rte_eal.h         | 20 +++++++-\n lib/librte_eal/linuxapp/eal/Makefile            |  3 +-\n lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +\n 7 files changed, 93 insertions(+), 2 deletions(-)\n create mode 100644 lib/librte_eal/common/eal_common_proc.c",
    "diff": "diff --git a/doc/guides/rel_notes/release_16_04.rst b/doc/guides/rel_notes/release_16_04.rst\nindex 24f15bf..7d5000f 100644\n--- a/doc/guides/rel_notes/release_16_04.rst\n+++ b/doc/guides/rel_notes/release_16_04.rst\n@@ -74,6 +74,14 @@ EAL\n ~~~\n \n \n+* **Added rte_eal_primary_proc_alive() function**\n+\n+  A new function ``rte_eal_primary_proc_alive()`` has been added\n+  to allow the user to detect if a primary process is running.\n+  Use cases for this feature include fault detection, and monitoring\n+  using secondary processes.\n+\n+\n Drivers\n ~~~~~~~\n \ndiff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile\nindex 9015516..9ecf429 100644\n--- a/lib/librte_eal/bsdapp/eal/Makefile\n+++ b/lib/librte_eal/bsdapp/eal/Makefile\n@@ -79,6 +79,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_devargs.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_dev.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_options.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_thread.c\n+SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += eal_common_proc.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += rte_malloc.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_elem.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_BSDAPP) += malloc_heap.c\ndiff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\nindex 0c24223..58c2951 100644\n--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n@@ -148,5 +148,6 @@ DPDK_16.04 {\n \trte_eal_pci_ioport_write;\n \trte_eal_pci_map_device;\n \trte_eal_pci_unmap_device;\n+\trte_eal_primary_proc_alive;\n \n } DPDK_2.2;\ndiff --git a/lib/librte_eal/common/eal_common_proc.c b/lib/librte_eal/common/eal_common_proc.c\nnew file mode 100644\nindex 0000000..12e0fca\n--- /dev/null\n+++ b/lib/librte_eal/common/eal_common_proc.c\n@@ -0,0 +1,61 @@\n+/*-\n+ *   BSD LICENSE\n+ *\n+ *   Copyright(c) 2016 Intel Corporation. All rights reserved.\n+ *\n+ *   Redistribution and use in source and binary forms, with or without\n+ *   modification, are permitted provided that the following conditions\n+ *   are met:\n+ *\n+ *     * Redistributions of source code must retain the above copyright\n+ *       notice, this list of conditions and the following disclaimer.\n+ *     * Redistributions in binary form must reproduce the above copyright\n+ *       notice, this list of conditions and the following disclaimer in\n+ *       the documentation and/or other materials provided with the\n+ *       distribution.\n+ *     * Neither the name of Intel Corporation nor the names of its\n+ *       contributors may be used to endorse or promote products derived\n+ *       from this software without specific prior written permission.\n+ *\n+ *   THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS\n+ *   \"AS IS\" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT\n+ *   LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR\n+ *   A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT\n+ *   OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,\n+ *   SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT\n+ *   LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,\n+ *   DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY\n+ *   THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT\n+ *   (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE\n+ *   OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.\n+ */\n+\n+#include <stdio.h>\n+#include <fcntl.h>\n+#include <stdlib.h>\n+#include <rte_eal.h>\n+\n+#include \"eal_filesystem.h\"\n+#include \"eal_internal_cfg.h\"\n+\n+int\n+rte_eal_primary_proc_alive(const char *config_file_path)\n+{\n+\tint config_fd;\n+\n+\tif (config_file_path)\n+\t\tconfig_fd = open(config_file_path, O_RDONLY);\n+\telse {\n+\t\tchar default_path[PATH_MAX+1];\n+\t\tsnprintf(default_path, PATH_MAX, RUNTIME_CONFIG_FMT,\n+\t\t\t default_config_dir, \"rte\");\n+\t\tconfig_fd = open(default_path, O_RDONLY);\n+\t}\n+\tif (config_fd < 0)\n+\t\treturn 0;\n+\n+\tint ret = lockf(config_fd, F_TEST, 0);\n+\tclose(config_fd);\n+\n+\treturn !!ret;\n+}\ndiff --git a/lib/librte_eal/common/include/rte_eal.h b/lib/librte_eal/common/include/rte_eal.h\nindex 0e99c31..a71d6f5 100644\n--- a/lib/librte_eal/common/include/rte_eal.h\n+++ b/lib/librte_eal/common/include/rte_eal.h\n@@ -1,7 +1,7 @@\n /*-\n  *   BSD LICENSE\n  *\n- *   Copyright(c) 2010-2014 Intel Corporation. All rights reserved.\n+ *   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n  *   All rights reserved.\n  *\n  *   Redistribution and use in source and binary forms, with or without\n@@ -156,6 +156,24 @@ int rte_eal_iopl_init(void);\n  *   - On failure, a negative error value.\n  */\n int rte_eal_init(int argc, char **argv);\n+\n+/**\n+ * Check if a primary process is currently alive\n+ *\n+ * This function returns true when a primary process is currently\n+ * active.\n+ *\n+ * @param config_file_path\n+ *   The config_file_path argument provided should point at the location\n+ *   that the primary process will create its config file. If NULL, the default\n+ *   config file path is used.\n+ *\n+ * @return\n+ *  - If alive, returns 1.\n+ *  - If dead, returns 0.\n+ */\n+int rte_eal_primary_proc_alive(const char *config_file_path);\n+\n /**\n  * Usage function typedef used by the application usage function.\n  *\ndiff --git a/lib/librte_eal/linuxapp/eal/Makefile b/lib/librte_eal/linuxapp/eal/Makefile\nindex c5490e4..d72f035 100644\n--- a/lib/librte_eal/linuxapp/eal/Makefile\n+++ b/lib/librte_eal/linuxapp/eal/Makefile\n@@ -1,6 +1,6 @@\n #   BSD LICENSE\n #\n-#   Copyright(c) 2010-2015 Intel Corporation. All rights reserved.\n+#   Copyright(c) 2010-2016 Intel Corporation. All rights reserved.\n #   All rights reserved.\n #\n #   Redistribution and use in source and binary forms, with or without\n@@ -89,6 +89,7 @@ SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_devargs.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_dev.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_options.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_thread.c\n+SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += eal_common_proc.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += rte_malloc.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_elem.c\n SRCS-$(CONFIG_RTE_EXEC_ENV_LINUXAPP) += malloc_heap.c\ndiff --git a/lib/librte_eal/linuxapp/eal/rte_eal_version.map b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\nindex 4aa9de7..12503ef 100644\n--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n@@ -151,5 +151,6 @@ DPDK_16.04 {\n \trte_eal_pci_ioport_write;\n \trte_eal_pci_map_device;\n \trte_eal_pci_unmap_device;\n+\trte_eal_primary_proc_alive;\n \n } DPDK_2.2;\n",
    "prefixes": [
        "dpdk-dev",
        "v9",
        "2/2"
    ]
}