about summary refs log tree commit diff
path: root/sysdeps/unix/sysdep.h
diff options
context:
space:
mode:
Diffstat (limited to 'sysdeps/unix/sysdep.h')
-rw-r--r--sysdeps/unix/sysdep.h19
1 files changed, 19 insertions, 0 deletions
diff --git a/sysdeps/unix/sysdep.h b/sysdeps/unix/sysdep.h
index 52dad582ce..c4316db4bc 100644
--- a/sysdeps/unix/sysdep.h
+++ b/sysdeps/unix/sysdep.h
@@ -73,3 +73,22 @@
 #ifndef INLINE_SYSCALL
 #define INLINE_SYSCALL(name, nr, args...) __syscall_##name (args)
 #endif
+
+/* Similar to INLINE_SYSCALL, but with return type.  It should only be
+   used with function return.  */
+#ifndef INLINE_SYSCALL_RETURN
+#define INLINE_SYSCALL_RETURN(name, nr, type, args...) \
+  INLINE_SYSCALL (name, nr, args)
+#endif
+
+/* Set error number and return value.  It should only be used with
+   function return.  ERR is the negative error number returned from
+   the majority of Linux kernels for which -ERR is no-op
+   with INTERNAL_SYSCALL_ERRNO.   */
+#ifndef INLINE_SYSCALL_ERROR_RETURN
+#define INLINE_SYSCALL_ERROR_RETURN(err, type, value) \
+  ({								\
+    __set_errno (-err);						\
+    (type) (value);						\
+  })
+#endif