From: Chris Johns <chr...@rtems.org> --- freebsd/contrib/ptpd/src/dep/constants_dep.h | 5 +++-- freebsd/contrib/ptpd/src/dep/net.c | 7 ++++++- freebsd/contrib/ptpd/src/dep/ptpd_dep.h | 8 ++++++++ freebsd/contrib/ptpd/src/dep/startup.c | 2 ++ freebsd/contrib/ptpd/src/dep/sys.c | 7 ++++++- 5 files changed, 25 insertions(+), 4 deletions(-)
diff --git a/freebsd/contrib/ptpd/src/dep/constants_dep.h b/freebsd/contrib/ptpd/src/dep/constants_dep.h index ad0f39f6..2aaad49d 100644 --- a/freebsd/contrib/ptpd/src/dep/constants_dep.h +++ b/freebsd/contrib/ptpd/src/dep/constants_dep.h @@ -16,7 +16,8 @@ /* platform dependent */ #if !defined(linux) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \ - !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__sun) && !defined(__QNXNTO__) + !defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__sun) && !defined(__QNXNTO__) && \ + !defined(__rtems__) #error PTPD hasn't been ported to this OS - should be possible \ if it's POSIX compatible, if you succeed, report it to ptpd-de...@sourceforge.net #endif @@ -34,7 +35,7 @@ if it's POSIX compatible, if you succeed, report it to ptpd-de...@sourceforge.ne #define octet ether_addr_octet #endif /* linux */ -#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun) || defined(__QNXNTO__) +#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun) || defined(__QNXNTO__) || defined(__rtems__) # include <sys/types.h> # include <sys/socket.h> #ifdef HAVE_SYS_SOCKIO_H diff --git a/freebsd/contrib/ptpd/src/dep/net.c b/freebsd/contrib/ptpd/src/dep/net.c index 7e185728..86db9b83 100644 --- a/freebsd/contrib/ptpd/src/dep/net.c +++ b/freebsd/contrib/ptpd/src/dep/net.c @@ -1208,7 +1208,12 @@ netInit(NetPath * netPath, RunTimeOpts * rtOpts, PtpClock * ptpClock) */ if(rtOpts->ipMode == IPMODE_UNICAST || - rtOpts->ignore_daemon_lock) { +#ifdef __rtems__ + FALSE +#else + rtOpts->ignore_daemon_lock +#endif + ) { addr.sin_addr = netPath->interfaceAddr; } else { addr.sin_addr.s_addr = htonl(INADDR_ANY); diff --git a/freebsd/contrib/ptpd/src/dep/ptpd_dep.h b/freebsd/contrib/ptpd/src/dep/ptpd_dep.h index 10663afb..e0bcdf11 100644 --- a/freebsd/contrib/ptpd/src/dep/ptpd_dep.h +++ b/freebsd/contrib/ptpd/src/dep/ptpd_dep.h @@ -14,6 +14,10 @@ #define PTPD_DBGV #endif +#ifdef __rtems__ +#include <errno.h> +#endif /* __rtems__ */ + /** \name System messages*/ /**\{*/ @@ -31,7 +35,11 @@ #define ALERT(x, ...) logMessage(LOG_ALERT, x, ##__VA_ARGS__) #define CRITICAL(x, ...) logMessage(LOG_CRIT, x, ##__VA_ARGS__) #define ERROR(x, ...) logMessage(LOG_ERR, x, ##__VA_ARGS__) +#ifdef __rtems__ +#define PERROR(x, ...) logMessage(LOG_ERR, x " (strerror: %s)\n", ##__VA_ARGS__, strerror(errno)) +#else /* __rtems__ */ #define PERROR(x, ...) logMessage(LOG_ERR, x " (strerror: %m)\n", ##__VA_ARGS__) +#endif /* __rtems__ */ #define WARNING(x, ...) logMessage(LOG_WARNING, x, ##__VA_ARGS__) #define NOTIFY(x, ...) logMessage(LOG_NOTICE, x, ##__VA_ARGS__) #define NOTICE(x, ...) logMessage(LOG_NOTICE, x, ##__VA_ARGS__) diff --git a/freebsd/contrib/ptpd/src/dep/startup.c b/freebsd/contrib/ptpd/src/dep/startup.c index a9011736..97231d99 100644 --- a/freebsd/contrib/ptpd/src/dep/startup.c +++ b/freebsd/contrib/ptpd/src/dep/startup.c @@ -679,7 +679,9 @@ ptpdStartup(int argc, char **argv, Integer16 * ret, RunTimeOpts * rtOpts) * this was not the case for log files. This adds consistency * and allows to use FILE* vs. fds everywhere */ +#ifndef __rtems__ umask(~DEFAULT_FILE_PERMS); +#endif /* __rtems__ */ /* get some entropy in... */ getTime(&tmpTime); diff --git a/freebsd/contrib/ptpd/src/dep/sys.c b/freebsd/contrib/ptpd/src/dep/sys.c index 31553b84..bf459a62 100644 --- a/freebsd/contrib/ptpd/src/dep/sys.c +++ b/freebsd/contrib/ptpd/src/dep/sys.c @@ -390,8 +390,13 @@ int writeMessage(FILE* destination, uint32_t *lastHash, int priority, const char gettimeofday(&now, 0); strftime(time_str, MAXTIMESTR, "%F %X", localtime((time_t*)&now.tv_sec)); fprintf(destination, "%s.%06d ", time_str, (int)now.tv_usec ); +#ifndef __rtems__ fprintf(destination,PTPD_PROGNAME"[%d].%s (%-9s ", (int)getpid(), startupInProgress ? "startup" : rtOpts.ifaceName, +#else /* __rtems__ */ + fprintf(destination,PTPD_PROGNAME"[%08x].%s (%-9s ", + rtems_task_self(), startupInProgress ? "startup" : rtOpts.ifaceName, +#endif /* __rtems__ */ priority == LOG_EMERG ? "emergency)" : priority == LOG_ALERT ? "alert)" : priority == LOG_CRIT ? "critical)" : @@ -2627,7 +2632,7 @@ int setCpuAffinity(int cpu) { #endif -#ifdef HAVE_SYS_CPUSET_H +#if defined(HAVE_SYS_CPUSET_H) && !defined(__rtems__) cpuset_t mask; CPU_ZERO(&mask); if(cpu >= 0) { -- 2.25.1 _______________________________________________ devel mailing list devel@rtems.org http://lists.rtems.org/mailman/listinfo/devel