From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from alln-iport-5.cisco.com (alln-iport-5.cisco.com [173.37.142.92]) by dpdk.org (Postfix) with ESMTP id 50DA45A69 for ; Wed, 25 Nov 2015 14:51:41 +0100 (CET) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=cisco.com; i=@cisco.com; l=3918; q=dns/txt; s=iport; t=1448459501; x=1449669101; h=subject:to:references:from:message-id:date:mime-version: in-reply-to; bh=g0304yErDFYBZsutpEhmtSvtodeg8QKa9JUL589UmTA=; b=JqLua6Lzbuv5DAqZ+mccUqC88mW6lcOFHZwMg07Troe3UkdkuDdx6oPE puGyMpNTL6iaskTkLI3wYvQijiiil3//X/kc6sIwuH/bFZWmfedLW3tCy kjaCvad4OcR2dIvI2BIJtPim6E5ozYY+yY5OFRcCEUCKXaypJ8EWY3oyg s=; X-IronPort-Anti-Spam-Filtered: true X-IronPort-Anti-Spam-Result: =?us-ascii?q?A0D0AQDxu1VW/49dJa1egzu9aYIaAQ2BZ?= =?us-ascii?q?oYPAoFBOBQBAQEBAQEBgQqENQEBBCNVEQsEHRYLAgIJAwIBAgFFBgEMCAEBiCq?= =?us-ascii?q?tTpA0AQEBAQEBAQECAQEBAQEBAQEbhlSEfoFAAYY0gUQFjSJ2iD8BjTSJIIYQj?= =?us-ascii?q?S4fAQFCgh4mgV4ghWABAQE?= X-IronPort-AV: E=Sophos;i="5.20,342,1444694400"; d="scan'208,217";a="211847388" Received: from rcdn-core-7.cisco.com ([173.37.93.143]) by alln-iport-5.cisco.com with ESMTP/TLS/DHE-RSA-AES256-GCM-SHA384; 25 Nov 2015 13:51:39 +0000 Received: from [10.116.86.170] (rtp-rmelton-8819.cisco.com [10.116.86.170]) by rcdn-core-7.cisco.com (8.14.5/8.14.5) with ESMTP id tAPDpd1Z008295; Wed, 25 Nov 2015 13:51:39 GMT To: Ferruh Yigit , dev@dpdk.org References: <20151124184755.GA26521@sivlogin002.ir.intel.com> <1448450035-23991-1-git-send-email-ferruh.yigit@intel.com> From: "Roger B. Melton" Message-ID: <5655BCE7.2060206@cisco.com> Date: Wed, 25 Nov 2015 08:51:35 -0500 User-Agent: Mozilla/5.0 (Macintosh; Intel Mac OS X 10.9; rv:38.0) Gecko/20100101 Thunderbird/38.3.0 MIME-Version: 1.0 In-Reply-To: <1448450035-23991-1-git-send-email-ferruh.yigit@intel.com> Content-Type: text/plain; charset=utf-8; format=flowed Content-Transfer-Encoding: 7bit X-Content-Filtered-By: Mailman/MimeDel 2.1.15 Subject: Re: [dpdk-dev] [PATCH v2] eal: fix compile error for old glibc caused by pthread_setname_np() X-BeenThere: dev@dpdk.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: patches and discussions about DPDK List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 25 Nov 2015 13:51:41 -0000 > +/** > + * Set thread names. > + * > + * Macro to wrap `pthread_setname_np()` with a glibc version check. > + * Only glibc >= 2.12 supports this feature. > + * > + * This macro only used for Linux, BSD does direct libc call. > + * BSD libc version of function is `pthread_set_name_np()`. > + */ > +#if defined(__DOXYGEN__) > +#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__) > +#endif > + > +#if defined(__GLIBC__) && defined(__GLIBC_PREREQ) > +#if __GLIBC_PREREQ(2, 12) > +#define rte_thread_setname(...) pthread_setname_np(__VA_ARGS__) > +#else > +#define rte_thread_setname(...) 0 > +#endif > +#endif Have you thought about a way to set thread name when glibc < 2.12. I also ran into the problem recently and played around with prctl() (Linux) to set thread (process) name. e.g. ret = prctl(PR_SET_NAME,,0,0,0); There are 2 issues I think: 1) The semantics are different than prthread_setname_np(). With pthread_setname_np() a name can be assigned to any thread, with prctl() the name is assigned to the active thread. That would mean that rather than rte_eal_init(), rte_eal_intr_init() could not assign thread names. Rather the threads would have to name themselves. 2) I think BSD lacks prctl(), but some (not all?) BSD implementations have setproctitle() to do the same thing. It might be too late for 2.2, but something to think about for the future. Regards, Roger