get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 11139,
    "url": "http://patches.dpdk.org/api/patches/11139/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1457350669-32582-1-git-send-email-harry.van.haaren@intel.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": "<1457350669-32582-1-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1457350669-32582-1-git-send-email-harry.van.haaren@intel.com",
    "date": "2016-03-07T11:37:49",
    "name": "[dpdk-dev,v5] eal: add function to check if primary proc alive",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "216201ea99147748437b6f697eec496147bd967e",
    "submitter": {
        "id": 317,
        "url": "http://patches.dpdk.org/api/people/317/?format=api",
        "name": "Van Haaren, Harry",
        "email": "harry.van.haaren@intel.com"
    },
    "delegate": null,
    "mbox": "http://patches.dpdk.org/project/dpdk/patch/1457350669-32582-1-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/11139/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/11139/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 DBB2929C7;\n\tMon,  7 Mar 2016 12:37:58 +0100 (CET)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n\tby dpdk.org (Postfix) with ESMTP id AC1492986\n\tfor <dev@dpdk.org>; Mon,  7 Mar 2016 12:37:57 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby orsmga103.jf.intel.com with ESMTP; 07 Mar 2016 03:37:56 -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; 07 Mar 2016 03:37:53 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.22,551,1449561600\"; d=\"scan'208\";a=\"903801544\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "dev@dpdk.org",
        "Date": "Mon,  7 Mar 2016 11:37:49 +0000",
        "Message-Id": "<1457350669-32582-1-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.5.0",
        "In-Reply-To": "<1456236612-30021-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1456236612-30021-1-git-send-email-harry.van.haaren@intel.com>",
        "Subject": "[dpdk-dev] [PATCH v5] eal: add function to check if primary proc\n\talive",
        "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\nThe RTE_MAGIC number is written to the shared config by the\nprimary process, this is the signal to the secondary process\nthat the EAL is set up, and ready to be used. The function\nrte_eal_mcfg_complete() writes RTE_MAGIC. This has been\ndelayed in the EAL init proceedure, as the PCI probing in\nthe primary process can interfere with the secondary running.\n\nSigned-off-by: Harry van Haaren <harry.van.haaren@intel.com>\nAcked-by: Maryam Tahhan <maryam.tahhan@intel.com>\n\n---\n\nv5:\n- Renamed returns in doc from words to digits\n- Fixed line spacing in docs\n- Fixed line spacing in EAL header\n- Rebased to master (Makefile conflicts)\n\nv4:\n- Rebased to git head (2.3 -> 16.04 changes)\n\nv3:\n- Fixed Copyright years\n\nv2:\n- Passing NULL as const char* uses default /var/run/.rte_config\n- Moved code into /common/ instead of /linuxapp/, should work on BSD now\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/eal.c               |  6 +--\n lib/librte_eal/linuxapp/eal/rte_eal_version.map |  1 +\n 8 files changed, 96 insertions(+), 5 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..c598891\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 2016 Intel Shannon Ltd. 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/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex ceac435..364f303 100644\n--- a/lib/librte_eal/linuxapp/eal/eal.c\n+++ b/lib/librte_eal/linuxapp/eal/eal.c\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  *   Copyright(c) 2012-2014 6WIND S.A.\n  *   All rights reserved.\n  *\n@@ -821,8 +821,6 @@ rte_eal_init(int argc, char **argv)\n \n \teal_check_mem_on_local_socket();\n \n-\trte_eal_mcfg_complete();\n-\n \tif (eal_plugins_init() < 0)\n \t\trte_panic(\"Cannot init plugins\\n\");\n \n@@ -880,6 +878,8 @@ rte_eal_init(int argc, char **argv)\n \tif (rte_eal_pci_probe())\n \t\trte_panic(\"Cannot probe PCI\\n\");\n \n+\trte_eal_mcfg_complete();\n+\n \treturn fctret;\n }\n \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",
        "v5"
    ]
}