This document is still being updated for CUPS 1.2...
This design description documents the overall organization of the Common UNIX Printing System. The purpose is not to provide a line-by-line description of the CUPS source code, but rather to describe the overall architecture and location of key pieces so that developers can more easily understand the underlying operation of CUPS.
Like most printing systems, CUPS is designed around a central print scheduling process that dispatches print jobs, processes administrative commands, provides printer status information to local and remote programs, and informs users as needed. Figure 1 shows the basic organization of CUPS.
The scheduler is a HTTP/1.1 and IPP/1.1 server application
manages HTTP and IPP requests, printers, classes, jobs,
subscriptions, and notifications on the system. HTTP is used for
normal web browser services as well as IPP operation messages
passed via HTTP POST requests with the
application/ipp content type. The scheduler uses a
series of helper Common Gateway Interface ("CGI") applications to
provide dynamic web interfaces, and can be configured to run
additional, site-specific programs or scripts for the web
interface.
The scheduler is designed as a traditional monolithic, single-threaded server process which runs external processes to do longer-term operations such as printing, notification, device/driver enumeration, and remote printer monitoring. While this design does limit the maximum number of simultaneous clients that can be supported on a typical system, it also keep resource utilization to a minimum and greatly simplifies the scheduler's logic.
![]() |
The scheduler stores job files in a spool directory, typically /var/spool/cups. Two types of files will be found in the spool directory: control files starting with the letter "c" ("c00001", "c99999", "c100000", etc.) and data files starting with the letter "d" ("d00001-001", "d99999-001", "d100000-001", etc.) Control files are IPP messages based on the original IPP Print-Job or Create-Job messages, while data files are the original print files that were submitted for printing. There is one control file for every job known to the system and 0 or more data files for each job. Data files are normally removed after a job has successfully printed, however this behavior can be configured.
The scheduler keeps three kinds of log files which are normally stored in the /var/log/cups directory. The access_log file lists every HTTP and IPP request that is processed by the scheduler. The error_log file contains messages from the scheduler and its helper applications that can be used to track down problems. The page_log file lists every page that is printed, allowing for simple print accounting.
Log files are rotated automatically by the scheduler when they reach the configured size limit, by default 1MB. If the limit is set to 0 then no rotation is performed in the scheduler - this mode is often used by Linux distributions so they can use the logrotated(8) program to rotate them instead.
The scheduler uses several configuration files to store the server settings (cupsd.conf), available classes (classes.conf), available printers (printers.conf), current notification subscriptions (subscriptions.conf), and supported file types and filters (mime.types, mime.convs). In addition, PostScript Printer Description ("PPD") files or interface scripts are associated with each printer, and the scheduler has cache files for remote printers, PPD files, and current jobs to optimize the scheduler's startup speed and availability.
CUPS provides the Berkeley lpc(8), lpq(1), lpr(1), and lprm(1) commands. In general, they function identically to the original Berkeley commands with the following exceptions:
CUPS provides the System V accept(8), cancel(1), lp(1), lpadmin(8), lpmove(8), lpstat(1), and reject(8) commands. In general, they function identically to the original System V commands with the following exceptions:
CUPS provides the cupsaddsmb(8), cupsdisable(8), cupsenable(8), cupstestppd(1), lpinfo(8), and lppasswd(1) commands. The cupsdisable and cupsenable commands correspond to the System V disable and enable commands but have been renamed to avoid conflicts with the bash(1) internal commands of the same name.
LPD client support is provided via the cups-lpd(8) program. Incoming LPD requests are accepted on TCP port 515 by the local inetd(8), launchd(8), or xinetd(8) process and forwarded to the cups-lpd program for conversion to the corresponding IPP request(s).
The cups-lpd program conforms, for the most part, to RFC 1179: Line Printer Daemon Protocol, but does not enforce the privileged source port restriction specified in that document. In addition, the banner page and output format options are usually overridden via command-line options to the cups-lpd program when it is invoked by the corresponding super-daemon program.
The web interface is supported by five CGI programs. Table 1 describes the purpose of each of the programs.
| Program | Location | Description |
|---|---|---|
| admin.cgi | /admin | Provides all of the administrative functions |
| classes.cgi | /classes | Lists classes and provides class management functions |
| help.cgi | /help | Provides access to on-line help documents |
| jobs.cgi | /jobs | Lists jobs and provides job management functions |
| printers.cgi | /printers | Lists printers and provides printer management functions |
Notifiers provide the means for sending event notifications from the scheduler. Notifiers are executed with the recipient information on the command-line and the event data on the standard input.
The mailto notifier is the only notifier included with CUPS 1.2 and handles email notifications for the scheduler. Additional notifiers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.
ers can be added as needed without additional configuration.
Filters convert job files into a printable format. Multiple filters are run, as needed, to convert from the job file format to the printable format. A filter program reads from the standard input or from a file if a filename is supplied. All filters must support a common set of options including printer name, job ID, username, job title, number of copies, and job options. All output is sent to the standard output.