Static functions in Linux device driver

前端 未结 3 971
清歌不尽
清歌不尽 2020-12-24 10:08

Why is it that every function in most device drivers are static? As static functions are not visible outside of the file scope. Then, how do these driver function get called

3条回答
  •  滥情空心
    2020-12-24 10:27

    The kernel has thousands of modules and they are (or used to be) all object files, loaded dynamically via a process similar to linking --or are actually linked-- into the executable. Can you imagine how many name clashes there would be if they were all to export all their function names, as is the default C behavior unless static is specified?

    Userspace applications cannot call driver functions directly, but there are other ways to interact.

提交回复
热议问题