News for hackers. Stuff that matters.
Re:A bit of XENIX history (2014) by m463 on Wednesday April 07, 2021 @12:09PM (#26726947)
I just remember using xenix, and the trouble we had porting some software to run on it.

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.

Re:A bit of XENIX history (2014) by ajross on Wednesday April 07, 2021 @01:51PM (#26728351)
> Turns out xenix had a filename length limitation (I don't recall exactly, but maybe 12 or 15 characters?)

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.

Re:A bit of XENIX history (2014) by anyfoo on Wednesday April 07, 2021 @02:21PM (#26728818)
I got into Linux just when the ext fs became a thing. Or maybe it was ext2 already, but in any case, there were a lot of remnants of when it used the Minix filesystem, which as I recall was limited to 14 characters as well.
Re:A bit of XENIX history (2014) by kazinator on Wednesday April 07, 2021 @06:24PM (#26732258)
This fourteen could be related to the

  char sa_data[14];
in struct sockaddr.
Re:A bit of XENIX history (2014) by fanf2 on Wednesday April 07, 2021 @09:20PM (#26733943)
No, sa_data is a minimum size, not a maximum. For unix domain sockets you should look at the definition of sockaddr_un which has char sun_path[104]; but again, that's a minimum reserved size and if you allocate a larger size you can use sockets with longer names.

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.

Re:A bit of XENIX history (2014) by ajross on Wednesday April 07, 2021 @06:44PM (#26732490)
Likely, but the causality goes the other way. Sockets arrived in 4.2BSD on Sun and VAX, well after the world's attention had moved away from PDP-11 Unix.
Re:A bit of XENIX history (2014) by kazinator on Wednesday April 07, 2021 @08:11PM (#26733325)
That's what I mean; because AF_UNIX sockets are in the file namespace, the 14 is filename-sized.
Re:A bit of XENIX history (2014) by LukeShu on Wednesday April 07, 2021 @09:41PM (#26734090)
Hah! I'd never noticed that it was actually defined that way on many systems (including GNU); POSIX says it should be declared as

    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.

Re:A bit of XENIX history (2014) by LukeShu on Thursday April 08, 2021 @12:39AM (#26735144)
Looks like "someone" was Bill Joy in November 1981:

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?)

Re:A bit of XENIX history (2014) by Taniwha on Wednesday April 07, 2021 @02:12PM (#26728673)
s.* files were how SCCS worked, the filename limits were also how Unix V7 worked - most people understood this at the time and used small names
Re:A bit of XENIX history (2014) by tyingq on Wednesday April 07, 2021 @05:50PM (#26731838)
I would guess there was a wave of folks that started using the extra room when 4BSD was released, and forgetting their peers on Xenix, Unix V7, etc. I remember some popular software (rrn or trn maybe?) had a file called environment.sh in it that got truncated with SCCS on some unix limited to 14 chars.
Re:A bit of XENIX history (2014) by zozbot234 on Wednesday April 07, 2021 @05:53PM (#26731874)
DOS programs could run in protected mode by using a DOS extender. There were also quasi-standard interfaces that enabled programs so written to interoperate with environments that might use protected mode for their own operation and run DOS programs in VM86 mode. This support could also be extended to TSR's (background services) or device drivers.

Of course this was also problematic in that it could make some DOS software incompatible with earlier 8086-based hardware.