History log of /openbmc/obmc-console/log-handler.c (Results 1 – 25 of 27)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 366651d9 22-Aug-2024 Marshall Zhan <marshall.zhan.wiwynn@gmail.com>

log-handler: Set the end of the file as the file size

The file descriptor is lost after system AC cycle.
The log file will grow indefinitely if the log recorded does not exceed
the maximum log size

log-handler: Set the end of the file as the file size

The file descriptor is lost after system AC cycle.
The log file will grow indefinitely if the log recorded does not exceed
the maximum log size after each AC cycle.

Change-Id: If23d68b08817d54731dd6eff8a42e9eb476b6437
Fixes: 46d9ef298f2e ("Do not truncate log files after reboot")
Signed-off-by: Marshall Zhan <marshall.zhan.wiwynn@gmail.com>

show more ...


# 6498f9fa 13-Sep-2024 Alexander Hansen <alexander.hansen@9elements.com>

log-handler: fix console logs

server->n_consoles was not incremented until after console_init.

But the log handler already made use of that value to decide which
filename to use for logging, in the

log-handler: fix console logs

server->n_consoles was not incremented until after console_init.

But the log handler already made use of that value to decide which
filename to use for logging, in the case of config with no sections.

This fix avoids use of server->n_consoles in favor of looking at the
number of sections in the config.

Change-Id: Ic19802808197557cd1f632c63a0123604a619039
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>

show more ...


# a6b29104 10-Jul-2024 Alexander Hansen <alexander.hansen@9elements.com>

console-server: Add UART Mux Support

This commit adds support for uart-muxes which can be controlled via
gpios.

Change-Id: I91a4de1962554adf4302a2a59d2b371f492dc21d
Signed-off-by: Alexander Hansen

console-server: Add UART Mux Support

This commit adds support for uart-muxes which can be controlled via
gpios.

Change-Id: I91a4de1962554adf4302a2a59d2b371f492dc21d
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# 1e04f449 12-Jun-2024 Alexander Hansen <alexander.hansen@9elements.com>

use iniparser dependency for config file parsing

For the config file, we do not need the custom handwritten parser.

Thanks to Andrew for this command, we can now search for an alternative

$ git gr

use iniparser dependency for config file parsing

For the config file, we do not need the custom handwritten parser.

Thanks to Andrew for this command, we can now search for an alternative

$ git grep -lw INI -- :/:*.bb
meta-openembedded/meta-oe/recipes-support/inih/libinih_58.bb
meta-openembedded/meta-oe/recipes-support/iniparser/iniparser_4.1.bb
meta-openembedded/meta-oe/recipes-support/minini/minini_1.2.b.bb
poky/meta/recipes-devtools/python/python3-iniconfig_2.0.0.bb
poky/meta/recipes-devtools/python/python3-iniparse_0.5.bb

For the ini parser we have following requirements

- small API
- easy to use
- compiles fast
- has tests, examples, docs
- support for sections

- minini [1]

can be dropped from the list since it also supports colon
':' instead of '=' for separating key and value, creating 2 ways of
doing something. This makes it harder to swap out the ini parser in
the future.

- libinih [2]

uses SAX-style parsing of .ini files and thus does not provide
a DOM of the .ini. This is a break from the previous parser which
stored everything in struct config. To use this library would require
to create a struct to store all the possible configuration, then fill
that struct in one pass. Essentially wrapping that library to have
DOM capability. That would be possible, but not ideal. libinih is also
highly configurable with lots of config options.

- iniparser [3]

has all the required features and stores the results of its
parsing for later use. It is a seamless upgrade from the previous
parser. The call sites do not have to be modified and we can read the
config as before. A downside is that we have to provide our own wrap
file.

For our purposes, iniparser is a good choice.

Using this dependency allows us to drop the custom parser and all the
tests that go along with it.

If sections are required in future config files, iniparser can also
support that.

References:

[1] https://github.com/compuphase/minIni
[2] https://github.com/benhoyt/inih
[3] https://gitlab.com/iniparser/iniparser

