Skip to content

bhyveload: add a small ring buffer to the cb_putc function.#2226

Open
yuichiro-naito wants to merge 1 commit into
freebsd:mainfrom
yuichiro-naito:fix/bhyveload_putc
Open

bhyveload: add a small ring buffer to the cb_putc function.#2226
yuichiro-naito wants to merge 1 commit into
freebsd:mainfrom
yuichiro-naito:fix/bhyveload_putc

Conversation

@yuichiro-naito
Copy link
Copy Markdown
Contributor

While bhyveload opens an nmdm device as a console, I often see that the boot loader messages are partly missing on my console. I investigated the bhyloveload with truss(1), I found that write(2) system call returns EGAIN while missing the message. The console output descriptor is opened with O_NONBLOCK. So, the write(2) system call may return the EAGAIN. It is described in the manual. An application should accept and handle the error case.

I added a small ring buffer for the output characters and retry writing in the error case. I see about 150 characters are missing with my debug message, so the 256-byte buffer is enough for me.

@yuichiro-naito yuichiro-naito requested a review from bsdjhb as a code owner May 23, 2026 06:25
@github-actions
Copy link
Copy Markdown

github-actions Bot commented May 23, 2026

Thank you for taking the time to contribute to FreeBSD!

Some of files have special handling:

Important

@bsdjhb @bryanv @markjdb @khng300 @markpeek wants to review changes to usr.sbin/bhyve

Important

@bsdjhb @bryanv @markjdb @khng300 @markpeek wants to review changes to usr.sbin/bhyveload

@yuichiro-naito yuichiro-naito force-pushed the fix/bhyveload_putc branch 2 times, most recently from 4b86806 to 1198cab Compare May 23, 2026 08:24
The console output descriptor is NONBLOCK. It often returns EAGIN
when the console connects to nmdm(4). The cb_putc should buffer
the output characters and retry writing. If the buffer becomes full,
the first character will be discarded.

Signed-off-by: Yuichiro NAITO <naito.yuichiro@gmail.com>
@yuichiro-naito
Copy link
Copy Markdown
Contributor Author

I found that the uint niov variable doesn't need to be 'static'. I removed 'static' from the variable declaration.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant