]> git.ipfire.org Git - thirdparty/cups.git/commitdiff
Mirror 1.1.x changes.
authormike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 18 Jul 2002 10:52:10 +0000 (10:52 +0000)
committermike <mike@7a7537e8-13f0-0310-91df-b6672ffda945>
Thu, 18 Jul 2002 10:52:10 +0000 (10:52 +0000)
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@2567 7a7537e8-13f0-0310-91df-b6672ffda945

CHANGES-1.1.txt
data/cups.suse
man/cupsd.man
scheduler/conf.c
scheduler/job.c
scheduler/job.h
scheduler/main.c
scheduler/network.c

index a34bc21e5b008806fd790fb0f57b41512e0cf5a5..fc742fc85c372f537b10548d7e5d396a3151cb97 100644 (file)
@@ -3,6 +3,20 @@ CHANGES-1.1.txt
 
 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
index 0c26fbe0d8da74b1fb109430cf33bde5d781d32e..a9369e1619c894264612527414b13b8fb66c3bca 100644 (file)
@@ -1,2 +1,2 @@
-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
index 418af8ba51696121ef7b0de6aa1cd93d4da22d15..55589a7596029285ff59cb52dee29fe33cd19f22 100644 (file)
@@ -1,5 +1,5 @@
 .\"
-.\" "$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,
@@ -38,6 +38,11 @@ used.
 .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
@@ -52,5 +57,5 @@ http://localhost:631/documentation.html
 .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 $".
 .\"
index 9892da45cc8cbf42c59b079dd570e379d3ea7699..bd66c2253813ce0fcd979d9a3ed8d4c5c39a8b89 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -184,6 +184,7 @@ ReadConfiguration(void)
   * Free all memory...
   */
 
+  FreeAllJobs();
   DeleteAllClasses();
   DeleteAllLocations();
   DeleteAllPrinters();
@@ -593,6 +594,7 @@ ReadConfiguration(void)
   * Check for queued jobs...
   */
 
+  LoadAllJobs();
   CheckJobs();
 
   return (1);
@@ -2022,5 +2024,5 @@ get_addr_and_mask(const char *value,      /* I - String from config file */
 
 
 /*
- * 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 $".
  */
index a4a57ec2cae47beff92fa9e300b85c614fcf4134..07b1c46c52a780fd21e58288f285a91a534d9796 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -29,6 +29,7 @@
  *   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.
@@ -356,6 +357,30 @@ CleanJobs(void)
 }
 
 
+/*
+ * '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.
  */
@@ -2321,5 +2346,5 @@ start_process(const char *command,        /* I - Full path to command */
 
 
 /*
- * 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 $".
  */
index e9e832a64755217fc35825d0c5d9188e6f562acf..05c788fbb955d6256e88cbad21e70ed43faef2dd 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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.
  *
@@ -91,6 +91,7 @@ extern void   CheckJobs(void);
 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);
@@ -108,5 +109,5 @@ extern void UpdateJob(job_t *job);
 
 
 /*
- * 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 $".
  */
index fe732bd121864c7851f07a3b45f48f5a20ef18bb..69eaa901dc1b95d3f8a549dfedf490796ebea161 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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).
  *
@@ -57,6 +57,7 @@
 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);
 
 
@@ -132,6 +133,10 @@ main(int  argc,                    /* I - Number of command-line arguments */
              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();
@@ -150,8 +155,39 @@ main(int  argc,                    /* I - Number of command-line arguments */
   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...
     */
@@ -283,10 +319,12 @@ main(int  argc,                   /* I - Number of command-line arguments */
   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...
@@ -645,7 +683,7 @@ sigchld_handler(int sig)    /* I - Signal number */
   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...
@@ -741,7 +779,7 @@ sighup_handler(int sig)     /* I - Signal number */
  */
 
 static void
-sigterm_handler(int sig)
+sigterm_handler(int sig)               /* I - Signal */
 {
 #ifdef __sgi
   struct stat  statbuf;                /* Needed for checking lpsched FIFO */
@@ -768,7 +806,7 @@ sigterm_handler(int sig)
   if (Clients != NULL)
     free(Clients);
 
-  StopAllJobs();
+  FreeAllJobs();
 
   if (AccessFile != NULL)
     fclose(AccessFile);
@@ -810,6 +848,17 @@ sigterm_handler(int sig)
 }
 
 
+/*
+ * 'sigusr1_handler()' - Catch USR1 signals...
+ */
+
+static void
+sigusr1_handler(int sig)               /* I - Signal */
+{
+  (void)sig;   /* remove compiler warnings... */
+}
+
+
 /*
  * 'usage()' - Show scheduler usage.
  */
@@ -823,5 +872,5 @@ usage(void)
 
 
 /*
- * 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 $".
  */
index 921481703957f5aa691474e594a83059ae340575..917f1e05a7e95363462b8d050e29be5e0ad3e177 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * "$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.
@@ -142,6 +142,8 @@ NetIFUpdate(void)
   if ((time(NULL) - NetIFTime) < 60)
     return;
 
+  NetIFTime = time(NULL);
+
  /*
   * Free the old interfaces...
   */
@@ -477,5 +479,5 @@ freeifaddrs(struct ifaddrs *addrs)  /* I - Interface list to free */
 
 
 /*
- * 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 $".
  */