本文整理汇总了C++中cupsdLogMessage函数的典型用法代码示例。如果您正苦于以下问题:C++ cupsdLogMessage函数的具体用法?C++ cupsdLogMessage怎么用?C++ cupsdLogMessage使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了cupsdLogMessage函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C++代码示例。
示例1: cupsdExpireSubscriptions
void
cupsdExpireSubscriptions(
cupsd_printer_t *dest, /* I - Printer, if any */
cupsd_job_t *job) /* I - Job, if any */
{
cupsd_subscription_t *sub; /* Current subscription */
int update; /* Update subscriptions.conf? */
time_t curtime; /* Current time */
curtime = time(NULL);
update = 0;
cupsdLogMessage(CUPSD_LOG_INFO, "Expiring subscriptions...");
for (sub = (cupsd_subscription_t *)cupsArrayFirst(Subscriptions);
sub;
sub = (cupsd_subscription_t *)cupsArrayNext(Subscriptions))
if ((!sub->job && !dest && sub->expire && sub->expire <= curtime) ||
(dest && sub->dest == dest) ||
(job && sub->job == job))
{
cupsdLogMessage(CUPSD_LOG_INFO, "Subscription %d has expired...",
sub->id);
cupsdDeleteSubscription(sub, 0);
update = 1;
}
if (update)
cupsdMarkDirty(CUPSD_DIRTY_SUBSCRIPTIONS);
}
开发者ID:Cacauu,项目名称:cups,代码行数:33,代码来源:subscriptions.c
示例2: cupsdPauseListening
void
cupsdPauseListening(void)
{
cupsd_listener_t *lis; /* Current listening socket */
if (cupsArrayCount(Listeners) < 1)
return;
if (cupsArrayCount(Clients) == MaxClients)
cupsdLogMessage(CUPSD_LOG_WARN,
"Max clients reached, holding new connections...");
else if (errno == ENFILE || errno == EMFILE)
cupsdLogMessage(CUPSD_LOG_WARN,
"Too many open files, holding new connections for "
"30 seconds...");
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdPauseListening: Clearing input bits...");
for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
lis;
lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
cupsdRemoveSelect(lis->fd);
ListeningPaused = time(NULL) + 30;
}
开发者ID:jianglei12138,项目名称:cups,代码行数:26,代码来源:listen.c
示例3: service_checkout
static void
service_checkout(void)
{
int fd; /* File descriptor */
/*
* Create or remove the "keep-alive" file based on whether there are active
* jobs or shared printers to advertise...
*/
if (cupsArrayCount(ActiveJobs) || /* Active jobs */
WebInterface || /* Web interface enabled */
NeedReload || /* Doing a reload */
(Browsing && BrowseLocalProtocols && cupsArrayCount(Printers)))
/* Printers being shared */
{
cupsdLogMessage(CUPSD_LOG_DEBUG, "Creating keep-alive file \"" CUPS_KEEPALIVE "\".");
if ((fd = open(CUPS_KEEPALIVE, O_RDONLY | O_CREAT | O_EXCL, S_IRUSR)) >= 0)
close(fd);
}
else
{
cupsdLogMessage(CUPSD_LOG_DEBUG, "Removing keep-alive file \"" CUPS_KEEPALIVE "\".");
unlink(CUPS_KEEPALIVE);
}
}
开发者ID:apple,项目名称:cups,代码行数:29,代码来源:main.c
示例4: cupsdEndTLS
int /* O - 1 on success, 0 on error */
cupsdEndTLS(cupsd_client_t *con) /* I - Client connection */
{
int error; /* Error code */
gnutls_certificate_server_credentials *credentials;
/* TLS credentials */
credentials = (gnutls_certificate_server_credentials *)
(con->http.tls_credentials);
error = gnutls_bye(con->http.tls, GNUTLS_SHUT_WR);
switch (error)
{
case GNUTLS_E_SUCCESS:
cupsdLogMessage(CUPSD_LOG_DEBUG,
"SSL shutdown successful!");
break;
default:
cupsdLogMessage(CUPSD_LOG_ERROR,
"SSL shutdown failed: %s", gnutls_strerror(error));
break;
}
gnutls_deinit(con->http.tls);
con->http.tls = NULL;
gnutls_certificate_free_credentials(*credentials);
free(credentials);
return (1);
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:32,代码来源:tls-gnutls.c
示例5: dnssdAddAlias
static void
dnssdAddAlias(const void *key, /* I - Key */
const void *value, /* I - Value (domain) */
void *context) /* I - Unused */
{
char valueStr[1024], /* Domain string */
hostname[1024], /* Complete hostname */
*hostptr; /* Pointer into hostname */
(void)key;
(void)context;
if (CFGetTypeID((CFStringRef)value) == CFStringGetTypeID() &&
CFStringGetCString((CFStringRef)value, valueStr, sizeof(valueStr),
kCFStringEncodingUTF8))
{
snprintf(hostname, sizeof(hostname), "%s.%s", DNSSDHostName, valueStr);
hostptr = hostname + strlen(hostname) - 1;
if (*hostptr == '.')
*hostptr = '\0'; /* Strip trailing dot */
if (!DNSSDAlias)
DNSSDAlias = cupsArrayNew(NULL, NULL);
cupsdAddAlias(DNSSDAlias, hostname);
cupsdLogMessage(CUPSD_LOG_DEBUG, "Added Back to My Mac ServerAlias %s",
hostname);
}
else
cupsdLogMessage(CUPSD_LOG_ERROR,
"Bad Back to My Mac domain in dynamic store!");
}
开发者ID:AndychenCL,项目名称:cups,代码行数:33,代码来源:dirsvc.c
示例6: launchd_checkout
static void
launchd_checkout(void)
{
int fd; /* File descriptor */
/*
* Create or remove the launchd KeepAlive file based on whether
* there are active jobs, polling, browsing for remote printers or
* shared printers to advertise...
*/
if (cupsArrayCount(ActiveJobs) ||
(Browsing && BrowseLocalProtocols && cupsArrayCount(Printers)))
{
cupsdLogMessage(CUPSD_LOG_DEBUG,
"Creating launchd keepalive file \"" CUPS_KEEPALIVE
"\"...");
if ((fd = open(CUPS_KEEPALIVE, O_RDONLY | O_CREAT | O_EXCL, S_IRUSR)) >= 0)
close(fd);
}
else
{
cupsdLogMessage(CUPSD_LOG_DEBUG,
"Removing launchd keepalive file \"" CUPS_KEEPALIVE
"\"...");
unlink(CUPS_KEEPALIVE);
}
}
开发者ID:ChErePOdaViLka,项目名称:cups,代码行数:31,代码来源:main.c
示例7: colord_delete_device
static void
colord_delete_device(
const char *device_id) /* I - Device ID string */
{
DBusMessage *message = NULL; /* D-Bus request */
DBusMessage *reply = NULL; /* D-Bus reply */
DBusMessageIter args; /* D-Bus method arguments */
DBusError error; /* D-Bus error */
char *device_path; /* Device object path */
/*
* Find the device...
*/
if ((device_path = colord_find_device(device_id)) == NULL)
goto out;
/*
* Delete the device...
*/
message = dbus_message_new_method_call(COLORD_DBUS_SERVICE,
COLORD_DBUS_PATH,
COLORD_DBUS_INTERFACE,
"DeleteDevice");
dbus_message_iter_init_append(message, &args);
dbus_message_iter_append_basic(&args, DBUS_TYPE_OBJECT_PATH, &device_path);
/*
* Send the DeleteDevice request synchronously...
*/
dbus_error_init(&error);
cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling DeleteDevice(%s)", device_path);
reply = dbus_connection_send_with_reply_and_block(colord_con, message,
COLORD_DBUS_TIMEOUT,
&error);
if (!reply)
{
cupsdLogMessage(CUPSD_LOG_DEBUG, "DeleteDevice failed: %s:%s", error.name,
error.message);
dbus_error_free(&error);
goto out;
}
out:
if (device_path)
free(device_path);
if (message)
dbus_message_unref(message);
if (reply)
dbus_message_unref(reply);
}
开发者ID:Cacauu,项目名称:cups,代码行数:58,代码来源:colorman.c
示例8: cupsdSetEnv
void
cupsdSetEnv(const char *name, /* I - Name of variable */
const char *value) /* I - Value of variable */
{
int i; /* Index into environent array */
/*
* If "value" is NULL, try getting value from current environment...
*/
if (!value)
value = getenv(name);
if (!value)
return;
/*
* Do not allow dynamic linker variables when running as root...
*/
if (!RunUser && (!strncmp(name, "DYLD_", 5) || !strncmp(name, "LD_", 3)))
return;
/*
* See if this variable has already been defined...
*/
if ((i = find_env(name)) < 0)
{
/*
* Check for room...
*/
if (num_common_env >= (int)(sizeof(common_env) / sizeof(common_env[0])))
{
cupsdLogMessage(CUPSD_LOG_ERROR,
"cupsdSetEnv: Too many environment variables set!");
return;
}
i = num_common_env;
num_common_env ++;
}
/*
* Set the new environment variable...
*/
cupsdSetStringf(common_env + i, "%s=%s", name, value);
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdSetEnv: %s", common_env[i]);
}
开发者ID:AndychenCL,项目名称:cups,代码行数:53,代码来源:env.c
示例9: colord_device_add_profile
static void
colord_device_add_profile(
const char *device_path, /* I - Device object path */
const char *profile_path, /* I - Profile object path */
const char *relation) /* I - Device relation, either
'soft' or 'hard' */
{
DBusMessage *message = NULL; /* D-Bus request */
DBusMessage *reply = NULL; /* D-Bus reply */
DBusMessageIter args; /* D-Bus method arguments */
DBusError error; /* D-Bus error */
message = dbus_message_new_method_call(COLORD_DBUS_SERVICE,
device_path,
COLORD_DBUS_INTERFACE_DEVICE,
"AddProfile");
dbus_message_iter_init_append(message, &args);
dbus_message_iter_append_basic(&args, DBUS_TYPE_STRING, &relation);
dbus_message_iter_append_basic(&args, DBUS_TYPE_OBJECT_PATH, &profile_path);
cupsdLogMessage(CUPSD_LOG_DEBUG, "Calling %s:AddProfile(%s) [%s]",
device_path, profile_path, relation);
/*
* Send the AddProfile request synchronously...
*/
dbus_error_init(&error);
reply = dbus_connection_send_with_reply_and_block(colord_con, message,
COLORD_DBUS_TIMEOUT,
&error);
if (!reply)
{
cupsdLogMessage(CUPSD_LOG_WARN, "AddProfile failed: %s:%s", error.name,
error.message);
dbus_error_free(&error);
goto out;
}
out:
if (message)
dbus_message_unref(message);
if (reply)
dbus_message_unref(reply);
}
开发者ID:Cacauu,项目名称:cups,代码行数:48,代码来源:colorman.c
示例10: cupsdFinishProcess
const char * /* O - Process name */
cupsdFinishProcess(int pid, /* I - Process ID */
char *name, /* I - Name buffer */
size_t namelen, /* I - Size of name buffer */
int *job_id) /* O - Job ID pointer or NULL */
{
cupsd_proc_t key, /* Search key */
*proc; /* Matching process */
key.pid = pid;
if ((proc = (cupsd_proc_t *)cupsArrayFind(process_array, &key)) != NULL)
{
if (job_id)
*job_id = proc->job_id;
strlcpy(name, proc->name, namelen);
cupsArrayRemove(process_array, proc);
free(proc);
}
else
{
if (job_id)
*job_id = 0;
strlcpy(name, "unknown", namelen);
}
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFinishProcess(pid=%d, name=%p, namelen=" CUPS_LLFMT ", job_id=%p(%d)) = \"%s\"", pid, name, CUPS_LLCAST namelen, job_id, job_id ? *job_id : 0, name);
return (name);
}
开发者ID:Cacauu,项目名称:cups,代码行数:33,代码来源:process.c
示例11: cupsdEndProcess
int /* O - 0 on success, -1 on failure */
cupsdEndProcess(int pid, /* I - Process ID */
int force) /* I - Force child to die */
{
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdEndProcess(pid=%d, force=%d)", pid,
force);
if (!pid)
return (0);
if (!RunUser)
{
/*
* When running as root, cupsd puts child processes in their own process
* group. Using "-pid" sends a signal to all processes in the group.
*/
pid = -pid;
}
if (force)
return (kill(pid, SIGKILL));
else
return (kill(pid, SIGTERM));
}
开发者ID:Cacauu,项目名称:cups,代码行数:25,代码来源:process.c
示例12: cupsdStopListening
void
cupsdStopListening(void)
{
cupsd_listener_t *lis; /* Current listening socket */
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdStopListening: closing all listen sockets.");
cupsdPauseListening();
for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
lis;
lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
{
if (lis->fd != -1)
{
#ifdef HAVE_LAUNCH_H
httpAddrClose(NULL, lis->fd);
#else
httpAddrClose(&(lis->address), lis->fd);
#endif /* HAVE_LAUNCH */
lis->fd = -1;
}
}
}
开发者ID:jelmer,项目名称:cups,代码行数:27,代码来源:listen.c
示例13: cupsdStartSystemMonitor
void
cupsdStartSystemMonitor(void)
{
int flags; /* fcntl flags on pipe */
if (cupsdOpenPipe(SysEventPipes))
{
cupsdLogMessage(CUPSD_LOG_ERROR, "System event monitor pipe() failed - %s!",
strerror(errno));
return;
}
cupsdAddSelect(SysEventPipes[0], (cupsd_selfunc_t)sysUpdate, NULL, NULL);
/*
* Set non-blocking mode on the descriptor we will be receiving notification
* events on.
*/
flags = fcntl(SysEventPipes[0], F_GETFL, 0);
fcntl(SysEventPipes[0], F_SETFL, flags | O_NONBLOCK);
/*
* Start the thread that runs the runloop...
*/
pthread_mutex_init(&SysEventThreadMutex, NULL);
pthread_cond_init(&SysEventThreadCond, NULL);
pthread_create(&SysEventThread, NULL, (void *(*)())sysEventThreadEntry, NULL);
}
开发者ID:thangap,项目名称:tizen-release,代码行数:31,代码来源:sysman.c
示例14: cupsdDeleteAllCerts
void
cupsdDeleteAllCerts(void)
{
cupsd_cert_t *cert, /* Current certificate */
*next; /* Next certificate */
char filename[1024]; /* Certificate file */
/*
* Loop through each certificate, deleting them...
*/
for (cert = Certs; cert != NULL; cert = next)
{
/*
* Delete the file...
*/
snprintf(filename, sizeof(filename), "%s/certs/%d", StateDir, cert->pid);
if (unlink(filename))
cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to remove %s!", filename);
/*
* Free memory...
*/
next = cert->next;
free(cert);
}
Certs = NULL;
RootCertTime = 0;
}
开发者ID:jelmer,项目名称:cups,代码行数:33,代码来源:cert.c
示例15: cupsdStopListening
void
cupsdStopListening(void)
{
cupsd_listener_t *lis; /* Current listening socket */
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdStopListening: closing all listen sockets.");
cupsdPauseListening();
for (lis = (cupsd_listener_t *)cupsArrayFirst(Listeners);
lis;
lis = (cupsd_listener_t *)cupsArrayNext(Listeners))
{
#if defined(HAVE_LAUNCHD) || defined(HAVE_SYSTEMD)
if (!lis->on_demand && lis->fd != -1)
{
httpAddrClose(&(lis->address), lis->fd);
lis->fd = -1;
}
#else
if (lis->fd != -1)
{
httpAddrClose(&(lis->address), lis->fd);
lis->fd = -1;
}
#endif /* HAVE_LAUNCHD || HAVE_SYSTEMD */
}
}
开发者ID:jianglei12138,项目名称:cups,代码行数:31,代码来源:listen.c
示例16: cupsdAddPolicyOp
cupsd_location_t * /* O - New policy operation */
cupsdAddPolicyOp(cupsd_policy_t *p, /* I - Policy */
cupsd_location_t *po, /* I - Policy operation to copy */
ipp_op_t op) /* I - IPP operation code */
{
cupsd_location_t *temp; /* New policy operation */
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdAddPolicyOp(p=%p, po=%p, op=%x(%s))",
p, po, op, ippOpString(op));
if (!p)
return (NULL);
if (!p->ops)
p->ops = cupsArrayNew3((cups_array_func_t)compare_ops, NULL,
(cups_ahash_func_t)hash_op, 128,
(cups_acopy_func_t)NULL,
(cups_afree_func_t)cupsdFreeLocation);
if (!p->ops)
return (NULL);
if ((temp = cupsdCopyLocation(po)) != NULL)
{
temp->op = op;
temp->limit = CUPSD_AUTH_LIMIT_IPP;
cupsArrayAdd(p->ops, temp);
}
return (temp);
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:33,代码来源:policy.c
示例17: cupsdDeregisterPrinter
void
cupsdDeregisterPrinter(
cupsd_printer_t *p, /* I - Printer to register */
int removeit) /* I - Printer being permanently removed */
{
/*
* Only deregister if browsing is enabled and it's a local printer...
*/
cupsdLogMessage(CUPSD_LOG_DEBUG,
"cupsdDeregisterPrinter(p=%p(%s), removeit=%d)", p, p->name,
removeit);
if (!Browsing || !p->shared ||
(p->type & (CUPS_PRINTER_REMOTE | CUPS_PRINTER_SCANNER)))
return;
/*
* Announce the deletion...
*/
#if defined(HAVE_DNSSD) || defined(HAVE_AVAHI)
if (removeit && (BrowseLocalProtocols & BROWSE_DNSSD) && DNSSDMaster)
dnssdDeregisterPrinter(p, 1, 0);
#endif /* HAVE_DNSSD || HAVE_AVAHI */
}
开发者ID:AndychenCL,项目名称:cups,代码行数:26,代码来源:dirsvc.c
示例18: cupsdFindAvailablePrinter
cupsd_printer_t * /* O - Available printer or NULL */
cupsdFindAvailablePrinter(
const char *name) /* I - Class to check */
{
int i; /* Looping var */
cupsd_printer_t *c; /* Printer class */
/*
* Find the class...
*/
if ((c = cupsdFindClass(name)) == NULL)
{
cupsdLogMessage(CUPSD_LOG_ERROR, "Unable to find class \"%s\"!", name);
return (NULL);
}
if (c->num_printers == 0)
return (NULL);
/*
* Make sure that the last printer is also a valid index into the printer
* array. If not, reset the last printer to 0...
*/
if (c->last_printer >= c->num_printers)
c->last_printer = 0;
/*
* Loop through the printers in the class and return the first idle
* printer... We keep track of the last printer that we used so that
* a "round robin" type of scheduling is realized (otherwise the first
* server might be saturated with print jobs...)
*
* Thanks to Joel Fredrikson for helping us get this right!
*/
for (i = c->last_printer + 1; ; i ++)
{
if (i >= c->num_printers)
i = 0;
if (c->printers[i]->accepting &&
(c->printers[i]->state == IPP_PRINTER_IDLE ||
((c->printers[i]->type & CUPS_PRINTER_REMOTE) && !c->printers[i]->job)))
{
c->last_printer = i;
return (c->printers[i]);
}
if (i == c->last_printer)
break;
}
return (NULL);
}
开发者ID:ystk,项目名称:debian-cups,代码行数:57,代码来源:classes.c
示例19: cupsdAllowSleep
void
cupsdAllowSleep(void)
{
cupsdCleanDirty();
cupsdLogMessage(CUPSD_LOG_DEBUG, "Allowing system sleep.");
IOAllowPowerChange(LastSysEvent.powerKernelPort,
LastSysEvent.powerNotificationID);
}
开发者ID:AndychenCL,项目名称:cups,代码行数:9,代码来源:sysman.c
示例20: cupsdFindPolicyOp
cupsd_location_t * /* O - Policy operation */
cupsdFindPolicyOp(cupsd_policy_t *p, /* I - Policy */
ipp_op_t op) /* I - IPP operation */
{
cupsd_location_t key, /* Search key... */
*po; /* Current policy operation */
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindPolicyOp(p=%p, op=%x(%s))",
p, op, ippOpString(op));
/*
* Range check...
*/
if (!p)
return (NULL);
/*
* Check the operation against the available policies...
*/
key.op = op;
if ((po = (cupsd_location_t *)cupsArrayFind(p->ops, &key)) != NULL)
{
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdFindPolicyOp: Found exact match...");
return (po);
}
key.op = IPP_ANY_OPERATION;
if ((po = (cupsd_location_t *)cupsArrayFind(p->ops, &key)) != NULL)
{
cupsdLogMessage(CUPSD_LOG_DEBUG2,
"cupsdFindPolicyOp: Found wildcard match...");
return (po);
}
cupsdLogMessage(CUPSD_LOG_DEBUG2, "cupsdFindPolicyOp: No match found!");
return (NULL);
}
开发者ID:alfintatorkace,项目名称:osx-10.9-opensource,代码行数:42,代码来源:policy.c
注:本文中的cupsdLogMessage函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论