[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
Mark Wielaard
mark@klomp.org
Thu Mar 2 13:24:39 GMT 2023
Hi,
On Sun, 2022-12-18 at 00:52 +0800, Yonggang Luo via Elfutils-devel
wrote:
> Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
> ---
> libelf/libelf.h | 6 ++++++
> 1 file changed, 6 insertions(+)
>
> 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
More information about the Elfutils-devel
mailing list