Frank Meerkötter | 18 Feb 22:30 2015

malloc_trim() behaviour

Hello,

I've got a question about the actual behaviour of malloc_trim().

man malloc_trim says:
[...]
malloc_trim - release free memory from the top of the heap
[...]
This function cannot release free memory located at places other than
the top of the heap.
[...]

Today I've looked that the implementation of malloc_trim()
malloc/malloc.c and I am a bit puzzled now as its (as far)
as I can see not the behaviour described in its man page.

__malloc_trim() calls mtrim which makes use of
__madvise (paligned_mem, size & ~psm1, MADV_DONTNEED);

My understanding is that madvise(MADV_DONTNEED) would allow
me to release a range of memory back to the OS. This range
wouldn't need to be at the top of the heap.

Is the man-page outdated? Am I looking at the wrong place?
What is the actual behaviour of malloc_trim()?

Kind Regards,
Frank

(Continue reading)

dE | 17 Feb 17:24 2015
Picon

Re: Easy way to decode res_query/res_search returned packet.

On 02/17/15 02:44, Sean Conner wrote:
> It was thus said that the Great dE once stated:
>> Hi!
>>
>> As we know, these 2 return a char array of the whole packet.
>>
>> Is there any easy way to decode the packet to retrieve resource records?
>>
>> I mean, going through the packet by hand is not easy... there must be
>> another way.
>    Check out <https://github.com/spc476/SPCDNS>.  I wrote it to encode DNS
> queries and parse DNS responses.  Perhaps this will help.
>
>    -spc
>

Thanks for that, but I was wondering about compiling it using mingw.

That's why I cant use adns, ldns.

Florian Weimer | 17 Feb 17:16 2015
Picon

Sequence points in fscanf

Is there a sequence point between the assignments for the individual
format specifiers?  I think there is not (in C11).  Does this trigger
undefined behavior if application code uses the same object to store
multiple format conversion results?

--

-- 
Florian Weimer / Red Hat Product Security

dE | 16 Feb 17:00 2015
Picon

Easy way to decode res_query/res_search returned packet.

Hi!

As we know, these 2 return a char array of the whole packet.

Is there any easy way to decode the packet to retrieve resource records?

I mean, going through the packet by hand is not easy... there must be 
another way.

Thanks for any pointers.

Carlos O'Donell | 12 Feb 16:03 2015
Picon

Re: glibc 2.5 - patch for GHOST (CVE-2015-0235)

On 02/12/2015 03:32 AM, czezz wrote:
> thank you for your answer.

I have moved this discussion to libc-help.

It seems you are quite new at this process. I would suggest
that you seek help from a local experienced developer who
can guide you through the process you are attempting.

One way to get the glibc sources and patch is like this:

mkdir -p ~/src
cd ~/src
git clone 
git clone git://sourceware.org/git/glibc.git
cd glibc
git diff d5dd6189d506068ed11c8bfa1e1e9bffde04decd^..d5dd6189d506068ed11c8bfa1e1e9bffde04decd
> ghost.patch

The other way is by direct URL referencing the commit id:

https://sourceware.org/git/?p=glibc.git;a=commitdiff_plain;h=d5dd6189d506068ed11c8bfa1e1e9bffde04decd;hp=fef94eab0bd308d5059a2588c753bf9a4926845d

Cheers,
Carlos.

Vyacheslav Barinov | 12 Feb 08:05 2015

glibc 2.21 -msse build problem

Hello,

  I tried to build glibc 2.21 with '-msse4.2' compilation flag.
  But sse is switched off explicitly for dl-runtime and as -Werror is now switched on by default I
  get build failure:

   cc1: all warnings being treated as errors
   dl-runtime.c:1:0: error: SSE instruction set disabled, using 387 arithmetics [-Werror]

  Adding -Wno-error right after -mno-sse fixes the problem, but I'm not sure this is the right way.

Best Regards,
Vyacheslav Barinov

P. S.
I created a bug https://sourceware.org/bugzilla/show_bug.cgi?id=17950

Florian Weimer | 11 Feb 17:00 2015
Picon

Re: utf8 varable length encoding support

On 02/11/2015 04:54 PM, attonie@... wrote:

> It seems that libiconv only do conversation, but I need POSIX compliance utf8 functions, like strcmp,
strlen, etc. (for utf8)

UTF-8 was designed a way that ensures the existing string functions work
as-is.  (You may have to replace strchr with strstr, though.)

--

-- 
Florian Weimer / Red Hat Product Security

Thomas Schwinge | 10 Feb 12:12 2015

