<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8" /></head><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Hallo Mritunjay,</p>
<p>You can't just take the github ptpd sources and make them work in RTEMS. You have to make some configuration<br />and sources changes before you can build the with the rsb.</p>
<p>Some things like the sys/cpuset.h seems not to be fully compatible yet and so the configure simply makes<br />"wrong" decisions. E.g. defines HAVE_SYS_CPUSET_H = 1 as sys/cpuset.h exists.I played a little bit with it and reset<br />the definition in ptpd-master/src/ptpd.h  (quick and dirty) and could reduce the error messages because there is a query for<br />this variable in the code (src/dep/sys.c):</p>
<p>in ptpd.h after the include of the created configs :</p>
<p>...<br />#ifdef HAVE_CONFIG_H<br /># include <config.h><br />#endif /* HAVE_CONFIG_H */</p>
<p>#undef HAVE_NTP_GETTIME<br />#undef HAVE_SYS_CPUSET_H</p>
<p>#ifdef linux<br />...</p>
<p>in src/dep/sys.c </p>
<p>...<br /><span>#ifdef HAVE_SYS_CPUSET_H                                                                                                                                                      <br />       cpuset_t mask;                                                                                                                                                        <br />       CPU_ZERO(&mask);                                                                                                                                                      <br />       if(cpu >= 0) {                                                                                                                                                        <br />           CPU_SET(cpu,&mask);                                                                                                                                               <br />       } else {                                                                                                                                                              <br />               int i;                                                                                                                                                        <br />               for(i = 0;  i < CPU_SETSIZE; i++) {                                                                                                                           <br />                       CPU_SET(i, &mask);                                                                                                                                    <br />               }                                                                                                                                                             <br />       }                                                                                                                                                                     <br />       return(cpuset_setaffinity(CPU_LEVEL_WHICH, CPU_WHICH_PID,                                                                                                             <br />                             -1, sizeof(mask), &mask));                                                                                                                      <br />#endif /* HAVE_SYS_CPUSET_H */   <br /></span></p>
<p>In src/dep/constants_dep.h  one can find:</p>
<p>* platform dependent */</p>
<p>#if !defined(linux) && !defined(__NetBSD__) && !defined(__FreeBSD__) && \<br />!defined(__APPLE__) && !defined(__OpenBSD__) && !defined(__sun) && !defined(__QNXNTO__)<br />#error PTPD hasn't been ported to this OS - should be possible \<br />if it's POSIX compatible, if you succeed, report it to ptpd-devel@sourceforge.net<br />#endif</p>
<p>here I added "&& !defined(__rtems__) </p>
<p>and here:<br /><span style="font-size: 10pt;">...                                                                                                                                                                            <br /></span><span>#if defined(__NetBSD__) || defined(__FreeBSD__) || defined(__APPLE__) || defined(__OpenBSD__) || defined(__sun) || defined(__QNXNTO__) || defined(__rtems__)                  <br /># include <sys/types.h>                                                                                                                                                       <br /># include <sys/socket.h>                                                                                                                                                      <br />#ifdef HAVE_SYS_SOCKIO_H                                                                                                                                                      <br />#include <sys/sockio.h>                                                                                                                                                       <br />#endif /* HAVE_SYS_SOCKIO_H */                                                                                                                                                <br /># include <netinet/in.h>                                                                                                                                                      <br /># include <net/if.h>                                                                                                                                                          <br /># include <net/if_dl.h>                                                                                                                                                       <br /># include <net/if_types.h>                                                                                                                                                    <br />#ifdef HAVE_NET_IF_ETHER_H                                                                                                                                                    <br />#  include <net/if_ether.h><br />...</span></p>
<p><span>and so on... You'd have to bite through it once and then you will surely get it compiled.      <br /></span></p>
<p>HTH Heinz</p>
<p><br /></p>
<p><br /></p>
<p id="reply-intro">On 2020-06-04 20:29, Mritunjay Sharma wrote:</p>
<blockquote type="cite" style="padding: 0 0.4em; border-left: #1010ff 2px solid; margin: 0">
<div id="replybody1">
<div dir="ltr">
<div dir="ltr"> </div>
<br />
<div class="v1gmail_quote">
<div class="v1gmail_attr" dir="ltr">On Thu, Jun 4, 2020 at 11:07 PM Sebastian Huber <<a href="mailto:sebastian.huber@embedded-brains.de" rel="noreferrer">sebastian.huber@embedded-brains.de</a>> wrote:</div>
<blockquote class="v1gmail_quote" style="margin: 0px 0px 0px 0.8ex; border-left: 1px solid #cccccc; padding-left: 1ex;">On 04/06/2020 16:22, Gedare Bloom wrote:<br /><br />>>> In the github version this code is conditional on sys/cpuset.h being present.<br />>>><br />> Well, we do have a sys/cpuset.h in newlib. It doesn't have these BSD<br />> definitions though. Probably either:<br />> 1. Add more stuff to sys/cpuset.h to make it support BSDisms. This<br />> would mean adding cpuset_setaffinity support in rtems, I guess.<br />> 2. Figure out how to disable the conditional code using the<br />> cpuset_setaffinity function.<br />The <sys/cpuset.h> is already as compatible as possible to glibc and <br />FreeBSD. There is always room for improvement, however, in this area it <br />will be difficult.</blockquote>
<div> </div>
<div>Please it would be kind of you all to guide on what is the best thing I can do next. It is looking</div>
<div>a little difficult. If something similar has been done earlier, sharing it can be a lot helpful to take a cue. </div>
<div> </div>
<div>Mritunjay</div>
</div>
</div>
</div>
<br />
<div class="pre" style="margin: 0; padding: 0; font-family: monospace">_______________________________________________<br />devel mailing list<br /><a href="mailto:devel@rtems.org">devel@rtems.org</a><br /><a href="http://lists.rtems.org/mailman/listinfo/devel" target="_blank" rel="noopener noreferrer">http://lists.rtems.org/mailman/listinfo/devel</a></div>
</blockquote>
<p><br /></p>

</body></html>