Change-Id: Ie2b57171ec1f8cb6b1b80ca1d9e6c112bedc1195
Signed-off-by: Alexander Hansen <alexander.hansen@9elements.com>

show more ...


# 48d1f533 09-Jul-2024 Andrew Jeffery <andrew@codeconstruct.com.au>

log-hander: Fix leak of rotate_filename in cleanup path

Running `obmc-console-server` under valgrind yields:

```
==259265== 34 bytes in 1 blocks are definitely lost in loss record 1 of 1
==259265==

log-hander: Fix leak of rotate_filename in cleanup path

Running `obmc-console-server` under valgrind yields:

```
==259265== 34 bytes in 1 blocks are definitely lost in loss record 1 of 1
==259265== at 0x48407B4: malloc (vg_replace_malloc.c:381)
==259265== by 0x49BC427: __vasprintf_internal (vasprintf.c:71)
==259265== by 0x498FBD5: asprintf (asprintf.c:31)
==259265== by 0x10F2EF: log_init (log-handler.c:189)
==259265== by 0x10EBEB: handlers_init (console-server.c:564)
==259265== by 0x10EBEB: main (console-server.c:1000)
```

Free rotate_filename to avoid the leak.

Change-Id: Ib403d50d47b5d266bab415944cbae93582ecdb65
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>

show more ...


# e2826c7d 04-Jul-2024 Jeremy Kerr <jk@codeconstruct.com.au>

console-server: allow separate handler instances

Currently, each handler (socket-handler, tty-handler and log-handler)
provides a statically-allocated instance of a handler, which gets
initialized f

console-server: allow separate handler instances

Currently, each handler (socket-handler, tty-handler and log-handler)
provides a statically-allocated instance of a handler, which gets
initialized for a console through the ->init callback.

We have upcoming changes that may create more than one console object,
in which case means we will need multiple instances of each handler
type.

This change splits the handler type from the handler instance; the
former is now struct handler_type, with struct handler being the
instance. Handler modules define a (const) struct handler_type, and
->init() now returns a newly-allocated instance of a handler of that
type.

This allows multiple handlers of each type.

Because the handler instances are allocated by type->init, we now
require both ->init and ->fini to be present on registered handlers.

We no longer need the `bool active` member of the handler, as instances
are always active.

Change-Id: Id97f15bd6445e17786f5883b849de8559c5ea434
Signed-off-by: Jeremy Kerr <jk@codeconstruct.com.au>

show more ...


Revision tags: v1.1.0
# 46d9ef29 15-Jan-2023 John Wang <wangzhiqiang02@inspur.com>

Do not truncate log files after reboot

The log file will be truncated during the log_init process, so that the
logs will be lost after bmc(obmc-console) restarts.

Here we change the logic to loop t

Do not truncate log files after reboot

The log file will be truncated during the log_init process, so that the
logs will be lost after bmc(obmc-console) restarts.

Here we change the logic to loop through the sol logs instead of
truncating them when they already exist in the bmc system

Signed-off-by: John Wang <wangzhiqiang02@inspur.com>
Change-Id: I9a14867c7ec8bfb6f25edcc8f383afd44f8ee3ad

show more ...


# d6e8b64a 18-Mar-2024 Medicine Yeh <medicinehy@gmail.com>

config: rename parse_logsize to be more generic

Rename config_parse_logsize to config_parse_bytesize.
A more generic name allows this function to be reused in other
config parsing purposes.

Change-

config: rename parse_logsize to be more generic

Rename config_parse_logsize to config_parse_bytesize.
A more generic name allows this function to be reused in other
config parsing purposes.

Change-Id: I3036c184669be17ddc0d194f275ea05d871341d1
Signed-off-by: Medicine Yeh <medicinehy@gmail.com>

show more ...


# b70f8713 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Fix readability-isolate-declaration

For example:

```
/usr/bin/clang-tidy -checks=-*, readability-isolate-declaration -export-fixes /tmp/tmpoo7fbs72/tmpo8xiwfxs.yaml -p=build /mnt/host

