Add additional debug2 messages to track pipe usage.
Also stop jobs and browsing on scheduler shutdown.
Use strace, if available, to provide a system call trace in the test
report.
git-svn-id: svn+ssh://src.apple.com/svn/cups/cups.org/branches/branch-1.2@2341
7a7537e8-13f0-0310-91df-
b6672ffda945
- * "$Id: client.c,v 1.91.2.8 2002/04/20 21:05:13 mike Exp $"
+ * "$Id: client.c,v 1.91.2.9 2002/04/21 12:47:03 mike Exp $"
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
*
* Client routines for the Common UNIX Printing System (CUPS) scheduler.
*
int val; /* Parameter value */
client_t *con; /* New client pointer */
const struct hostent *host; /* Host entry for address */
int val; /* Parameter value */
client_t *con; /* New client pointer */
const struct hostent *host; /* Host entry for address */
+ char *hostname;/* Hostname for address */
http_addr_t temp; /* Temporary address variable */
http_addr_t temp; /* Temporary address variable */
con->http.hostaddr.ipv4.sin_port = lis->address.ipv4.sin_port;
if (HostNameLookups)
con->http.hostaddr.ipv4.sin_port = lis->address.ipv4.sin_port;
if (HostNameLookups)
- host = httpAddrLookup(&(con->http.hostaddr), con->http.hostname,
- sizeof(con->http.hostname));
+ hostname = httpAddrLookup(&(con->http.hostaddr), con->http.hostname,
+ sizeof(con->http.hostname));
httpAddrString(&(con->http.hostaddr), con->http.hostname,
sizeof(con->http.hostname));
}
httpAddrString(&(con->http.hostaddr), con->http.hostname,
sizeof(con->http.hostname));
}
strncpy(con->http.hostname, ServerName, sizeof(con->http.hostname) - 1);
}
strncpy(con->http.hostname, ServerName, sizeof(con->http.hostname) - 1);
}
- if (host == NULL && HostNameLookups == 2)
+ if (hostname == NULL && HostNameLookups == 2)
{
/*
* Can't have an unresolved IP address with double-lookups enabled...
{
/*
* Can't have an unresolved IP address with double-lookups enabled...
#ifdef AF_INET6
if (con->http.hostaddr.addr.sa_family == AF_INET6)
#ifdef AF_INET6
if (con->http.hostaddr.addr.sa_family == AF_INET6)
- LogMessage(L_DEBUG, "AcceptClient() %d from %s:%d.", con->http.fd,
+ LogMessage(L_DEBUG, "AcceptClient: %d from %s:%d.", con->http.fd,
con->http.hostname, ntohs(con->http.hostaddr.ipv6.sin6_port));
else
#endif /* AF_INET6 */
con->http.hostname, ntohs(con->http.hostaddr.ipv6.sin6_port));
else
#endif /* AF_INET6 */
- LogMessage(L_DEBUG, "AcceptClient() %d from %s:%d.", con->http.fd,
+ LogMessage(L_DEBUG, "AcceptClient: %d from %s:%d.", con->http.fd,
con->http.hostname, ntohs(con->http.hostaddr.ipv4.sin_port));
/*
con->http.hostname, ntohs(con->http.hostaddr.ipv4.sin_port));
/*
fcntl(con->http.fd, F_SETFD, fcntl(con->http.fd, F_GETFD) | FD_CLOEXEC);
fcntl(con->http.fd, F_SETFD, fcntl(con->http.fd, F_GETFD) | FD_CLOEXEC);
- LogMessage(L_DEBUG2, "AcceptClient() Adding fd %d to InputSet...",
+ LogMessage(L_DEBUG2, "AcceptClient: Adding fd %d to InputSet...",
con->http.fd);
FD_SET(con->http.fd, &InputSet);
con->http.fd);
FD_SET(con->http.fd, &InputSet);
- * End of "$Id: client.c,v 1.91.2.8 2002/04/20 21:05:13 mike Exp $".
+ * End of "$Id: client.c,v 1.91.2.9 2002/04/21 12:47:03 mike Exp $".
- * "$Id: ipp.c,v 1.127.2.10 2002/03/22 15:47:28 mike Exp $"
+ * "$Id: ipp.c,v 1.127.2.11 2002/04/21 12:47:03 mike Exp $"
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
*
* IPP routines for the Common UNIX Printing System (CUPS) scheduler.
*
httpPrintf(HTTP(con), "Content-Length: %d\r\n\r\n",
con->http.data_remaining);
httpPrintf(HTTP(con), "Content-Length: %d\r\n\r\n",
con->http.data_remaining);
+ LogMessage(L_DEBUG2, "ProcessIPPRequest: Adding fd %d to OutputSet...",
+ con->http.fd);
+
FD_SET(con->http.fd, &OutputSet);
}
FD_SET(con->http.fd, &OutputSet);
}
- * End of "$Id: ipp.c,v 1.127.2.10 2002/03/22 15:47:28 mike Exp $".
+ * End of "$Id: ipp.c,v 1.127.2.11 2002/04/21 12:47:03 mike Exp $".
- * "$Id: job.c,v 1.124.2.13 2002/04/20 21:05:13 mike Exp $"
+ * "$Id: job.c,v 1.124.2.14 2002/04/21 12:47:05 mike Exp $"
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
*
* Job management routines for the Common UNIX Printing System (CUPS).
*
job = calloc(sizeof(job_t), 1);
job = calloc(sizeof(job_t), 1);
- job->id = NextJobId ++;
- job->priority = priority;
+ job->id = NextJobId ++;
+ job->priority = priority;
+ job->back_pipes[0] = -1;
+ job->back_pipes[1] = -1;
+ job->print_pipes[0] = -1;
+ job->print_pipes[1] = -1;
+ job->status_pipe = -1;
+
strncpy(job->dest, dest, sizeof(job->dest) - 1);
NumJobs ++;
strncpy(job->dest, dest, sizeof(job->dest) - 1);
NumJobs ++;
classification[0] = '\0';
if (getenv("LD_LIBRARY_PATH") != NULL)
snprintf(ldpath, sizeof(ldpath), "LD_LIBRARY_PATH=%s", getenv("LD_LIBRARY_PATH"));
classification[0] = '\0';
if (getenv("LD_LIBRARY_PATH") != NULL)
snprintf(ldpath, sizeof(ldpath), "LD_LIBRARY_PATH=%s", getenv("LD_LIBRARY_PATH"));
+ else if (getenv("DYLD_LIBRARY_PATH") != NULL)
+ snprintf(ldpath, sizeof(ldpath), "DYLD_LIBRARY_PATH=%s", getenv("DYLD_LIBRARY_PATH"));
- LogMessage(L_DEBUG, "StartJob: statusfds = %d, %d",
+ LogMessage(L_DEBUG, "StartJob: statusfds = [ %d %d ]",
statusfds[0], statusfds[1]);
current->status_pipe = statusfds[0];
statusfds[0], statusfds[1]);
current->status_pipe = statusfds[0];
filterfds[1][0] = open("/dev/null", O_RDONLY);
filterfds[1][1] = -1;
filterfds[1][0] = open("/dev/null", O_RDONLY);
filterfds[1][1] = -1;
- LogMessage(L_DEBUG, "StartJob: filterfds[%d] = %d, %d", 1, filterfds[1][0],
+ LogMessage(L_DEBUG, "StartJob: filterfds[%d] = [ %d %d ]", 1, filterfds[1][0],
filterfds[1][1]);
for (i = 0, slot = 0; i < num_filters; i ++)
filterfds[1][1]);
for (i = 0, slot = 0; i < num_filters; i ++)
pipe(filterfds[slot]);
else
{
pipe(filterfds[slot]);
else
{
- if (current->current_file == 0)
+ if (current->current_file == 1)
{
if (strncmp(printer->device_uri, "file:", 5) != 0)
pipe(current->print_pipes);
{
if (strncmp(printer->device_uri, "file:", 5) != 0)
pipe(current->print_pipes);
current->print_pipes[1] = open(printer->device_uri + 5,
O_WRONLY | O_CREAT | O_TRUNC, 0600);
}
current->print_pipes[1] = open(printer->device_uri + 5,
O_WRONLY | O_CREAT | O_TRUNC, 0600);
}
+
+ LogMessage(L_DEBUG2, "StartJob: print_pipes = [ %d %d ]",
+ current->print_pipes[0], current->print_pipes[1]);
}
filterfds[slot][0] = current->print_pipes[0];
}
filterfds[slot][0] = current->print_pipes[0];
}
LogMessage(L_DEBUG, "StartJob: filter = \"%s\"", command);
}
LogMessage(L_DEBUG, "StartJob: filter = \"%s\"", command);
- LogMessage(L_DEBUG, "StartJob: filterfds[%d] = %d, %d",
+ LogMessage(L_DEBUG, "StartJob: filterfds[%d] = [ %d %d ]",
slot, filterfds[slot][0], filterfds[slot][1]);
pid = start_process(command, argv, envp, filterfds[!slot][0],
filterfds[slot][1], statusfds[1],
current->back_pipes[0], 0);
slot, filterfds[slot][0], filterfds[slot][1]);
pid = start_process(command, argv, envp, filterfds[!slot][0],
filterfds[slot][1], statusfds[1],
current->back_pipes[0], 0);
+ LogMessage(L_DEBUG2, "StartJob: Closing filter pipes for slot %d [ %d %d ]...",
+ !slot, filterfds[!slot][0], filterfds[!slot][1]);
+
close(filterfds[!slot][0]);
close(filterfds[!slot][1]);
close(filterfds[!slot][0]);
close(filterfds[!slot][1]);
if (strncmp(printer->device_uri, "file:", 5) != 0)
{
if (strncmp(printer->device_uri, "file:", 5) != 0)
{
- if (current->current_file == 0)
+ if (current->current_file == 1)
{
sscanf(printer->device_uri, "%254[^:]", method);
snprintf(command, sizeof(command), "%s/backend/%s", ServerBin, method);
{
sscanf(printer->device_uri, "%254[^:]", method);
snprintf(command, sizeof(command), "%s/backend/%s", ServerBin, method);
filterfds[slot][1] = open("/dev/null", O_WRONLY);
LogMessage(L_DEBUG, "StartJob: backend = \"%s\"", command);
filterfds[slot][1] = open("/dev/null", O_WRONLY);
LogMessage(L_DEBUG, "StartJob: backend = \"%s\"", command);
- LogMessage(L_DEBUG, "StartJob: filterfds[%d] = %d, %d",
+ LogMessage(L_DEBUG, "StartJob: filterfds[%d] = [ %d %d ]",
slot, filterfds[slot][0], filterfds[slot][1]);
pid = start_process(command, argv, envp, filterfds[!slot][0],
slot, filterfds[slot][0], filterfds[slot][1]);
pid = start_process(command, argv, envp, filterfds[!slot][0],
if (current->current_file == current->num_files)
{
if (current->current_file == current->num_files)
{
- close(filterfds[!slot][0]);
- close(filterfds[!slot][1]);
+ LogMessage(L_DEBUG2, "StartJob: Closing print pipes [ %d %d ]...",
+ current->print_pipes[0], current->print_pipes[1]);
+
+ close(current->print_pipes[0]);
+ close(current->print_pipes[1]);
+
+ current->print_pipes[0] = -1;
+ current->print_pipes[1] = -1;
+ LogMessage(L_DEBUG2, "StartJob: Closing filter pipes for slot %d [ %d %d ]...",
+ slot, filterfds[slot][0], filterfds[slot][1]);
+
close(filterfds[slot][0]);
close(filterfds[slot][1]);
close(filterfds[slot][0]);
close(filterfds[slot][1]);
+ LogMessage(L_DEBUG2, "StartJob: Closing status output pipe %d...",
+ statusfds[1]);
+
close(statusfds[1]);
LogMessage(L_DEBUG2, "StartJob: Adding fd %d to InputSet...",
close(statusfds[1]);
LogMessage(L_DEBUG2, "StartJob: Adding fd %d to InputSet...",
* Close the pipe and clear the input bit.
*/
* Close the pipe and clear the input bit.
*/
+ LogMessage(L_DEBUG2, "StopJob: Closing status input pipe %d...",
+ current->status_pipe);
+
+ close(current->status_pipe);
+
LogMessage(L_DEBUG2, "StopJob: Removing fd %d from InputSet...",
current->status_pipe);
LogMessage(L_DEBUG2, "StopJob: Removing fd %d from InputSet...",
current->status_pipe);
- close(current->status_pipe);
FD_CLR(current->status_pipe, &InputSet);
current->status_pipe = -1;
}
FD_CLR(current->status_pipe, &InputSet);
current->status_pipe = -1;
}
* Close the pipe and clear the input bit.
*/
* Close the pipe and clear the input bit.
*/
+ LogMessage(L_DEBUG2, "UpdateJob: Closing status input pipe %d...",
+ job->status_pipe);
+
+ close(job->status_pipe);
+
LogMessage(L_DEBUG2, "UpdateJob: Removing fd %d from InputSet...",
job->status_pipe);
LogMessage(L_DEBUG2, "UpdateJob: Removing fd %d from InputSet...",
job->status_pipe);
- close(job->status_pipe);
FD_CLR(job->status_pipe, &InputSet);
job->status_pipe = -1;
}
FD_CLR(job->status_pipe, &InputSet);
job->status_pipe = -1;
}
- * End of "$Id: job.c,v 1.124.2.13 2002/04/20 21:05:13 mike Exp $".
+ * End of "$Id: job.c,v 1.124.2.14 2002/04/21 12:47:05 mike Exp $".
- * "$Id: listen.c,v 1.9.2.4 2002/01/27 21:20:32 mike Exp $"
+ * "$Id: listen.c,v 1.9.2.5 2002/04/21 12:47:07 mike Exp $"
*
* Server listening routines for the Common UNIX Printing System (CUPS)
* scheduler.
*
* Server listening routines for the Common UNIX Printing System (CUPS)
* scheduler.
if (NumClients == MaxClients)
LogMessage(L_WARN, "Max clients reached, holding new connections...");
if (NumClients == MaxClients)
LogMessage(L_WARN, "Max clients reached, holding new connections...");
- LogMessage(L_DEBUG, "PauseListening: clearing input bits...");
+ LogMessage(L_DEBUG, "PauseListening: Clearing input bits...");
for (i = NumListeners, lis = Listeners; i > 0; i --, lis ++)
for (i = NumListeners, lis = Listeners; i > 0; i --, lis ++)
+ {
+ LogMessage(L_DEBUG2, "PauseListening: Removing fd %d from InputSet...",
+ lis->fd);
+
FD_CLR(lis->fd, &InputSet);
FD_CLR(lis->fd, &InputSet);
if (NumClients >= (MaxClients - 1))
LogMessage(L_WARN, "Resuming new connection processing...");
if (NumClients >= (MaxClients - 1))
LogMessage(L_WARN, "Resuming new connection processing...");
- LogMessage(L_DEBUG, "ResumeListening: setting input bits...");
+ LogMessage(L_DEBUG, "ResumeListening: Setting input bits...");
for (i = NumListeners, lis = Listeners; i > 0; i --, lis ++)
for (i = NumListeners, lis = Listeners; i > 0; i --, lis ++)
+ {
+ LogMessage(L_DEBUG2, "ResumeListening: Adding fd %d to InputSet...",
+ lis->fd);
FD_SET(lis->fd, &InputSet);
FD_SET(lis->fd, &InputSet);
+ LogMessage(L_DEBUG2, "StartListening: fd=%d", lis->fd);
+
fcntl(lis->fd, F_SETFD, fcntl(lis->fd, F_GETFD) | FD_CLOEXEC);
/*
fcntl(lis->fd, F_SETFD, fcntl(lis->fd, F_GETFD) | FD_CLOEXEC);
/*
- * End of "$Id: listen.c,v 1.9.2.4 2002/01/27 21:20:32 mike Exp $".
+ * End of "$Id: listen.c,v 1.9.2.5 2002/04/21 12:47:07 mike Exp $".
- * "$Id: main.c,v 1.57.2.10 2002/04/20 21:05:16 mike Exp $"
+ * "$Id: main.c,v 1.57.2.11 2002/04/21 12:47:07 mike Exp $"
*
* Scheduler main loop for the Common UNIX Printing System (CUPS).
*
*
* Scheduler main loop for the Common UNIX Printing System (CUPS).
*
+ StopBrowsing();
+ StopAllJobs();
DeleteAllCerts();
CloseAllClients();
StopListening();
DeleteAllCerts();
CloseAllClients();
StopListening();
- * End of "$Id: main.c,v 1.57.2.10 2002/04/20 21:05:16 mike Exp $".
+ * End of "$Id: main.c,v 1.57.2.11 2002/04/21 12:47:07 mike Exp $".
-# "$Id: run-stp-tests.sh,v 1.4.2.4 2002/04/20 21:05:16 mike Exp $"
+# "$Id: run-stp-tests.sh,v 1.4.2.5 2002/04/21 12:47:08 mike Exp $"
#
# Perform the complete set of IPP compliance tests specified in the
# CUPS Software Test Plan.
#
# Perform the complete set of IPP compliance tests specified in the
# CUPS Software Test Plan.
../scheduler/cupsd -c /tmp/$user/cupsd.conf -f &
cupsd=$!
../scheduler/cupsd -c /tmp/$user/cupsd.conf -f &
cupsd=$!
+if test -x /usr/bin/strace; then
+ # Trace system calls in cupsd if we have strace...
+ /usr/bin/strace -tt -o /tmp/$user/log/cupsd.trace -p $cupsd &
+fi
+
echo "Scheduler is PID $cupsd; run debugger now if you need to."
echo ""
echo "Press ENTER to continue..."
echo "Scheduler is PID $cupsd; run debugger now if you need to."
echo ""
echo "Press ENTER to continue..."
cat /tmp/$user/log/page_log >>$strfile
echo "</PRE>" >>$strfile
cat /tmp/$user/log/page_log >>$strfile
echo "</PRE>" >>$strfile
+if test -f /tmp/$user/log/cupsd.trace; then
+ echo "<H2>cupsd.trace</H2>" >>$strfile
+ echo "<PRE>" >>$strfile
+ cat /tmp/$user/log/cupsd.trace >>$strfile
+ echo "</PRE>" >>$strfile
+fi
+
#
# Format the reports and tell the user where to find them...
#
#
# Format the reports and tell the user where to find them...
#
-# End of "$Id: run-stp-tests.sh,v 1.4.2.4 2002/04/20 21:05:16 mike Exp $"
+# End of "$Id: run-stp-tests.sh,v 1.4.2.5 2002/04/21 12:47:08 mike Exp $"