+ memset(&saddr, 0x00, sizeof(saddr));
+ saddr.sun_family = AF_LOCAL;
+ strcpy(saddr.sun_path, UDEVD_SOCK);
+
+ unlink(UDEVD_SOCK);
+ ssock = socket(AF_LOCAL, SOCK_STREAM, 0);
+ if (ssock == -1) {
+ dbg("error getting socket");
+ exit(1);
+ }
+
+ retval = bind(ssock, &saddr, sizeof(saddr));
+ if (retval < 0) {
+ dbg("bind failed\n");
+ goto exit;
+ }
+
+ retval = listen(ssock, SOMAXCONN);
+ if (retval < 0) {
+ dbg("listen failed\n");
+ goto exit;
+ }
+
+ pthread_mutex_init(&msg_lock, NULL);
+ pthread_mutex_init(&msg_active_lock, NULL);
+ pthread_mutex_init(&exec_lock, NULL);
+ pthread_mutex_init(&exec_active_lock, NULL);
+ pthread_mutex_init(&running_lock, NULL);
+
+ /* set default attributes for created threads */
+ pthread_attr_init(&thr_attr);
+ pthread_attr_setdetachstate(&thr_attr, PTHREAD_CREATE_DETACHED);
+ pthread_attr_setstacksize(&thr_attr, 16 * 1024);
+
+ /* init queue management */
+ pthread_create(&mgr_msg_tid, &thr_attr, msg_queue_manager, NULL);
+ pthread_create(&mgr_exec_tid, &thr_attr, exec_queue_manager, NULL);