From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.2 (2018-09-13) on dcvr.yhbt.net X-Spam-Level: X-Spam-ASN: AS22989 209.51.188.0/24 X-Spam-Status: No, score=-3.1 required=3.0 tests=AWL,BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,FREEMAIL_FORGED_FROMDOMAIN,FREEMAIL_FROM, HEADER_FROM_DIFFERENT_DOMAINS,HTML_MESSAGE,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI,SPF_HELO_PASS,SPF_PASS shortcircuit=no autolearn=ham autolearn_force=no version=3.4.2 Received: from lists.gnu.org (lists.gnu.org [209.51.188.17]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dcvr.yhbt.net (Postfix) with ESMTPS id C95681F8C6 for ; Tue, 6 Jul 2021 11:33:14 +0000 (UTC) Received: from localhost ([::1]:52028 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1m0jKD-0002rB-NK for normalperson@yhbt.net; Tue, 06 Jul 2021 07:33:13 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]:60720) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0jCR-0005gX-Pn for bug-gnulib@gnu.org; Tue, 06 Jul 2021 07:25:11 -0400 Received: from mail-mw2nam12olkn2019.outbound.protection.outlook.com ([40.92.23.19]:23472 helo=NAM12-MW2-obe.outbound.protection.outlook.com) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1m0jCO-0001H9-Qu for bug-gnulib@gnu.org; Tue, 06 Jul 2021 07:25:11 -0400 ARC-Seal: i=1; a=rsa-sha256; s=arcselector9901; d=microsoft.com; cv=none; b=B04C+JWYs77IjrEQma7uegaFO0EAAwx0xLO3pzqCU6F0yC2QwkwTkIx7w0UFEbPtMaR09JzRP6JBLuYZYCnSyVhHqtTDnZJLdKqFygNPfK4opcoZiQdwULdty8KOQ5zo40srnvz80uURwL6b+jcS7HsNslhk0k3qzhKB6xZU+wnibCPFGP0NDZXZR+HnAO5bwVEF+Z7yjJ8Xn24idXhuVyhG7W0PD1JsyAc5P8IpxphB8qYNNC24wLIUpB87k9Log2cjnmmNQapeQvchs0WDZUullYLwb09/D7te7izAuaNQH6YRcoNbZWHcQ0YpuUF/aJbEpwJlm3TcJ9Q5sWdftw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=microsoft.com; s=arcselector9901; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UrDn//JCCz2vxMo3zx/Y1wUrfFba8Kc/0N0Z+gKU14Y=; b=ljeMcdRU1QsbFSsx3eD+7m8D1w5gnhOqBR73ToZ+d2BahE8zJU4dHRbjiI+92nFoW0IeSLj1n08nPsHmQiuVwEYrA6nvjVTrxiB1AdljuiHpXf8Z96xBaHtrs9qYdNpYnu8yk5wswYjc3zS2ilMfgK69s8ipFz2ldKca2VcpwkpOirt2SnjOExqWToDcy8d+3rMM/SZpszPMvuoBwBu5gWWql9CWA33BOZgwCP0dwjSrv31CK5RXaWndioF46tgyQoM+bVul451cisVpTFNxNwijd1nj2SUkk6VjFyErthIXxupv9IZiZBvBIgZkUkFLT3DWVliqRqbrxeMgi34AfQ== ARC-Authentication-Results: i=1; mx.microsoft.com 1; spf=none; dmarc=none; dkim=none; arc=none DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=hotmail.com; s=selector1; h=From:Date:Subject:Message-ID:Content-Type:MIME-Version:X-MS-Exchange-SenderADCheck; bh=UrDn//JCCz2vxMo3zx/Y1wUrfFba8Kc/0N0Z+gKU14Y=; b=llEbVEBabUqw0jeAe5or7gZ8TaAg5SfuAJDbK0RsmJQvwQpqR7DGChPr8UYCHmIQaiovz4VAezRm3z3zGmMoaqTXozhikiWjz/STFPqKeqPlYCrK5ZI/5r6SVpyKgAsqa9Fy6vJhsgY39/07YEUGH+P9svGBuN87DejZc9AEL9PH1E/cG2NXUlxiXefqr6p0uL3beo4DwaWpC1Dz0M5I/zVucgZ2yIAZhFdYWzUA1iO7HQxkOc32UqOvl+pXCc6Q8yEH9Q2TuA2KR+HMY6YhWa+rDP3v4ogEn//JYUjEhftUrVWgMp7D1tL97G2F3e2kvWZqknH44cmyThfwpDdNrg== Received: from MWHPR1401MB1951.namprd14.prod.outlook.com (2603:10b6:301:51::14) by MW4PR14MB4698.namprd14.prod.outlook.com (2603:10b6:303:103::9) with Microsoft SMTP Server (version=TLS1_2, cipher=TLS_ECDHE_RSA_WITH_AES_256_GCM_SHA384) id 15.20.4287.27; Tue, 6 Jul 2021 11:25:07 +0000 Received: from MWHPR1401MB1951.namprd14.prod.outlook.com ([fe80::adc0:8922:4de7:e7b7]) by MWHPR1401MB1951.namprd14.prod.outlook.com ([fe80::adc0:8922:4de7:e7b7%9]) with mapi id 15.20.4287.033; Tue, 6 Jul 2021 11:25:06 +0000 From: Jay K To: Bruno Haible , "bug-gnulib@gnu.org" Subject: Re: getprocname Tru64 Thread-Topic: getprocname Tru64 Thread-Index: AQHXbMA8gAm9+jG+l0SnN53fGH0wUKsrFpaAgArCo4c= Date: Tue, 6 Jul 2021 11:25:06 +0000 Message-ID: References: , <10419687.R7EI6JQ4AT@omega> In-Reply-To: <10419687.R7EI6JQ4AT@omega> Accept-Language: en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-tmn: [eiZUKXtXMztakxj3iJlqBX6ZHd0JfV0z4nzkHFygOc6uWnBsr9SHPDprAV8CIQFy] x-ms-publictraffictype: Email x-ms-office365-filtering-correlation-id: ea364992-3db3-4adf-889a-08d94070b524 x-ms-traffictypediagnostic: MW4PR14MB4698: x-microsoft-antispam: BCL:0; x-microsoft-antispam-message-info: oiE9ByMeH8VBEs6i59Mnr8GKNOcOJp6jUVck3u350yB2UiWajU2B3IiKNLGfLChqEtBwxlDJe0WoJrP9bjN52pYDvdn2oz38ovCcTEz/0vNRUdO0qqF+l3f4P8o3fZELBHfNyu9d9iPI+sv8y3Zo1u/f2ttAq32TkCIwOkqN+cokB6LR9Q7HUdfqUi2mPFuBaR135/IJaqQ7GTPgOOB049UJhLQlvE55k2Bbr9+AVv9sbJ0fgwtf7I4OF0KpIcFTlQc6AOmyF+hdYx6TOGsnKREHwKU+evisLRHwGtOp2qTt/b3sTTlIAwJ++T0I0BXeOXx4xM+mza0w+sQnmU1B1VeEUW0Kc/8UlvjWMstDBlHzksN1+c00CXUiNHzCL+u34H2wfxseIV1luLuOi3hJwSAga6J7/GmbxEdn/nWHiZ3qRSod6ErWal5o4DudVb/ZtS+2y6d/aInmnsGdlBaXtwSp13N9pRlZX4JxF2+VLoA= x-ms-exchange-antispam-messagedata-chunkcount: 1 x-ms-exchange-antispam-messagedata-0: PUqYw4PY65nBAOAo+/H4tlNyBjGUFoCSyLqK3tOMNIwXXHXLjlJ0+LlrKNqRwSdkgJPcIkXEC4Y2CH4ie3sI8H21OXzDxiFbvpirGfz2qyO0uB0eC3uCC7nVuquZsLDOSARY1Rq0LxAjAh4Uk5RswP9OKuadOa9gFjD5dSeKMwp80uONxNtRrzt7j5+wydqInZN5BK4YzVHhCq+xG13zLg== x-ms-exchange-transport-forked: True Content-Type: multipart/alternative; boundary="_000_MWHPR1401MB1951448EDC9B0E856F89074BE61B9MWHPR1401MB1951_" MIME-Version: 1.0 X-OriginatorOrg: sct-15-20-3174-20-msonline-outlook-32894.templateTenant X-MS-Exchange-CrossTenant-AuthAs: Internal X-MS-Exchange-CrossTenant-AuthSource: MWHPR1401MB1951.namprd14.prod.outlook.com X-MS-Exchange-CrossTenant-RMS-PersistedConsumerOrg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-CrossTenant-Network-Message-Id: ea364992-3db3-4adf-889a-08d94070b524 X-MS-Exchange-CrossTenant-originalarrivaltime: 06 Jul 2021 11:25:06.7941 (UTC) X-MS-Exchange-CrossTenant-fromentityheader: Hosted X-MS-Exchange-CrossTenant-id: 84df9e7f-e9f6-40af-b435-aaaaaaaaaaaa X-MS-Exchange-CrossTenant-rms-persistedconsumerorg: 00000000-0000-0000-0000-000000000000 X-MS-Exchange-Transport-CrossTenantHeadersStamped: MW4PR14MB4698 Received-SPF: pass client-ip=40.92.23.19; envelope-from=jayk123@hotmail.com; helo=NAM12-MW2-obe.outbound.protection.outlook.com X-Spam_score_int: -18 X-Spam_score: -1.9 X-Spam_bar: - X-Spam_report: (-1.9 / 5.0 requ) BAYES_00=-1.9, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, FREEMAIL_ENVFROM_END_DIGIT=0.25, FREEMAIL_FROM=0.001, HTML_MESSAGE=0.001, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H2=-0.001, SPF_HELO_PASS=-0.001, SPF_PASS=-0.001 autolearn=ham autolearn_force=no X-Spam_action: no action X-BeenThere: bug-gnulib@gnu.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Gnulib discussion list List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Larkin Nickle Errors-To: bug-gnulib-bounces+normalperson=yhbt.net@gnu.org Sender: "bug-gnulib" --_000_MWHPR1401MB1951448EDC9B0E856F89074BE61B9MWHPR1401MB1951_ Content-Type: text/plain; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable > emulator Do emulators like, are the process/executable from the kernel point of view but implement their own loaders and load an executable? ok. They should intercept aux queries though. > link error True it is a warning when building .so, and then *tends* to work with all executables, given the same startup code. I guess someone could write their own. > undocumented Indeed. I am not sure of the O_CLOEXEC there. I know the intent, but I don't think it is a thing on Tru64/OSF1. Other than removing O_CLOEXEC I tested the code and it works. Thank you, - Jay ________________________________ From: Bruno Haible Sent: Tuesday, June 29, 2021 3:04 PM To: bug-gnulib@gnu.org Cc: Jay K ; Larkin Nickle Subject: Re: getprocname Tru64 Jay K wrote: > I see I lost the race here, but here is my rendition of getprogname for T= ru64, much more efficient. > > > diff -c getprogname.c.orig getprogname.c > *** getprogname.c.orig Tue Jun 29 03:46:44 2021 > --- getprogname.c Tue Jun 29 03:48:55 2021 > *************** > *** 283,288 **** > --- 283,291 ---- > close (fd); > } > return "?"; > + # elif defined __osf__ > + extern char** __Argv; > + return last_component (__Argv[0]); > # else But it seems that the use '__Argv' can cause link-time errors on Tru64. [1] > I came to this by: > 1: Looked in old gcc to find: > #define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/" > > 2: grep/nm/dis there. > > I had hoped to step through the startup but haven't learned this dbx yet. In other words, it's undocumented. In Gnulib, we avoid to rely on undocumented stuff when possible. In some cases it is unavoidable, but here we already have an implementation of getprogname() for OSF/1. > There is also maybe "auxv" stuff. That's not good. The result would not only depend on which executable is running, but on how it was invoked (shell, emulator, valgrind, etc.). > I find the proc file system kinda gross and inefficient but yeah. If it's inefficient, you can add caching via a 'static' variable. Like we already do in the implementations for AIX and HP-UX. Bruno [1] https://na01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fstat= .ethz.ch%2Fpipermail%2Fr-help%2F%2F2004-January%2F044699.html&data=3D04= %7C01%7C%7C862a06f8085c48b64b3e08d93b0f34a7%7C84df9e7fe9f640afb435aaaaaaaaa= aaa%7C1%7C0%7C637605758753944531%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD= AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&sdata=3DUT6O%2B= b32VETYGALCLYynBm0oamrOehw2wjLwcqsgI0I%3D&reserved=3D0 --_000_MWHPR1401MB1951448EDC9B0E856F89074BE61B9MWHPR1401MB1951_ Content-Type: text/html; charset="iso-8859-1" Content-Transfer-Encoding: quoted-printable
 > emulator

