[openib-general] win related [was: Re: [PATCH 1/2] opensm: sigusr1: syslog() fixes]

Yevgeny Kliteynik kliteyn at dev.mellanox.co.il
Tue Jan 9 23:47:36 PST 2007


Hi Sasha,

Sasha Khapyorsky wrote:
> Hi Yevgeny,
> 
> On 12:05 Tue 09 Jan     , Yevgeny Kliteynik wrote:
>> Hi Sasha.
>> Thanks for spotting this issue - I missed it when I reviewed the patch.
>> Here's how things look in windows:
>>  * openlog() and closelog() are redefined to nothing in windows config header
>>  * cl_log_event() implementation on windows does all the work - gets handler
>>    to event log, logs the message, and closes the handler.
>>    It does *not* uses syslog().
>>
>> To use syslog/sysopen/sysclose on windows, a user have to install some 
>> package (e.g. "Interix") that provides various daemons (such as syslogd), 
>> similar to Linux/Unix:
>> 	http://msdn2.microsoft.com/en-us/library/ms811897.aspx#ucmgch10_topic12
>> 	http://www.interix.com/
> 
> And this is not done for WinOpenSM now. Is this would be useful option? I
> guess this could solve a lot of compatibility problems and simplify the
> porting dramatically, right?

I'll address this question to the windows guys. But I seriously doubt that
they would want to make OSM depend on some third-party product, whether it
is commercial or free.
 
>> So replacing cl_log_event() with syslog() would definitely cause a problem.
>>
>> A (pretty ugly) solution can be writing a wrapper function to cl_log_event() 
>> on windows and redefining syslog() to use this wrapper.
> 
> Like #define syslog() cl_log_event() ? Not so ugly (better than
> combination of openlog()/closelog() and "unrelated" cl_log_event()),
> and perfectly simple IMO.

"#define syslog() cl_log_event()" will not do the job, since these functions 
have different definitios:
	syslog(int priority, char *message, ...);
	cl_log_event(char*, cl_log_type_t, char*, void*, uint32_t);
so there should be wrapper just for windows that will prepare the message
for cl_log_event() as a single string.
 
>> But the question is: why do we need this replacement in the first place?
> 
> Look at the original Ira's patch for details - there syslog() is
> introduced and closelog() is removed from cl_event_log(). I think his
> motivation is to keep syslog connected for log reopening events and
> prevent noisy openlog()/closelog() calls in cl_log_event().

Agree.

--Yevgeny
 
>>> replacement itself is needed in order to restore complib's cl_log_event()
>>> behavior used by various applications (like ibutils ones and others).
>> What behavior are we talking about here?
> 
> OTOH closelog() is needed than openlog()/syslog()/closelog() is part
> shared library (look "Submitting Syslog Messages" at 'info libc' ).
> 
> Sasha
> 




More information about the general mailing list