obmc-console: Fix readability-isolate-declaration

For example:

```
/usr/bin/clang-tidy -checks=-*, readability-isolate-declaration -export-fixes /tmp/tmpoo7fbs72/tmpo8xiwfxs.yaml -p=build /mnt/host/andrew/home/andrew/src/openbmc/obmc-console/test/test-client-escape.c
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:61:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
char *name, *value;
^~~~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:62:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
char *p, *line;
^~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:110:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
size_t size, len;
^~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../config.c:170:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
struct config_item *item, *next;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
/mnt/host/andrew/home/andrew/src/openbmc/obmc-console/build/../console-client.c:263:2: error: multiple declarations in a single statement reduces readability [readability-isolate-declaration,-warnings-as-errors]
struct console_client _client, *client;
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
6 warnings generated.
```

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: Ia7829b1672ea2dfb3fa020c7c48bd8266e6a1769

show more ...


# 2834c5b1 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Fix readability-braces-around-statements

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I88d2bdcb15106298d83a1cf7176e069092820f1d


# 19c74d58 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Extract definition of _GNU_SOURCE

Avoid triggering bugprone-reserved-identifier

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I8b4d40c92c1e9633bdb078c3f8d6d97ffb248cc2


# 5db8c792 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Fix bugprone-implicit-widening-of-multiplication-result

For example:

