dmy (01/12/83)
Is it true that in 4.2 the "open" command will take three arguments? Won't this break virtually every program? If so, why not simply have the kernel call be Open (or opEN or whatever) with open, creat, etc. defined in terms of it (macro, subroutine, hard wired, whichever is best). It is only rarely necessary and desirable to cause the sky to fall. --dmy-- (David Yablon, decvax!harpo!seismo!dmy)
emrath (01/14/83)
#R:seismo:-19600:uiucdcs:13700017:000:1011 uiucdcs!emrath Jan 14 04:35:00 1983 It shouldn't break anything on a vax. C function calls generate a "CALLS" vax instruction which pushes the actual number of arguments on the stack, which is computed by the C compiler. The "RET" instruction automatically pops the correct number of arguments. The kernel must examine this value on the stack (normal C functions can't easily get at it) in order to determine if it is a 2 or 3 argument open call. An assembler routine can also get at the number of args and a C function could do: func(arg1,arg2,...) { int numargs; ... numargs = *((int *)&arg1 - 1); ... which is kind of gross and very machine & implementation dependent. I don't know about other machines and implementations. I imagine there are those where the number of arguments is not a hidden argument to the called function. For these, a possible solution is to allow new modes of say 4,5 & 6 to indicate that a third argument is present (whatever is it). If this is done, very few programs should break (only those that deserve to!).
edwards (01/15/83)
#R:seismo:-19600:uicsovax:5500057:000:48 uicsovax!edwards Jan 14 21:53:00 1983 That's how printf works! It hasn't broken yet!
dmmartindale (01/16/83)
Actually, the value pushed onto the stack during a VAX CALLS instruction is the number of longwords of arguments pushed, which isn't always equal to the number of arguments - doubles are two longwords, structures are arbitrary size, etc.