This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: [PATCH v3 15/19] RISC-V: Linux Syscall Interface


On Tue, 26 Dec 2017, Palmer Dabbelt wrote:

> diff --git a/sysdeps/unix/sysv/linux/riscv/arch-fork.h b/sysdeps/unix/sysv/linux/riscv/arch-fork.h
> new file mode 100644
> index 000000000000..9a2465b58e5a
> --- /dev/null
> +++ b/sysdeps/unix/sysv/linux/riscv/arch-fork.h
> @@ -0,0 +1,27 @@
> +/* Internal definitions for thread-friendly fork implementation.  Linux/i386.
> +   Copyright (C) 2002-2017 Free Software Foundation, Inc.
> +   This file is part of the GNU C Library.
> +   Contributed by Ulrich Drepper <drepper@redhat.com>, 2002.

No "Contributed by" in new files, even when copied.

> diff --git a/sysdeps/unix/sysv/linux/riscv/pt-vfork.S b/sysdeps/unix/sysv/linux/riscv/pt-vfork.S

> +/* libpthread used to have its own vfork implementation that differed
> +   from libc's only in having a pointless micro-optimization.  There
> +   is no longer any use to having a separate copy in libpthread, but
> +   the historical ABI requires it.  For static linking, there is no
> +   need to provide anything here--the libc version will be linked in.
> +   For shared library ABI compatibility, there must be __vfork and
> +   vfork symbols in libpthread.so.  */
> +
> +#if (SHLIB_COMPAT (libpthread, GLIBC_2_0, GLIBC_2_20) \
> +     || SHLIB_COMPAT (libpthread, GLIBC_2_1_2, GLIBC_2_20))

No file for a new port should include SHLIB_COMPAT conditionals on 
versions that don't exist for that port.

I think that means this file can just be a one-line

/* Not needed.  */

or similar comment (no copyright / license notice needed in that case).

> +long
> +syscall (long syscall_number, long arg1, long arg2, long arg3, long arg4,
> +	 long arg5, long arg6, long arg7)
> +{
> +  long ret;

long int.

> +  INTERNAL_SYSCALL_DECL (err);
> +
> +  ret = INTERNAL_SYSCALL_NCS (syscall_number, err, 7, arg1, arg2, arg3, arg4,
> +			      arg5, arg6, arg7);
> +
> +  if (INTERNAL_SYSCALL_ERROR_P (ret, err))
> +    {
> +      extern long __syscall_error (long neg_errno);
> +      return __syscall_error (ret);

Avoid such block-scope function declarations.  Include some header that 
declares __syscall_error instead.

> diff --git a/sysdeps/unix/sysv/linux/riscv/sysdep.h b/sysdeps/unix/sysv/linux/riscv/sysdep.h
> +/* Define a macro which expands into the inline wrapper code for a system
> +   call.  */
> +# undef INLINE_SYSCALL
> +# define INLINE_SYSCALL(name, nr, args...)				\
> +  ({ INTERNAL_SYSCALL_DECL (err);					\
> +     long __sys_result = INTERNAL_SYSCALL (name, err, nr, args);	\

long int.

> +# define INTERNAL_SYSCALL_ERROR_P(val, err)   ((unsigned long) (val) > -4096UL)

unsigned long int.

> +# define internal_syscall0(number, err, dummy...)			\
> +({ 									\
> +	long _sys_result;						\
> +									\
> +	{								\
> +	register long __a7 asm("a7") = number;				\
> +	register long __a0 asm("a0");					\

More uses of long int, throughout all these macros.

-- 
Joseph S. Myers
joseph@codesourcery.com


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]