* SPLINT: sys_open missing a parameter in init/main.c
@ 2002-04-28 21:15 Riley Williams
2002-04-28 22:32 ` Christoph Plattner
2002-04-29 0:11 ` Alan Cox
0 siblings, 2 replies; 4+ messages in thread
From: Riley Williams @ 2002-04-28 21:15 UTC (permalink / raw)
To: Harry Kalogirou; +Cc: Linux 8086
Hi Harry.
The funtion sys_open is defined with three parameters...
int sys_open(char *filename, int flags, int mode);
...but in init/main.c it is called with only two parameters...
#ifdef CONFIG_CONSOLE_SERIAL
num = sys_open("/dev/ttyS0", 2);
#else
num = sys_open("/dev/tty1", 2);
#endif
...and I haven't the foggiest how to correct this. Can somebody rather
more knowledgable than I am advise regarding this please?
Best wishes from Riley.
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SPLINT: sys_open missing a parameter in init/main.c
2002-04-28 21:15 SPLINT: sys_open missing a parameter in init/main.c Riley Williams
@ 2002-04-28 22:32 ` Christoph Plattner
2002-04-29 0:11 ` Alan Cox
1 sibling, 0 replies; 4+ messages in thread
From: Christoph Plattner @ 2002-04-28 22:32 UTC (permalink / raw)
To: Riley Williams; +Cc: Harry Kalogirou, Linux 8086
In the standard the "mode" argument is optional. It is only used
together
with O_CREAT as flag to define the file mode (see UNIX command chmod,
etc).
It is not a "beautiful" way, but this usage works. The third parameter
is not defined at call, and if O_CREAT is not used, this argument with
the not define value is not read.
A correct implementation is done by using the va_args ! A C-method to
pass variable amount of arguments. See for example printf(), how it is
implemented !
With friendly regards
Christoph P.
Riley Williams wrote:
>
> Hi Harry.
>
> The funtion sys_open is defined with three parameters...
>
> int sys_open(char *filename, int flags, int mode);
>
> ...but in init/main.c it is called with only two parameters...
>
> #ifdef CONFIG_CONSOLE_SERIAL
> num = sys_open("/dev/ttyS0", 2);
> #else
> num = sys_open("/dev/tty1", 2);
> #endif
>
> ...and I haven't the foggiest how to correct this. Can somebody rather
> more knowledgable than I am advise regarding this please?
>
> Best wishes from Riley.
>
> -
> To unsubscribe from this list: send the line "unsubscribe linux-8086" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
--
-------------------------------------------------------
private: christoph.plattner@gmx.at
company: christoph.plattner@alcatel.at
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SPLINT: sys_open missing a parameter in init/main.c
2002-04-28 21:15 SPLINT: sys_open missing a parameter in init/main.c Riley Williams
2002-04-28 22:32 ` Christoph Plattner
@ 2002-04-29 0:11 ` Alan Cox
2002-04-29 21:20 ` Riley Williams
1 sibling, 1 reply; 4+ messages in thread
From: Alan Cox @ 2002-04-29 0:11 UTC (permalink / raw)
To: Riley; +Cc: Harry Kalogirou, Linux 8086
> The funtion sys_open is defined with three parameters...
> int sys_open(char *filename, int flags, int mode);
>
> ...but in init/main.c it is called with only two parameters...
Thats sort of fine. The third parameter is optional in open() syscalls and
is the mode for creation. Historically ancient unix had creat() and no
3 argument open.
> ...and I haven't the foggiest how to correct this. Can somebody rather
> more knowledgable than I am advise regarding this please?
Stuff a ",0" on the end - its not needed but its good for correctness and
portability
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: SPLINT: sys_open missing a parameter in init/main.c
2002-04-29 0:11 ` Alan Cox
@ 2002-04-29 21:20 ` Riley Williams
0 siblings, 0 replies; 4+ messages in thread
From: Riley Williams @ 2002-04-29 21:20 UTC (permalink / raw)
To: Alan Cox; +Cc: Harry Kalogirou, Linux 8086
Hi Alan.
>> The funtion sys_open is defined with three parameters...
>>
>> int sys_open(char *filename, int flags, int mode);
>>
>> ...but in init/main.c it is called with only two parameters...
> Thats sort of fine. The third parameter is optional in open()
> syscalls and is the mode for creation. Historically ancient unix
> had creat() and no 3 argument open.
Ah...
>> ...and I haven't the foggiest how to correct this. Can somebody
>> rather more knowledgable than I am advise regarding this please?
> Stuff a ",0" on the end - its not needed but its good for
> correctness and portability
Many thanks. I've now done that in init/main.c and committed the
result, so that file (and, therefore, that directory) is now clean
as far as `splint -weak` is concerned.
Best wishes from Riley.
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2002-04-29 21:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2002-04-28 21:15 SPLINT: sys_open missing a parameter in init/main.c Riley Williams
2002-04-28 22:32 ` Christoph Plattner
2002-04-29 0:11 ` Alan Cox
2002-04-29 21:20 ` Riley Williams
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox