* [LTP] [Bug Fix] write04 will crash on uClinux platform
@ 2010-12-29 9:35 Vivi
2010-12-29 16:32 ` Mike Frysinger
0 siblings, 1 reply; 2+ messages in thread
From: Vivi @ 2010-12-29 9:35 UTC (permalink / raw)
To: LTP mailing list
[-- Attachment #1.1: Type: text/plain, Size: 1319 bytes --]
LTP test case write04 will crash on uClinux platform.
Bellow is the fix:
--
Index: testcases/kernel/syscalls/write/write04.c
===================================================================
--- testcases/kernel/syscalls/write/write04.c
+++ testcases/kernel/syscalls/write/write04.c
@@ -71,6 +71,10 @@
static sigjmp_buf jmp;
int rfd, wfd;
+#ifdef UCLINUX
+char *wbuf;
+#endif
+
int main(int argc, char **argv)
{
int lc;
@@ -79,7 +83,9 @@
struct stat buf;
int fail;
int cnt;
+#ifndef UCLINUX
char wbuf[17 * PIPE_SIZE_TEST];
+#endif
struct sigaction sigptr; /* set up signal handler */
/* parse standard options */
@@ -221,6 +227,17 @@
*/
void setup(void)
{
+#ifdef UCLINUX
+ /* Allocate wbuf in heap not in the local function stack */
+ int pagesize = getpagesize();
+
+ wbuf = (char *) malloc(17 * pagesize);
+ if (!wbuf) {
+ tst_resm(TBROK, "malloc failed");
+ cleanup();
+ }
+#endif
+
/* capture signals */
tst_sig(FORK, DEF_HANDLER, cleanup);
@@ -244,6 +261,12 @@
void cleanup()
{
+
+#ifdef UCLINUX
+ if (wbuf)
+ free(wbuf);
+#endif
+
/*
* print errno log if that option was specified.
*/
--
Best regards,
Vivi Li
[-- Attachment #1.2: Type: text/html, Size: 1550 bytes --]
[-- Attachment #2: Type: text/plain, Size: 371 bytes --]
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
* Re: [LTP] [Bug Fix] write04 will crash on uClinux platform
2010-12-29 9:35 [LTP] [Bug Fix] write04 will crash on uClinux platform Vivi
@ 2010-12-29 16:32 ` Mike Frysinger
0 siblings, 0 replies; 2+ messages in thread
From: Mike Frysinger @ 2010-12-29 16:32 UTC (permalink / raw)
To: ltp-list
[-- Attachment #1.1: Type: Text/Plain, Size: 1166 bytes --]
On Wednesday, December 29, 2010 04:35:25 Vivi wrote:
> --- testcases/kernel/syscalls/write/write04.c
> +++ testcases/kernel/syscalls/write/write04.c
> @@ -71,6 +71,10 @@
> static sigjmp_buf jmp;
> int rfd, wfd;
>
> +#ifdef UCLINUX
> +char *wbuf;
> +#endif
should be static
> @@ -79,7 +83,9 @@
> struct stat buf;
> int fail;
> int cnt;
> +#ifndef UCLINUX
> char wbuf[17 * PIPE_SIZE_TEST];
> +#endif
> struct sigaction sigptr; /* set up signal handler */
>
> /* parse standard options */
> @@ -221,6 +227,17 @@
> */
> void setup(void)
> {
> +#ifdef UCLINUX
> + /* Allocate wbuf in heap not in the local function stack */
> + int pagesize = getpagesize();
> +
> + wbuf = (char *) malloc(17 * pagesize);
> + if (!wbuf) {
> + tst_resm(TBROK, "malloc failed");
> + cleanup();
> + }
> +#endif
there is no need to make this depend on UCLINUX. have it execute this code
for everyone. also, the original code is 17*PIPE_SIZE_TEST but yours is
17*getpagiesize(). please stick to the original define.
-mike
[-- Attachment #1.2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
[-- Attachment #2: Type: text/plain, Size: 371 bytes --]
------------------------------------------------------------------------------
Learn how Oracle Real Application Clusters (RAC) One Node allows customers
to consolidate database storage, standardize their database environment, and,
should the need arise, upgrade to a full multi-node Oracle RAC database
without downtime or disruption
http://p.sf.net/sfu/oracle-sfdevnl
[-- Attachment #3: Type: text/plain, Size: 155 bytes --]
_______________________________________________
Ltp-list mailing list
Ltp-list@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/ltp-list
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2010-12-29 16:32 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2010-12-29 9:35 [LTP] [Bug Fix] write04 will crash on uClinux platform Vivi
2010-12-29 16:32 ` Mike Frysinger
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox