[PATCH v4 3/3] sysv: linux: Pass 64-bit version of semctl syscall

Joseph Myers joseph@codesourcery.com
Thu Mar 26 19:01:27 GMT 2020


On Thu, 26 Mar 2020, Alistair Francis via Libc-alpha wrote:

> +#if __WORDSIZE == 32
> +/* This is the "new" y2038 types defined after the 5.1 kernel. It allows
> + * the kernel to use {o,c}time{_high} values to support a 64-bit time_t.  */
> +struct __semid_ds32 {
> +  struct ipc_perm sem_perm;              /* operation permission struct */
> +  __syscall_ulong_t   sem_otime;         /* last semop() time */
> +  __syscall_ulong_t   sem_otime_high;    /* last semop() time high */
> +  __syscall_ulong_t   sem_ctime;         /* last time changed by semctl() */
> +  __syscall_ulong_t   sem_ctime_high;    /* last time changed by semctl() high */
> +  __syscall_ulong_t   sem_nsems;         /* number of semaphores in set */
> +  __syscall_ulong_t   __glibc_reserved3;
> +  __syscall_ulong_t   __glibc_reserved4;
> +};
> +#endif

As far as I can see, this type is not used in any public interface, just 
internally in the implementation.  Thus it should be defined in an 
internal header, not a bits/ installed header.

> +      arg.buf->sem_nsems = arg.buf32->sem_nsems;
> +      arg.buf->sem_otime = arg.buf32->sem_otime |
> +                               ((time_t) arg.buf32->sem_otime_high << 32);
> +      arg.buf->sem_ctime = arg.buf32->sem_ctime |
> +                               ((time_t) arg.buf32->sem_ctime_high << 32);

Split lines before not after operators, and make sure to include 
parentheses in such a case to ensure the operator at the start of the next 
line automatically goes in the correct column (see the GNU Coding 
Standards).

-- 
Joseph S. Myers
joseph@codesourcery.com


More information about the Libc-alpha mailing list