get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 10329,
    "url": "http://patches.dpdk.org/api/patches/10329/?format=api",
    "web_url": "http://patches.dpdk.org/project/dpdk/patch/1454422283-14025-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": "<1454422283-14025-1-git-send-email-harry.van.haaren@intel.com>",
    "list_archive_url": "https://inbox.dpdk.org/dev/1454422283-14025-1-git-send-email-harry.van.haaren@intel.com",
    "date": "2016-02-02T14:11:23",
    "name": "[dpdk-dev,v3] eal: add function to check if primary proc alive",
    "commit_ref": null,
    "pull_url": null,
    "state": "superseded",
    "archived": true,
    "hash": "41763bc0416966ec20cf790032c29b9585e71c27",
    "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/1454422283-14025-1-git-send-email-harry.van.haaren@intel.com/mbox/",
    "series": [],
    "comments": "http://patches.dpdk.org/api/patches/10329/comments/",
    "check": "pending",
    "checks": "http://patches.dpdk.org/api/patches/10329/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 AC4FE95CC;\n\tTue,  2 Feb 2016 15:11:41 +0100 (CET)",
            "from mga11.intel.com (mga11.intel.com [192.55.52.93])\n\tby dpdk.org (Postfix) with ESMTP id 9C0298D28\n\tfor <dev@dpdk.org>; Tue,  2 Feb 2016 15:11:39 +0100 (CET)",
            "from orsmga001.jf.intel.com ([10.7.209.18])\n\tby fmsmga102.fm.intel.com with ESMTP; 02 Feb 2016 06:11:39 -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; 02 Feb 2016 06:11:37 -0800"
        ],
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.22,384,1449561600\"; d=\"scan'208\";a=\"875126506\"",
        "From": "Harry van Haaren <harry.van.haaren@intel.com>",
        "To": "david.marchand@6wind.com",
        "Date": "Tue,  2 Feb 2016 14:11:23 +0000",
        "Message-Id": "<1454422283-14025-1-git-send-email-harry.van.haaren@intel.com>",
        "X-Mailer": "git-send-email 2.5.0",
        "In-Reply-To": "<1453890706-24003-1-git-send-email-harry.van.haaren@intel.com>",
        "References": "<1453890706-24003-1-git-send-email-harry.van.haaren@intel.com>",
        "Cc": "dev@dpdk.org",
        "Subject": "[dpdk-dev] [PATCH v3] 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>\n---\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_2_3.rst            |  7 +++\n lib/librte_eal/bsdapp/eal/Makefile              |  1 +\n lib/librte_eal/bsdapp/eal/rte_eal_version.map   |  8 ++++\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 |  7 +++\n 8 files changed, 108 insertions(+), 5 deletions(-)\n create mode 100644 lib/librte_eal/common/eal_common_proc.c",
    "diff": "diff --git a/doc/guides/rel_notes/release_2_3.rst b/doc/guides/rel_notes/release_2_3.rst\nindex 99de186..14b5b06 100644\n--- a/doc/guides/rel_notes/release_2_3.rst\n+++ b/doc/guides/rel_notes/release_2_3.rst\n@@ -11,6 +11,13 @@ Resolved Issues\n EAL\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 ~~~~~~~\ndiff --git a/lib/librte_eal/bsdapp/eal/Makefile b/lib/librte_eal/bsdapp/eal/Makefile\nindex 65b293f..2d6e3b1 100644\n--- a/lib/librte_eal/bsdapp/eal/Makefile\n+++ b/lib/librte_eal/bsdapp/eal/Makefile\n@@ -61,6 +61,7 @@ SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_alarm.c\n \n # from common dir\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_lcore.c\n+SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_proc.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_timer.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_memzone.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_BSDAPP) += eal_common_log.c\ndiff --git a/lib/librte_eal/bsdapp/eal/rte_eal_version.map b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\nindex 9d7adf1..0e28017 100644\n--- a/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/bsdapp/eal/rte_eal_version.map\n@@ -135,3 +135,11 @@ DPDK_2.2 {\n \trte_xen_dom0_supported;\n \n } DPDK_2.1;\n+\n+\n+DPDK_2.3 {\n+       global:\n+\n+       rte_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 d2816a8..67a0324 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 one.\n+ *  - If dead, returns zero.\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 26eced5..b3700da 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@@ -71,6 +71,7 @@ endif\n \n # from common dir\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_lcore.c\n+SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_proc.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_timer.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_memzone.c\n SRCS-$(CONFIG_RTE_LIBRTE_EAL_LINUXAPP) += eal_common_log.c\ndiff --git a/lib/librte_eal/linuxapp/eal/eal.c b/lib/librte_eal/linuxapp/eal/eal.c\nindex 635ec36..efa1121 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@@ -818,8 +818,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@@ -877,6 +875,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 cbe175f..7a8c530 100644\n--- a/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n+++ b/lib/librte_eal/linuxapp/eal/rte_eal_version.map\n@@ -138,3 +138,10 @@ DPDK_2.2 {\n \trte_xen_dom0_supported;\n \n } DPDK_2.1;\n+\n+DPDK_2.3 {\n+\tglobal:\n+\n+\trte_eal_primary_proc_alive;\n+\n+} DPDK_2.2;\n",
    "prefixes": [
        "dpdk-dev",
        "v3"
    ]
}