File: socket.c

package info (click to toggle)
linux 4.19.249-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 968,784 kB
  • sloc: ansic: 16,810,930; asm: 272,263; makefile: 38,450; sh: 33,900; perl: 27,702; python: 21,148; cpp: 5,068; yacc: 4,650; lex: 2,584; awk: 1,386; ruby: 25; sed: 5
file content (28 lines) | stat: -rw-r--r-- 789 bytes parent folder | download | duplicates (5)
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
// SPDX-License-Identifier: GPL-2.0
/*
 * trace/beauty/socket.c
 *
 *  Copyright (C) 2018, Red Hat Inc, Arnaldo Carvalho de Melo <acme@redhat.com>
 */

#include "trace/beauty/beauty.h"
#include <sys/types.h>
#include <sys/socket.h>

static size_t socket__scnprintf_ipproto(int protocol, char *bf, size_t size)
{
#include "trace/beauty/generated/socket_ipproto_array.c"
	static DEFINE_STRARRAY(socket_ipproto);

	return strarray__scnprintf(&strarray__socket_ipproto, bf, size, "%d", protocol);
}

size_t syscall_arg__scnprintf_socket_protocol(char *bf, size_t size, struct syscall_arg *arg)
{
	int domain = syscall_arg__val(arg, 0);

	if (domain == AF_INET || domain == AF_INET6)
		return socket__scnprintf_ipproto(arg->val, bf, size);

	return syscall_arg__scnprintf_int(bf, size, arg);
}