]> granicus.if.org Git - strace/commitdiff
tests/accept.c: call accept syscall directly, if available
authorEugene Syromyatnikov <evgsyr@gmail.com>
Thu, 8 Feb 2018 10:58:30 +0000 (11:58 +0100)
committerDmitry V. Levin <ldv@altlinux.org>
Fri, 9 Feb 2018 20:11:53 +0000 (20:11 +0000)
* tests/accept.c [__NR_accept && !TEST_SYSCALL_NAME]: Define a wrapper that
calls accept directly.
* tests/sockname.c [TEST_SYSCALL_STR]: Do not define TEST_SYSCALL_STR.

tests/accept.c
tests/sockname.c

index 8d42ba15694909ffb211a08fac2d5c74053b5860..b96023d34fddc5cc5c6f8036e27df31ae37df434 100644 (file)
  * THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  */
 
-#ifndef TEST_SYSCALL_NAME
-# define TEST_SYSCALL_NAME accept
-#endif
+#include "tests.h"
+
+#include <unistd.h>
+
+#include <asm/unistd.h>
+
+#if defined __NR_accept
+
+# ifndef TEST_SYSCALL_NAME
+#  define TEST_SYSCALL_NAME do_accept
+
+#  ifndef TEST_SYSCALL_STR
+#   define TEST_SYSCALL_STR "accept"
+#  endif
+
+int do_accept(int sockfd, void *addr, void *addrlen)
+{
+       return syscall(__NR_accept, sockfd, addr, addrlen);
+}
+# endif /* !TEST_SYSCALL_NAME */
+
+#else /* !__NR_accept */
+
+# ifndef TEST_SYSCALL_NAME
+#  define TEST_SYSCALL_NAME accept
+# endif
+
+#endif /* __NR_accept */
 
 #define TEST_SYSCALL_PREPARE connect_un()
 static void connect_un(void);
index 587267120bdc78ca1bb31b9a5c77b15c80318531..47b840031016414b113ab051960b7f90d7c5c91b 100644 (file)
@@ -42,7 +42,9 @@
 # error TEST_SYSCALL_NAME must be defined
 #endif
 
-#define TEST_SYSCALL_STR STRINGIFY_VAL(TEST_SYSCALL_NAME)
+#ifndef TEST_SYSCALL_STR
+# define TEST_SYSCALL_STR STRINGIFY_VAL(TEST_SYSCALL_NAME)
+#endif
 #define TEST_SOCKET TEST_SYSCALL_STR ".socket"
 
 #ifdef TEST_SYSCALL_PREPARE