buglwIP - A Lightweight TCP/IP stack - Bugs: bug #26121, Ability to retain per-thread...

 
 

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

bug #26121: Ability to retain per-thread socket error

Submitted by:  Zhenwei Chu <blackfin>
Submitted on:  Wed 08 Apr 2009 07:59:59 PM UTC  
 
Category:  None Severity:  3 - Normal
Item Group:  Change Request Status:  Fixed
Privacy:  Public Assigned to:  Simon Goldschmidt <goldsimon>
Open/Closed:  Closed Planned Release:  None
lwIP version:  1.3.0

Wed 15 Apr 2009 02:33:37 PM UTC, comment #4: 

Checked in like in comment #1

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 15 Apr 2009 12:45:18 PM UTC, comment #3: 

Yes.Works for us. Thanks Simon.

Srinivas Gollakota <gollakota>
Thu 09 Apr 2009 02:55:25 PM UTC, comment #2: 

I'd be happy with Simon's suggestion.  Zhenwei: would that meet your needs? 

Kieran Mansley <kieranm>
Project Member
Wed 08 Apr 2009 08:46:34 PM UTC, comment #1: 

A better way (and more lwip-like) would be to change

#ifdef ERRNO
#define set_errno(err) errno = (err)
#else
#define set_errno(err)
#endif

to

#ifdef ERRNO
#ifndef set_errno
#define set_errno(err) errno = (err)
#endif
#else
#define set_errno(err)
#endif

That way you could define set_errno to whatever you like. You won't have a chance to get totally port-dependent things like your set_thread_errno into the main lwip source.

Simon Goldschmidt <goldsimon>
Project AdministratorIn charge of this item.
Wed 08 Apr 2009 07:59:59 PM UTC, original submission:  

In a multi-threaded lwIP application multiple threads can issue high level socket API calls. By default global errno is used to save the last error. Some operating systems allow thread local storage that is thread specific which can be used to store the error values. We have extended the sock_set_errno(sk,e) macro to set the thread specific error as below. The new set_thread_sock_err(e) sets the socket error in the thread local storage.

Files Changed:
In api\sockets.c, line 158

From:
#define sock_set_errno(sk, e) do { \
      sk->err = (e); \
      set_errno(sk->err); \
} while (0)

To:
void set_thread_sock_err(int);
#define sock_set_errno(sk, e) do { \
      sk->err = (e); \
      set_errno(sk->err); \
      set_thread_sock_err(e);\
} while (0)

#ifndef ERRNO /* NOT ERRNO */
// For multithreaded environments error is set per thread.
void set_thread_sock_err(int err)
{
ker_set_lasterror(err);
}
#endif

Zhenwei Chu <blackfin>

 

No files currently attached

 

Depends on the following items: None found

Items that depend on this one: None found

 

Carbon-Copy List
  • -email is unavailable- added by gollakota (Posted a comment)
  • -email is unavailable- added by kieranm (Posted a comment)
  • -email is unavailable- added by goldsimon (Posted a comment)
  • -email is unavailable- added by blackfin (Submitted the item)
  •  

    Do you think this task is very important?
    If so, you can add your encouragement to it.
    This task has 0 encouragements so far.

    Only logged-in users can vote.

     

     

     

    Follow 3 latest changes.

    Date Changed by Updated Field Previous Value => Replaced by
    2009-04-15 goldsimon StatusNone => Fixed
        Assigned toNone => goldsimon
        Open/ClosedOpen => Closed

    Back to the top


    Powered by Savane 3.5