Changeset 4831944 in rtems-libbsd


Ignore:
Timestamp:
Jul 5, 2016, 2:31:43 PM (5 years ago)
Author:
Christian Mauderer <Christian.Mauderer@…>
Branches:
4.11
Children:
709fbfa
Parents:
85dd332
git-author:
Christian Mauderer <Christian.Mauderer@…> (07/05/16 14:31:43)
git-committer:
Sebastian Huber <sebastian.huber@…> (08/03/16 12:13:18)
Message:

pfctl: Adapt for RTEMS.

Location:
freebsd/contrib/pf/pfctl
Files:
8 added
10 edited

Legend:

Unmodified
Added
Removed
  • freebsd/contrib/pf/pfctl/parse.y

    r85dd332 r4831944  
    3030#ifdef __rtems__
    3131#include <machine/rtems-bsd-user-space.h>
     32#include <machine/rtems-bsd-program.h>
    3233#define pf_find_or_create_ruleset _bsd_pf_find_or_create_ruleset
    3334#define pf_anchor_setup _bsd_pf_anchor_setup
     
    61346135#endif
    61356136}
     6137#ifdef __rtems__
     6138#include "parse-data.h"
     6139#endif /* __rtems__ */
  • freebsd/contrib/pf/pfctl/pf_print_state.c

    r85dd332 r4831944  
    3333 */
    3434
     35#ifdef __rtems__
     36#include <machine/rtems-bsd-program.h>
     37#endif /* __rtems__ */
    3538#include <sys/cdefs.h>
    3639__FBSDID("$FreeBSD$");
  • freebsd/contrib/pf/pfctl/pfctl.c

    r85dd332 r4831944  
    3434 */
    3535
     36#ifdef __rtems__
     37#include <machine/rtems-bsd-program.h>
     38
     39#define __need_getopt_newlib
     40#include <getopt.h>
     41
     42/* We need some functions from kernel space. */
     43#define pf_get_ruleset_number _bsd_pf_get_ruleset_number
     44#define pf_init_ruleset _bsd_pf_init_ruleset
     45
     46#include <rtems/linkersets.h>
     47#include <machine/rtems-bsd-commands.h>
     48#endif /* __rtems__ */
    3649#include <sys/cdefs.h>
    3750__FBSDID("$FreeBSD$");
     
    293306usage(void)
    294307{
     308#ifndef __rtems__
    295309        extern char *__progname;
     310#else /* __rtems__ */
     311#define __progname "pfctl"
     312#endif /* __rtems__ */
    296313
    297314        fprintf(stderr, "usage: %s [-AdeghmNnOPqRrvz] ", __progname);
     
    16461663        pf->limit[PF_LIMIT_TABLE_ENTRIES] = PFR_KENTRY_HIWAT;
    16471664
     1665#ifndef __rtems__
    16481666        mib[0] = CTL_HW;
    16491667#ifdef __FreeBSD__
     
    16561674                err(1, "sysctl");
    16571675        if (mem <= 100*1024*1024)
     1676#endif /* __rtems__ */
    16581677                pf->limit[PF_LIMIT_TABLE_ENTRIES] = PFR_KENTRY_HIWAT_SMALL;
    16591678
     
    20702089}
    20712090
     2091#ifdef __rtems__
     2092static int main(int argc, char *argv[]);
     2093
     2094RTEMS_LINKER_RWSET(bsd_prog_pfctl, char);
     2095
     2096int
     2097rtems_bsd_command_pfctl(int argc, char *argv[])
     2098{
     2099        int exit_code = EXIT_FAILURE;
     2100        const void *data_buf = RTEMS_LINKER_SET_BEGIN(bsd_prog_pfctl);
     2101        const size_t data_size = RTEMS_LINKER_SET_SIZE(bsd_prog_pfctl);
     2102
     2103        rtems_bsd_program_lock();
     2104        exit_code = rtems_bsd_program_call_main_with_data_restore("pfctl",
     2105            main, argc, argv, data_buf, data_size);
     2106        rtems_bsd_program_unlock();
     2107
     2108        return exit_code;
     2109}
     2110
     2111#endif /* __rtems__ */
    20722112int
    20732113main(int argc, char *argv[])
     
    20802120        char     anchorname[MAXPATHLEN];
    20812121        char    *path;
     2122
     2123#ifdef __rtems__
     2124        struct getopt_data getopt_data;
     2125        memset(&getopt_data, 0, sizeof(getopt_data));
     2126#define optind getopt_data.optind
     2127#define optarg getopt_data.optarg
     2128#define opterr getopt_data.opterr
     2129#define optopt getopt_data.optopt
     2130#define getopt(argc, argv, opt) getopt_r(argc, argv, "+" opt, &getopt_data)
     2131#endif /* __rtems__ */
    20822132
    20832133        if (argc < 2)
     
    24722522        exit(error);
    24732523}
     2524#ifdef __rtems__
     2525#include "pfctl-data.h"
     2526#endif /* __rtems__ */
  • freebsd/contrib/pf/pfctl/pfctl_altq.c

    r85dd332 r4831944  
    2121 */
    2222
     23#ifdef __rtems__
     24#include <machine/rtems-bsd-program.h>
     25#endif /* __rtems__ */
    2326#include <sys/cdefs.h>
    2427__FBSDID("$FreeBSD$");
     
    12771280                printf(")");
    12781281}
     1282#ifdef __rtems__
     1283#include "pfctl_altq-data.h"
     1284#endif /* __rtems__ */
  • freebsd/contrib/pf/pfctl/pfctl_optimize.c

    r85dd332 r4831944  
    1919 */
    2020
     21#ifdef __rtems__
     22#include <machine/rtems-bsd-program.h>
     23
     24/* We need some functions from kernel space. */
     25#define pf_find_or_create_ruleset _bsd_pf_find_or_create_ruleset
     26#endif /* __rtems__ */
    2127#include <sys/cdefs.h>
    2228__FBSDID("$FreeBSD$");
     
    16931699        free(block);
    16941700}
    1695 
     1701#ifdef __rtems__
     1702#include "pfctl_optimize-data.h"
     1703#endif /* __rtems__ */
  • freebsd/contrib/pf/pfctl/pfctl_osfp.c

    r85dd332 r4831944  
    1919 */
    2020
     21#ifdef __rtems__
     22#include <machine/rtems-bsd-program.h>
     23#endif /* __rtems__ */
    2124#include <rtems/bsd/sys/types.h>
    2225#include <sys/ioctl.h>
     
    11261129        return (buf);
    11271130}
     1131#ifdef __rtems__
     1132#include "pfctl_osfp-data.h"
     1133#endif /* __rtems__ */
  • freebsd/contrib/pf/pfctl/pfctl_parser.c

    r85dd332 r4831944  
    3434 */
    3535
     36#ifdef __rtems__
     37#include <machine/rtems-bsd-program.h>
     38#endif /* __rtems__ */
    3639#include <sys/cdefs.h>
    3740__FBSDID("$FreeBSD$");
     
    4144#include <sys/socket.h>
    4245#include <rtems/bsd/sys/param.h>
     46#ifdef __rtems__
     47#include <rtems/bsd/sys/errno.h>
     48#endif /* __rtems__ */
    4349#include <sys/proc.h>
    4450#include <net/if.h>
     
    17681774        return ioctl(dev, cmd, &trans);
    17691775}
     1776#ifdef __rtems__
     1777#include "pfctl_parser-data.h"
     1778#endif /* __rtems__ */
  • freebsd/contrib/pf/pfctl/pfctl_qstats.c

    r85dd332 r4831944  
    1919 */
    2020
     21#ifdef __rtems__
     22#include <machine/rtems-bsd-program.h>
     23#endif /* __rtems__ */
    2124#include <sys/cdefs.h>
    2225__FBSDID("$FreeBSD$");
     
    456459                qs->avgn++;
    457460}
     461#ifdef __rtems__
     462#include "pfctl_qstats-data.h"
     463#endif /* __rtems__ */
  • freebsd/contrib/pf/pfctl/pfctl_radix.c

    r85dd332 r4831944  
    3333 */
    3434
     35#ifdef __rtems__
     36#include <machine/rtems-bsd-program.h>
     37#endif /* __rtems__ */
    3538#include <sys/cdefs.h>
    3639__FBSDID("$FreeBSD$");
     
    4952#include <stdlib.h>
    5053#include <limits.h>
     54#ifdef __rtems__
     55#define SIZE_T_MAX SIZE_MAX
     56#endif /* __rtems__ */
    5157#include <err.h>
    5258
     
    595601        }
    596602}
     603#ifdef __rtems__
     604#include "pfctl_radix-data.h"
     605#endif /* __rtems__ */
  • freebsd/contrib/pf/pfctl/pfctl_table.c

    r85dd332 r4831944  
    3333 */
    3434
     35#ifdef __rtems__
     36#include <machine/rtems-bsd-program.h>
     37#endif /* __rtems__ */
    3538#include <sys/cdefs.h>
    3639__FBSDID("$FreeBSD$");
     
    496499radix_perror(void)
    497500{
     501#ifndef __rtems__
    498502        extern char *__progname;
     503#else /* __rtems__ */
     504#define __progname "pfctl"
     505#endif /* __rtems__ */
    499506        fprintf(stderr, "%s: %s.\n", __progname, pfr_strerror(errno));
    500507}
Note: See TracChangeset for help on using the changeset viewer.