```
/usr/bin/clang-tidy -checks=-*, bugprone-implicit-widening-of-multiplication-result -export-fixes /tmp/tmpppty

obmc-console: Fix bugprone-implicit-widening-of-multiplication-result

For example:

```
/usr/bin/clang-tidy -checks=-*, bugprone-implicit-widening-of-multiplication-result -export-fixes /tmp/tmpppty3tdm/tmpod_qxcie.yaml -p=build /mnt/host/andrew/home/andrew/src/openbmc/obmc-console/test/test-config-parse-logsize.c
../test/test-config-parse-logsize.c:24:11: error: performing an implicit widening conversion to type 'size_t' (aka 'unsigned long') of a multiplication performed in type 'int' [bugprone-implicit-widening-of-multiplication-result,-warnings-as-errors]
{ "4k", 4 * 1024, 0 },
^
```

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I571983c6381fad7a14fb179108d14220f5dfdeca

show more ...


# a72711af 18-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Add clang-format configuration

And apply the formatting.

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I75251051affa5129c8698185baf8d151302b19d6


# 8f548f6c 17-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Clean up invalid sign comparisons

Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I83fae6857620ca2913952bea597c1299dd962620


# fd048328 17-Apr-2023 Andrew Jeffery <andrew@aj.id.au>

obmc-console: Mark unused parameters as such

As part of the clean up, remove the size parameter from log_trim().
log_trim() is a static function that only has one call site, so it was
straight-forwa

obmc-console: Mark unused parameters as such

As part of the clean up, remove the size parameter from log_trim().
log_trim() is a static function that only has one call site, so it was
straight-forward to fix without applying __attribute__((unused)).

Change-Id: Ic61821934dab644590adb4df09b7a8f547aa1c5a
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>

show more ...


# 93fd8a39 29-Mar-2022 Lei YU <mine260309@gmail.com>

log_trim: Rotate log instead of truncate

When the log buffer file's size exceeds, the log_trim() was using
moving the file's content and truncate it to a specific size.
This results in a behavior th

log_trim: Rotate log instead of truncate

When the log buffer file's size exceeds, the log_trim() was using
moving the file's content and truncate it to a specific size.
This results in a behavior that the log file is always changing its
whole content when log_trim() is called.

It could be better to change the behavior like logrotate, that move the
original file to a new one, and create a new log file for log buffer.
This way it makes sure that the log file is always appended with new
content and thus is friendly to rsyslog.

Tested: Verify rsyslog could use imfile module to handle this log file
normally. Before this change, rsyslog will handle it incorrectly
when log_trim() is called.

Signed-off-by: Lei YU <mine260309@gmail.com>
Change-Id: I7647b8e21747ea98f68e4bc7c5bbf1339354bd75

show more ...


# 18644357 27-Aug-2018 Kun Yi <kunyi731@gmail.com>

log-handler: Init log size properly

Log size is not initialized when the config string is not
present in the configuration file. Add a default value
in that case.

Resolves openbmc/obmc-console#14

log-handler: Init log size properly

Log size is not initialized when the config string is not
present in the configuration file. Add a default value
in that case.

Resolves openbmc/obmc-console#14

Tested:
Made sure when configuration file contains no logsize
option, the size is configured to 16kB.

Change-Id: I20b109fc791f2d6ac54704c9aabb5cd129a8bf13
Signed-off-by: Kun Yi <kunyi731@gmail.com>

show more ...


# 6424cc3b 14-Jun-2018 Kun Yi <kunyi731@gmail.com>

log-handler: Add a config option for log size.

Allow a configuration option to specify a log size. The parameter takes and
interprets common size suffixes k/M/G. 1kB = 1024B, 1MB=1024kB, 1GB=1024MB.

log-handler: Add a config option for log size.

Allow a configuration option to specify a log size. The parameter takes and
interprets common size suffixes k/M/G. 1kB = 1024B, 1MB=1024kB, 1GB=1024MB.
Default unit is byte. If "B" is specified at the end it will be ignored.

Tested:
Tested that "logsize = 567kB" correctly sets up a 567KB log buffer.
Tested that invalid/overflow values will be ignored and 16KB will be used.
Tested that if log size smaller than pagesize is rounded up.

Change-Id: I2fb50462c6ff7873130be80f7d57ef8065acc5da
Signed-off-by: Kun Yi <kunyi731@gmail.com>

show more ...


# f733c85a 07-Feb-2017 Jeremy Kerr <jk@ozlabs.org>

server: use ringbuffer for all handlers

Currently, we use the a ringbuffer within the socket handler to manage
bursts of data to slower clients.

However, we're also seeing cases where the local tty

server: use ringbuffer for all handlers

Currently, we use the a ringbuffer within the socket handler to manage
bursts of data to slower clients.

However, we're also seeing cases where the local tty handler becomes
blocking as well. So, we want to implement a buffer within the tty
handler too.

This change moves the ringbuffer 'up a layer' - from the socket handler
to the core console code.

We remove the ->data_in callback from handlers, and work on the
assumption that handlers have registered their own consumer on the
console's ringbuffer (through a new helper function,
console_ringbuffer_consumer_register()).

Change-Id: Ie8f02d6632578c50bb5e2dfb9bee6ece86432135
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 55c9712d 07-Feb-2017 Jeremy Kerr <jk@ozlabs.org>

server: Use consistent function names

Put verbs at the end, ie:
console_register_poller -> console_poller_register
console_register_handler -> console_handler_register

Change-Id: I4fa78137ce54a3f

server: Use consistent function names

Put verbs at the end, ie:
console_register_poller -> console_poller_register
console_register_handler -> console_handler_register

Change-Id: I4fa78137ce54a3f15aad87c3371569b084e47094
Signed-off-by: Jeremy Kerr <jk@ozlabs.org>

show more ...


# 9326d779 17-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

Add licence document and per-file headers

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


# e440a407 17-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

Use obmc-* for binary, logs, and config filenames

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


# b8f2845b 16-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

log-handler: Allow configuration of logfile parameter

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


# d47963e5 16-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

handlers: pass config to handlers' init()

The handlers may want to consume config parameters, so pass the struct
config to their init call.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


# df94dc12 15-Mar-2016 Jeremy Kerr <jk@ozlabs.org>

Use LOCALSTATEDIR for logfile location

Now that we have autoconf giving us installation directories, set the
log directory accordingly.

Signed-off-by: Jeremy Kerr <jk@ozlabs.org>


12