- memset(&msg, 0x00, sizeof(struct hotplug_msg));
- strcpy(msg.magic, UDEV_MAGIC);
- msg.seqnum = seq;
- strfieldcpy(msg.action, action);
- strfieldcpy(msg.devpath, devpath);
- strfieldcpy(msg.subsystem, subsystem);
-
- /* If we can't send, try to start daemon and resend message */
- loop = UDEVSEND_CONNECT_RETRY;
- while (loop--) {
- retval = sendto(sock, &msg, sizeof(struct hotplug_msg), 0,
- (struct sockaddr *)&saddr, addrlen);
- if (retval != -1) {
+ memset(&usend_msg, 0x00, sizeof(struct udevd_msg));
+ strcpy(usend_msg.magic, UDEV_MAGIC);
+ usend_msg.type = UDEVD_UEVENT_UDEVSEND;
+
+ /* copy all keys to send buffer */
+ for (i = 0; envp[i]; i++) {
+ const char *key;
+ int keylen;
+
+ key = envp[i];
+ keylen = strlen(key);
+
+ /* ignore events which are already sent on the netlink socket */
+ if (strncmp(key, "SEQNUM=", 7) == 0) {
+ dbg("ignoring event with SEQNUM set");