Changeset 860 for vendor/current/source3/printing/printing.c
- Timestamp:
- May 12, 2014, 8:58:38 PM (11 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
vendor/current/source3/printing/printing.c
r746 r860 1657 1657 } 1658 1658 1659 /**************************************************************************** 1660 Notify smbds of new printcap data 1661 **************************************************************************/ 1662 static void reload_pcap_change_notify(struct tevent_context *ev, 1663 struct messaging_context *msg_ctx) 1664 { 1665 /* 1666 * Reload the printers first in the background process so that 1667 * newly added printers get default values created in the registry. 1668 * 1669 * This will block the process for some time (~1 sec per printer), but 1670 * it doesn't block smbd's servering clients. 1671 */ 1672 reload_printers_full(ev, msg_ctx); 1673 1674 message_send_all(msg_ctx, MSG_PRINTER_PCAP, NULL, 0, NULL); 1675 } 1676 1659 1677 static bool printer_housekeeping_fn(const struct timeval *now, 1660 1678 void *private_data) … … 1679 1697 } 1680 1698 1699 static void printing_sig_term_handler(struct tevent_context *ev, 1700 struct tevent_signal *se, 1701 int signum, 1702 int count, 1703 void *siginfo, 1704 void *private_data) 1705 { 1706 exit_server_cleanly("termination signal"); 1707 } 1708 1709 static void printing_sig_hup_handler(struct tevent_context *ev, 1710 struct tevent_signal *se, 1711 int signum, 1712 int count, 1713 void *siginfo, 1714 void *private_data) 1715 { 1716 struct messaging_context *msg_ctx = talloc_get_type_abort( 1717 private_data, struct messaging_context); 1718 1719 DEBUG(1,("Reloading printers after SIGHUP\n")); 1720 pcap_cache_reload(ev, msg_ctx, 1721 &reload_pcap_change_notify); 1722 } 1723 1724 static void printing_conf_updated(struct messaging_context *msg, 1725 void *private_data, 1726 uint32_t msg_type, 1727 struct server_id server_id, 1728 DATA_BLOB *data) 1729 { 1730 DEBUG(5,("Reloading printers after conf change\n")); 1731 pcap_cache_reload(messaging_event_context(msg), msg, 1732 &reload_pcap_change_notify); 1733 } 1734 1735 1681 1736 static pid_t background_lpq_updater_pid = -1; 1682 1737 … … 1714 1769 int ret; 1715 1770 NTSTATUS status; 1771 struct tevent_signal *se; 1716 1772 1717 1773 /* Child. */ … … 1728 1784 } 1729 1785 1730 smbd_setup_sig_term_handler(); 1731 smbd_setup_sig_hup_handler(ev, msg_ctx); 1786 se = tevent_add_signal(ev, ev, SIGTERM, 0, 1787 printing_sig_term_handler, 1788 NULL); 1789 if (se == NULL) { 1790 smb_panic("failed to setup SIGTERM handler"); 1791 } 1792 se = tevent_add_signal(ev, ev, SIGHUP, 0, 1793 printing_sig_hup_handler, 1794 msg_ctx); 1795 if (se == NULL) { 1796 smb_panic("failed to setup SIGHUP handler"); 1797 } 1732 1798 1733 1799 if (!serverid_register(procid_self(), … … 1743 1809 messaging_register(msg_ctx, NULL, MSG_PRINTER_UPDATE, 1744 1810 print_queue_receive); 1811 messaging_register(msg_ctx, NULL, MSG_SMB_CONF_UPDATED, 1812 printing_conf_updated); 1745 1813 1746 1814 fde = tevent_add_fd(ev, ev, pause_pipe[1], TEVENT_FD_READ, … … 1751 1819 smb_panic("tevent_add_fd() failed for pause_pipe"); 1752 1820 } 1821 1822 /* reload on startup to ensure parent smbd is refreshed */ 1823 pcap_cache_reload(server_event_context(), 1824 smbd_messaging_context(), 1825 &reload_pcap_change_notify); 1753 1826 1754 1827 if (!(event_add_idle(ev, NULL,
Note:
See TracChangeset
for help on using the changeset viewer.