On 16/06/15 05:21, Chris Johns wrote:
Module:    rtems-libbsd
Branch:    master
Commit:    affed5e3f586860e2fd97445eaa20674dc4bcd25
Changeset: 
http://git.rtems.org/rtems-libbsd/commit/?id=affed5e3f586860e2fd97445eaa20674dc4bcd25

Author:    Chris Johns <chr...@rtems.org>
Date:      Tue Jun 16 13:20:15 2015 +1000

Add BDS command support headers.

---

  freebsd/contrib/tcpdump/tcpdump.c | 6 ++++--
  1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/freebsd/contrib/tcpdump/tcpdump.c 
b/freebsd/contrib/tcpdump/tcpdump.c
index 32ffb45..00e44db 100644
--- a/freebsd/contrib/tcpdump/tcpdump.c
+++ b/freebsd/contrib/tcpdump/tcpdump.c
@@ -55,6 +55,8 @@ static const char rcsid[] _U_ =
  #define __need_getopt_newlib
  #include <getopt.h>
  #define setpriority(a, b, c)
+#include <machine/rtems-bsd-program.h>
+#include <machine/rtems-bsd-commands.h>

Every RTEMS specific change should be in #ifdef __rtems__ sections. This is very helpful if you have to review files. This is missing in a couple of files.

There is not much documentation, but at least this is in libbsd.txt:

=== Rules for Modifying FreeBSD Source

Only add lines.  Subtract code by added `#ifndef __rtems__`.  This makes
merging easier in the future.  For example:

-------------------------------------------------------------------------------
/* Global variables for the kernel. */

#ifndef __rtems__
/* 1.1 */
extern char kernelname[MAXPATHLEN];
#endif /* __rtems__ */

extern int tick;            /* usec per tick (1000000 / hz) */
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
#if defined(_KERNEL) || defined(_WANT_FILE)
#ifdef __rtems__
#include <rtems/libio_.h>
#include <sys/fcntl.h>
#endif /* __rtems__ */
/*
 * Kernel descriptor table.
 * One entry for each open kernel vnode and socket.
 *
 * Below is the list of locks that protects members in struct file.
 *
 * (f) protected with mtx_lock(mtx_pool_find(fp))
 * (d) cdevpriv_mtx
 * none    not locked
 */
-------------------------------------------------------------------------------

-------------------------------------------------------------------------------
extern int profprocs;            /* number of process's profiling */
#ifndef __rtems__
extern volatile int ticks;
#else /* __rtems__ */
#include <rtems/score/watchdogimpl.h>
#define ticks _Watchdog_Ticks_since_boot
#endif /* __rtems__ */

#endif /* _KERNEL */
-------------------------------------------------------------------------------

Add nothing (even blank lines) before or after the `__rtems__` guards. Always
include a `__rtems__` in the guards to make searches easy.



--
Sebastian Huber, embedded brains GmbH

Address : Dornierstr. 4, D-82178 Puchheim, Germany
Phone   : +49 89 189 47 41-16
Fax     : +49 89 189 47 41-09
E-Mail  : sebastian.hu...@embedded-brains.de
PGP     : Public key available on request.

Diese Nachricht ist keine geschäftliche Mitteilung im Sinne des EHUG.

_______________________________________________
devel mailing list
devel@rtems.org
http://lists.rtems.org/mailman/listinfo/devel

Reply via email to