17c478bd9Sstevel@tonic-gate /* 27c478bd9Sstevel@tonic-gate * CDDL HEADER START 37c478bd9Sstevel@tonic-gate * 47c478bd9Sstevel@tonic-gate * The contents of this file are subject to the terms of the 5e2738c5eSjacobs * Common Development and Distribution License (the "License"). 6e2738c5eSjacobs * You may not use this file except in compliance with the License. 77c478bd9Sstevel@tonic-gate * 87c478bd9Sstevel@tonic-gate * You can obtain a copy of the license at usr/src/OPENSOLARIS.LICENSE 97c478bd9Sstevel@tonic-gate * or http://www.opensolaris.org/os/licensing. 107c478bd9Sstevel@tonic-gate * See the License for the specific language governing permissions 117c478bd9Sstevel@tonic-gate * and limitations under the License. 127c478bd9Sstevel@tonic-gate * 137c478bd9Sstevel@tonic-gate * When distributing Covered Code, include this CDDL HEADER in each 147c478bd9Sstevel@tonic-gate * file and include the License file at usr/src/OPENSOLARIS.LICENSE. 157c478bd9Sstevel@tonic-gate * If applicable, add the following below this CDDL HEADER, with the 167c478bd9Sstevel@tonic-gate * fields enclosed by brackets "[]" replaced with your own identifying 177c478bd9Sstevel@tonic-gate * information: Portions Copyright [yyyy] [name of copyright owner] 187c478bd9Sstevel@tonic-gate * 197c478bd9Sstevel@tonic-gate * CDDL HEADER END 207c478bd9Sstevel@tonic-gate */ 21e2738c5eSjacobs 227c478bd9Sstevel@tonic-gate /* 23e2738c5eSjacobs * Copyright 2006 Sun Microsystems, Inc. All rights reserved. 247c478bd9Sstevel@tonic-gate * Use is subject to license terms. 257c478bd9Sstevel@tonic-gate */ 267c478bd9Sstevel@tonic-gate 277c478bd9Sstevel@tonic-gate /* Copyright (c) 1984, 1986, 1987, 1988, 1989 AT&T */ 287c478bd9Sstevel@tonic-gate /* All Rights Reserved */ 297c478bd9Sstevel@tonic-gate 307c478bd9Sstevel@tonic-gate 317c478bd9Sstevel@tonic-gate #include "stdio.h" 327c478bd9Sstevel@tonic-gate #include "sys/types.h" 337c478bd9Sstevel@tonic-gate #include "memory.h" 347c478bd9Sstevel@tonic-gate #include "string.h" 357c478bd9Sstevel@tonic-gate #include "pwd.h" 367c478bd9Sstevel@tonic-gate #include "fcntl.h" 377c478bd9Sstevel@tonic-gate #include "errno.h" 387c478bd9Sstevel@tonic-gate #include "signal.h" 397c478bd9Sstevel@tonic-gate #include "unistd.h" 407c478bd9Sstevel@tonic-gate #include "stdlib.h" 417c478bd9Sstevel@tonic-gate 427c478bd9Sstevel@tonic-gate #include "lp.h" 437c478bd9Sstevel@tonic-gate #include "access.h" 447c478bd9Sstevel@tonic-gate #include "form.h" 457c478bd9Sstevel@tonic-gate #include "requests.h" 467c478bd9Sstevel@tonic-gate #include "filters.h" 477c478bd9Sstevel@tonic-gate #include "printers.h" 487c478bd9Sstevel@tonic-gate #include "class.h" 497c478bd9Sstevel@tonic-gate #include "users.h" 507c478bd9Sstevel@tonic-gate #include "secure.h" 517c478bd9Sstevel@tonic-gate #include "msgs.h" 527c478bd9Sstevel@tonic-gate 537c478bd9Sstevel@tonic-gate #include "nodes.h" 547c478bd9Sstevel@tonic-gate 557c478bd9Sstevel@tonic-gate /** 567c478bd9Sstevel@tonic-gate ** Defines: 577c478bd9Sstevel@tonic-gate **/ 587c478bd9Sstevel@tonic-gate 597c478bd9Sstevel@tonic-gate /* 60*19d32b9aSRobert Mustacchi * These are the fields in the PSTATUS and CLSTATUS files, 617c478bd9Sstevel@tonic-gate * found in the SYSTEM directory. 627c478bd9Sstevel@tonic-gate */ 637c478bd9Sstevel@tonic-gate 647c478bd9Sstevel@tonic-gate #define PST_MAX 8 657c478bd9Sstevel@tonic-gate # define PST_BRK 0 667c478bd9Sstevel@tonic-gate # define PST_NAME 1 677c478bd9Sstevel@tonic-gate # define PST_STATUS 2 687c478bd9Sstevel@tonic-gate # define PST_DATE 3 697c478bd9Sstevel@tonic-gate # define PST_DISREAS 4 707c478bd9Sstevel@tonic-gate # define PST_REJREAS 5 717c478bd9Sstevel@tonic-gate # define PST_PWHEEL 6 727c478bd9Sstevel@tonic-gate # define PST_FORM 7 737c478bd9Sstevel@tonic-gate 747c478bd9Sstevel@tonic-gate #define CST_MAX 5 757c478bd9Sstevel@tonic-gate # define CST_BRK 0 767c478bd9Sstevel@tonic-gate # define CST_NAME 1 777c478bd9Sstevel@tonic-gate # define CST_STATUS 2 787c478bd9Sstevel@tonic-gate # define CST_DATE 3 797c478bd9Sstevel@tonic-gate # define CST_REJREAS 4 807c478bd9Sstevel@tonic-gate 817c478bd9Sstevel@tonic-gate /* 827c478bd9Sstevel@tonic-gate * Exit codes from child processes: 837c478bd9Sstevel@tonic-gate * 847c478bd9Sstevel@tonic-gate * 0 <= exit <= 0177 (127) are reserved for ``normal'' exits. 857c478bd9Sstevel@tonic-gate * 0200 <= exit <= 0377 (255) are reserved for special failures. 867c478bd9Sstevel@tonic-gate * 877c478bd9Sstevel@tonic-gate * If bit 0200 is set, then we have three sets of special error 887c478bd9Sstevel@tonic-gate * codes available, with 32 values in each set (except the first): 897c478bd9Sstevel@tonic-gate * 907c478bd9Sstevel@tonic-gate * 0201 - 0237 Printer faults 917c478bd9Sstevel@tonic-gate * 0240 - 0277 Dial problems 927c478bd9Sstevel@tonic-gate * 0300 - 0337 Port problems 937c478bd9Sstevel@tonic-gate * 0340 - 0377 Exec problems 947c478bd9Sstevel@tonic-gate * 957c478bd9Sstevel@tonic-gate * 0200 Interface received SIGTERM 967c478bd9Sstevel@tonic-gate */ 977c478bd9Sstevel@tonic-gate #define EXEC_EXIT_OKAY 0 /* success */ 987c478bd9Sstevel@tonic-gate #define EXEC_EXIT_USER 0177 /* user exit codes, 7 bits */ 997c478bd9Sstevel@tonic-gate #define EXEC_EXIT_NMASK 0340 /* mask to uncover reason bits */ 1007c478bd9Sstevel@tonic-gate #define EXEC_EXIT_FAULT 0201 /* printer fault */ 1017c478bd9Sstevel@tonic-gate #define EXEC_EXIT_HUP 0202 /* got hangup early in exec */ 1027c478bd9Sstevel@tonic-gate #define EXEC_EXIT_INTR 0203 /* got interrupt early in exec */ 1037c478bd9Sstevel@tonic-gate #define EXEC_EXIT_PIPE 0204 /* got close of FIFO early in exec */ 1047c478bd9Sstevel@tonic-gate #define EXEC_EXIT_EXIT 0237 /* interface used reserved exit code */ 1057c478bd9Sstevel@tonic-gate #define EXEC_EXIT_NDIAL 0240 /* can't dial, low 5 bits abs(dial()) */ 1067c478bd9Sstevel@tonic-gate #define EXEC_EXIT_NPORT 0300 /* can't open port */ 1077c478bd9Sstevel@tonic-gate #define EXEC_EXIT_TMOUT 0301 /* can't open port in N seconds */ 1087c478bd9Sstevel@tonic-gate #define EXEC_EXIT_NOPEN 0340 /* can't open input/output file */ 1097c478bd9Sstevel@tonic-gate #define EXEC_EXIT_NEXEC 0341 /* can't exec */ 1107c478bd9Sstevel@tonic-gate #define EXEC_EXIT_NOMEM 0342 /* malloc failed */ 1117c478bd9Sstevel@tonic-gate #define EXEC_EXIT_NFORK 0343 /* fork failed, must try again */ 1127c478bd9Sstevel@tonic-gate #define EXEC_EXIT_NPUSH 0344 /* could not push streams module(s) */ 1137c478bd9Sstevel@tonic-gate 1147c478bd9Sstevel@tonic-gate #define EXIT_RETRY 129 /* interface failed, try again */ 1157c478bd9Sstevel@tonic-gate 1167c478bd9Sstevel@tonic-gate /* 1177c478bd9Sstevel@tonic-gate * If killed, return signal, else 0. 1187c478bd9Sstevel@tonic-gate */ 1197c478bd9Sstevel@tonic-gate #define KILLED(x) (!(x & 0xFF00)? (x & 0x7F) : 0) 1207c478bd9Sstevel@tonic-gate 1217c478bd9Sstevel@tonic-gate /* 1227c478bd9Sstevel@tonic-gate * If exited, return exit code, else -1. 1237c478bd9Sstevel@tonic-gate */ 1247c478bd9Sstevel@tonic-gate #define EXITED(x) (!(x & 0xFF)? ((x >> 8) & 0xFF) : -1) 1257c478bd9Sstevel@tonic-gate 1267c478bd9Sstevel@tonic-gate /* 1277c478bd9Sstevel@tonic-gate * Events that can be scheduled: 1287c478bd9Sstevel@tonic-gate */ 1297c478bd9Sstevel@tonic-gate #define EV_SLOWF 1 1307c478bd9Sstevel@tonic-gate #define EV_INTERF 2 1317c478bd9Sstevel@tonic-gate #define EV_NOTIFY 3 1327c478bd9Sstevel@tonic-gate #define EV_LATER 4 1337c478bd9Sstevel@tonic-gate #define EV_ALARM 5 1347c478bd9Sstevel@tonic-gate #define EV_MESSAGE 6 1350a44ef6dSjacobs #define EV_ENABLE 7 1360a44ef6dSjacobs #define EV_FORM_MESSAGE 8 1377c478bd9Sstevel@tonic-gate 1387c478bd9Sstevel@tonic-gate /* 1397c478bd9Sstevel@tonic-gate * How long to wait before retrying an event: 1407c478bd9Sstevel@tonic-gate * (For best results, make CLOCK_TICK a factor of 60.) 1417c478bd9Sstevel@tonic-gate */ 1427c478bd9Sstevel@tonic-gate #define CLOCK_TICK 10 /* no. seconds between alarms */ 1437c478bd9Sstevel@tonic-gate #define MINUTE (60/CLOCK_TICK) /* number of ticks per minute */ 1447c478bd9Sstevel@tonic-gate #define WHEN_FORK (MINUTE) /* retry forking child process */ 1457c478bd9Sstevel@tonic-gate #define WHEN_PRINTER (1*MINUTE) /* retry faulted printer */ 1467c478bd9Sstevel@tonic-gate 1477c478bd9Sstevel@tonic-gate /* 1487c478bd9Sstevel@tonic-gate * Alert types: 1497c478bd9Sstevel@tonic-gate */ 1507c478bd9Sstevel@tonic-gate #define A_PRINTER 1 1517c478bd9Sstevel@tonic-gate #define A_PWHEEL 2 1527c478bd9Sstevel@tonic-gate #define A_FORM 3 1537c478bd9Sstevel@tonic-gate 1547c478bd9Sstevel@tonic-gate /* 1557c478bd9Sstevel@tonic-gate * How to handle active requests when disabling a printer: 1567c478bd9Sstevel@tonic-gate */ 1577c478bd9Sstevel@tonic-gate #define DISABLE_STOP 0 1587c478bd9Sstevel@tonic-gate #define DISABLE_FINISH 1 1597c478bd9Sstevel@tonic-gate #define DISABLE_CANCEL 2 1607c478bd9Sstevel@tonic-gate 1617c478bd9Sstevel@tonic-gate /* 1627c478bd9Sstevel@tonic-gate * validate_request() - VERIFY REQUEST CAN BE PRINTED 1637c478bd9Sstevel@tonic-gate * evaluate_request() - TRY REQUEST ON A PARTICULAR PRINTER 1647c478bd9Sstevel@tonic-gate * reevaluate_request() - TRY TO MOVE REQUEST TO ANOTHER PRINTER 1657c478bd9Sstevel@tonic-gate */ 1667c478bd9Sstevel@tonic-gate 1677c478bd9Sstevel@tonic-gate #define validate_request(PRS,PREFIXP,MOVING) \ 1687c478bd9Sstevel@tonic-gate _validate((PRS), (PSTATUS *)0, (PSTATUS *)0, (PREFIXP), (MOVING)) 1697c478bd9Sstevel@tonic-gate 1707c478bd9Sstevel@tonic-gate #define evaluate_request(PRS,PPS,MOVING) \ 1717c478bd9Sstevel@tonic-gate _validate((PRS), (PPS), (PSTATUS *)0, (char **)0, (MOVING)) 1727c478bd9Sstevel@tonic-gate 1737c478bd9Sstevel@tonic-gate #define reevaluate_request(PRS,PPS) \ 1747c478bd9Sstevel@tonic-gate _validate((PRS), (PSTATUS *)0, (PPS), (char **)0, 0) 1757c478bd9Sstevel@tonic-gate 1767c478bd9Sstevel@tonic-gate /* 1777c478bd9Sstevel@tonic-gate * Request is ready to be slow-filtered: 1787c478bd9Sstevel@tonic-gate */ 1797c478bd9Sstevel@tonic-gate #define NEEDS_FILTERING(PRS) \ 1807c478bd9Sstevel@tonic-gate ((PRS)->slow && !((PRS)->request->outcome & RS_FILTERED)) 1817c478bd9Sstevel@tonic-gate 1827c478bd9Sstevel@tonic-gate /* 1837c478bd9Sstevel@tonic-gate * Misc: 1847c478bd9Sstevel@tonic-gate */ 1857c478bd9Sstevel@tonic-gate 1867c478bd9Sstevel@tonic-gate #define isadmin(ID) (!(ID) || (ID) == Lp_Uid) 1877c478bd9Sstevel@tonic-gate 1887c478bd9Sstevel@tonic-gate #define makereqerr(PRS) \ 1897c478bd9Sstevel@tonic-gate makepath( \ 1900a44ef6dSjacobs Lp_Temp, \ 1917c478bd9Sstevel@tonic-gate getreqno((PRS)->secure->req_id), \ 1927c478bd9Sstevel@tonic-gate (char *)0 \ 1937c478bd9Sstevel@tonic-gate ) 1947c478bd9Sstevel@tonic-gate 1957c478bd9Sstevel@tonic-gate #define EVER ;; 1967c478bd9Sstevel@tonic-gate 1977c478bd9Sstevel@tonic-gate #define DEFAULT_SHELL "/bin/sh" 1987c478bd9Sstevel@tonic-gate 1997c478bd9Sstevel@tonic-gate #define BINMAIL "/bin/mail" 2007c478bd9Sstevel@tonic-gate #define BINWRITE "/bin/write" 2017c478bd9Sstevel@tonic-gate 2027c478bd9Sstevel@tonic-gate #define RMCMD "/usr/bin/rm -f" 2037c478bd9Sstevel@tonic-gate 2047c478bd9Sstevel@tonic-gate 2057c478bd9Sstevel@tonic-gate #if defined(MLISTENDEL_WORKS) 2067c478bd9Sstevel@tonic-gate #define DROP_MD(MD) if (MD) { \ 2077c478bd9Sstevel@tonic-gate mlistendel (MD); \ 2087c478bd9Sstevel@tonic-gate mdisconnect (MD); \ 2090a44ef6dSjacobs MD = 0; \ 2107c478bd9Sstevel@tonic-gate } else /*EMPTY*/ 2117c478bd9Sstevel@tonic-gate #else 2127c478bd9Sstevel@tonic-gate #define DROP_MD(MD) if (MD) { \ 2137c478bd9Sstevel@tonic-gate Close ((MD)->readfd); \ 2147c478bd9Sstevel@tonic-gate if ((MD)->writefd == (MD)->readfd) \ 2157c478bd9Sstevel@tonic-gate (MD)->writefd = -1; \ 2167c478bd9Sstevel@tonic-gate (MD)->readfd = -1; \ 2170a44ef6dSjacobs MD = 0; \ 2187c478bd9Sstevel@tonic-gate } else /*EMPTY*/ 2197c478bd9Sstevel@tonic-gate #endif 2207c478bd9Sstevel@tonic-gate 2217c478bd9Sstevel@tonic-gate /** 2227c478bd9Sstevel@tonic-gate ** External routines: 2237c478bd9Sstevel@tonic-gate **/ 2247c478bd9Sstevel@tonic-gate 2257c478bd9Sstevel@tonic-gate typedef int (*qchk_fnc_type)( RSTATUS * ); 2267c478bd9Sstevel@tonic-gate 2277c478bd9Sstevel@tonic-gate CLASS * Getclass ( char * ); 2287c478bd9Sstevel@tonic-gate 2297c478bd9Sstevel@tonic-gate extern void GetRequestFiles(REQUEST *req, char *buffer, int length); 2307c478bd9Sstevel@tonic-gate 2317c478bd9Sstevel@tonic-gate 2327c478bd9Sstevel@tonic-gate PRINTER * Getprinter ( char * ); 2337c478bd9Sstevel@tonic-gate 2347c478bd9Sstevel@tonic-gate PWHEEL * Getpwheel ( char * ); 2357c478bd9Sstevel@tonic-gate 2367c478bd9Sstevel@tonic-gate 2377c478bd9Sstevel@tonic-gate REQUEST * Getrequest ( char * ); 2387c478bd9Sstevel@tonic-gate 2397c478bd9Sstevel@tonic-gate RSTATUS * request_by_id ( char * ); 2407c478bd9Sstevel@tonic-gate RSTATUS * request_by_id_num ( long ); 2417c478bd9Sstevel@tonic-gate RSTATUS * request_by_jobid ( char * , char * ); 2427c478bd9Sstevel@tonic-gate 2437c478bd9Sstevel@tonic-gate SECURE * Getsecure ( char * ); 2447c478bd9Sstevel@tonic-gate 2457c478bd9Sstevel@tonic-gate USER * Getuser ( char * ); 2467c478bd9Sstevel@tonic-gate 2477c478bd9Sstevel@tonic-gate _FORM * Getform ( char * ); 2487c478bd9Sstevel@tonic-gate 2490a44ef6dSjacobs char * _alloc_files ( int , char * , uid_t , gid_t); 2507c478bd9Sstevel@tonic-gate char * dispatchName(int); 2517c478bd9Sstevel@tonic-gate char * statusName(int); 2527c478bd9Sstevel@tonic-gate char * getreqno ( char * ); 2537c478bd9Sstevel@tonic-gate 2547c478bd9Sstevel@tonic-gate int Loadfilters ( char * ); 2557c478bd9Sstevel@tonic-gate int Putsecure(char *, SECURE *); 2567c478bd9Sstevel@tonic-gate int cancel ( RSTATUS * , int ); 2577c478bd9Sstevel@tonic-gate int disable ( PSTATUS * , char * , int ); 2587c478bd9Sstevel@tonic-gate int enable ( PSTATUS * ); 2597c478bd9Sstevel@tonic-gate int exec ( int , ... ); 2607c478bd9Sstevel@tonic-gate int one_printer_with_charsets ( RSTATUS * ); 2617c478bd9Sstevel@tonic-gate int open_dialup ( char * , PRINTER * ); 2627c478bd9Sstevel@tonic-gate int open_direct ( char * , PRINTER * ); 2637c478bd9Sstevel@tonic-gate int qchk_filter ( RSTATUS * ); 2647c478bd9Sstevel@tonic-gate int qchk_form ( RSTATUS * ); 2657c478bd9Sstevel@tonic-gate int qchk_pwheel ( RSTATUS * ); 2667c478bd9Sstevel@tonic-gate int qchk_waiting ( RSTATUS * ); 2677c478bd9Sstevel@tonic-gate int queue_repel ( PSTATUS * , int , int (*)( RSTATUS * ) ); 2687c478bd9Sstevel@tonic-gate int rsort ( RSTATUS ** , RSTATUS ** ); 2697c478bd9Sstevel@tonic-gate 2707c478bd9Sstevel@tonic-gate long getkey ( void ); 2717c478bd9Sstevel@tonic-gate long _alloc_req_id ( void ); 2727c478bd9Sstevel@tonic-gate 2737c478bd9Sstevel@tonic-gate off_t chfiles ( char ** , uid_t , gid_t ); 2747c478bd9Sstevel@tonic-gate 2757c478bd9Sstevel@tonic-gate short _validate ( RSTATUS * , PSTATUS * , PSTATUS * , char ** , int ); 2767c478bd9Sstevel@tonic-gate 2777c478bd9Sstevel@tonic-gate void add_flt_act ( MESG * , ... ); 2787c478bd9Sstevel@tonic-gate void alert ( int , ... ); 2797c478bd9Sstevel@tonic-gate void cancel_alert ( int , ... ); 2807c478bd9Sstevel@tonic-gate void check_children ( void ); 2817c478bd9Sstevel@tonic-gate void check_form_alert ( FSTATUS * , _FORM * ); 2827c478bd9Sstevel@tonic-gate void check_pwheel_alert ( PWSTATUS * , PWHEEL * ); 2837c478bd9Sstevel@tonic-gate void check_request ( RSTATUS * ); 2847c478bd9Sstevel@tonic-gate void del_flt_act ( MESG * , ... ); 2857c478bd9Sstevel@tonic-gate void dial_problem ( PSTATUS * , RSTATUS * , int ); 2867c478bd9Sstevel@tonic-gate void dispatch ( int , char * , MESG * ); 2877c478bd9Sstevel@tonic-gate void dowait ( void ); 2887c478bd9Sstevel@tonic-gate void dump_cstatus ( void ); 2897c478bd9Sstevel@tonic-gate void dump_fault_status(PSTATUS *); 2907c478bd9Sstevel@tonic-gate void dump_pstatus ( void ); 2917c478bd9Sstevel@tonic-gate void dump_status ( void ); 2927c478bd9Sstevel@tonic-gate void execlog ( char * , ... ); 2937c478bd9Sstevel@tonic-gate void fail ( char * , ... ); 2947c478bd9Sstevel@tonic-gate void free_form ( _FORM * ); 2957c478bd9Sstevel@tonic-gate void freerstatus ( register RSTATUS * ); 2967c478bd9Sstevel@tonic-gate void init_memory ( void ); 2977c478bd9Sstevel@tonic-gate void init_messages ( void ); 2987c478bd9Sstevel@tonic-gate void insertr ( RSTATUS * ); 2997c478bd9Sstevel@tonic-gate void load_sdn ( char ** , SCALED ); 3007c478bd9Sstevel@tonic-gate void load_status ( void ); 3017c478bd9Sstevel@tonic-gate void load_str ( char ** , char * ); 3027c478bd9Sstevel@tonic-gate void lp_endpwent ( void ); 3037c478bd9Sstevel@tonic-gate void lp_setpwent ( void ); 3047c478bd9Sstevel@tonic-gate void lpfsck ( void ); 3057c478bd9Sstevel@tonic-gate void lpshut ( int ); 3067c478bd9Sstevel@tonic-gate void mallocfail ( void ); 3077c478bd9Sstevel@tonic-gate void maybe_schedule ( RSTATUS * ); 3087c478bd9Sstevel@tonic-gate void note ( char * , ... ); 3097c478bd9Sstevel@tonic-gate void notify ( RSTATUS * , char * , int , int , int ); 3107c478bd9Sstevel@tonic-gate void printer_fault ( PSTATUS * , RSTATUS * , char * , int ); 3117c478bd9Sstevel@tonic-gate void clear_printer_fault ( PSTATUS * , char * ); 3127c478bd9Sstevel@tonic-gate void putjobfiles ( RSTATUS * ); 3137c478bd9Sstevel@tonic-gate void queue_attract ( PSTATUS * , int (*)( RSTATUS * ) , int ); 3147c478bd9Sstevel@tonic-gate void queue_check ( int (*)( RSTATUS * ) ); 3157c478bd9Sstevel@tonic-gate void queue_form ( RSTATUS * , FSTATUS * ); 3167c478bd9Sstevel@tonic-gate void queue_pwheel ( RSTATUS * , char * ); 3177c478bd9Sstevel@tonic-gate void remount_form(register PSTATUS *, FSTATUS *, short); 3187c478bd9Sstevel@tonic-gate void remover ( RSTATUS * ); 3197c478bd9Sstevel@tonic-gate void rmfiles ( RSTATUS * , int ); 3207c478bd9Sstevel@tonic-gate void rmreq ( RSTATUS * ); 3217c478bd9Sstevel@tonic-gate void schedule ( int , ... ); 3227c478bd9Sstevel@tonic-gate void take_message ( void ); 3237c478bd9Sstevel@tonic-gate void terminate ( EXEC * ); 3247c478bd9Sstevel@tonic-gate void unload_list ( char *** ); 3257c478bd9Sstevel@tonic-gate void unload_str ( char ** ); 3267c478bd9Sstevel@tonic-gate void unqueue_form ( RSTATUS * ); 3277c478bd9Sstevel@tonic-gate void unqueue_pwheel ( RSTATUS * ); 3287c478bd9Sstevel@tonic-gate void update_req ( char * , long ); 3297c478bd9Sstevel@tonic-gate int isFormMountedOnPrinter ( PSTATUS *, FSTATUS * ); 3307c478bd9Sstevel@tonic-gate int isFormUsableOnPrinter ( PSTATUS *, FSTATUS * ); 3317c478bd9Sstevel@tonic-gate char *allTraysWithForm ( PSTATUS *, FSTATUS * ); 3320a44ef6dSjacobs extern int list_append(void ***, void *); 3330a44ef6dSjacobs extern void list_remove(void ***, void *); 3340a44ef6dSjacobs 3350a44ef6dSjacobs extern RSTATUS *new_rstatus(REQUEST *, SECURE *); 3360a44ef6dSjacobs extern PSTATUS *new_pstatus(PRINTER *); 337*19d32b9aSRobert Mustacchi extern CLSTATUS *new_cstatus(CLASS *); 3380a44ef6dSjacobs extern FSTATUS *new_fstatus(_FORM *f); 3390a44ef6dSjacobs extern PWSTATUS *new_pwstatus(PWHEEL *p); 3400a44ef6dSjacobs extern ALERT *new_alert(char *fmt, int i); 3410a44ef6dSjacobs extern EXEC *new_exec(int type, void *ex); 3420a44ef6dSjacobs 3430a44ef6dSjacobs extern void pstatus_add_printer(PSTATUS *, PRINTER *); 3440a44ef6dSjacobs 3450a44ef6dSjacobs extern void free_exec(EXEC *); 3460a44ef6dSjacobs extern void free_alert(ALERT *); 3470a44ef6dSjacobs extern void free_pwstatus(PWSTATUS *); 3480a44ef6dSjacobs extern void free_fstatus(FSTATUS *); 349*19d32b9aSRobert Mustacchi extern void free_cstatus(CLSTATUS *); 3500a44ef6dSjacobs extern void free_pstatus(PSTATUS *); 3510a44ef6dSjacobs extern void free_rstatus(RSTATUS *); 3520a44ef6dSjacobs 353*19d32b9aSRobert Mustacchi extern CLSTATUS *search_cstatus ( char * ); 3540a44ef6dSjacobs extern FSTATUS *search_fptable(register char *); 3550a44ef6dSjacobs extern FSTATUS *search_fstatus ( char * ); 3560a44ef6dSjacobs extern PSTATUS *search_pstatus ( char * ); 3570a44ef6dSjacobs extern PWSTATUS *search_pwstatus ( char * ); 3587c478bd9Sstevel@tonic-gate 3597c478bd9Sstevel@tonic-gate /* 3607c478bd9Sstevel@tonic-gate * Things that can't be passed as parameters: 3617c478bd9Sstevel@tonic-gate */ 3627c478bd9Sstevel@tonic-gate 3637c478bd9Sstevel@tonic-gate extern FSTATUS *form_in_question; 3647c478bd9Sstevel@tonic-gate 3657c478bd9Sstevel@tonic-gate extern char *pwheel_in_question; 3667c478bd9Sstevel@tonic-gate 3677c478bd9Sstevel@tonic-gate /** 3687c478bd9Sstevel@tonic-gate ** External tables, lists: 3697c478bd9Sstevel@tonic-gate **/ 3707c478bd9Sstevel@tonic-gate 371*19d32b9aSRobert Mustacchi extern CLSTATUS **CStatus; /* Status of classes */ 3720a44ef6dSjacobs extern PSTATUS **PStatus; /* Status of printers */ 3730a44ef6dSjacobs extern FSTATUS **FStatus; /* Status of forms */ 3740a44ef6dSjacobs extern PWSTATUS **PWStatus; /* Status of print wheels */ 3757c478bd9Sstevel@tonic-gate 3760a44ef6dSjacobs extern EXEC **Exec_Table; /* Running processes */ 3770a44ef6dSjacobs extern EXEC **Exec_Slow, /* First slow filter exec */ 3780a44ef6dSjacobs **Exec_Notify; /* First notification exec */ 3797c478bd9Sstevel@tonic-gate 3807c478bd9Sstevel@tonic-gate extern RSTATUS *Request_List; /* Queue of print requests */ 3817c478bd9Sstevel@tonic-gate extern RSTATUS *NewRequest; /* Not in Request_List yet */ 3827c478bd9Sstevel@tonic-gate 3830a44ef6dSjacobs extern int ET_SlowSize, /* Number of filter execs */ 3840a44ef6dSjacobs ET_NotifySize; /* Number of notify execs */ 3857c478bd9Sstevel@tonic-gate 3867c478bd9Sstevel@tonic-gate #if defined(DEBUG) 3877c478bd9Sstevel@tonic-gate #define DB_ABORT 0x00000008 3887c478bd9Sstevel@tonic-gate #define DB_SDB 0x00000020 3897c478bd9Sstevel@tonic-gate #define DB_ALL 0xFFFFFFFF 3907c478bd9Sstevel@tonic-gate 3917c478bd9Sstevel@tonic-gate extern unsigned long debug; 3927c478bd9Sstevel@tonic-gate #endif 3937c478bd9Sstevel@tonic-gate 3947c478bd9Sstevel@tonic-gate extern char *Local_System, /* Node name of local system */ 3957c478bd9Sstevel@tonic-gate *SHELL; /* value of $SHELL, or default */ 3967c478bd9Sstevel@tonic-gate 3977c478bd9Sstevel@tonic-gate extern int lock_fd; 3987c478bd9Sstevel@tonic-gate 3997c478bd9Sstevel@tonic-gate extern uid_t Lp_Uid; 4007c478bd9Sstevel@tonic-gate 4017c478bd9Sstevel@tonic-gate extern gid_t Lp_Gid; 4027c478bd9Sstevel@tonic-gate 4037c478bd9Sstevel@tonic-gate extern int Starting, 4047c478bd9Sstevel@tonic-gate OpenMax, 4057c478bd9Sstevel@tonic-gate Sig_Alrm, 4067c478bd9Sstevel@tonic-gate DoneChildren, 4077c478bd9Sstevel@tonic-gate am_in_background, 4087c478bd9Sstevel@tonic-gate Shutdown; 4097c478bd9Sstevel@tonic-gate 4107c478bd9Sstevel@tonic-gate extern unsigned long chkprinter_result; 4117c478bd9Sstevel@tonic-gate 4127c478bd9Sstevel@tonic-gate #if defined(MDL) 4137c478bd9Sstevel@tonic-gate #include "mdl.h" 4147c478bd9Sstevel@tonic-gate #endif 4157c478bd9Sstevel@tonic-gate # define CLOSE_ON_EXEC(fd) (void) Fcntl(fd, F_SETFD, 1) 416