This is the mail archive of the libc-alpha@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

Re: tst-pthread-getattr changes break sparc


> +static long pagesize;

We always write 'long int', never 'long'.
But for this, I'd use size_t.

> +  *(int *)mem = 42;

Put a space after the closing paren in cast.

If this function gets inlined the store could be deduced to be dead, I
think.  Using volatile makes it explicit that you intend to have the store
done here no matter what.

> +  stack_limit.rlim_cur = _MIN(stacksize - pagesize + 1, MAX_STACK_SIZE);

Space before paren.  Where does _MIN come from?

> +  if (((uintptr_t) stackaddr & pagemask ) != ((uintptr_t) mem & pagemask))

Spurious space before close-paren there.

> +    {
> +      printf ("We successfully wrote into the wrong page. ");
> +      printf ("Expected %lx, but got %lx\n", (uintptr_t) stackaddr & pagemask,
> +	      (uintptr_t) mem & pagemask);

This can be one printf with string concatenation.
But since it needs two lines in the source, give it two lines in the output.

I think it's nice to use %#x whenever we print hex, so we get 0x.
'l' is not the right modifier for uintptr_t.  I'm not sure there's
a C99 one, though z (for size_t) is probably always right.
To be pedantically correct, use "...%#" PRIxPTR "...".

> +  if (pagesize < 0)
> +    {
> +      perror ("could not get page size");
> +      return 1;

Tests should write to stdout, not stderr.
So make it:
	printf ("sysconf (_SC_PAGESIZE): %m");


Thanks,
Roland


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]