Re: [GSoC 2015] Dynamic Documentation Project

Hi!

On Sun, 1 Feb 2015 08:53:13 +0530, Sajidur Rahman
<sajidur1993@...> wrote:
> I am Sajidur, from India. Currently I am enrolled in Computer Science
> & Engineering branch at BITS Pilani University. I went through all the
> ideas mentioned in the GNU's GSoC ideas page and found the dynamic
> documentation idea under glibc, fit for my skills as well as interest.

For reference, that's from last year's Summer of Code projects for GNU,
glibc: <http://www.gnu.org/software/soc-projects/ideas-2014.html#glibc>.

It is not yet certain that the GNU project/glibc will again be
participating in the Google Summer of Code.  (But there is an intention
to again apply as a mentoring organization,
<https://lists.gnu.org/archive/html/summer-of-code/2015-01/msg00000.html>.)

> I have been thinking about the idea and reading materials relating to
> it since last few days and these are the points that I believe would
> constitute the project. Please correct me wherever I might have
> misunderstood.

Thanks for your interest in this project, and also thanks for contacting
us early!

> 1. The project is basically to develop a program which would read the
> internal inline markups in a C code and dynamically create a file,

I'm not the one who came up with this project idea (Carlos?
<https://sourceware.org/glibc/wiki/GSoC?action=diff&rev1=1&rev2=2>), but
(Continue reading)

Matt Turner | 5 Feb 20:51 2015
Picon

Round-to-even without modifying rounding mode?

The rint() family of functions with the rounding mode set to
FE_TONEAREST is the only libc function I can find that will do
round-to-even. round() rounds half away from zero.

By setting various rounding modes rint() can do floor/ceil/trunc, but
there doesn't seem to be function that simply does round-to-even. Is
there one I've missed?

Alternatively, the reservations I have about setting the rounding mode
come from vague ideas about high costs involved with doing so and
potential problems from changing the rounding mode in a library. Are
either of these concerns valid, or should I simply save and restore
the rounding mode around a call to rint() to get round-to-even
behavior?

D. Hugh Redelmeier | 2 Feb 03:38 2015

timeval_subtract example

I'm trying to think about arithmetic with time values (struct timeval or 
struct timespec).

In the glibc manual, section 21.2, there is a function to subtract two 
struct timevals, "timeval_subtract".
<https://www.gnu.org/software/libc/manual/html_node/Elapsed-Time.html>

/* Subtract the ‘struct timeval’ values X and Y,
   storing the result in RESULT.
   Return 1 if the difference is negative, otherwise 0. */

int
timeval_subtract (result, x, y)
     struct timeval *result, *x, *y;
{
  /* Perform the carry for the later subtraction by updating y. */
  if (x->tv_usec < y->tv_usec) {
    int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
    y->tv_usec -= 1000000 * nsec;
    y->tv_sec += nsec;
  }
  if (x->tv_usec - y->tv_usec > 1000000) {
    int nsec = (x->tv_usec - y->tv_usec) / 1000000;
    y->tv_usec += 1000000 * nsec;
    y->tv_sec -= nsec;
  }

  /* Compute the time remaining to wait.
     tv_usec is certainly positive. */
  result->tv_sec = x->tv_sec - y->tv_sec;
(Continue reading)

D. Hugh Redelmeier | 3 Feb 04:57 2015
Picon

timeval_subtract example

I'm trying to think about arithmetic with time values (struct timeval or
struct timespec).

In the glibc manual, section 21.2, there is a function to subtract two
struct timevals, "timeval_subtract".
<https://www.gnu.org/software/libc/manual/html_node/Elapsed-Time.html>

/* Subtract the ‘struct timeval’ values X and Y,
    storing the result in RESULT.
    Return 1 if the difference is negative, otherwise 0. */

int
timeval_subtract (result, x, y)
      struct timeval *result, *x, *y;
{
   /* Perform the carry for the later subtraction by updating y. */
   if (x->tv_usec < y->tv_usec) {
     int nsec = (y->tv_usec - x->tv_usec) / 1000000 + 1;
     y->tv_usec -= 1000000 * nsec;
     y->tv_sec += nsec;
   }
   if (x->tv_usec - y->tv_usec > 1000000) {
     int nsec = (x->tv_usec - y->tv_usec) / 1000000;
     y->tv_usec += 1000000 * nsec;
     y->tv_sec -= nsec;
   }

   /* Compute the time remaining to wait.
      tv_usec is certainly positive. */
   result->tv_sec = x->tv_sec - y->tv_sec;
(Continue reading)


Gmane