Advertisement
Guest User

Untitled

a guest
Jun 19th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.56 KB | None | 0 0
  1. static int msr_open(struct inode *inode, struct file *file)
  2. {
  3. unsigned int cpu = iminor(file_inode(file));
  4. struct cpuinfo_x86 *c;
  5.  
  6. if (!capable(CAP_SYS_RAWIO))
  7. return -EPERM;
  8.  
  9. if (cpu >= nr_cpu_ids || !cpu_online(cpu))
  10. return -ENXIO; /* No such CPU */
  11.  
  12. c = &cpu_data(cpu);
  13. if (!cpu_has(c, X86_FEATURE_MSR))
  14. return -EIO; /* MSR not supported */
  15.  
  16. return 0;
  17. }
  18.  
  19. SYSCALL_DEFINE0(vhangup)
  20. {
  21. if (capable(CAP_SYS_TTY_CONFIG)) {
  22. tty_vhangup_self();
  23. return 0;
  24. }
  25. return -EPERM;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement