Why does Windows have a Unix-style etc/hosts?

4

2

Why does Windows have %systemroot%/system32/drivers/etc/hosts, as opposed to something more "Windowsy"? It feels like a relic from the BSD derivative Windows got some bits from eons ago. Is this purely a compatibility thing?

Foritus

Posted 2011-11-08T23:29:29.093

Reputation: 59

Question was closed 2011-11-09T18:08:07.847

Unix (and Linux) is a great system that works very well. Implementing things like /etc/hosts is a good idea because it's beautifully simple and extremely effective. Perhaps a developer at Microsoft decided to copy this concept instead of re-inventing the wheel. – Randolf Richardson – 2011-11-08T23:34:47.573

Answers

6

Yes it arrived with Microsoft's adoption of TCP/IP based on the BSD sockets API as implemented according to the WinSock spec.

Winsock follows the Windows Open System Architecture (WOSA) model; it defines a standard service provider interface (SPI) between the application programming interface (API), with its exported functions and the protocol stacks. It uses the sockets paradigm that was first popularized by Berkeley Software Distribution (BSD) UNIX. It was later adapted for Windows in Windows Sockets 1.1

http://msdn.microsoft.com/en-us/library/windows/desktop/ms740673(v=vs.85).aspx

Compatible as in

A local text file in the same format as the 4.3 Berkeley Software Distribution (BSD) UNIX \etc\hosts file.

http://technet.microsoft.com/en-us/library/bb727005.aspx


One version of the story is here

RedGrittyBrick

Posted 2011-11-08T23:29:29.093

Reputation: 70 632

That's far more reasonable than expected. Thanks :) – Foritus – 2011-11-08T23:45:09.700

1@David: The /etc/hosts format is UNIX-style; a simple list of "address hostname [aliases]" entries. The one described in RFC 952 is way more complex. – user1686 – 2011-11-09T00:47:22.333

1And now I was expecting an Old New Thing post I haven't read yet. . . – surfasb – 2011-11-09T03:04:10.510

@surfasb: Yeah Chen's blog is always worth reading. However " 'A question about the windows networking system...' - I have no idea.", he wasn't involved in everything.

– RedGrittyBrick – 2011-11-09T09:54:05.903

1@RedGrittyBrick: As always, we forget that he's still human, and you know, didn't write Windows himself. – surfasb – 2011-11-09T17:50:44.640