Fourteen. A Bell Labs Unix directory entry was 16 bytes: a 2-byte inode number followed by the file name. You read the directory by opening it as a file and reading it as an array of these.
It wasn't until 4BSD/SunOS and System V needed multi-filesystem support that this was changed and what became the POSIX struct dirent replaced it.
char sa_data[14];
in struct sockaddr.And, the 14 character limit in old unix was for individual path components, whereas unix domain sockets contain complete paths, so the 14 character limit was never relevant for unix domain socket addresses.
char sa_data[];
So thanks for that! However, I don't think your suggestion as to the reasoning passes muster; (1) the socket interface originated in BSD, where longer filenames already existed, and (2) for AF_UNIX sockets, the data is the full path including directories, not just the base filename.My guess is that sockaddr was originally defined as 16 bytes (2 bytes type, 14 bytes data) just because someone thought it was a nice round number, and that GNU and other systems have kept the "14" to establish a minimum size for the struct, and that in order to avoid breaking historical code that uses sockaddr instead of sockaddr_storage.
https://github.com/dspinellis/unix-history-repo/commit/3573c...
And we have a better clue as to why: there was a separate "sockaddri" that allowed for indirect references for address sizes > 14 bytes.
So the sa_data[14] comes from 16 bytes being the maximum amount of data that Bill Joy was willing to pass around by value instead of by reference.
(Actually, that was probably modeled after the older `struct in_addr`, but the headers for that are missing--so I can't tell. Perhaps it was a design decision carried forward from someone else; perhaps someone from BBN?)
Of course this was also problematic in that it could make some DOS software incompatible with earlier 8086-based hardware.
We were using SCCS, and when we would check in foo.c it would become s.foo.c
Then trying to build with make, it wouldn't find some file or wouldn't apply a c compile rule and nothing would work.
Turns out xenix had a filename length limitation (I don't recall exactly, but maybe 12 or 15 characters?)
So files like longfilename.c would hit the length limitatation and when checked into sccs would become s.longfilename. and truncate away the filetype. and since it wasn't a c file anymore...
But I do remember it was an operating system that might actually use protected mode and extra memory of the 286 - without EMS or XMS shenanigans that came to the dos world.
A lot of early PC & DOS development was shackled by silly limitations. You couldn't write a program that didn't do all kinds of checks to make sure you didn't use more than 64k because of the real mode segmented memory. Same with filenames, or linking+overlays or any number of things.
We take all that stuff for granted now. I write scripts that read an entire file into memory, do things and write it back out. Those things were a real headache back then.