Do emulators like, are the process/executable from the kernel
point of view but implement their own loaders and load an executable? = ok.
They should intercept aux queries though.

> link error

True it is a warning when building .so, and then
*tends* to work with all executables, given the same startup code.
I guess someone could write their own.

 > undocumented

Indeed.

I am not sure of the O_CLOEXEC there.
I know the intent, but I don't think it is a thing on Tru64/OSF1.

Other than removing O_CLOEXEC I tested the code and it works.

Thank you,
 - Jay


From: Bruno Haible <brun= o@clisp.org>
Sent: Tuesday, June 29, 2021 3:04 PM
To: bug-gnulib@gnu.org <bug-gnulib@gnu.org>
Cc: Jay K <jayk123@hotmail.com>; Larkin Nickle <me@larbob.o= rg>
Subject: Re: getprocname Tru64
 
Jay K wrote:
> I see I lost the race here, but here is my rendition of getprogname fo= r Tru64, much more efficient.
>
> > diff -c getprogname.c.orig getprogname.c
> *** getprogname.c.orig  Tue Jun 29 03:46:44 2021
> --- getprogname.c       Tue Jun 29 03:48= :55 2021
> ***************
> *** 283,288 ****
> --- 283,291 ----
>         close (fd);
>       }
>     return "?";
> + # elif defined __osf__
> +   extern char** __Argv;
> +   return last_component (__Argv[0]);
>   # else

