* @brief Send a 'notification' to userland, using standard ways */
| 673 | * @brief Send a 'notification' to userland, using standard ways |
| 674 | */ |
| 675 | void |
| 676 | devctl_notify(const char *system, const char *subsystem, const char *type, |
| 677 | const char *data) |
| 678 | { |
| 679 | struct dev_event_info *dei; |
| 680 | struct sbuf sb; |
| 681 | |
| 682 | if (system == NULL || subsystem == NULL || type == NULL) |
| 683 | return; |
| 684 | dei = devctl_alloc_dei_sb(&sb); |
| 685 | if (dei == NULL) |
| 686 | return; |
| 687 | sbuf_cpy(&sb, "!system="); |
| 688 | sbuf_cat(&sb, system); |
| 689 | sbuf_cat(&sb, " subsystem="); |
| 690 | sbuf_cat(&sb, subsystem); |
| 691 | sbuf_cat(&sb, " type="); |
| 692 | sbuf_cat(&sb, type); |
| 693 | if (data != NULL) { |
| 694 | sbuf_putc(&sb, ' '); |
| 695 | sbuf_cat(&sb, data); |
| 696 | } |
| 697 | sbuf_putc(&sb, '\n'); |
| 698 | if (sbuf_finish(&sb) != 0) |
| 699 | devctl_free_dei(dei); /* overflow -> drop it */ |
| 700 | else |
| 701 | devctl_queue(dei); |
| 702 | } |
| 703 | |
| 704 | /* |
| 705 | * Common routine that tries to make sending messages as easy as possible. |
no test coverage detected