Page MenuHomeFreeBSD

kthread: Add a wrapper macro KPROC_START
AcceptedPublic

Authored by zlei on Fri, Oct 17, 10:38 AM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Oct 17, 1:15 PM
Unknown Object (File)
Fri, Oct 17, 1:05 PM
Unknown Object (File)
Fri, Oct 17, 12:18 PM
Unknown Object (File)
Fri, Oct 17, 11:58 AM
Unknown Object (File)
Fri, Oct 17, 11:55 AM
Unknown Object (File)
Fri, Oct 17, 11:46 AM

Details

Reviewers
kib
jeff
olce
Summary
kthread: Add a wrapper macro KPROC_START

The function kproc_start(const void *) requires passing an argument
with type `struct kproc_desc *`. The compilers are not able to report
error when passing wrong typed arguments.

Add a wrapper macro KPROC_START so that we no longer worry about that
when using the macro instead of plain SYSINIT.

MFC after:      2 weeks


kthread: Migrate to use the macro KPROC_START to start kernel threads

No functional change intended.

MFC after:      2 weeks

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Skipped
Unit
Tests Skipped

Event Timeline

zlei requested review of this revision.Fri, Oct 17, 10:38 AM
sys/kern/kern_alq.c
418

Hi @jeff, I'm not quite sure if the name matters, but I do not find "ALQ Daemon" used elsewhere except here.

Will the change of thread name from "ALQ Daemon" to "alq_daemon" breaks anything ?

olce added inline comments.
sys/kern/kern_alq.c
418

I don't think that name matters, and would prefer the names to have no spaces. Let's see if @jeff says something (based on the past few years, I'd say it's unlikely, but perhaps wait for a few days or a little more).

sys/sys/kthread.h
62

Perhaps expand the generated name to decrease the chances of collision with explicit variables?

67

If changed above, to be changed here.

This revision is now accepted and ready to land.Fri, Oct 17, 12:05 PM
sys/sys/kthread.h
61

The simple macro argument names have high chance of interfere with names locally visible.
C standard reserves the identifiers namespace '^_[A-Z]' (i.e. all identifiers starting with underscore, then upper-case letter) to file-local preprocessor tokens.

I suggest to use that convention for such global macro args, and also I suggest to use much more descriptive names for them. If I need to write another KPROC_START(), I would need to spend more time than I want figuring out what these n/s/o/f/gp mean.