Thursday, January 20, 2011

Day 1 - nginx does http and mail

First look at nginx internals. Guess what? I tar xvzfed it, of course.
And looked at it. First reaction : pretty cool, simple structure, not too many files. What the heck, I've been doing this for 15 years, I can handle this...


Hey, the thing has a mail directory : probably means it can do a mailer job. Better or worse than qmail and/or postfix. I don't care : that's not what I'm here for.


Moving forward directly to the http part. It has modules. It has a core/nginx.c : probably where the main thing is. Looking at it. Yeah, it's here. Something is missing, though : comments. No worries, it's just main, function names are pretty explicit : I can understand. If I had written it, I probably wouldn't have commented it myself.

The cycle thing looks interesting. Looking at core/ngx_cycle.c. This is getting serious. Probably too serious for now. I'll have to look at it later, when I have a better understanding of the big picture. Still no comments. I'm starting to think "you'd better get used to this".

Looking at the hierarchy... http/modules/... A ssi_filter thingie. Very promising for what I want to do. Opening http/modules/ngx_http_ssi_filter_module.c. Trying to figure out what is there. Missing the big picture. Still no comments. Three files, no comments. Now, I'm sure I won't get much help from here. I guess I really entered the community : UTSL is one of the open-source trademarks. At least you can read the source. This is better than not being allowed to. Proprietary source might be a bit more documented, but not always, trust me... And at least, here, I won't have misleading comments of a developer who understood neither the need nor what he did.

Anyway, going back to the main thing... Aside from the command array, the various inits and the configurations/options handling, the ngx_single_process_cycle and ngx_master_process_cycle are clearly the next steps in my exploration. Just have to find them. Let's grep, baby.

And here you go : src/os/unix/ngx_process_cycle. Wasn't expecting to get OS specific this early. Maybe I'm wrong and this is not OS specific but the hierarchy definitely gives an hint in this direction. It starts with an impressive list of sigaddset. Well, this is what nginx is supposed to be all about : signal handling, events, etc. Not too surprised here. Trying to man sigaddset : "No manual entry for sigaddset". Stupid me : my machine doesn't even have developer tools (gcc/make), let alone libraries documentations. I guess we'll continue this after I'm done with a bunch of yum install...

1 comment: