File: accept_compat.h

package info (click to toggle)
strace 6.1-0.1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 64,424 kB
  • sloc: ansic: 160,349; sh: 9,223; makefile: 3,817; cpp: 944; awk: 353; perl: 267; exp: 62; sed: 9
file content (32 lines) | stat: -rw-r--r-- 793 bytes parent folder | download | duplicates (6)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/*
 * Copyright (c) 2018-2019 The strace developers.
 * All rights reserved.
 *
 * SPDX-License-Identifier: GPL-2.0-or-later
 */

#ifndef _STRACE_TESTS_ACCEPT_COMPAT_H_
# define _STRACE_TESTS_ACCEPT_COMPAT_H_

# include <unistd.h>
# include <sys/socket.h>
# include "scno.h"

# if defined __NR_socketcall && defined __sparc__
/*
 * Work around the fact that
 * - glibc >= 2.26 uses accept4 syscall to implement accept() call on sparc;
 * - accept syscall had not been wired up on sparc until v4.4-rc8~4^2~1.
 */
static inline int
do_accept(int sockfd, struct sockaddr *addr, socklen_t *addrlen)
{
	const long args[] = { sockfd, (long) addr, (long) addrlen };

	return syscall(__NR_socketcall, 5, args);
}
# else
#  define do_accept accept
# endif

#endif /* !_STRACE_TESTS_ACCEPT_COMPAT_H_ */