Merge our signal handlers into a single function and let Wayland deal with all the struct sigaction stuff.
ΔSLOC: -3
N54JKDQTHG2GSXAXR6PGMVVEKAHLKENNDSQ2IUGKQUDHGA72J4XQC QA3LE32PDSYAUFS4XVY6IBHTTMDHSBHIHI5CVEKMT7QN5DGB2GBQC NWKV3CJZDJGETIBG7P2QHOQVHSEK5J2YZAYKL4OVWZEIWHK6LINAC 6US7XFRJWUNIUZHKTODZDU3DX6WO5K3J2G3ECIQYSVBDII3DXGWAC ZEKBZDRVZJFHG75HZQVVQHO4G7RIY5OZTSI5G3BWIF566BRQBXHAC 7B74AT3BXYB7PVW4F6SGQNPMHOU5TEV5TZ54CG6VSQI46XSEKWXQC S7RXJJZG4IEIVLPHEWFT5M2T3SRRO5US5SYBPXSYSWJJLXAKNNPAC VIPO7NAXJ7HWGD5XJEBQI6FBQ2QYR5HTI6UYGK64U4WH6EXPSBOQC 6XZIQSMIVP2GZ5S3UCKEVNDSLTHSQEVSXLV4UIFF3G3SRCGJPXYAC EK6VCEIAKFHDTJOI7PEEIUZ2BO5AYS4FFOOYC3UNLZSHLJBD5W3AC 2QL2H4REDZT46FI3LQ4RYEMQYZBNBK3IC3KH3XERAJU3NCZWMNYQC E7UO6NRGXFDMBU3BSJYRDNOA3Y7VHD7NWPHI5PHCPHQF6ZNOPZLQC YQQETCXBXPPLXBU3UPUIIKB3JZCHRFSW7PPP2DR436WVIXNXFUHAC GYBKUNGUNB57EQR3HCEP3EEO37RRXSPXCY2XI7RY2TAFSETKXUSQC EQRGODLKSVSPFSUZU7BV5ER72U4QS4ATSBKV544XXQVKKTOSC7EAC HGITBD7RZVPMWWPLFXDXW53LO5MWD4RVS77ZBFLORUIJMJ35IVDQC }inthandlesig(int signo, void *data){if (signo == SIGCHLD) {#ifdef XWAYLANDsiginfo_t in;/* wlroots expects to reap the XWayland process itself, so we* use WNOWAIT to keep the child waitable until we know it's not* XWayland.*/while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid&& (!xwayland || in.si_pid != xwayland->server->pid))waitpid(in.si_pid, NULL, 0);#elsewhile (waitpid(-1, NULL, WNOHANG) > 0);#endif} else if (signo == SIGINT || signo == SIGTERM) {quit(NULL);}return 0;
sigchld(int unused){#ifdef XWAYLANDsiginfo_t in;/* We should be able to remove this function in favor of a simple* struct sigaction sa = {.sa_handler = SIG_IGN};* sigaction(SIGCHLD, &sa, NULL);* but the Xwayland implementation in wlroots currently prevents us from* setting our own disposition for SIGCHLD.*//* WNOWAIT leaves the child in a waitable state, in case this is the* XWayland process*/while (!waitid(P_ALL, 0, &in, WEXITED|WNOHANG|WNOWAIT) && in.si_pid&& (!xwayland || in.si_pid != xwayland->server->pid))waitpid(in.si_pid, NULL, 0);#elsewhile (waitpid(-1, NULL, WNOHANG) > 0);#endif}void