Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Added an example of using the proc filesystem (add more linux kernel programs #2) #6

Merged
merged 3 commits into from
Oct 17, 2017
Merged

Conversation

d-grossman
Copy link
Contributor

@d-grossman d-grossman commented Oct 15, 2017

There is some weird involved with the copy_to_user call. I'm getting reasonable values going into the call, and then an oops.

*/

/* @todo figure out why copy_to_user so upset wich nonzero */
copy_to_user(buf, message, 0);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

this should be
copy_to_user(buf, message, len)
I'm not sure if it is my vm that is bad or a real bug.

@d-grossman
Copy link
Contributor Author

d-grossman commented Oct 15, 2017

example works,

user@ubuntu:~/x$ uname -a
Linux ubuntu 4.4.0-97-generic #120-Ubuntu SMP Tue Sep 19 17:28:18 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
user@ubuntu:~/x$ make
make -C /lib/modules/4.4.0-97-generic/build M=/home/user/x modules
make[1]: Entering directory '/usr/src/linux-headers-4.4.0-97-generic'
  CC [M]  /home/user/x/procfs_hw.o
  Building modules, stage 2.
  MODPOST 1 modules
  CC      /home/user/x/procfs_hw.mod.o
  LD [M]  /home/user/x/procfs_hw.ko
make[1]: Leaving directory '/usr/src/linux-headers-4.4.0-97-generic'
user@ubuntu:~/x$ sudo insmod procfs_hw.ko
user@ubuntu:~/x$ cat /proc/procfs_hw 
Hello World

user@ubuntu:~/x$ sudo rmmod procfs_hw 

@d-grossman d-grossman changed the title almost working. works Oct 15, 2017
@d-grossman d-grossman changed the title works works (add more linux kernel programs #2) Oct 15, 2017
@d-grossman d-grossman changed the title works (add more linux kernel programs #2) Added an example of using the proc filesystem (add more linux kernel programs #2) Oct 15, 2017
@d-grossman
Copy link
Contributor Author

@doomers anything else to close this out?

@doomers
Copy link
Owner

doomers commented Oct 17, 2017

nopes great work, actually i was not active from last 2-3 days on github.
Thanks for contributing

@doomers doomers merged commit 792cecb into doomers:master Oct 17, 2017
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