From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from gnu.wildebeest.org (gnu.wildebeest.org [45.83.234.184]) by sourceware.org (Postfix) with ESMTPS id 956C13858D33 for ; Thu, 2 Mar 2023 13:24:41 +0000 (GMT) DMARC-Filter: OpenDMARC Filter v1.4.2 sourceware.org 956C13858D33 Authentication-Results: sourceware.org; dmarc=none (p=none dis=none) header.from=klomp.org Authentication-Results: sourceware.org; spf=pass smtp.mailfrom=klomp.org Received: from r6.localdomain (82-217-174-174.cable.dynamic.v4.ziggo.nl [82.217.174.174]) (using TLSv1.2 with cipher ADH-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by gnu.wildebeest.org (Postfix) with ESMTPSA id 525AB30067B2; Thu, 2 Mar 2023 14:24:40 +0100 (CET) Received: by r6.localdomain (Postfix, from userid 1000) id C7B2A340233; Thu, 2 Mar 2023 14:24:39 +0100 (CET) Message-ID: <4212d96ab907819248ba3bcaad8887e634eed846.camel@klomp.org> Subject: Re: [PATCH v2 09/16] libelf: uid_t, gid_t and mode_t are not comes with msvcrt, so using long/unsigned long instead on win32 From: Mark Wielaard To: Yonggang Luo , elfutils-devel@sourceware.org Date: Thu, 02 Mar 2023 14:24:39 +0100 In-Reply-To: <20221217165213.152-10-luoyonggang@gmail.com> References: <20221217165213.152-1-luoyonggang@gmail.com> <20221217165213.152-10-luoyonggang@gmail.com> Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable User-Agent: Evolution 3.46.4 (3.46.4-1.fc37) MIME-Version: 1.0 X-Spam-Status: No, score=-3035.6 required=5.0 tests=BAYES_00,GIT_PATCH_0,JMQ_SPF_NEUTRAL,KAM_DMARC_STATUS,KAM_NUMSUBJECT,RCVD_IN_BARRACUDACENTRAL,SPF_HELO_NONE,SPF_PASS,TXREP autolearn=ham autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on server2.sourceware.org List-Id: Hi, On Sun, 2022-12-18 at 00:52 +0800, Yonggang Luo via Elfutils-devel wrote: > Signed-off-by: Yonggang Luo > --- > libelf/libelf.h | 6 ++++++ > 1 file changed, 6 insertions(+) >=20 > diff --git a/libelf/libelf.h b/libelf/libelf.h > index a139e733..2fa3838b 100644 > --- a/libelf/libelf.h > +++ b/libelf/libelf.h > @@ -195,9 +195,15 @@ typedef struct > { > char *ar_name; /* Name of archive member. */ > time_t ar_date; /* File date. */ > +#if defined(_WIN32) > + long ar_uid; > + long ar_gid; > + unsigned long ar_mode; > +#else > uid_t ar_uid; /* User ID. */ > gid_t ar_gid; /* Group ID. */ > mode_t ar_mode; /* File mode. */ > +#endif > int64_t ar_size; /* File size. */ > char *ar_rawname; /* Original name of archive member. */ > } Elf_Arhdr; uid_t, gid_t and mode_t are all defined by POSIX to be provided through sys/types.h. Except for defining them as integer types it doesn't really say how big they are. elf_begin has some macros to handle either int or long types generically. But ar.c also simply uses uid_t, gid_t and mode_t. So those should then also be adjusted. Can't we use some configure check instead? I am somewhat hesitant to change this because it is in a public header. Cheers, Mark