[LEDE-DEV] [PATCH 1/2] [ubox] syslog: use realloc to change log buffer size

Conor O'Gorman i at conorogorman.net
Wed May 18 05:57:37 PDT 2016


On 18/05/16 10:45, Dan Bugnar wrote:
> +		newest = (_log + (newest - log));
>   		newest->size = 0;
> -		oldest = log = _log;
> +		memset(newest, 0, size - log_size);
> +		oldest = (_log + (oldest - log));
> +		log = _log;
>   		log_end = ((void*) log) + size;

Reallocating a circular buffer is non-trival. I'm concerned it doesn't 
cover all combinations of:

(larger size OR smaller size) AND (newest > oldest OR oldest > newest)

Also is there a need for locking during the log_buffer_reinit()?

Conor



More information about the Lede-dev mailing list