[ofa-general] Re: [PATCH V2 1/3] Create a new library libibnetdisc

Ira Weiny weiny2 at llnl.gov
Tue Dec 23 15:54:11 PST 2008


On Tue, 23 Dec 2008 15:43:46 -0800
Roland Dreier <rdreier at cisco.com> wrote:

>  > Also that is in the test code (libibnetdisc/test/iblinkinfotest.c).  The real
>  > iblinkinfo has them all declared static.
>  > 
>  > void
>  > print_port(ibnd_node_t *node, ibnd_port_t *port)
>  > {
>  > 	static char remote_guid_str[256];
>  > 	static char remote_str[256];
> 
> so this function is not thread-safe.... This seems to be setting an
> unnecessary booby-trap; is there a reason not to put these variables on
> the stack?

Just what Sean mentioned.

There are actually 2 print_port functions in the 3 patches which were sent.
One is in a prototype tool called iblinkinfotest which was left in the library
directory and optionally built for testing.  The other is in a single threaded
tool which uses the library maintained in the official src dir of
infiniband_diags.  _Neither_ function _is_ part of the library and both are in
single threaded tools.

Ira




More information about the general mailing list