Commit Graph

16 Commits

Author SHA1 Message Date
Travis Geiselbrecht
f5999d5a40 Merge branch 'port_race_test' of github.com:redpig/lk
edit: add a few quickie warning fixes
2025-09-29 23:15:57 -07:00
Travis Geiselbrecht
75eaa5c489 [app][warnings] fix -Wmissing-declarations warnings in app/ 2021-10-21 23:16:57 -07:00
Travis Geiselbrecht
f7d8e2300c [warnings] add -Wshadow which helps detect local variables that override globals
Nothing particularly bad showed up but cleaned up a bit of code.
2020-07-25 16:49:25 -07:00
Travis Geiselbrecht
4edb93adde [lib][console] rename some console command types to be prefixed with console_
Some of the structures, notably 'cmd', in the lib console stuff are a
little too generically named and have collided with some other code
so prefix the names a bit more cleanly with console_

The change is largely mechanical, and folks with out of tree code can
easily switch by renaming:
cmd -> console_cmd
cmd_args -> console_cmd_args
cmd_block -> console_cmd_block
console_cmd -> console_cmd_func

Apologies if this breaks you but it should be pretty easy to fix.
2020-07-25 15:59:58 -07:00
Travis Geiselbrecht
cf7de9eaa7 [app][tests] fix a function definition to make the prototype
Only shows up when trying to link with LTO.
2020-07-12 13:11:28 -07:00
Travis Geiselbrecht
cba9e47987 [license] replace the longer full MIT license with a shorter one
Used scripts/replacelic. Everything seems to build fine.
2019-07-05 17:22:23 -07:00
Travis Geiselbrecht
d8fa82cb91 [formatting] run everything through codestyle
Almost nothing changes here except moving braces to the same line as the
function declaration. Everything else is largely whitespace changes and
a few dangling files with tab indents.

See scripts/codestyle
2019-06-19 21:02:24 -07:00
Travis Geiselbrecht
1b7a28efb8 [include][lk] fixup lk/ include path move 2019-06-19 19:46:11 -07:00
Will Drewry
1c59a73cb4 app/tests/port_tests.c: static-ify consts
This change makes the shared constants static
as well as const-ifies shared packets.
2017-12-22 16:12:36 -06:00
Will Drewry
0f939a52e9 app/tests/port_tests.c: fix bad indents 2017-12-22 15:19:00 -06:00
Will Drewry
e08ca47ff1 kernel/port.c: protect against port_create() race
In the current design, ports may be created with the same name
because of time-of-check-time-of-use behavior.

This change adds a new port magic, PORTHOLD_MAGIC, which cannot be
accessed using the normal accessors. It is injected into the list
upon a successful, locked search for a name.  It holds the name
until the allocation happens. At which point the port-hold is
deleted and the real port is added while, again, under the thread
lock.

This change assumes using a stack-allocated port is desirable over
preallocating and freeing on each port_create().  If the overhead
of allocation is low, then pre-allocating the new port would be
the cleanest option: (1) allocate, (2) check for collisions,
(3) add to list.

This fix is confirmed by the two_threads_race test completing its
256 iterations without a race. It also fixes the test to expect
ERR_BUSY and to exit cleanly, as it had never completed before.
2017-12-22 15:10:42 -06:00
Will Drewry
bc69dededf app/tests/port_tests.c: add two_threads_race test
This change adds a test to the port_tests suite
to trigger the port_create() race.  When tested with
an SMP (3) qemu instance, the race is discovered in
less than twenty iterations and often much sooner.
2017-12-22 14:55:17 -06:00
Gurjant Kalsi
42e76b1fc7 [ports] Add an API to dynamically add/remove ports from a port group. 2016-02-23 14:23:25 -08:00
Travis Geiselbrecht
2eb32a4369 [style] mass reformat all the non external code to 4 space indents
Ran everything through scripts/codestyle.space, which uses astyle
to generally follow K&R style.

Biggest non whitespace change is pulling brackets down on function
declarations, which I'm pretty ambivalent about, but astyle insists
on taking a stance
2016-02-14 12:24:01 -08:00
Carlos Pizano
c8ec0024da [kernel][port] port group test
A basic port watcher.

BUG=
R=travisg@google.com

Review URL: https://codereview.chromium.org/1478653002 .
2015-12-02 12:32:09 -08:00
Carlos Pizano
614eaf166a [kernel][ports] Add basic ports functionality
Missing mostly more tests, specifically group tests.

BUG=none
R=travisg@google.com

Review URL: https://codereview.chromium.org/1437453002 .
2015-11-20 14:43:27 -08:00