On 03/13/2013 01:33 PM, Roger Massey wrote:
> Hi Alan,
>
> Brief responses to your comments, mine in red.
[Not sure if the mailing list will preserve the HTML for "red" text -
nor if everyone can see it - but I can - at least for now]
> One thing that's important -- I use this call to test to see if the
> process exists without terminating it as well. Will this API be able to
> do this?
> > +int __declspec(dllimport) __stdcall TerminateProcess(void *
> > hProcess,unsigned int uExitCode);
>
> We need to think about all the code that involves multiple processes and
> how to do that on windows. Replacement logic for the discovery agent bash
> scripts is needed. The background/foreground stuff as well.
For the daemonizing code - it only needs to know if a process with that
process ID exists. We can encapsulate that in a more abstract function.
However, regarding the somewhat related topic of multiple processes and
discovery on Windows...
I'm sure I didn't get everything right - but I did think about it and
used the glib functions that claim that they work in windows too. I
avoided pipes, and just read a file after process termination. There
are all kinds of language issues (VB script, C#, etc) and pathname
issues that I didn't deal with, but I did at least give it _some_ thought.
Jeff Mayrand has similar interests. He asked me for an explanation of
the architecture. Guess I should do that.
> How do you log in Windows? We ought to provide a syslog replacement
> which interfaces with the Windows syslog capability - not just throwing
> things out to stdout/stderr...
>
> I have forgotten the calls for the windows logging capability, I'll
> look into it.
Thanks!
> I take it you can't have a variable the same as a function in MS C?
> > {
> This should also be HAVE_SIGACTION - which we can test. Some really old
> versions of UNIX don't have sigaction (although they're pretty old...)
>
> I am not sure the limited windows notion of signals is robust enough
> for your needs. It needs more thought.
I really only _need_ to be told to shut down (SIGTERM). Everything else
(SIGUSR1, SIGUSR2, etc) is optional (although nice).
I wouldn't call UNIX signals robust - there is a very limited number of
things you can do while handling a signal. All we do is set a flag
saying to handle it in the event loop. If I can detect that someone
asked us to shut down, and set a flag for the event loop - then that's
robust enough.
> > + #define W_CNAME_SIZE 1026
> > + {
> > + char cname[W_CNAME_SIZE + 2] = "";
> > + DWORD lsize = W_CNAME_SIZE;
> > + GetComputerName(cname, &lsize);
> > + sysname = g_strdup(cname);
> > + }
> > + //rhm
> > +#endif
> We should do something prettier for this than using uname raw. Create a
> function which has two versions - probably? I didn't see anything in
> glib for this -- too bad :-(
> Put these two versions in the misc.c file... proj_get_sysname() or
> assim_get_sysname() or something...
>
> Definitely need to make a proj_get_sysname() function as noted before...
>
> I will look at what you have done and try to duplicate it for windows.
You had the right code in the patch shown above, but I decided I wanted
you to show as the author, and also I have no good way to test it.
> > +// the checks for these are not working in winxp
> We need to figure out why and fix it. Cmake seems to be more designed
> more for Windows than UNIX systems - it ought to work... My guess is we
> need to tell it how to find the glib libraries ${GLIB2_LIBRARIES} or
> something. Can you research this some more?
>
> I can look into this more. The link line needed a library c.lib. I
> doubt linux of windows has a c.lib.
Did you add the 'c', or did I? [What is "linux of windows"? ]
>
> >
> Not quite sure I understand the WINIMPORT vs WINEXPORT. Can you explain
> it to those of us who are windows impaired?
>
> If a dll is where the code for a function resides it exports the
> function name.
> If code calls a function in another dll it imports the function name.
>
Thanks Roger!
--
Alan Robertson <[email protected]> - @OSSAlanR
"Openness is the foundation and preservative of friendship... Let me claim
from you at all times your undisguised opinions." - William Wilberforce
_______________________________________________
Assimilation mailing list - Discovery-Driven Monitoring
[email protected]
http://lists.community.tummy.com/cgi-bin/mailman/listinfo/assimilation
http://assimmon.org/