Skip to content

dev: handle an empty udev receive queue - #747

Open
ooonea wants to merge 1 commit into
NetworkConfiguration:masterfrom
ooonea:pr-dhcpcd-udev-eagain-current-20261023
Open

ooonea wants to merge 1 commit into
NetworkConfiguration:masterfrom
ooonea:pr-dhcpcd-udev-eagain-current-20261023

Conversation

@ooonea

@ooonea ooonea commented Oct 24, 2026 •

Copy link
Copy Markdown

Avoid logging an empty nonblocking udev queue (EAGAIN). Other NULL results are still logged, and all NULL results keep the existing -1 return.

I checked the empty-queue and error cases, normal device callbacks, and rebuilt the udev module.

@coderabbitai

coderabbitai Bot commented Oct 24, 2026 •

Copy link
Copy Markdown

Review in Change Stack →

No actionable comments were generated in the recent review.

Recent review info
Run configuration
  • Source mode: Auto
  • Repository: Unavailable
  • Branch: Unavailable
  • File: No configuration file from this repository applied
  • Commit: Unavailable
  • Layers: Organization UI
  • Review profile: CHILL
  • Plan: Advanced
  • Run ID: c03c23cf-039c-4718-9891-ed623270c96f
Commits

Reviewing files that changed from the base of the PR and between ad46b1e and 5ac805e.

Files selected for processing: 1
  • src/dev/udev.c

Included review availability: This review used your included allowance. Your plan provides up to 2 included reviews per hour; 1 remain after this review.

Walkthrough

udev_handle_device now suppresses the error log when udev_monitor_receive_device returns NULL and sets errno to EAGAIN. It still returns -1 for all NULL device results.

Changes

udev device reception

Layer / File(s) Summary
Handle EAGAIN from device reception
src/dev/udev.c
The code includes <errno.h> and checks errno after a NULL device result. It suppresses the error log for EAGAIN and still returns -1.

Priority: Low

Estimated code review effort: 1 (Trivial) | ~3 minutes

Change: Bug fix

Suggested reviewers: rsmarples

Merge Risk: Minimal · up to 5ac80

The change only suppresses expected empty-queue logging and preserves existing handling, so it is mergeable.

Pre-merge checks: Passed 4 · Failed 1

Failed Failed checks: 1 warning

Check name Status Explanation Resolution
Docstring Coverage Warning Docstring coverage is 0.00% which is insufficient. The required threshold is 80.00%. Docstring coverage is scoped to functions touched by this diff. Analyzed 1 functions across 1 files. Write docstrings for the functions missing them to satisfy the coverage threshold.
Passed Passed checks: 4 passed
Check name Status Explanation
Title check Passed The title clearly and concisely describes the main change: handling an empty nonblocking udev receive queue.
Description check Passed The description accurately explains the EAGAIN handling, retained error behavior, return value, and reported verification steps.
Linked Issues check Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check Passed Check skipped because no linked issues were found for this pull request.
Finishing Touches
🧪 Generate unit tests (beta)
  • Create a new PR
  • Autofix · Keep fixing CodeRabbit findings and required CI, and resolving merge conflicts

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands.

Comment thread src/dev/udev.c Outdated
device = udev_monitor_receive_device(monitor);
if (device == NULL) {
if (errno == EAGAIN)
return 0;

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why return 0?

The dev manager currently doesn't do anything with the result, so all you are doing here is avoiding the logging.

I would prefer to return -1 still unless you have a good technical reason?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I used 0 to distinguish an empty queue, but that distinction isn't needed here. I've kept -1 and only skip the log for EAGAIN.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ah, that's fair enough. I'm happy for it to return 0 if you like.

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a comment to explain we are are ignoring EAGAIN.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added a short comment for the empty-queue case. I kept the original -1 return so the change only affects logging.

@ooonea
ooonea force-pushed the pr-dhcpcd-udev-eagain-current-20261023 branch from 946da29 to ad46b1e Compare October 24, 2026 14:59
Avoid logging an empty nonblocking udev queue (EAGAIN). Keep the
existing -1 return for NULL devices and log other errors as before.

Assisted-by: OpenAI Codex
@ooonea
ooonea force-pushed the pr-dhcpcd-udev-eagain-current-20261023 branch from ad46b1e to 5ac805e Compare October 25, 2026 07:43
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.

2 participants