----- Original Message -----
> From: [email protected]
> To: "Jan Stancek" <[email protected]>
> Cc: [email protected]
> Sent: Monday, 29 October, 2012 3:04:25 PM
> Subject: Re: [LTP] [PATCH v3] ipc/shmat: pick suitable base_addr before each
> testcase
>
> Hi!
> > diff --git a/testcases/kernel/syscalls/ipc/shmat/Makefile
> > b/testcases/kernel/syscalls/ipc/shmat/Makefile
> > index f467389..5cbf37c 100644
> > --- a/testcases/kernel/syscalls/ipc/shmat/Makefile
> > +++ b/testcases/kernel/syscalls/ipc/shmat/Makefile
> > @@ -20,4 +20,7 @@ top_srcdir ?= ../../../../..
> >
> > include $(top_srcdir)/include/mk/testcases.mk
> > include $(abs_srcdir)/../Makefile.inc
> > +
> > +MAKE_TARGETS := $(patsubst
> > $(abs_srcdir)/%.c,%,$(wildcard $(abs_srcdir)/*[0-9].c))
>
> Hm, perhaps it would be easier to rename the shmat_common.c to
> shmat_common.h.
Yes, that would work too.
> > --- /dev/null
> > +++ b/testcases/kernel/syscalls/ipc/shmat/shmat_common.c
> > @@ -0,0 +1,33 @@
> > +static key_t probe_key;
> > +
> > +void *probe_free_addr()
>
> Add void as the function parameters here.
Of course, I always manage to miss this..
>
> > +{
> > + void *p;
> > + int ret;
> > + int shm_id = -1;
> > +
> > + if (probe_key == 0)
> > + probe_key = getipckey();
> > +
> > + /* create a shared memory resource with read and write
> > permissions
> > + * We align this to SHMLBA so we should allocate at least
> > + * SHMLBA*2 in case SHMLBA > page_size. */
> > + shm_id = shmget(probe_key, SHMLBA*2, SHM_RW | IPC_CREAT |
> > IPC_EXCL);
> > + if (shm_id == -1)
> > + tst_brkm(TBROK, cleanup, "probe: shmget failed");
> > +
> > + /* Probe an available linear address for attachment */
> > + p = shmat(shm_id, NULL, 0);
> > + if (p == (void *)-1)
> > + tst_brkm(TBROK, cleanup, "probe: shmat failed");
> > + ret = shmdt((const void *)p);
>
> Hmm, is this cast really needed?
No, that was carried over from original code. Implicit conversion
should work just fine.
>
> > + if (ret == -1)
> > + tst_brkm(TBROK, cleanup, "probe: shmdt failed");
> > +
> > + rm_shm(shm_id);
> > +
> > + /* some architectures (e.g. parisc) are strange, so better always
> > + * align to next SHMLBA address. */
> > + p = (void *)(((unsigned long)(p) + (SHMLBA - 1)) & ~(SHMLBA -
> > 1));
> > + return p;
> > +}
>
> --
> Cyril Hrubis
> [email protected]
>
------------------------------------------------------------------------------
Everyone hates slow websites. So do we.
Make your web apps faster with AppDynamics
Download AppDynamics Lite for free today:
http://p.sf.net/sfu/appdyn_sfd2d_oct
_______________________________________________
Ltp-list mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/ltp-list