Blame sysdeps/unix/sysv/linux/sysdep.h

Packit 6c4009
/* Copyright (C) 2015-2018 Free Software Foundation, Inc.
Packit 6c4009
   This file is part of the GNU C Library.
Packit 6c4009
Packit 6c4009
   The GNU C Library is free software; you can redistribute it and/or
Packit 6c4009
   modify it under the terms of the GNU Lesser General Public
Packit 6c4009
   License as published by the Free Software Foundation; either
Packit 6c4009
   version 2.1 of the License, or (at your option) any later version.
Packit 6c4009
Packit 6c4009
   The GNU C Library is distributed in the hope that it will be useful,
Packit 6c4009
   but WITHOUT ANY WARRANTY; without even the implied warranty of
Packit 6c4009
   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
Packit 6c4009
   Lesser General Public License for more details.
Packit 6c4009
Packit 6c4009
   You should have received a copy of the GNU Lesser General Public
Packit 6c4009
   License along with the GNU C Library; if not, see
Packit 6c4009
   <http://www.gnu.org/licenses/>.  */
Packit 6c4009
Packit 6c4009
#include <bits/wordsize.h>
Packit 6c4009
#include <kernel-features.h>
Packit 6c4009
Packit 6c4009
/* Set error number and return -1.  A target may choose to return the
Packit 6c4009
   internal function, __syscall_error, which sets errno and returns -1.
Packit 6c4009
   We use -1l, instead of -1, so that it can be casted to (void *).  */
Packit 6c4009
#define INLINE_SYSCALL_ERROR_RETURN_VALUE(err)  \
Packit 6c4009
  ({						\
Packit 6c4009
    __set_errno (err);				\
Packit 6c4009
    -1l;					\
Packit 6c4009
  })
Packit 6c4009
Packit 6c4009
/* Provide a dummy argument that can be used to force register
Packit 6c4009
   alignment for register pairs if required by the syscall ABI.  */
Packit 6c4009
#ifdef __ASSUME_ALIGNED_REGISTER_PAIRS
Packit 6c4009
#define __ALIGNMENT_ARG 0,
Packit 6c4009
#define __ALIGNMENT_COUNT(a,b) b
Packit 6c4009
#else
Packit 6c4009
#define __ALIGNMENT_ARG
Packit 6c4009
#define __ALIGNMENT_COUNT(a,b) a
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Provide a common macro to pass 64-bit value on syscalls.  */
Packit 6c4009
#if __WORDSIZE == 64 || defined __ASSUME_WORDSIZE64_ILP32
Packit 6c4009
# define SYSCALL_LL(val)   (val)
Packit 6c4009
# define SYSCALL_LL64(val) (val)
Packit 6c4009
#else
Packit 6c4009
#define SYSCALL_LL(val)   \
Packit 6c4009
  __LONG_LONG_PAIR ((val) >> 31, (val))
Packit 6c4009
#define SYSCALL_LL64(val) \
Packit 6c4009
  __LONG_LONG_PAIR ((long) ((val) >> 32), (long) ((val) & 0xffffffff))
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Provide a common macro to pass 64-bit value on pread and pwrite
Packit 6c4009
   syscalls.  */
Packit 6c4009
#ifdef __ASSUME_PRW_DUMMY_ARG
Packit 6c4009
# define SYSCALL_LL_PRW(val)   0, SYSCALL_LL (val)
Packit 6c4009
# define SYSCALL_LL64_PRW(val) 0, SYSCALL_LL64 (val)
Packit 6c4009
#else
Packit 6c4009
# define SYSCALL_LL_PRW(val)   __ALIGNMENT_ARG SYSCALL_LL (val)
Packit 6c4009
# define SYSCALL_LL64_PRW(val) __ALIGNMENT_ARG SYSCALL_LL64 (val)
Packit 6c4009
#endif
Packit 6c4009
Packit 6c4009
/* Provide a macro to pass the off{64}_t argument on p{readv,writev}{64}.  */
Packit 6c4009
#define LO_HI_LONG(val) \
Packit 6c4009
 (long) (val), \
Packit 6c4009
 (long) (((uint64_t) (val)) >> 32)
Packit 6c4009
Packit 6c4009
/* Exports the __send symbol on send.c linux implementation (some ABI have
Packit 6c4009
   it missing due the usage of a old generic version without it).  */
Packit 6c4009
#define HAVE_INTERNAL_SEND_SYMBOL	1