patchlwIP - A Lightweight TCP/IP stack - Patches: patch #9010, Build unix port under Darwin

 
 

You are not allowed to post comments on this tracker with your current authentication level.

patch #9010: Build unix port under Darwin

Submitter:  Brian Armstrong <brian_armstrong>
Submitted:  Tue 24 May 2016 07:48:55 PM UTC
   
 
Category:  Platform ports Priority:  3 - Low
Status:  Done Privacy:  Public
Assigned to:  None Open/Closed:  Closed
Planned Release:  None

Wed 25 May 2016 07:21:52 PM UTC, comment #5: 

Applied with a few modifications. Thanks!

Dirk Ziegelmeier <dziegel>
Group administrator
Wed 25 May 2016 10:55:50 AM UTC, comment #4: 

You can't detect the presence of a header file while compiling. That would require some kind of automake thing, and we don't want to make the unix example port too complicated.

You can't use the absence of CLOCK_MONOTONIC to say you're running on Darwin! Instead, is there a define to detect it? I know there is one for cygwin and for linux...

As to the pthread function, I have no idea how to explicitly detect which function to call... Making it depend on Darwin/not Darwin (to me) seems enough for the use case of an example project.

And yes, I'd be willing to add that change. Unless auto-detection is implemented, you can just change the makefile to say you're compiling for darwin instead of linux (as is the case for BSD - I wonder if that's still working or if we broke it)

Simon Goldschmidt <goldsimon>
Group administrator
Wed 25 May 2016 07:43:38 AM UTC, comment #3: 

Also, rather than explicitly detect Darwin, I wonder if it would be simpler to just detect the presence of `<mach/mach.h>` and `pthread_cond_timedwait_relative_np` (and the lack of CLOCK_MONOTONIC)

Brian Armstrong <brian_armstrong>
Wed 25 May 2016 07:37:54 AM UTC, comment #2: 

Ah, sure, that's not a portable change.

Aside from the build fix needed, would you accept this patch? I'd be happy to fix up the Darwin detection issue if that's the only blocker for this patch. I try not to make changes to build systems unless necessary :)

Brian Armstrong <brian_armstrong>
Wed 25 May 2016 07:27:27 AM UTC, comment #1: 

Ehrm, you're right that it's questionable: making this depend on the existence of "CLOCK_MONOTONIC" as a define is certainly wrong. You can't expect you're on Darwin just because this define is missing.

The way to go would be to define the correct "LWIP_UNIX_*" define (see Common.mk). However, this is not really implemented in a clean way (I'd expect to switch sub-defines depending on this so this define is only checked in a central place). And sadly, the correct architecture is not detected automatically.

You could adde a define "LWIP_UNIX_DARWIN" if you want...

Simon Goldschmidt <goldsimon>
Group administrator
Tue 24 May 2016 07:48:55 PM UTC, original submission:  

Ok, I have one more patch of questionable value for lwIP :)

It looks like the unix port for lwIP mostly works on darwin, except for the lack of CLOCK_MONOTONIC and the ability to use `pthread_condattr_setclock`. This patch got me running with darwin's `pthread_cond_timedwait_relative_np`.

Cheers

Brian Armstrong <brian_armstrong>

 

(Note: upload size limit is set to 16384 kB, after insertion of the required escape characters.)

Attached Files
file #37252:  patch.txt added by brian_armstrong (3KiB - text/plain)

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by dziegel (Posted a comment)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by brian_armstrong (Submitted the item)
  •  

    There are 0 votes so far. Votes easily highlight which items people would like to see resolved in priority, independently of the priority of the item set by tracker managers.

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2016-05-25 dziegel StatusNone Done
        Open/ClosedOpen Closed
    2016-05-24 brian_armstrong Attached File- Added patch.txt, #37252

    Back to the top

    Powered by Savane 3.13-02a9.
    Corresponding source code