void cupsdCleanDirty(void) { if (DirtyFiles & CUPSD_DIRTY_PRINTERS) cupsdSaveAllPrinters(); if (DirtyFiles & CUPSD_DIRTY_CLASSES) cupsdSaveAllClasses(); if (DirtyFiles & CUPSD_DIRTY_PRINTCAP) cupsdWritePrintcap(); if (DirtyFiles & CUPSD_DIRTY_JOBS) { cupsd_job_t *job; /* Current job */ cupsdSaveAllJobs(); for (job = (cupsd_job_t *)cupsArrayFirst(Jobs); job; job = (cupsd_job_t *)cupsArrayNext(Jobs)) if (job->dirty) cupsdSaveJob(job); } if (DirtyFiles & CUPSD_DIRTY_SUBSCRIPTIONS) cupsdSaveAllSubscriptions(); DirtyFiles = CUPSD_DIRTY_NONE; DirtyCleanTime = 0; cupsdSetBusyState(); }
void cupsdStartServer(void) { /* * Start color management (as needed)... */ cupsdStartColor(); /* * Create the default security profile... */ DefaultProfile = cupsdCreateProfile(0, 1); /* * Startup all the networking stuff... */ cupsdStartListening(); cupsdStartBrowsing(); /* * Create a pipe for CGI processes... */ if (cupsdOpenPipe(CGIPipes)) cupsdLogMessage(CUPSD_LOG_ERROR, "cupsdStartServer: Unable to create pipes for CGI status!"); else { CGIStatusBuffer = cupsdStatBufNew(CGIPipes[0], "[CGI]"); cupsdAddSelect(CGIPipes[0], (cupsd_selfunc_t)cupsdUpdateCGI, NULL, NULL); } /* * Mark that the server has started and printers and jobs may be changed... */ LastEvent = CUPSD_EVENT_PRINTER_CHANGED | CUPSD_EVENT_JOB_STATE_CHANGED | CUPSD_EVENT_SERVER_STARTED; started = 1; cupsdSetBusyState(); }
void cupsdMarkDirty(int what) /* I - What file(s) are dirty? */ { cupsdLogMessage(CUPSD_LOG_DEBUG, "cupsdMarkDirty(%c%c%c%c%c)", (what & CUPSD_DIRTY_PRINTERS) ? 'P' : '-', (what & CUPSD_DIRTY_CLASSES) ? 'C' : '-', (what & CUPSD_DIRTY_PRINTCAP) ? 'p' : '-', (what & CUPSD_DIRTY_JOBS) ? 'J' : '-', (what & CUPSD_DIRTY_SUBSCRIPTIONS) ? 'S' : '-'); if (what == CUPSD_DIRTY_PRINTCAP && !Printcap) return; DirtyFiles |= what; if (!DirtyCleanTime) DirtyCleanTime = time(NULL) + DirtyCleanInterval; cupsdSetBusyState(); }