CHANGES IN CUPS V1.1.16
+ - When starting the scheduler in daemon mode, the parent
+ process now waits for the child to signal it is ready
+ to accept connections.
+ - Added -F option to cupsd to run cupsd in the
+ foreground but detach from the controlling terminal
+ and current directory.
+ - The scheduler did not reload jobs when receiving a HUP
+ signal; this would cause problems since the pointers
+ into the file type database would no longer be valid
+ for existing jobs.
+ - The scheduler did not save the network interface list
+ update time, thus no caching of the network data was
+ actually provided.
+ - Updated the SuSE PAM configuration file.
- The LPD backend now supports a "reserve" option and no
longer reserves a priviledged port by default.
- The cupsaddsmb command now continues past printers
-auth required /lib/security/pam_unix.so nullok shadow
-account required /lib/security/pam_unix.so
+auth required pam_unix2.so nullok shadow
+account required pam_unix2.so
.\"
-.\" "$Id: cupsd.man,v 1.5.2.1 2002/01/02 18:04:52 mike Exp $"
+.\" "$Id: cupsd.man,v 1.5.2.2 2002/07/18 10:52:07 mike Exp $"
.\"
.\" cupsd man page for the Common UNIX Printing System (CUPS).
.\"
.\" EMail: cups-info@cups.org
.\" WWW: http://www.cups.org
.\"
-.TH cupsd 8 "Common UNIX Printing System" "19 October 2000" "Easy Software Products"
+.TH cupsd 8 "Common UNIX Printing System" "18 July 2002" "Easy Software Products"
.SH NAME
cupsd \- common unix printing system daemon
.SH SYNOPSIS
.B cupsd
[ \-c
.I config-file
-] [ \-f ]
+] [ \-f ] [ \-F ]
.SH DESCRIPTION
\fIcupsd\fR is the scheduler for the Common UNIX Printing System. It
implements a printing system based upon the Internet Printing Protocol,
.PP
The \fI-f\fR option forces \fIcupsd\fR to run in the foreground; the
default is to run in the background as a "daemon".
+.PP
+The \fI-F\fR option forces \fIcupsd\fR to run in the foreground
+but detaches the process from the controlling terminal and
+current directory. This is useful for running \fIcupsd\fR from
+\fIinit\fR.
.SH COMPATIBILITY
\fIcupsd\fR implements all of the required IPP/1.1 attributes and
operations. It also implements several CUPS-specific administation
.SH COPYRIGHT
Copyright 1993-2002 by Easy Software Products, All Rights Reserved.
.\"
-.\" End of "$Id: cupsd.man,v 1.5.2.1 2002/01/02 18:04:52 mike Exp $".
+.\" End of "$Id: cupsd.man,v 1.5.2.2 2002/07/18 10:52:07 mike Exp $".
.\"
/*
- * "$Id: conf.c,v 1.77.2.12 2002/06/14 19:48:54 mike Exp $"
+ * "$Id: conf.c,v 1.77.2.13 2002/07/18 10:52:08 mike Exp $"
*
* Configuration routines for the Common UNIX Printing System (CUPS).
*
* Free all memory...
*/
+ FreeAllJobs();
DeleteAllClasses();
DeleteAllLocations();
DeleteAllPrinters();
* Check for queued jobs...
*/
+ LoadAllJobs();
CheckJobs();
return (1);
/*
- * End of "$Id: conf.c,v 1.77.2.12 2002/06/14 19:48:54 mike Exp $".
+ * End of "$Id: conf.c,v 1.77.2.13 2002/07/18 10:52:08 mike Exp $".
*/
/*
- * "$Id: job.c,v 1.124.2.21 2002/07/15 23:47:28 mike Exp $"
+ * "$Id: job.c,v 1.124.2.22 2002/07/18 10:52:08 mike Exp $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
* CheckJobs() - Check the pending jobs and start any if the
* destination is available.
* CleanJobs() - Clean out old jobs.
+ * FreeAllJobs() - Free all jobs from memory.
* FindJob() - Find the specified job.
* GetPrinterJobCount() - Get the number of pending, processing,
* or held jobs in a printer or class.
}
+/*
+ * 'FreeAllJobs()' - Free all jobs from memory.
+ */
+
+void
+FreeAllJobs(void)
+{
+ job_t *job, /* Current job */
+ *next; /* Next job */
+
+
+ StopAllJobs();
+
+ for (job = Jobs; job; job = next)
+ {
+ next = job->next;
+
+ ippDelete(job->attrs);
+ free(job->filetypes);
+ free(job);
+ }
+}
+
+
/*
* 'FindJob()' - Find the specified job.
*/
/*
- * End of "$Id: job.c,v 1.124.2.21 2002/07/15 23:47:28 mike Exp $".
+ * End of "$Id: job.c,v 1.124.2.22 2002/07/18 10:52:08 mike Exp $".
*/
/*
- * "$Id: job.h,v 1.25.2.4 2002/03/21 02:34:28 mike Exp $"
+ * "$Id: job.h,v 1.25.2.5 2002/07/18 10:52:09 mike Exp $"
*
* Print job definitions for the Common UNIX Printing System (CUPS) scheduler.
*
extern void CleanJobs(void);
extern void DeleteJob(int id);
extern job_t *FindJob(int id);
+extern void FreeAllJobs(void);
extern int GetPrinterJobCount(const char *dest);
extern int GetUserJobCount(const char *username);
extern void HoldJob(int id);
/*
- * End of "$Id: job.h,v 1.25.2.4 2002/03/21 02:34:28 mike Exp $".
+ * End of "$Id: job.h,v 1.25.2.5 2002/07/18 10:52:09 mike Exp $".
*/
/*
- * "$Id: main.c,v 1.57.2.15 2002/06/14 19:48:56 mike Exp $"
+ * "$Id: main.c,v 1.57.2.16 2002/07/18 10:52:09 mike Exp $"
*
* Scheduler main loop for the Common UNIX Printing System (CUPS).
*
static void sigchld_handler(int sig);
static void sighup_handler(int sig);
static void sigterm_handler(int sig);
+static void sigusr1_handler(int sig);
static void usage(void);
fg = 1;
break;
+ case 'F' : /* Run in foreground, but still disconnect from terminal... */
+ fg = -1;
+ break;
+
default : /* Unknown option */
fprintf(stderr, "cupsd: Unknown option \'%c\' - aborting!\n", *opt);
usage();
if (!fg)
{
if (fork() > 0)
- return (0);
+ {
+ /*
+ * OK, wait for the child to startup and send us SIGUSR1...
+ */
+#ifdef HAVE_SIGSET /* Use System V signals over POSIX to avoid bugs */
+ sigset(SIGUSR1, sigusr1_handler);
+#elif defined(HAVE_SIGACTION)
+ sigemptyset(&action.sa_mask);
+ sigaddset(&action.sa_mask, SIGUSR1);
+ action.sa_handler = sigusr1_handler;
+ sigaction(SIGUSR1, &action, NULL);
+#else
+ signal(SIGUSR1, sigusr1_handler);
+#endif /* HAVE_SIGSET */
+
+ if (wait(&i) < 0)
+ i = 0;
+
+ if (i == 0)
+ return (0);
+
+ if (i >= 256)
+ fprintf(stderr, "cupsd: Child exited with status %d!\n", i / 256);
+ else
+ fprintf(stderr, "cupsd: Child exited on signal %d!\n", i);
+
+ return (i);
+ }
+ }
+
+ if (fg < 1)
+ {
/*
* Make sure we aren't tying up any filesystems...
*/
InitCerts();
/*
- * Load all the jobs...
+ * If we are running in the background, signal the parent process that
+ * we are up and running...
*/
- LoadAllJobs();
+ if (!fg)
+ kill(getppid(), SIGUSR1);
/*
* Loop forever...
if ((pid = wait(&status)) > 0)
#endif /* HAVE_WAITPID */
{
- DEBUG_printf(("sigcld_handler: pid = %d, status = %d\n", pid, status));
+ DEBUG_printf(("sigchld_handler: pid = %d, status = %d\n", pid, status));
/*
* Delete certificates for CGI processes...
*/
static void
-sigterm_handler(int sig)
+sigterm_handler(int sig) /* I - Signal */
{
#ifdef __sgi
struct stat statbuf; /* Needed for checking lpsched FIFO */
if (Clients != NULL)
free(Clients);
- StopAllJobs();
+ FreeAllJobs();
if (AccessFile != NULL)
fclose(AccessFile);
}
+/*
+ * 'sigusr1_handler()' - Catch USR1 signals...
+ */
+
+static void
+sigusr1_handler(int sig) /* I - Signal */
+{
+ (void)sig; /* remove compiler warnings... */
+}
+
+
/*
* 'usage()' - Show scheduler usage.
*/
/*
- * End of "$Id: main.c,v 1.57.2.15 2002/06/14 19:48:56 mike Exp $".
+ * End of "$Id: main.c,v 1.57.2.16 2002/07/18 10:52:09 mike Exp $".
*/
/*
- * "$Id: network.c,v 1.5.2.5 2002/05/16 14:00:15 mike Exp $"
+ * "$Id: network.c,v 1.5.2.6 2002/07/18 10:52:10 mike Exp $"
*
* Network interface functions for the Common UNIX Printing System
* (CUPS) scheduler.
if ((time(NULL) - NetIFTime) < 60)
return;
+ NetIFTime = time(NULL);
+
/*
* Free the old interfaces...
*/
/*
- * End of "$Id: network.c,v 1.5.2.5 2002/05/16 14:00:15 mike Exp $".
+ * End of "$Id: network.c,v 1.5.2.6 2002/07/18 10:52:10 mike Exp $".
*/