* [LTP] [PATCH] syscalls: getdtablesize01 fix for missing /etc/hosts
@ 2010-06-08 12:32 monstr
0 siblings, 0 replies; 4+ messages in thread
From: monstr @ 2010-06-08 12:32 UTC (permalink / raw)
To: ltp-list; +Cc: Michal Simek, michal.simek
From: Michal Simek <monstr@monstr.eu>
Embedded systems doesn't need to contain /etc/hosts that's why
will be good to create it if doesn't exist. If file doesn't exist
then syscall test failed.
Error:
getdtablesize01 0 TINFO : Maximum number of files a process can have opened is 1024
getdtablesize01 0 TINFO : Checking with the value returned by getrlimit...RLIMIT_NOFILE
getdtablesize01 1 TPASS : got correct dtablesize, value is 1024
getdtablesize01 0 TINFO : Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1
Opened file num -1
getdtablesize01 2 TFAIL : 0 != 1023
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
.../syscalls/getdtablesize/getdtablesize01.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
index a495501..568e1ad 100644
--- a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
+++ b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
@@ -83,7 +83,7 @@ int main()
tst_resm(TINFO,
"Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1");
for (loop = 1; loop <= max_val_opfiles; loop++) {
- fd = open("/etc/hosts", O_RDONLY);
+ fd = open("/etc/hosts", O_RDONLY | O_CREAT);
#ifdef DEBUG
printf("Opened file num %d\n", fd);
#endif
--
1.5.5.6
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread
* [LTP] [PATCH] syscalls: getdtablesize01 fix for missing /etc/hosts
@ 2010-06-08 12:46 monstr
2010-06-08 16:21 ` Garrett Cooper
0 siblings, 1 reply; 4+ messages in thread
From: monstr @ 2010-06-08 12:46 UTC (permalink / raw)
To: ltp-list; +Cc: Michal Simek, michal.simek
From: Michal Simek <monstr@monstr.eu>
Embedded systems doesn't need to contain /etc/hosts that's why
will be good to create it if doesn't exist. If file doesn't exist
then syscall test failed.
Error:
getdtablesize01 0 TINFO : Maximum number of files a process can have opened is 1024
getdtablesize01 0 TINFO : Checking with the value returned by getrlimit...RLIMIT_NOFILE
getdtablesize01 1 TPASS : got correct dtablesize, value is 1024
getdtablesize01 0 TINFO : Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1
Opened file num -1
getdtablesize01 2 TFAIL : 0 != 1023
Signed-off-by: Michal Simek <monstr@monstr.eu>
---
.../syscalls/getdtablesize/getdtablesize01.c | 2 +-
1 files changed, 1 insertions(+), 1 deletions(-)
diff --git a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
index a495501..568e1ad 100644
--- a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
+++ b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
@@ -83,7 +83,7 @@ int main()
tst_resm(TINFO,
"Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1");
for (loop = 1; loop <= max_val_opfiles; loop++) {
- fd = open("/etc/hosts", O_RDONLY);
+ fd = open("/etc/hosts", O_RDONLY | O_CREAT);
#ifdef DEBUG
printf("Opened file num %d\n", fd);
#endif
--
1.5.5.6
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] syscalls: getdtablesize01 fix for missing /etc/hosts
2010-06-08 12:46 [LTP] [PATCH] syscalls: getdtablesize01 fix for missing /etc/hosts monstr
@ 2010-06-08 16:21 ` Garrett Cooper
2010-06-08 16:54 ` Michal Simek
0 siblings, 1 reply; 4+ messages in thread
From: Garrett Cooper @ 2010-06-08 16:21 UTC (permalink / raw)
To: monstr; +Cc: ltp-list, michal.simek
On Tue, Jun 8, 2010 at 5:46 AM, <monstr@monstr.eu> wrote:
> From: Michal Simek <monstr@monstr.eu>
>
> Embedded systems doesn't need to contain /etc/hosts that's why
> will be good to create it if doesn't exist. If file doesn't exist
> then syscall test failed.
>
> Error:
> getdtablesize01 0 TINFO : Maximum number of files a process can have opened is 1024
> getdtablesize01 0 TINFO : Checking with the value returned by getrlimit...RLIMIT_NOFILE
> getdtablesize01 1 TPASS : got correct dtablesize, value is 1024
> getdtablesize01 0 TINFO : Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1
> Opened file num -1
> getdtablesize01 2 TFAIL : 0 != 1023
>
> Signed-off-by: Michal Simek <monstr@monstr.eu>
> ---
> .../syscalls/getdtablesize/getdtablesize01.c | 2 +-
> 1 files changed, 1 insertions(+), 1 deletions(-)
>
> diff --git a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
> index a495501..568e1ad 100644
> --- a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
> +++ b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
> @@ -83,7 +83,7 @@ int main()
> tst_resm(TINFO,
> "Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1");
> for (loop = 1; loop <= max_val_opfiles; loop++) {
> - fd = open("/etc/hosts", O_RDONLY);
> + fd = open("/etc/hosts", O_RDONLY | O_CREAT);
> #ifdef DEBUG
> printf("Opened file num %d\n", fd);
> #endif
No. You need to fix your embedded system to have all of the files on
it before you try and run LTP. This would regress all sane Linux
systems running LTP because the file already exists.
I agree that this assumption is broken though; it might be better to
use a different file, like via mkstemp(3).
Also, leaking file descriptors is silly if getdtablesize(2) is busted,
or the OS fails to clean up all of the open file descriptors... it
should cache the opened filehandles if != -1, then close each of them
one by one.
Thanks,
-Garrett
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [LTP] [PATCH] syscalls: getdtablesize01 fix for missing /etc/hosts
2010-06-08 16:21 ` Garrett Cooper
@ 2010-06-08 16:54 ` Michal Simek
0 siblings, 0 replies; 4+ messages in thread
From: Michal Simek @ 2010-06-08 16:54 UTC (permalink / raw)
To: Garrett Cooper; +Cc: ltp-list, michal.simek
Garrett Cooper wrote:
> On Tue, Jun 8, 2010 at 5:46 AM, <monstr@monstr.eu> wrote:
>> From: Michal Simek <monstr@monstr.eu>
>>
>> Embedded systems doesn't need to contain /etc/hosts that's why
>> will be good to create it if doesn't exist. If file doesn't exist
>> then syscall test failed.
>>
>> Error:
>> getdtablesize01 0 TINFO : Maximum number of files a process can have opened is 1024
>> getdtablesize01 0 TINFO : Checking with the value returned by getrlimit...RLIMIT_NOFILE
>> getdtablesize01 1 TPASS : got correct dtablesize, value is 1024
>> getdtablesize01 0 TINFO : Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1
>> Opened file num -1
>> getdtablesize01 2 TFAIL : 0 != 1023
>>
>> Signed-off-by: Michal Simek <monstr@monstr.eu>
>> ---
>> .../syscalls/getdtablesize/getdtablesize01.c | 2 +-
>> 1 files changed, 1 insertions(+), 1 deletions(-)
>>
>> diff --git a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
>> index a495501..568e1ad 100644
>> --- a/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
>> +++ b/testcases/kernel/syscalls/getdtablesize/getdtablesize01.c
>> @@ -83,7 +83,7 @@ int main()
>> tst_resm(TINFO,
>> "Checking Max num of files that can be opened by a process.Should be: RLIMIT_NOFILE - 1");
>> for (loop = 1; loop <= max_val_opfiles; loop++) {
>> - fd = open("/etc/hosts", O_RDONLY);
>> + fd = open("/etc/hosts", O_RDONLY | O_CREAT);
>> #ifdef DEBUG
>> printf("Opened file num %d\n", fd);
>> #endif
>
> No. You need to fix your embedded system to have all of the files on
> it before you try and run LTP. This would regress all sane Linux
> systems running LTP because the file already exists.
If the file doesn't exist then is created. If exists then there is no
change. And I have no problem to fix my system! My point was do not use
any assumption.
>
> I agree that this assumption is broken though; it might be better to
> use a different file, like via mkstemp(3).
I like this solution.
Thanks,
Michal
>
> Also, leaking file descriptors is silly if getdtablesize(2) is busted,
> or the OS fails to clean up all of the open file descriptors... it
> should cache the opened filehandles if != -1, then close each of them
> one by one.
>
> Thanks,
> -Garrett
--
Michal Simek, Ing. (M.Eng)
w: www.monstr.eu p: +42-0-721842854
Maintainer of Linux kernel 2.6 Microblaze Linux - http://www.monstr.eu/fdt/
Microblaze U-BOOT custodian
------------------------------------------------------------------------------
ThinkGeek and WIRED's GeekDad team up for the Ultimate
GeekDad Father's Day Giveaway. ONE MASSIVE PRIZE to the
lucky parental unit. See the prize list and enter to win:
http://p.sf.net/sfu/thinkgeek-promo
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2010-06-08 17:20 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-06-08 12:46 [LTP] [PATCH] syscalls: getdtablesize01 fix for missing /etc/hosts monstr
2010-06-08 16:21 ` Garrett Cooper
2010-06-08 16:54 ` Michal Simek
-- strict thread matches above, loose matches on Subject: below --
2010-06-08 12:32 monstr
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox