/etc for win32, continued

djberg96 on 2003-08-28T18:52:27

I've been diligently working on porting the /etc functions to the win32 platform. I've started with a Ruby version for now. Don't worry - when (if?) I've settled on the code, I'll submit it for Perl as well (it's mainly C).

Today I released sys-win32etc. The major change is that you can do lookups against a remote server instead of a local machine. Unfortunately, I have no way to test this - help wanted.

About the only *bad* news is that the memory leaks have gotten worse. I have no idea why. Not to panic, though - it doesn't matter unless you plan on calling these functions in a continuous loop (for whatever odd reason). Still, I'd like to nail them down.

Another issue - Ruby's Etc module doesn't support the 'set' side of the house (setgrent, sethostent, etc). But I really have to wonder how often anyone uses these functions anyway. I have *never* seen them used anywhere, and I suspect most admins would rather perform their functionality manually rather than programatically. That being said, they *could* be supported on Win32 as well.


Umm...

jhi on 2003-08-28T20:35:38

Another issue - Ruby's Etc module doesn't support the 'set' side of the house (setgrent, sethostent, etc). But I really have to wonder how often anyone uses these functions anyway. I have *never* seen them used anywhere, and I suspect most admins would rather perform their functionality manually rather than programatically. That being said, they *could* be supported on Win32 as well.

I have this nagging feeling that you have misunderstood the "'set' side"... it has nothing to do with setting entries.

Re:Umm...

djberg96 on 2003-08-28T21:39:21

Oh, you're right. That's what I get for not reading the docs. :-P

Okay, now that I've actually looked at the docs for sethostent and setgrent....they're just like setprotoent which I *do* remember now.

My guess was that they're some holdover from 20 years ago when holding a pointer in the middle of a file was an attempt to gain speed/efficiency while reading the file. Given the size of the files being read from (usually around 10-100k), I cannot fathom what use they are nowadays, or for the last 10 years for that matter.

What am I missing?

Re:Umm...

jhi on 2003-08-29T08:06:08

Regardless of their origin, you will have to implement them if you want to support them :-) Yes, for modern PC implementations you will probably want to suck in the whatever database to memory and then iterate over that on your own. Remember, however, that PCs with gigabytes of memory are not all the systems out there.

Re:Umm...

djberg96 on 2003-09-04T19:56:31

Um, what? Who has gigabytes worth of /etc/passwd or /etc/group entries?

Anyway, unless someone can demonstrate some critical piece of code (or *any* code for that matter) that actually uses sethostent() or setgrent(), I am officially declaring them *worthless*.