diff mbox series

[uclibc-ng-devel,2/2] Add time64 support for PowerPC.

Message ID 20240224182140.1988000-2-dm.chestnykh@gmail.com
State Accepted
Headers show
Series [uclibc-ng-devel,1/2] Add support for using time64 on big-endian machines. | expand

Commit Message

Dmitry Chestnykh Feb. 24, 2024, 6:21 p.m. UTC
Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
---
 extra/Configs/Config.in                       |  2 +-
 libc/sysdeps/linux/powerpc/bits/kernel_stat.h | 28 +++++++++++++++++--
 libc/sysdeps/linux/powerpc/bits/sem.h         | 16 +++++++++++
 3 files changed, 42 insertions(+), 4 deletions(-)

Comments

Waldemar Brodkorb Feb. 26, 2024, 8:32 a.m. UTC | #1
Hi Dmitry,

Thanks! applied and pushed,
 best regards
  Waldemar

Dmitry Chestnykh wrote,

> Signed-off-by: Dmitry Chestnykh <dm.chestnykh@gmail.com>
> ---
>  extra/Configs/Config.in                       |  2 +-
>  libc/sysdeps/linux/powerpc/bits/kernel_stat.h | 28 +++++++++++++++++--
>  libc/sysdeps/linux/powerpc/bits/sem.h         | 16 +++++++++++
>  3 files changed, 42 insertions(+), 4 deletions(-)
> 
> diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
> index 9351dffc8..f11a63b79 100644
> --- a/extra/Configs/Config.in
> +++ b/extra/Configs/Config.in
> @@ -1026,7 +1026,7 @@ config UCLIBC_FALLBACK_TO_ETC_LOCALTIME
>  
>  config UCLIBC_USE_TIME64
>  	bool "Use *time64 syscalls instead of 32bit ones (if possible)"
> -	depends on TARGET_arm || TARGET_xtensa
> +	depends on TARGET_arm || TARGET_powerpc || TARGET_xtensa
>  	# TODO: add support for other architectures
>  	default n
>  
> diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
> index ce62b2ba2..0e76120ab 100644
> --- a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
> +++ b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
> @@ -5,6 +5,16 @@
>   * struct kernel_stat should look like...  It turns out each arch has a
>   * different opinion on the subject... */
>  
> +#if defined(__UCLIBC_USE_TIME64__)
> +#include <bits/types.h>
> +
> +struct ts32_struct {
> +	__S32_TYPE tv_sec;
> +	__S32_TYPE tv_nsec;
> +};
> +
> +#endif
> +
>  #if __WORDSIZE == 64
>  #define kernel_stat kernel_stat64
>  #else
> @@ -19,9 +29,15 @@ struct kernel_stat {
>  	__kernel_off_t	st_size;
>  	unsigned long  	st_blksize;
>  	unsigned long  	st_blocks;
> +#if defined(__UCLIBC_USE_TIME64__)
> +	struct ts32_struct __st_atim32;
> +	struct ts32_struct __st_mtim32;
> +	struct ts32_struct __st_ctim32;
> +#else
>  	struct timespec	st_atim;
>  	struct timespec	st_mtim;
>  	struct timespec	st_ctim;
> +#endif
>  	unsigned long  	__unused4;
>  	unsigned long  	__unused5;
>  };
> @@ -39,9 +55,15 @@ struct kernel_stat64 {
>  	long long st_size;		/* Size of file, in bytes.  */
>  	long st_blksize;		/* Optimal block size for I/O.  */
>  	long long st_blocks;		/* Number 512-byte blocks allocated. */
> -	struct timespec st_atim;	/* Time of last access.  */
> -	struct timespec st_mtim;	/* Time of last modification.  */
> -	struct timespec st_ctim;	/* Time of last status change.  */
> +#if defined(__UCLIBC_USE_TIME64__)
> +	struct ts32_struct __st_atim32;
> +	struct ts32_struct __st_mtim32;
> +	struct ts32_struct __st_ctim32;
> +#else
> +	struct timespec	st_atim;
> +	struct timespec	st_mtim;
> +	struct timespec	st_ctim;
> +#endif
>  	unsigned long int __uclibc_unused4;
>  	unsigned long int __uclibc_unused5;
>  };
> diff --git a/libc/sysdeps/linux/powerpc/bits/sem.h b/libc/sysdeps/linux/powerpc/bits/sem.h
> index a9d895374..8d338eac0 100644
> --- a/libc/sysdeps/linux/powerpc/bits/sem.h
> +++ b/libc/sysdeps/linux/powerpc/bits/sem.h
> @@ -35,6 +35,7 @@
>  #define SETALL         17              /* set all semval's */
>  
>  
> +
>  /* Data structure describing a set of semaphores.  */
>  struct semid_ds
>  {
> @@ -42,16 +43,31 @@ struct semid_ds
>  #if __WORDSIZE == 32
>    unsigned int __uclibc_unused1;
>  #endif
> +#if defined(__UCLIBC_USE_TIME64__)
> +  unsigned long int __sem_otime_internal_1; /* last semop() time */
> +  unsigned long int __sem_otime_internal_2;
> +#else
>    __time_t sem_otime;                  /* last semop() time */
> +#endif
>  #if __WORDSIZE == 32
>    unsigned int __uclibc_unused2;
>  #endif
> +#if defined(__UCLIBC_USE_TIME64__)
> +  unsigned long int __sem_ctime_internal_1; /* last time changed by semctl() */
> +  unsigned long int __sem_ctime_internal_2;
> +#else
>    __time_t sem_ctime;                  /* last time changed by semctl() */
> +#endif
>    unsigned long int sem_nsems;         /* number of semaphores in set */
> +#if defined(__UCLIBC_USE_TIME64__)
> +  __time_t sem_otime;
> +  __time_t sem_ctime;
> +#endif
>    unsigned long __uclibc_unused3;
>    unsigned long __uclibc_unused4;
>  };
>  
> +
>  /* The user should define a union like the following to use it for arguments
>     for `semctl'.
>  
> -- 
> 2.43.2
> 
> _______________________________________________
> devel mailing list -- devel@uclibc-ng.org
> To unsubscribe send an email to devel-leave@uclibc-ng.org
>
diff mbox series

Patch

diff --git a/extra/Configs/Config.in b/extra/Configs/Config.in
index 9351dffc8..f11a63b79 100644
--- a/extra/Configs/Config.in
+++ b/extra/Configs/Config.in
@@ -1026,7 +1026,7 @@  config UCLIBC_FALLBACK_TO_ETC_LOCALTIME
 
 config UCLIBC_USE_TIME64
 	bool "Use *time64 syscalls instead of 32bit ones (if possible)"
-	depends on TARGET_arm || TARGET_xtensa
+	depends on TARGET_arm || TARGET_powerpc || TARGET_xtensa
 	# TODO: add support for other architectures
 	default n
 
diff --git a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
index ce62b2ba2..0e76120ab 100644
--- a/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
+++ b/libc/sysdeps/linux/powerpc/bits/kernel_stat.h
@@ -5,6 +5,16 @@ 
  * struct kernel_stat should look like...  It turns out each arch has a
  * different opinion on the subject... */
 
