source: rtems-libbsd/libbsd.txt @ 7ec935e

5-freebsd-12
Last change on this file since 7ec935e was 7ec935e, checked in by Christian Mauderer <christian.mauderer@…>, on Mar 23, 2018 at 6:58:18 AM

vprintf: Add handler that mutes all output.

This adds a vprintf handler that can be used to suppress all outputs of
the libbsd.

  • Property mode set to 100644
File size: 41.2 KB
Line 
1RTEMS BSD Library Guide
2=======================
3:toc:
4:icons:
5:numbered:
6:website: http://www.rtems.org/
7
8RTEMS uses FreeBSD 9.2 as the source of its TCP/IP and USB stacks.
9This is a guide which captures information on the
10process of merging code from FreeBSD, building this library,
11RTEMS specific support files, and general guidelines on what
12modifications to the FreeBSD source are permitted.
13
14Goals of this effort are
15
16* update TCP/IP and provide USB in RTEMS,
17* ease updating to future FreeBSD versions,
18* ease tracking changes in FreeBSD code,
19* minimize manual changes in FreeBSD code, and
20* define stable kernel/device driver API which is implemented
21by both RTEMS and FreeBSD. This is the foundation of the port.
22
23We will work to push our changes upstream to the FreeBSD Project
24and minimize changes required at each update point.
25
26*******************************************************************************
27This is a work in progress and is very likely to be incomplete.
28Please help by adding to it.
29*******************************************************************************
30
31== Getting Started
32
33=== Tool Chain ===
34
35You need a tool chain for RTEMS based on at least RSB 4.12 April 2016 or later.
36
37=== Installation Overview ===
38
39. You must configure your BSP with the +--disable-networking+ option to disable
40the old network stack.  Make sure no header files of the old network stack are
41installed.
42
43. Clone the Git repository +git clone git://git.rtems.org/rtems-libbsd.git+.
44. Change into the RTEMS BSD library root directory.
45. If you want to run tests with a custom IP configuration instead of the default
46  one you can use an adjusted `config.inc` configuration file.
47. Run +waf configure ...+.
48. Run +waf+.
49. Run +waf install+.
50
51Refer to the README.waf for Waf building instructions.
52
53Make sure the submodules have been initialised and are updated. If a 'git
54status' says `rtems_waf` need updating run the submodule update command:
55
56 $ git submodule rtems_waf update
57
58=== Board Support Package Requirements ===
59
60The RTEMS version must be at least 4.12.  The Board Support Package (BSP)
61should support the
62http://www.rtems.org/onlinedocs/doxygen/cpukit/html/group\__rtems\__interrupt__extension.html[Interrupt Manager Extension]
63// The first underscores have to be masked to stop asciidoc interpreting them
64to make use of generic FreeBSD based drivers.
65
66The linker command file of the BSP must contain the following section
67definitions:
68
69-------------------------------------------------------------------------------
70.rtemsroset : {
71        KEEP (*(SORT(.rtemsroset.*)))
72}
73
74.rtemsrwset : {
75        KEEP (*(SORT(.rtemsrwset.*)))
76}
77-------------------------------------------------------------------------------
78
79The first output section can be placed in read-only memory.  The second output
80section must be placed in read-write memory.  The output section name is not
81relevant.  The output sections may also contain other input sections.
82
83=== Board Support Package Configuration and Build ===
84
85You need to configure RTEMS for the desired BSP and install it.  The BSP should
86be configured with a disabled network stack.  The BSD library containing the
87new network stack is a separate package.  Using a BSP installation containing
88the old network stack may lead to confusion and unpredictable results.
89
90The following script is used to build the `arm/xilinx_zynq_a9_qemu` BSP for
91our internal testing purposes:
92
93-------------------------------------------------------------------------------
94#!/bin/sh
95
96cd ${HOME}/sandbox
97rm -rf b-xilinx_zynq_a9_qemu
98mkdir b-xilinx_zynq_a9_qemu
99cd b-xilinx_zynq_a9_qemu
100${HOME}/git-rtems/configure \
101        --prefix=${HOME}/sandbox/install \
102        --target=arm-rtems4.12 \
103        --enable-rtemsbsp=xilinx_zynq_a9_qemu \
104        --disable-networking && \
105        make && \
106        make install
107-------------------------------------------------------------------------------
108
109The `arm/xilinx_zynq_a9_qemu` BSP running on the Qemu simulator has some
110benefits for development and test of the BSD library
111
112* it offers a NULL pointer read and write protection,
113* Qemu is a fast simulator,
114* Qemu provides support for GDB watchpoints,
115* Qemu provides support for virtual Ethernet networks, e.g. TUN and bridge
116devices (you can run multiple test instances on one virtual network).
117
118=== BSD Library Configuration and Build ===
119
120The build system based on the Waf build system. To build with Waf please refer
121to the README.waf file.
122
123===== Example Configuration for Network Tests =====
124
125If you need some other IP configuration for the network tests that use a fixed
126IP config you can copy `config.inc` to a location outside to the source tree and
127adapt it. Then use the option `--net-test-config=NET_CONFIG` to pass the file to
128waf's configure command.
129
130-------------------------------------------------------------------------------
131NET_CFG_SELF_IP = 10.0.0.2
132NET_CFG_NETMASK = 255.255.0.0
133NET_CFG_PEER_IP = 10.0.0.1
134NET_CFG_GATEWAY_IP = 10.0.0.1
135-------------------------------------------------------------------------------
136
137=== BSD Library Initialization ===
138
139To initialise the BSD Library create a suitable rc.conf file. The FreeBSD man
140page rc.conf(5) provides the details needed to create a suitable format file:
141
142 https://www.freebsd.org/cgi/man.cgi?rc.conf
143
144You can call one of three functions to run the initialisation once BSD has
145initialised:
146
147 - rtems_bsd_run_etc_rc_conf: Run /etc/rc.conf.
148 - rtems_bsd_run_rc_conf: Run a user supplied file.
149 - rtems_bsd_run_rc_conf_script: Run the in memory line feed separated text string.
150
151For exapmle:
152
153 void
154 network_init(void)
155 {
156   rtems_status_code sc;
157
158   sc = rtems_bsd_initialize();
159   assert(sc == RTEMS_SUCCESSFUL);
160
161   rtems_bsd_run_etc_rc_conf(true); /* verbose = true */
162
163}
164
165By default the networking support is builtin. Other directives can be added and
166are found in 'machine/rtems-bsd-rc-conf-directives.h'. Please check the file
167for the list.
168
169The following network names are supported:
170
171  cloned_interfaces
172  ifconfig_'interface'
173  defaultrouter
174  hostname
175
176For example:
177
178 #
179 # My BSD initialisation.
180 #
181 hostname="myhost"
182 cloned_interfaces="vlan0 vlan1"
183 ifconfig_re0="inet inet 10.10.10.10 netmask 255.255.255.0"
184 fconfig_vlan0="inet 10.11.10.10 255.255.255.0 vlan 101 vlandev re0"
185 defaultrouter="10.10.10.1"
186
187You can also intialise the BSD library using code. The following code to
188initialize the BSD library:
189
190-------------------------------------------------------------------------------
191#include <assert.h>
192#include <sysexits.h>
193
194#include <machine/rtems-bsd-commands.h>
195#include <rtems/bsd/bsd.h>
196
197static void
198network_ifconfig_lo0(void)
199{
200        int exit_code;
201        char *lo0[] = {
202                "ifconfig",
203                "lo0",
204                "inet",
205                "127.0.0.1",
206                "netmask",
207                "255.255.255.0",
208                NULL
209        };
210        char *lo0_inet6[] = {
211                "ifconfig",
212                "lo0",
213                "inet6",
214                "::1",
215                "prefixlen",
216                "128",
217                NULL
218        };
219
220        exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0), lo0);
221        assert(exit_code == EX_OK);
222
223        exit_code = rtems_bsd_command_ifconfig(RTEMS_BSD_ARGC(lo0_inet6), lo0_inet6);
224        assert(exit_code == EX_OK);
225}
226
227void
228network_init(void)
229{
230        rtems_status_code sc;
231
232        sc = rtems_bsd_initialize();
233        assert(sc == RTEMS_SUCCESSFUL);
234
235        network_ifconfig_lo0();
236}
237-------------------------------------------------------------------------------
238
239This performs the basic network stack initialization with a loopback interface.
240Further initialization must be done using the standard BSD network
241configuration commands
242http://www.freebsd.org/cgi/man.cgi?query=ifconfig&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[IFCONFIG(8)]
243using `rtems_bsd_command_ifconfig()` and
244http://www.freebsd.org/cgi/man.cgi?query=route&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[ROUTE(8)]
245using `rtems_bsd_command_route()`.  For an example please have a look at
246`testsuite/include/rtems/bsd/test/default-network-init.h`.
247
248=== Task Priorities and Stack Size ===
249
250The default task priority is 96 for the interrupt server task (name "IRQS"), 98
251for the timer server task (name "TIME") and 100 for all other tasks.  The
252application may provide their own implementation of the
253`rtems_bsd_get_task_priority()` function (for example in the module which calls
254`rtems_bsd_initialize()`) if different values are desired.
255
256The task stack size is determined by the `rtems_bsd_get_task_stack_size()`
257function which may be provided by the application in case the default is not
258appropriate.
259
260=== Size for Allocator Domains ===
261
262The size for an allocator domain can be specified via the
263`rtems_bsd_get_allocator_domain_size()` function.  The application may provide
264their own implementation of the `rtems_bsd_get_allocator_domain_size()`
265function (for example in the module which calls `rtems_bsd_initialize()`) if
266different values are desired.  The default size is 8MiB for all domains.
267
268=== Redirecting or Disabling the Output ===
269
270A lot of system messages are printed to the stdout by default. If you want to
271redirect them you can overwrite the default print handler. That can even be done
272before the libbsd initialization to catch all messages. An example would look
273like follows:
274
275-------------------------------------------------------------------------------
276int my_vprintf_handler(int level, const char *fmt, va_list ap) {
277        /* Do something with the messages. */
278
279        return number_of_printed_chars;
280}
281
282...
283        /* In your initialization: */
284        rtems_bsd_vprintf_handler old;
285        old = rtems_bsd_set_vprintf_handler(my_vprintf_handler);
286...
287-------------------------------------------------------------------------------
288
289As a special case, you can set the `rtems_bsd_vprintf_handler_mute(...)`
290provided by libbsd to suppress all output.
291
292== Network Stack Features
293
294http://roy.marples.name/projects/dhcpcd/index[DHCPCD(8)]:: DHCP client
295
296https://developer.apple.com/library/mac/documentation/Networking/Reference/DNSServiceDiscovery_CRef/Reference/reference.html[dns_sd.h]:: DNS Service Discovery
297
298http://www.opensource.apple.com/source/mDNSResponder/mDNSResponder-320.10/mDNSCore/mDNSEmbeddedAPI.h[mDNS]:: Multi-Cast DNS
299
300http://www.freebsd.org/cgi/man.cgi?query=unix&sektion=4&apropos=0&manpath=FreeBSD+9.2-RELEASE[UNIX(4)]:: UNIX-domain protocol family
301
302http://www.freebsd.org/cgi/man.cgi?query=inet&sektion=4&apropos=0&manpath=FreeBSD+9.2-RELEASE[INET(4)]:: Internet protocol family
303
304http://www.freebsd.org/cgi/man.cgi?query=inet6&apropos=0&sektion=4&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[INET6(4)]:: Internet protocol version 6 family
305
306http://www.freebsd.org/cgi/man.cgi?query=tcp&apropos=0&sektion=4&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[TCP(4)]:: Internet Transmission Control Protocol
307
308http://www.freebsd.org/cgi/man.cgi?query=udp&apropos=0&sektion=4&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[UDP(4)]:: Internet User Datagram Protocol
309
310http://www.freebsd.org/cgi/man.cgi?query=route&sektion=4&apropos=0&manpath=FreeBSD+9.2-RELEASE[ROUTE(4)]:: Kernel packet forwarding database
311
312http://www.freebsd.org/cgi/man.cgi?query=bpf&apropos=0&sektion=4&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[BPF(4)]:: Berkeley Packet Filter
313
314http://www.freebsd.org/cgi/man.cgi?query=socket&apropos=0&sektion=2&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[SOCKET(2)]:: Create an endpoint for communication
315
316http://www.freebsd.org/cgi/man.cgi?query=kqueue&apropos=0&sektion=2&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[KQUEUE(2)]:: Kernel event notification mechanism
317
318http://www.freebsd.org/cgi/man.cgi?query=select&apropos=0&sektion=2&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[SELECT(2)]:: Synchronous I/O multiplexing
319
320http://www.freebsd.org/cgi/man.cgi?query=poll&apropos=0&sektion=2&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[POLL(2)]:: Synchronous I/O multiplexing
321
322http://www.freebsd.org/cgi/man.cgi?query=route&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[ROUTE(8)]:: Manually manipulate the routing tables
323
324http://www.freebsd.org/cgi/man.cgi?query=ifconfig&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[IFCONFIG(8)]:: Configure network interface parameters
325
326http://www.freebsd.org/cgi/man.cgi?query=netstat&apropos=0&sektion=1&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[NETSTAT(1)]:: Show network status
327
328http://www.freebsd.org/cgi/man.cgi?query=ping&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[PING(8)]:: Send ICMP ECHO_REQUEST packets to network hosts
329
330http://www.freebsd.org/cgi/man.cgi?query=ping6&apropos=0&sektion=8&manpath=FreeBSD+9.2-RELEASE&arch=default&format=html[PING6(8)]:: Send ICMPv6 ECHO_REQUEST packets to network hosts
331
332http://www.freebsd.org/cgi/man.cgi?query=sysctl&sektion=3&apropos=0&manpath=FreeBSD+9.2-RELEASE[SYSCTL(3)]:: Get or set system information
333
334http://www.freebsd.org/cgi/man.cgi?query=resolver&sektion=3&apropos=0&manpath=FreeBSD+9.2-RELEASE[RESOLVER(3)]:: Resolver routines
335
336http://www.freebsd.org/cgi/man.cgi?query=gethostbyname&sektion=3&apropos=0&manpath=FreeBSD+9.2-RELEASE[GETHOSTBYNAME(3)]:: Get network host entry
337
338== Network Interface Drivers
339
340=== Link Up/Down Events
341
342You can notifiy the application space of link up/down events in your network
343interface driver via the if_link_state_change(LINK_STATE_UP/LINK_STATE_DOWN)
344function.  The DHCPCD(8) client is a consumer of these events for example.
345Make sure that the interface flag IFF_UP and the interface driver flag
346IFF_DRV_RUNNING is set in case the link is up, otherwise ether_output() will
347return the error status ENETDOWN.
348
349== Shell Commands
350
351=== HOSTNAME(1)
352
353In addition to the standard options the RTEMS version of the HOSTNAME(1)
354command supports the -m flag to set/get the multicast hostname of the
355mDNS resolver instance.  See also rtems_mdns_sethostname() and
356rtems_mdns_gethostname().
357
358== Qemu
359
360Use the following script to set up a virtual network with three tap devices
361connected via one bridge device.
362
363-------------------------------------------------------------------------------
364#!/bin/sh -x
365
366user=`whoami`
367interfaces=(1 2 3)
368
369tap=qtap
370bri=qbri
371
372case $1 in
373        up)
374                sudo -i brctl addbr $bri
375                for i in ${interfaces[@]} ; do
376                        sudo -i tunctl -t $tap$i -u $user ;
377                        sudo -i ifconfig $tap$i up ;
378                        sudo -i brctl addif $bri $tap$i ;
379                done
380                sudo -i ifconfig $bri up
381                ;;
382        down)
383                for i in ${interfaces[@]} ; do
384                        sudo -i ifconfig $tap$i down ;
385                        sudo -i tunctl -d $tap$i ;
386                done
387                sudo -i ifconfig $bri down
388                sudo -i brctl delbr $bri
389                ;;
390esac
391-------------------------------------------------------------------------------
392
393Connect your Qemu instance to one of the tap devices, e.g.
394
395-------------------------------------------------------------------------------
396qemu-system-i386 -m 512 -boot a -cpu pentium3 \
397        -drive file=$HOME/qemu/pc386_fda,index=0,if=floppy,format=raw \
398        -drive file=fat:$HOME/qemu/hd,format=raw \
399        -net nic,model=e1000,macaddr=0e:b0:ba:5e:ba:11 \
400        -net tap,ifname=qtap1,script=no,downscript=no \
401        -nodefaults -nographic -serial stdio
402-------------------------------------------------------------------------------
403
404-------------------------------------------------------------------------------
405qemu-system-arm \
406        -serial null \
407        -serial mon:stdio \
408        -nographic \
409        -M xilinx-zynq-a9 \
410        -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:11 \
411        -net tap,ifname=qtap1,script=no,downscript=no \
412        -m 256M \
413        -kernel build/arm-rtems4.12-xilinx_zynq_a9_qemu/media01.exe
414-------------------------------------------------------------------------------
415
416Make sure that each Qemu instance uses its own MAC address to avoid an address
417conflict (or otherwise use it as a test).
418
419To connect the Qemu instances with your local network use the following
420(replace 'eth0' with the network interface of your host).
421
422-------------------------------------------------------------------------------
423ifconfig eth0 0.0.0.0
424brctl addif qbri eth0
425dhclient qbri
426-------------------------------------------------------------------------------
427
428=== VDE and QEMU
429
430On FreeBSD you can create VDE or the Virtual Distributed Ethernet to create a
431network environment that does not need to run qemu as root or needing to drop
432the tap's privileges to run qemu.
433
434VDE creates a software switch with a default of 32 ports which means a single
435kernel tap can support 32 qemu networking sessions.
436
437To use VDE you need to build qemu with VDE support. The RSB can detect a VDE
438plug and enable VDE support in qemu when building. On FreeBSD install the VDE
439support with:
440
441 # pkg install -u vde2
442
443Build qemu with the RSB.
444
445To network create a bridge and a tap. The network is 10.10.1.0/24. On FreeBSD
446add to your /etc/rc.conf:
447
448 cloned_interfaces="bridge0 tap0"
449 autobridge_interfaces="bridge0"
450 autobridge_bridge0="re0 tap0"
451 ifconfig_re0="up"
452 ifconfig_tap0="up"
453 ifconfig_bridge0="inet 10.1.1.2 netmask 255.255.255.0"
454 defaultrouter="10.10.1.1"
455
456Start the VDE switch as root:
457
458 # sysctl net.link.tap.user_open=1
459 # sysctl net.link.tap.up_on_open=1
460 # vde_switch -d -s /tmp/vde1 -M /tmp/mgmt1 -tap tap0 -m 660 --mgmtmode 660
461 # chmod 660 /dev/tap0
462
463You can connect to the VDE switch's management channel using:
464
465 $ vdeterm /tmp/mgmt1
466
467To run qemu:
468
469 $ qemu-system-arm \
470        -serial null \
471        -serial mon:stdio \
472        -nographic \
473        -M xilinx-zynq-a9 \
474        -net nic,model=cadence_gem,macaddr=0e:b0:ba:5e:ba:11 \
475        -net vde,id=vde0,sock=/tmp/vde1
476        -m 256M \
477        -kernel build/arm-rtems4.12-xilinx_zynq_a9_qemu/rcconf02.exe
478
479== Issues and TODO
480
481* PCI support on x86 uses a quick and dirty hack, see pci_reserve_map().
482
483* Priority queues are broken with clustered scheduling.
484
485* Per-CPU data should be enabled once the new stack is ready for SMP.
486
487* Per-CPU NETISR(9) should be enabled onece the new stack is ready for SMP.
488
489* Multiple routing tables are not supported.  Every FIB value is set to zero
490  (= BSD_DEFAULT_FIB).
491
492* Process identifiers are not supported.  Every PID value is set to zero
493  (= BSD_DEFAULT_PID).
494
495* User credentials are not supported.  The following functions allow the
496  operation for everyone
497  - prison_equal_ip4(),
498  - chgsbsize(),
499  - cr_cansee(),
500  - cr_canseesocket() and
501  - cr_canseeinpcb().
502
503* A basic USB functionality test that is known to work on Qemu is desirable.
504
505* Adapt generic IRQ PIC interface code to Simple Vectored Interrupt Model
506  so that those architectures can use new TCP/IP and USB code.
507
508* freebsd-userspace/rtems/include/sys/syslog.h is a copy from the old
509  RTEMS TCP/IP stack. For some reason, the __printflike markers do not
510  compile in this environment. We may want to use the FreeBSD syslog.h
511  and get this addressed.
512
513* in_cksum implementations for architectures not supported by FreeBSD.
514  This will require figuring out where to put implementations that do
515  not originate from FreeBSD and are populated via the script.
516
517* MAC support functions are not thread-safe ("freebsd/lib/libc/posix1e/mac.c").
518
519* IFCONFIG(8): IEEE80211 support is disabled.  This module depends on a XML
520  parser and mmap().
521
522* get_cyclecount(): The implementation is a security problem.
523
524* What to do with the priority parameter present in the FreeBSD synchronization
525  primitives and the thread creation functions?
526
527* TASKQUEUE(9): Support spin mutexes.
528
529* ZONE(9): Review allocator lock usage in rtems-bsd-chunk.c.
530
531* KQUEUE(2): Choose proper lock for global kqueue list.
532
533* TIMEOUT(9): Maybe use special task instead of timer server to call
534  callout_tick().
535
536* sysctl_handle_opaque(): Implement reliable snapshots.
537
538* PING6(8): What to do with SIGALARM?
539
540* <sys/param.h>: Update Newlib to use a MSIZE of 256.
541
542* BPF(4): Add support for zero-copy buffers.
543
544* UNIX(4): Fix race conditions in the area of socket object and file node
545  destruction.  Add support for file descriptor transmission via control
546  messages.
547
548* PRINTF(9): Add support for log(), the %D format specifier is missing in the
549  normal printf() family.
550
551* Why is the interrupt server used?  The BSD interrupt handlers can block on
552synchronization primitives like mutexes.  This is in contrast to RTEMS
553interrupt service routines.  The BSPs using the generic interrupt support must
554implement the `bsp_interrupt_vector_enable()` and
555`bsp_interrupt_vector_disable()` routines.  They normally enable/disable a
556particular interrupt source at the interrupt controller.  This can be used to
557implement the interrupt server.  The interrupt server is a task that wakes-up
558in case an associated interrupt happens.  The interrupt source is disabled in
559a generic interrupt handler that wakes-up the interrupt server task.   Once the
560postponed interrupt processing is performed in the interrupt server the
561interrupt source is enabled again.
562
563* Convert all BSP linkcmds to use a linkcmds.base so the sections are
564easier to insert.
565
566* NIC Device Drivers
567- Only common PCI NIC drivers have been included in the initial set. These
568do not include any system on chip or ISA drivers.
569- PCI configuration probe does not appear to happen to determine if a
570NIC is in I/O or memory space. We have worked around this by using a
571static hint to tell the fxp driver the correct mode. But this needs to
572be addressed.
573- The ISA drivers require more BSD infrastructure to be addressed. This was
574outside the scope of the initial porting effort.
575
576== FreeBSD Source
577
578You should be able to rely on FreebSD manual pages and documentation
579for details on the code itself.
580
581== BSD Library Source
582
583== Initialization of the BSD Library
584
585The initialization of the BSD library is based on the FreeBSD SYSINIT(9)
586infrastructure.  The key to initializing a system is to ensure that the desired
587device drivers are explicitly pulled into the linked application.  This plus
588linking against the BSD library (`libbsd.a`) will pull in the necessary FreeBSD
589infrastructure.
590
591The FreeBSD kernel is not a library like the RTEMS kernel.  It is a bunch of
592object files linked together.  If we have a library, then creating the
593executable is simple.  We begin with a start symbol and recursively resolve all
594references.  With a bunch of object files linked together we need a different
595mechanism.  Most object files don't know each other.  Lets say we have a driver
596module.  The rest of the system has no references to this driver module.  The
597driver module needs a way to tell the rest of the system: Hey, kernel I am
598here, please use my services!
599
600This registration of independent components is performed by SYSINIT(9) and
601specializations:
602
603http://www.freebsd.org/cgi/man.cgi?query=SYSINIT
604
605The SYSINIT(9) uses some global data structures that are placed in a certain
606section.  In the linker command file we need this:
607
608-------------------------------------------------------------------------------
609.rtemsroset : {
610        KEEP (*(SORT(.rtemsroset.*)))
611}
612
613.rtemsrwset : {
614        KEEP (*(SORT(.rtemsrwset.*)))
615}
616-------------------------------------------------------------------------------
617
618This results for example in this executable layout:
619
620-------------------------------------------------------------------------------
621[...]
622 *(SORT(.rtemsroset.*))
623 .rtemsroset.bsd.modmetadata_set.begin
624                0x000000000025fe00        0x0 libbsd.a(rtems-bsd-init.o)
625                0x000000000025fe00                _bsd__start_set_modmetadata_set
626 .rtemsroset.bsd.modmetadata_set.content
627                0x000000000025fe00        0x8 libbsd.a(rtems-bsd-nexus.o)
628 .rtemsroset.bsd.modmetadata_set.content
629                0x000000000025fe08        0x4 libbsd.a(kern_module.o)
630[...]
631 .rtemsroset.bsd.modmetadata_set.content
632                0x000000000025fe68        0x4 libbsd.a(mii.o)
633 .rtemsroset.bsd.modmetadata_set.content
634                0x000000000025fe6c        0x4 libbsd.a(mii_bitbang.o)
635 .rtemsroset.bsd.modmetadata_set.end
636                0x000000000025fe70        0x0 libbsd.a(rtems-bsd-init.o)
637                0x000000000025fe70                _bsd__stop_set_modmetadata_set
638[...]
639.rtemsrwset     0x000000000030bad0      0x290
640 *(SORT(.rtemsrwset.*))
641 .rtemsrwset.bsd.sysinit_set.begin
642                0x000000000030bad0        0x0 libbsd.a(rtems-bsd-init.o)
643                0x000000000030bad0                _bsd__start_set_sysinit_set
644 .rtemsrwset.bsd.sysinit_set.content
645                0x000000000030bad0        0x4 libbsd.a(rtems-bsd-nexus.o)
646 .rtemsrwset.bsd.sysinit_set.content
647                0x000000000030bad4        0x8 libbsd.a(rtems-bsd-thread.o)
648 .rtemsrwset.bsd.sysinit_set.content
649                0x000000000030badc        0x4 libbsd.a(init_main.o)
650[...]
651 .rtemsrwset.bsd.sysinit_set.content
652                0x000000000030bd54        0x4 libbsd.a(frag6.o)
653 .rtemsrwset.bsd.sysinit_set.content
654                0x000000000030bd58        0x8 libbsd.a(uipc_accf.o)
655 .rtemsrwset.bsd.sysinit_set.end
656                0x000000000030bd60        0x0 libbsd.a(rtems-bsd-init.o)
657                0x000000000030bd60                _bsd__stop_set_sysinit_set
658[...]
659-------------------------------------------------------------------------------
660
661Here you can see, that some global data structures are collected into
662continuous memory areas.  This memory area can be identified by start and stop
663symbols.  This constructs a table of uniform items.
664
665The low level FreeBSD code calls at some time during the initialization the
666mi_startup() function (machine independent startup).  This function will sort
667the SYSINIT(9) set and call handler functions which perform further
668initialization.  The last step is the scheduler invocation.
669
670The SYSINIT(9) routines are run in mi_startup() which is called by
671rtems_bsd_initialize().
672
673This is also explained in "The Design and Implementation of the FreeBSD
674Operating System" section 14.3 "Kernel Initialization".
675
676In RTEMS we have a library and not a bunch of object files.  Thus we need a way
677to pull-in the desired services out of the libbsd.  Here the
678`rtems-bsd-sysinit.h` comes into play.  The SYSINIT(9) macros have been
679modified and extended for RTEMS in `<sys/kernel.h>`:
680
681-------------------------------------------------------------------------------
682#ifndef __rtems__
683#define C_SYSINIT(uniquifier, subsystem, order, func, ident)    \
684        static struct sysinit uniquifier ## _sys_init = {       \
685                subsystem,                                      \
686                order,                                          \
687                func,                                           \
688                (ident)                                         \
689        };                                                      \
690        DATA_SET(sysinit_set,uniquifier ## _sys_init)
691#else /* __rtems__ */
692#define SYSINIT_ENTRY_NAME(uniquifier)                          \
693        _bsd_ ## uniquifier ## _sys_init
694#define SYSINIT_REFERENCE_NAME(uniquifier)                      \
695        _bsd_ ## uniquifier ## _sys_init_ref
696#define C_SYSINIT(uniquifier, subsystem, order, func, ident)    \
697        struct sysinit SYSINIT_ENTRY_NAME(uniquifier) = {       \
698                subsystem,                                      \
699                order,                                          \
700                func,                                           \
701                (ident)                                         \
702        };                                                      \
703        RWDATA_SET(sysinit_set,SYSINIT_ENTRY_NAME(uniquifier))
704#define SYSINIT_REFERENCE(uniquifier)                           \
705        extern struct sysinit SYSINIT_ENTRY_NAME(uniquifier);   \
706        static struct sysinit const * const                     \
707        SYSINIT_REFERENCE_NAME(uniquifier) __used               \
708        = &SYSINIT_ENTRY_NAME(uniquifier)
709#define SYSINIT_MODULE_REFERENCE(mod)                           \
710        SYSINIT_REFERENCE(mod ## module)
711#define SYSINIT_DRIVER_REFERENCE(driver, bus)                   \
712        SYSINIT_MODULE_REFERENCE(driver ## _ ## bus)
713#define SYSINIT_DOMAIN_REFERENCE(dom)                           \
714        SYSINIT_REFERENCE(domain_add_ ## dom)
715#endif /* __rtems__ */
716-------------------------------------------------------------------------------
717
718Here you see that the SYSINIT(9) entries are no longer static.  The
719\*_REFERENCE() macros will create references to the corresponding modules which
720are later resolved by the linker.  The application has to provide an object
721file with references to all required FreeBSD modules.
722
723The FreeBSD device model is quite elaborated (with follow-ups):
724
725http://www.freebsd.org/cgi/man.cgi?query=driver
726
727The devices form a tree with the Nexus device at a high-level.  This Nexus
728device is architecture specific in FreeBSD.  In RTEMS we have our own Nexus
729device, see `rtemsbsd/bsp/bsp-bsd-nexus-devices.c`.
730
731=== SYSCTL_NODE Example
732
733During development, we had an undefined reference to
734_bsd_sysctl__net_children that we had trouble tracking down. Thanks to
735Chris Johns, we located it. He explained how to read SYSCTL_NODE
736definitions. This line from freebsd/netinet/in_proto.c is attempting
737to add the "inet" node to the parent node "_net".
738
739----
740SYSCTL_NODE(_net,      PF_INET,         inet,   CTLFLAG_RW, 0,
741        "Internet Family");
742----
743
744Our problem was that we could not find where _bsd_sysctl__net_children
745was defined. Chris suggested that when in doubt compile with -save-temps
746and look at the preprocessed .i files. But he did not need that. He
747explained that this the symbol name _bsd_sysctl__net_children was
748automatically generated by a SYSCTL_NODE as follows:
749
750* _bsd_ - added by RTEMS modifications to SYSCTL_NODE macro
751* sysctl_ - boilerplace added by SYSCTL_NODE macro
752* "" - empty string for parent node
753* net - name of SYSCTL_NODE
754* children - added by SYSCTL macros
755
756This was all generated by a support macro declaring the node as this:
757
758----
759struct sysctl_oid_list SYSCTL_NODE_CHILDREN(parent, name);
760----
761
762Given this information, we located this SYSCTL_NODE declaration in
763kern/kern_mib.c
764
765----
766SYSCTL_NODE(, CTL_KERN,   kern,   CTLFLAG_RW, 0,
767        "High kernel, proc, limits &c");
768----
769
770== Core FreeBSD APIs and RTEMS Replacements ==
771
772=== SX(9) (Shared/exclusive locks) ===
773
774http://www.freebsd.org/cgi/man.cgi?query=sx
775
776Binary semaphores (this neglects the ability to allow shared access).
777
778=== MUTEX(9) (Mutual exclusion) ===
779
780http://www.freebsd.org/cgi/man.cgi?query=mutex
781
782Binary semaphores (not recursive mutexes are not supported this way).
783
784=== RWLOCK(9) (Reader/writer lock) ===
785
786http://www.freebsd.org/cgi/man.cgi?query=rwlock
787
788POSIX r/w lock.
789
790=== RMLOCK(9) (Reader/writer lock optimized for mostly read access patterns) ===
791
792Note:  This object was implemented as a wrapper for RWLOCK in the rm_lock header file.
793
794http://www.freebsd.org/cgi/man.cgi?query=rmlock
795
796POSIX r/w lock.
797
798=== CONDVAR(9) (Condition variables) ===
799
800http://www.freebsd.org/cgi/man.cgi?query=condvar
801
802POSIX condition variables with modifications (hack).
803
804=== CALLOUT(9) (Timer functions) ===
805
806http://www.freebsd.org/cgi/man.cgi?query=callout
807
808Timer server.
809
810=== TASKQUEUE(9) (Asynchronous task execution) ===
811
812http://www.freebsd.org/cgi/man.cgi?query=taskqueue
813
814TBD.
815
816=== KTHREAD(9), KPROC(9) (Tasks) ===
817
818http://www.freebsd.org/cgi/man.cgi?query=kthread
819
820http://www.freebsd.org/cgi/man.cgi?query=kproc
821
822Tasks.
823
824=== ZONE(9) (Zone allocator) ===
825
826http://www.freebsd.org/cgi/man.cgi?query=zone
827
828TBD.
829
830=== devfs (Device file system) ===
831
832There is a minimal implementation based on IMFS. The mount point is fixed to
833"/dev". Note that the devfs is only used by the cdev subsystem. cdev has been
834adapted so that the full path (including the leading "/dev") is given to devfs.
835This saves some copy operations.
836
837devfs_create() first creates the full path and then creates an IMFS generic node
838for the device.
839
840TBD: remove empty paths on devfs_destroy().
841
842=== psignal (Signals) ===
843
844TBD.  Seems to be not needed.
845
846=== poll, select ===
847
848TBD.  Seems to be not needed.
849
850=== RMAN(9) (Resource management) ===
851
852http://www.freebsd.org/cgi/man.cgi?query=rman
853
854TBD.  Seems to be not needed.
855
856=== DEVCLASS(9), DEVICE(9), DRIVER(9), MAKE_DEV(9) (Device management) ===
857
858http://www.freebsd.org/cgi/man.cgi?query=devclass
859
860http://www.freebsd.org/cgi/man.cgi?query=device
861
862http://www.freebsd.org/cgi/man.cgi?query=driver
863
864http://www.freebsd.org/cgi/man.cgi?query=make_dev
865
866Use FreeBSD implementation as far as possible.  FreeBSD has a nice API for
867dynamic device handling.  It may be interesting for RTEMS to use this API
868internally in the future.
869
870=== BUS_SPACE(9), BUS_DMA(9) (Bus and DMA access) ===
871
872http://www.freebsd.org/cgi/man.cgi?query=bus_space
873
874http://www.freebsd.org/cgi/man.cgi?query=bus_dma
875
876Likely BSP dependent.  A default implementation for memory mapped linear access
877is easy to provide.  The current heap implementation supports all properties
878demanded by bus_dma (including the boundary constraint).
879
880== RTEMS Replacements by File Description ==
881
882Note:  Files with a status of USB are used by the USB test and have at least
883been partially tested.  If they contain both USB and Nic, then they are used
884by both and MAY contain methods that have not been tested yet.  Files that
885are only used by the Nic test are the most suspect.
886
887----
888rtems-libbsd File:      rtems-bsd-assert.c
889FreeBSD File:           rtems-bsd-config.h redefines BSD_ASSERT.
890Description:            This file contains the support method rtems_bsd_assert_func().
891Status:                 USB, Nic
892
893rtems-libbsd File:      rtems-bsd-autoconf.c
894FreeBSD File:           FreeBSD has BSP specific autoconf.c
895Description:            This file contains configuration methods that are used to setup the system.
896Status:                 USB
897
898rtems-libbsd File:      rtems-bsd-bus-dma.c
899FreeBSD File:           FreeBSD has BSP specific busdma_machdep.c
900Description:
901Status:                 USB, Nic
902
903rtems-libbsd File:      rtems-bsd-bus-dma-mbuf.c
904FreeBSD File:           FreeBSD has BSP specific busdma_machdep.c
905Description:
906Status:                 Nic
907
908rtems-libbsd File:      rtems-bsd-callout.c
909FreeBSD File:           kern/kern_timeout.c
910Description:
911Status:                 USB, Nic
912
913rtems-libbsd File:      rtems-bsd-cam.c
914FreeBSD File:           cam/cam_sim.c
915Description:
916Status:                 USB
917
918rtems-libbsd File:      rtems-bsd-condvar.c
919FreeBSD File:           kern/kern_condvar.c
920Description:
921Status:                 USB
922
923rtems-libbsd File:      rtems-bsd-copyinout.c
924FreeBSD File:           bsp specific copyinout.c )
925Description:            Note: The FreeBSD file is split with some methods being in rtems-bsd-support
926Status:                 Nic
927
928rtems-libbsd File:      rtems-bsd-delay.c
929FreeBSD File:           bsp specific file with multiple names
930Description:
931Status:                 USB, Nic
932
933rtems-libbsd File:      rtems-bsd-descrip.c
934FreeBSD File:           kern/kern_descrip.c
935Description:
936Status:                 Nic
937
938rtems-libbsd File:      rtems-bsd-generic.c
939FreeBSD File:           kern/sys_generic.c
940Description:
941Status:                 Nic
942
943rtems-libbsd File:      rtems-bsd-init.c
944FreeBSD File:           N/A
945Description:
946Status:                 USB, Nic
947
948rtems-libbsd File:      rtems-bsd-init-with-irq.c
949FreeBSD File:           N/A
950Description:
951Status:                 USB, Nic
952
953rtems-libbsd File:      rtems-bsd-jail.c
954FreeBSD File:           kern/kern_jail.c
955Description:
956Status:                 USB, Nic
957
958rtems-libbsd File:      rtems-bsd-lock.c
959FreeBSD File:           kern/subr_lock.c
960Description:
961Status:                 USB, Nic
962
963rtems-libbsd File:      rtems-bsd-log.c
964FreeBSD File:           kern/subr_prf.c
965Description:
966Status:                 Nic
967
968rtems-libbsd File:      rtems-bsd-malloc.c
969FreeBSD File:           kern/kern_malloc.c
970Description:
971Status:                 USB, Nic
972
973rtems-libbsd File:      rtems-bsd-mutex.c
974FreeBSD File:           kern/kern_mutex.c
975Description:
976Status:                 USB, Nic
977
978rtems-libbsd File:      rtems-bsd-newproc.c
979FreeBSD File:           N/A
980Description:
981Status:                 Nic
982
983rtems-libbsd File:      rtems-bsd-nexus.c
984FreeBSD File:           bsp specific nexus.c
985Description:
986Status:                 USB
987
988rtems-libbsd File:      rtems-bsd-panic.c
989FreeBSD File:           boot/common/panic.c
990Description:
991Status:                 USB, Nic
992
993rtems-libbsd File:      rtems-bsd-rwlock.c
994FreeBSD File:           kern_rwlock.c
995Description:
996Status:                 USB, Nic
997
998rtems-libbsd File:      rtems-bsd-shell.c
999FreeBSD File:           N/A
1000Description:
1001Status:                 USB
1002
1003rtems-libbsd File:      rtems-bsd-signal.c
1004FreeBSD File:           kern/kern_sig.c
1005Description:
1006Status:                 Nic
1007
1008rtems-libbsd File:      rtems-bsd-smp.c
1009FreeBSD File:           N/A
1010Description:
1011Status:                 Nic
1012
1013rtems-libbsd File:      rtems-bsd-support.c
1014FreeBSD File:           bsp specific copyinout.c
1015Description:            Note: the FreeBSD file is split with some methods being in rtems-bsd-copyinout.
1016Status:                 USB, Nic
1017
1018rtems-libbsd File:      rtems-bsd-sx.c
1019FreeBSD File:           kern/kern_sx.c
1020Description:            Status: USB, Nic
1021
1022rtems-libbsd File:      rtems-bsd-synch.c
1023FreeBSD File:           kern/kern_synch.c
1024Description:
1025Status:                 USB, Nic
1026
1027rtems-libbsd File:      rtems-bsd-syscalls.c
1028FreeBSD File:           User API for kern/uipc_syscalls.c
1029Description:
1030Status:                 Nic
1031
1032rtems-libbsd File:      rtems-bsd-sysctlbyname.c
1033FreeBSD File:           User API for sysctlbyname(3)
1034Description:
1035Status:
1036
1037rtems-libbsd File:      rtems-bsd-sysctl.c
1038FreeBSD File:           User API for sysctl(8)
1039Description:
1040Status:
1041
1042rtems-libbsd File:      rtems-bsd-sysctlnametomib.c
1043FreeBSD File:           User API for sysctlnametomib
1044Description:
1045Status:
1046
1047rtems-libbsd File:      rtems-bsd-taskqueue.c
1048FreeBSD File:           kern/subr_taskqueue.c
1049Description:
1050Status:                 Nic
1051
1052rtems-libbsd File:      rtems-bsd-thread.c
1053FreeBSD File:           kern/kern_kthread.c
1054Description:
1055Status:                 USB, Nic
1056
1057rtems-libbsd File:      rtems-bsd-timeout.c
1058FreeBSD File:           kern/kern_timeout.c
1059Description:
1060Status:                 Nic
1061
1062rtems-libbsd File:      rtems-bsd-timesupport.c
1063FreeBSD File:           kern/kern_clock.c
1064Description:
1065Status:                 Nic
1066
1067rtems-libbsd File:      rtems-bsd-vm_glue.c
1068FreeBSD File:           vm/vm_glue.c
1069Description:
1070Status:                 USB, Nic
1071----
1072
1073== Notes by File ==
1074
1075altq_subr.c - Arbitrary choices were made in this file that RTEMS would
1076not support tsc frequency change.  Additionally, the clock frequency
1077for machclk_freq is always measured for RTEMS.
1078
1079conf.h - In order to add make_dev and destroy_dev, variables in the cdev
1080structure that were not being used were conditionally compiled out. The
1081capability of supporting children did not appear to be needed and was
1082not implemented in the rtems version of these routines.
1083
1084== NICs Status ==
1085
1086----
1087Driver                  Symbol                          Status
1088======                  ======                          ======
1089RealTek                 _bsd_re_pcimodule_sys_init      Links
1090EtherExpress            _bsd_fxp_pcimodule_sys_init     Links
1091DEC tulip               _bsd_dc_pcimodule_sys_init      Links
1092Broadcom BCM57xxx       _bsd_bce_pcimodule_sys_init     Links
1093Broadcom BCM4401        _bsd_bfe_pcimodule_sys_init     Links
1094Broadcom BCM570x        _bsd_bge_pcimodule_sys_init     Needs Symbols (A)
1095E1000 IGB               _bsd_igb_pcimodule_sys_init     Links
1096E1000 EM                _bsd_em_pcimodule_sys_init      Links
1097Cadence                 ?                               Links, works.
1098----
1099
1100To add a NIC edit rtemsbsd/include/bsp/nexus-devices.h and add the driver
1101reference to the architecture and/or BSP. For example to add the RealTek driver
1102add:
1103
1104SYSINIT_DRIVER_REFERENCE(re, pci);
1105
1106and to add the MII PHY driver add:
1107
1108SYSINIT_DRIVER_REFERENCE(rge, miibus);
1109
1110The PC BSP has these entries.
1111
1112Symbols (A)
1113         pci_get_vpd_ident
1114
1115=== Cadence ===
1116
1117The cadence driver works on the Xilinx Zynq platform. The hardware checksum
1118support works on real hardware but does not seem to be supported on qemu
1119therefore the default state is to disable TXCSUM and RXCSUM and this can be
1120enabled from the shell with:
1121
1122  # ifconfig cgem0 rxcsum txcsum
1123
1124or with an ioctl call to the network interface driver with SIOCSIFCAP and the
1125mask IFCAP_TXCSUM and IFCAP_RXCSUM set.
1126
1127== PF (Firewall) ==
1128
1129It is possible to use PF as a firewall. See
1130[https://www.freebsd.org/doc/handbook/firewalls-pf.html] for details on the
1131range of functions and for how to configure the firewall.
1132
1133The following is necessary to use PF on RTEMS:
1134
1135- You have to provide a +/etc/pf.os+ file. The firewall can use it for passive
1136  OS fingerprinting. If you don't want to use this feature, the file may contain
1137  nothing except a line of comment (for example "# empty").
1138
1139- If some filters use protocol names (like tcp or udp) you have to provide a
1140  +/etc/protocols+ file.
1141
1142- If some filters use service names (like ssh or http) you have to provide a
1143  +/etc/services+ file.
1144
1145- Create a rule file (normally +/etc/pf.conf+). See the FreeBSD manual for the
1146  syntax.
1147
1148- Load the rule file using the pfctl command and enable pf. Please note that the
1149  pfctl command needs a lot of stack. You should use at least
1150  RTEMS_MINIMUM_STACK_SIZE + 8192 Bytes of stack. An example initialisation can
1151  look like follows:
1152
1153----
1154        int exit_code;
1155        char *params[] = {
1156                "pfctl",
1157                "-f",
1158                "/etc/pf.conf",
1159                "-e",
1160                NULL
1161        };
1162
1163        exit_code = rtems_bsd_command_pfctl(ARGC(params), params);
1164        assert(exit_code == EXIT_SUCCSESS);
1165----
1166
1167=== Known restrictions ===
1168
1169- Currently PF on RTEMS always uses the configuration for memory restricted
1170  systems (on FreeBSD that means systems with less than 100 MB RAM). This is
1171  fixed in +pfctl_init_options()+.
1172
1173== Wireless Network (WLAN) ==
1174
1175The libbsd provides a basic support for WLAN. Note that currently this support
1176is still in an early state. The following gives a rough overview over the
1177necessary steps to connect to an encrypted network with an RTL8188EU based WiFi
1178dongle:
1179
1180- Reference all necessary module for your BSP. For some BSPs this is already
1181  done in the nexus-devices.h:
1182
1183----
1184        SYSINIT_MODULE_REFERENCE(wlan_ratectl_none);
1185        SYSINIT_MODULE_REFERENCE(wlan_sta);
1186        SYSINIT_MODULE_REFERENCE(wlan_amrr);
1187        SYSINIT_MODULE_REFERENCE(wlan_wep);
1188        SYSINIT_MODULE_REFERENCE(wlan_tkip);
1189        SYSINIT_MODULE_REFERENCE(wlan_ccmp);
1190        SYSINIT_DRIVER_REFERENCE(rtwn_usb, uhub);
1191        SYSINIT_REFERENCE(rtwn_rtl8188eufw);
1192----
1193
1194- Create your wlan device using ifconfig:
1195  +ifconfig wlan0 create wlandev rtwn0 up+
1196
1197- Start a wpa_supplicant instance for that device:
1198  + wpa_supplicant_fork -Dbsd -iwlan0 -c/media/mmcsd-0-0/wpa_supplicant.conf+
1199
1200Note that the wpa_supplicant will only be active till the device goes down. A
1201workaround is to just restart it every time it exits.
1202
1203=== Known restrictions ===
1204
1205- The network interface (e.g. wlan0) is currently not automatically created. It
1206  would be nice, if some service would create it as soon as for example a USB
1207  device is connected. In FreeBSD the names are assigned via rc.conf with lines
1208  like +wlans_rtwn0="wlan0"+.
1209
1210- wpa_supplicant hast to be started after the device is created. It has to be
1211  restarted every time the connection goes down. Instead of this behaviour,
1212  there should be some service that starts and restarts wpa_supplicant
1213  automatically if a interface is ready. Probably the dhcpcd hooks could be used
1214  for that.
1215
1216- The current wpa_supplicant implementation is protected with a lock so it can't
1217  be started more than one time. If multiple interface should be used, all have
1218  to be handled by that single instance. That makes it hard to add interfaces
1219  dynamically. wpa_supplicant should be reviewed thoroughly whether multiple
1220  instances could be started in parallel.
1221
1222- The control interface of wpa_supplicant most likely doesn't work. The wpa_cli
1223  application is not ported.
1224
1225== Problems to report to FreeBSD ==
1226
1227The MMAP_NOT_AVAILABLE define is inverted on its usage.  When it is
1228defined the mmap method is called. Additionally, it is not used
1229thoroughly. It is not used in the unmap portion of the source.
1230The file rec_open.c uses the define MMAP_NOT_AVAILABLE to wrap
1231the call to mmap and file rec_close.c uses the munmap method.
Note: See TracBrowser for help on using the repository browser.