But it seems that the use '__Argv' can cause link-time errors on Tru64. [1]=

> I came to this by:
> 1: Looked in old gcc to find:
> #define MD_STARTFILE_PREFIX "/usr/lib/cmplrs/cc/"
>
> 2: grep/nm/dis there.
>
> I had hoped to step through the startup but haven't learned this dbx y= et.

In other words, it's undocumented. In Gnulib, we avoid to rely on
undocumented stuff when possible. In some cases it is unavoidable,
but here we already have an implementation of getprogname() for
OSF/1.

> There is also maybe "auxv" stuff.

That's not good. The result would not only depend on which executable
is running, but on how it was invoked (shell, emulator, valgrind, etc.).
> I find the proc file system kinda gross and inefficient but yeah.

If it's inefficient, you can add caching via a 'static' variable.
Like we already do in the implementations for AIX and HP-UX.

Bruno

[1] https://na01.safelinks.protection.outlook.com/?url=3Dhttps%3A%2F%2Fstat.eth= z.ch%2Fpipermail%2Fr-help%2F%2F2004-January%2F044699.html&amp;data=3D04= %7C01%7C%7C862a06f8085c48b64b3e08d93b0f34a7%7C84df9e7fe9f640afb435aaaaaaaaa= aaa%7C1%7C0%7C637605758753944531%7CUnknown%7CTWFpbGZsb3d8eyJWIjoiMC4wLjAwMD= AiLCJQIjoiV2luMzIiLCJBTiI6Ik1haWwiLCJXVCI6Mn0%3D%7C1000&amp;sdata=3DUT6= O%2Bb32VETYGALCLYynBm0oamrOehw2wjLwcqsgI0I%3D&amp;reserved=3D0

--_000_MWHPR1401MB1951448EDC9B0E856F89074BE61B9MWHPR1401MB1951_--