+#if defined(__UCLIBC_USE_TIME64__)
+#include <bits/types.h>
+
+struct ts32_struct {
+	__S32_TYPE tv_sec;
+	__S32_TYPE tv_nsec;
+};
+
+#endif
+
 #if __WORDSIZE == 64
 #define kernel_stat kernel_stat64
 #else
@@ -19,9 +29,15 @@  struct kernel_stat {
 	__kernel_off_t	st_size;
 	unsigned long  	st_blksize;
 	unsigned long  	st_blocks;
+#if defined(__UCLIBC_USE_TIME64__)
+	struct ts32_struct __st_atim32;
+	struct ts32_struct __st_mtim32;
+	struct ts32_struct __st_ctim32;
+#else
 	struct timespec	st_atim;
 	struct timespec	st_mtim;
 	struct timespec	st_ctim;
+#endif
 	unsigned long  	__unused4;
 	unsigned long  	__unused5;
 };
@@ -39,9 +55,15 @@  struct kernel_stat64 {
 	long long st_size;		/* Size of file, in bytes.  */
 	long st_blksize;		/* Optimal block size for I/O.  */
 	long long st_blocks;		/* Number 512-byte blocks allocated. */
-	struct timespec st_atim;	/* Time of last access.  */
-	struct timespec st_mtim;	/* Time of last modification.  */
-	struct timespec st_ctim;	/* Time of last status change.  */
+#if defined(__UCLIBC_USE_TIME64__)
+	struct ts32_struct __st_atim32;
+	struct ts32_struct __st_mtim32;
+	struct ts32_struct __st_ctim32;
+#else
+	struct timespec	st_atim;
+	struct timespec	st_mtim;
+	struct timespec	st_ctim;
+#endif
 	unsigned long int __uclibc_unused4;
 	unsigned long int __uclibc_unused5;
 };
diff --git a/libc/sysdeps/linux/powerpc/bits/sem.h b/libc/sysdeps/linux/powerpc/bits/sem.h
index a9d895374..8d338eac0 100644
--- a/libc/sysdeps/linux/powerpc/bits/sem.h
+++ b/libc/sysdeps/linux/powerpc/bits/sem.h
@@ -35,6 +35,7 @@ 
 #define SETALL         17              /* set all semval's */
 
 
+
 /* Data structure describing a set of semaphores.  */
 struct semid_ds
 {
@@ -42,16 +43,31 @@  struct semid_ds
 #if __WORDSIZE == 32
   unsigned int __uclibc_unused1;
 #endif
+#if defined(__UCLIBC_USE_TIME64__)
+  unsigned long int __sem_otime_internal_1; /* last semop() time */
+  unsigned long int __sem_otime_internal_2;
+#else
   __time_t sem_otime;                  /* last semop() time */
+#endif
 #if __WORDSIZE == 32
   unsigned int __uclibc_unused2;
 #endif
+#if defined(__UCLIBC_USE_TIME64__)
+  unsigned long int __sem_ctime_internal_1; /* last time changed by semctl() */
+  unsigned long int __sem_ctime_internal_2;
+#else
   __time_t sem_ctime;                  /* last time changed by semctl() */
+#endif
   unsigned long int sem_nsems;         /* number of semaphores in set */
+#if defined(__UCLIBC_USE_TIME64__)
+  __time_t sem_otime;
+  __time_t sem_ctime;
+#endif
   unsigned long __uclibc_unused3;
   unsigned long __uclibc_unused4;
 };
 
+
 /* The user should define a union like the following to use it for arguments
    for `semctl'.