mirror of
https://git.rtems.org/rtems-libbsd/
synced 2025-07-02 18:46:43 +08:00
parent
0d979d6f53
commit
0099e16d9c
@ -86,6 +86,7 @@ program-header:
|
||||
cd freebsd/tools/tools/net80211/wlanstats && $(BASE)/userspace-header-gen.py $(BUILD_BSP)/freebsd/tools/tools/net80211/wlanstats/*.o -p wlanstats
|
||||
cd freebsd/usr.bin/netstat && $(BASE)/userspace-header-gen.py $(BUILD_BSP)/freebsd/usr.bin/netstat/*.o -p netstat
|
||||
cd freebsd/usr.sbin/arp && $(BASE)/userspace-header-gen.py $(BUILD_BSP)/freebsd/usr.sbin/arp/*.o -p arp
|
||||
cd freebsd/usr.sbin/ifmcstat && $(BASE)/userspace-header-gen.py $(BUILD_BSP)/freebsd/usr.sbin/ifmcstat/*.o -p ifmcstat
|
||||
cd ipsec-tools/src/racoon && $(BASE)/userspace-header-gen.py $(BUILD_BSP)/ipsec-tools/src/racoon/*.o -p racoon
|
||||
cd ipsec-tools/src/setkey && $(BASE)/userspace-header-gen.py $(BUILD_BSP)/ipsec-tools/src/setkey/*.o -p setkey
|
||||
|
||||
|
@ -1,5 +1,10 @@
|
||||
#include <machine/rtems-bsd-user-space.h>
|
||||
|
||||
#ifdef __rtems__
|
||||
#include "rtems-bsd-ifmcstat-namespace.h"
|
||||
#include "rtems-bsd-ifmcstat-ifmcstat-data.h"
|
||||
#endif /* __rtems__ */
|
||||
|
||||
/* $KAME: ifmcstat.c,v 1.48 2006/11/15 05:13:59 itojun Exp $ */
|
||||
|
||||
/*-
|
||||
@ -34,6 +39,13 @@
|
||||
* SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#ifdef __rtems__
|
||||
#define __need_getopt_newlib
|
||||
#include <getopt.h>
|
||||
#include <machine/rtems-bsd-program.h>
|
||||
#include <machine/rtems-bsd-commands.h>
|
||||
#include <rtems/libio_.h>
|
||||
#endif /* __rtems__ */
|
||||
#include <sys/cdefs.h>
|
||||
__FBSDID("$FreeBSD$");
|
||||
|
||||
@ -112,11 +124,20 @@ union sockunion {
|
||||
};
|
||||
typedef union sockunion sockunion_t;
|
||||
|
||||
#ifdef __rtems__
|
||||
static
|
||||
#endif /* __rtems__ */
|
||||
uint32_t ifindex = 0;
|
||||
#ifdef __rtems__
|
||||
static
|
||||
#endif /* __rtems__ */
|
||||
int af = AF_UNSPEC;
|
||||
#ifdef WITH_KVM
|
||||
int Kflag = 0;
|
||||
#endif
|
||||
#ifdef __rtems__
|
||||
static
|
||||
#endif /* __rtems__ */
|
||||
int vflag = 0;
|
||||
|
||||
#define sa_dl_equal(a1, a2) \
|
||||
@ -170,7 +191,31 @@ static const char * inm_mode(u_int mode);
|
||||
static void in6_ifinfo(struct mld_ifinfo *);
|
||||
static const char * inet6_n2a(struct in6_addr *, uint32_t);
|
||||
#endif
|
||||
#ifdef __rtems__
|
||||
static int main(int argc, char *argv[]);
|
||||
|
||||
RTEMS_LINKER_RWSET(bsd_prog_ifmcstat, char);
|
||||
|
||||
int
|
||||
rtems_bsd_command_ifmcstat(int argc, char *argv[])
|
||||
{
|
||||
int exit_code;
|
||||
void *data_begin;
|
||||
size_t data_size;
|
||||
|
||||
data_begin = RTEMS_LINKER_SET_BEGIN(bsd_prog_ifmcstat);
|
||||
data_size = RTEMS_LINKER_SET_SIZE(bsd_prog_ifmcstat);
|
||||
|
||||
rtems_bsd_program_lock();
|
||||
exit_code = rtems_bsd_program_call_main_with_data_restore("ifmcstat",
|
||||
main, argc, argv, data_begin, data_size);
|
||||
rtems_bsd_program_unlock();
|
||||
|
||||
return exit_code;
|
||||
}
|
||||
#else /* __rtems__ */
|
||||
int main(int, char **);
|
||||
#endif /* __rtems__ */
|
||||
|
||||
static void
|
||||
usage()
|
||||
@ -186,7 +231,7 @@ usage()
|
||||
exit(EX_USAGE);
|
||||
}
|
||||
|
||||
static const char *options = "i:f:vM:N:"
|
||||
static const char * const options = "i:f:vM:N:"
|
||||
#ifdef WITH_KVM
|
||||
"K"
|
||||
#endif
|
||||
@ -310,7 +355,7 @@ in_ifinfo(struct igmp_ifinfo *igi)
|
||||
printf("\n");
|
||||
}
|
||||
|
||||
static const char *inm_modes[] = {
|
||||
static const char * const inm_modes[] = {
|
||||
"undefined",
|
||||
"include",
|
||||
"exclude",
|
||||
|
@ -1,5 +1,10 @@
|
||||
#include <machine/rtems-bsd-user-space.h>
|
||||
|
||||
#ifdef __rtems__
|
||||
#include "rtems-bsd-ifmcstat-namespace.h"
|
||||
#include "rtems-bsd-ifmcstat-printb-data.h"
|
||||
#endif /* __rtems__ */
|
||||
|
||||
/*-
|
||||
* SPDX-License-Identifier: BSD-3-Clause
|
||||
*
|
||||
|
4
freebsd/usr.sbin/ifmcstat/rtems-bsd-ifmcstat-data.h
Normal file
4
freebsd/usr.sbin/ifmcstat/rtems-bsd-ifmcstat-data.h
Normal file
@ -0,0 +1,4 @@
|
||||
/* generated by userspace-header-gen.py */
|
||||
#include <rtems/linkersets.h>
|
||||
/* ifmcstat.c */
|
||||
/* printb.c */
|
@ -0,0 +1,7 @@
|
||||
/* generated by userspace-header-gen.py */
|
||||
#include <rtems/linkersets.h>
|
||||
#include "rtems-bsd-ifmcstat-data.h"
|
||||
/* ifmcstat.c */
|
||||
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifmcstat, static int af);
|
||||
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifmcstat, static int vflag);
|
||||
RTEMS_LINKER_RWSET_CONTENT(bsd_prog_ifmcstat, static uint32_t ifindex);
|
5
freebsd/usr.sbin/ifmcstat/rtems-bsd-ifmcstat-namespace.h
Normal file
5
freebsd/usr.sbin/ifmcstat/rtems-bsd-ifmcstat-namespace.h
Normal file
@ -0,0 +1,5 @@
|
||||
/* generated by userspace-header-gen.py */
|
||||
/* ifmcstat.c */
|
||||
#define main _bsd_ifmcstat_main
|
||||
/* printb.c */
|
||||
#define printb _bsd_ifmcstat_printb
|
@ -0,0 +1,4 @@
|
||||
/* generated by userspace-header-gen.py */
|
||||
#include <rtems/linkersets.h>
|
||||
#include "rtems-bsd-ifmcstat-data.h"
|
||||
/* printb.c */
|
@ -186,6 +186,7 @@ class rtems(builder.Module):
|
||||
'rtems/rtems-bsd-set-if-input.c',
|
||||
'rtems/rtems-bsd-shell-arp.c',
|
||||
'rtems/rtems-bsd-shell-ifconfig.c',
|
||||
'rtems/rtems-bsd-shell-ifmcstat.c',
|
||||
'rtems/rtems-bsd-shell-netstat.c',
|
||||
'rtems/rtems-bsd-shell-nvmecontrol.c',
|
||||
'rtems/rtems-bsd-shell-pfctl.c',
|
||||
@ -3026,6 +3027,8 @@ class user_space(builder.Module):
|
||||
'usr.bin/netstat/unix.c',
|
||||
'usr.bin/vmstat/vmstat.c',
|
||||
'usr.sbin/arp/arp.c',
|
||||
'usr.sbin/ifmcstat/ifmcstat.c',
|
||||
'usr.sbin/ifmcstat/printb.c',
|
||||
],
|
||||
mm.generator['source'](['-DINET'])
|
||||
)
|
||||
|
@ -50,6 +50,8 @@ int rtems_bsd_command_arp(int argc, char **argv);
|
||||
|
||||
int rtems_bsd_command_ifconfig(int argc, char **argv);
|
||||
|
||||
int rtems_bsd_command_ifmcstat(int argc, char **argv);
|
||||
|
||||
int rtems_bsd_command_netstat(int argc, char **argv);
|
||||
|
||||
int rtems_bsd_command_nvmecontrol(int argc, char **argv);
|
||||
|
@ -30,7 +30,11 @@ extern rtems_shell_cmd_t rtems_shell_PING_Command;
|
||||
extern rtems_shell_cmd_t rtems_shell_PING6_Command;
|
||||
|
||||
extern rtems_shell_cmd_t rtems_shell_IFCONFIG_Command;
|
||||
|
||||
extern rtems_shell_cmd_t rtems_shell_IFMCSTAT_Command;
|
||||
|
||||
extern rtems_shell_cmd_t rtems_shell_ROUTE_Command;
|
||||
|
||||
extern rtems_shell_cmd_t rtems_shell_NETSTAT_Command;
|
||||
|
||||
extern rtems_shell_cmd_t rtems_shell_DHCPCD_Command;
|
||||
|
36
rtemsbsd/rtems/rtems-bsd-shell-ifmcstat.c
Normal file
36
rtemsbsd/rtems/rtems-bsd-shell-ifmcstat.c
Normal file
@ -0,0 +1,36 @@
|
||||
/* SPDX-License-Identifier: BSD-2-Clause */
|
||||
|
||||
/*
|
||||
* Copyright (C) 2020 embedded brains GmbH (http://www.embedded-brains.de)
|
||||
*
|
||||
* Redistribution and use in source and binary forms, with or without
|
||||
* modification, are permitted provided that the following conditions
|
||||
* are met:
|
||||
* 1. Redistributions of source code must retain the above copyright
|
||||
* notice, this list of conditions and the following disclaimer.
|
||||
* 2. Redistributions in binary form must reproduce the above copyright
|
||||
* notice, this list of conditions and the following disclaimer in the
|
||||
* documentation and/or other materials provided with the distribution.
|
||||
*
|
||||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
||||
* AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
||||
* IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
||||
* ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE
|
||||
* LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
||||
* CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
||||
* SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
||||
* INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
||||
* CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
||||
* ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
||||
* POSSIBILITY OF SUCH DAMAGE.
|
||||
*/
|
||||
|
||||
#include <rtems/netcmds-config.h>
|
||||
#include <machine/rtems-bsd-commands.h>
|
||||
|
||||
rtems_shell_cmd_t rtems_shell_IFMCSTAT_Command = {
|
||||
.name = "ifmcstat",
|
||||
.usage = "ifmcstat [args]",
|
||||
.topic = "net",
|
||||
.command = rtems_bsd_command_ifmcstat
|
||||
};
|
@ -240,6 +240,7 @@ early_initialization(void)
|
||||
&rtems_shell_NETSTAT_Command, \
|
||||
&rtems_shell_SYSCTL_Command, \
|
||||
&rtems_shell_IFCONFIG_Command, \
|
||||
&rtems_shell_IFMCSTAT_Command, \
|
||||
&rtems_shell_VMSTAT_Command
|
||||
|
||||
#define CONFIGURE_SHELL_COMMAND_CPUINFO
|
||||
|
Loading…
x
Reference in New Issue
Block a user