Advertisement
Jack2

Untitled

Oct 10th, 2013
84
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.89 KB | None | 0 0
  1. void device_init(void)
  2. {
  3.     suseconds_t t0, t1;
  4.     struct stat info;
  5.     int fd;
  6.  
  7.     sehandle = NULL;
  8.     if (is_selinux_enabled() > 0) {
  9.         sehandle = selinux_android_file_context_handle();
  10.         selinux_status_open(true);
  11.     }
  12.  
  13.     /* is 256K enough? udev uses 16MB! */
  14.     device_fd = uevent_open_socket(256*1024, true);
  15.     if(device_fd < 0)
  16.         return;
  17.  
  18.     fcntl(device_fd, F_SETFD, FD_CLOEXEC);
  19.     fcntl(device_fd, F_SETFL, O_NONBLOCK);
  20.  
  21.     if (stat(coldboot_done, &info) < 0) {
  22.         t0 = get_usecs();
  23.         coldboot("/sys/class");
  24.         coldboot("/sys/block");
  25.         coldboot("/sys/devices");
  26.         t1 = get_usecs();
  27.         fd = open(coldboot_done, O_WRONLY|O_CREAT, 0000);
  28.         close(fd);
  29.         log_event_print("coldboot %ld uS\n", ((long) (t1 - t0)));
  30.     } else {
  31.         log_event_print("skipping coldboot, already done\n");
  32.     }
  33. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement