4 ms·
This has nothing to do with the naming conflict.
by cschep 17y ago
This has nothing to do with the naming conflict.
- wooster 17y ago'Ken Thompson was once asked what he would do differently if he were redesigning the UNIX system. His reply: "I'd spell creat with an e."' http://en.wikiquote.org/wiki/Kenneth_Thompson#Attributed http://en.wikiquote.org/wiki/Kenneth_Thompson#Attributed
- allenbrunson 17y agoi read somewhere that one of the early machines that unix ran on, maybe one of the pdp series, had a five-character limit on function names, which was the reason for 'creat'. or maybe a five-character limit on filenames? i'm not able to google up any supporting evidence at the moment, so i'm open to refutations or support.
- jacquesm 17y agoUnlink is 6 characters, so is rename, geteuid and getppid are 7...
- allenbrunson 17y agounlink() could have come a lot later, or been at a different level of abstraction, etc. i'm really sure i read this, so i just made another attempt to find the original source. the closest i could get was this man page for tmpnam: "Many applications prefer their temporary files to have certain favorite initial letter sequences in their names. Use the pfx argument for this. This argument may be NULL or point to a string of up to five characters to be used as the first few characters of the temporary-file name." http://www.phy.ohiou.edu/cgi-bin/man-cgi.sol?tmpnam+3S http://www.phy.ohiou.edu/cgi-bin/man-cgi.sol?tmpnam+3S ... which is a bit dubious, i admit, but just might point to a five-character file limit at one point in the murky past.
- jacquesm 17y agoIn some of the older version of the PDP assembler the symbols could be any length, but only the first 6 characters were significant, so you'd better make sure that your first 6 chars are unique. I don't see any reason to mix filenames and symbol length in any language though.
- allenbrunson 17y agothe one time i was poking around in the source files for the C standard library, the implementation for a given function was always in a similarly-named source file. printf() was in printf.c, and so on. so let's say you're implementing unix on a machine that has a five-character filename limit, and you want to follow that rule. creat.c is going to implement creat(). that would explain why he now thinks it's a mistake: he could have implemented create() in creat.c, but chose convention over forward-thinking.
- cpr 17y agoI'm pretty sure Unix even in its most primitive forms never had a 5-character filename limit. It might have been 8 initially, but not less than that.
- allenbrunson 17y agoyeah, i admit, i'm kind of reaching. i am sure i read a story about where the original limitation came from, i just can't remember the details. maybe it had something to do with kernel functions versus library functions? creat(), read(), write(), etc were all part of the early unix kernel, and were accessed via call gate or syscall or something, whereas printf() and friends were part of a library, and didn't require a trip into kernel-land, and therefore weren't under the same restrictions. something like that.
- cpr 17y agoYes, and I believe in early versions of Unix, system calls were prefixed by a _, so _creat was at the limit. (From vague memories of a pre-release version of Unix that showed up at Harvard in the mid-70's before it was even officially released to universities by Bell Labs.)
- pbhjpbhj 17y agoThe Google-fu is strong with this one ... although a 2002 mailing list entry is hardly great supporting evidence: I think he is thinking of the five-character limit in the original linker(s) used to develop Unix (which very well may have come from Multics). That five-character limit gave us the infamous creat(2) system call. http://www.mail-archive.com/gnhlug-discuss@mail.gnhlug.org/msg00372.html http://www.mail-archive.com/gnhlug-discuss@mail.gnhlug.org/m... Most other references to 5 char limit are about Tekken or the MS Windows Start button.
- cpr 17y agoThis might have been (see my other comment) a technical limitation at the time, but it also might have simply been the nature of Unix. Remember that Unix was created in response to a disastrous dis-engagement that Bell Labs had just had from the Multics project, where source-code and file-name verbosity was the rule of the day, and I imagine one of the disaffections involved was the absolute baroqueness of the Multics naming conventions. (E.g., random source code example of the Multics sources: http://web.mit.edu/multics-history/source/Multics/ldd/system_library_languages/source/bound_alm_.s.archive http://web.mit.edu/multics-history/source/Multics/ldd/system... .) So when you're using library and program names all day that are terse by design (ln, ls, awk, ed, etc.), "create" looks positively sesquipedalian.
- Semiapies 17y agoMind, that code example there seems pretty readable.