本文整理汇总了C++中DBPRT函数的典型用法代码示例。如果您正苦于以下问题:C++ DBPRT函数的具体用法?C++ DBPRT怎么用?C++ DBPRT使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了DBPRT函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: schd_get_queues
/*
* Get information about each of the queues in the list of lists. If
* schd_get_queue_limits() fails, return the error condition. It may
* be a transient or a hard failure, which the caller may want to deal
* with. If all queues are successful, return '0'.
*/
int
schd_get_queues(void)
{
int ret;
QueueList *qptr;
ret = schd_get_queue_limits(schd_SubmitQueue->queue);
if (ret)
{
DBPRT(("schd_get_queues: get_queue_limits for %s failed.\n",
schd_SubmitQueue->queue->qname));
return(-1);
}
for (qptr = schd_BatchQueues; qptr != NULL; qptr = qptr->next)
{
ret = schd_get_queue_limits(qptr->queue);
if (ret)
DBPRT(("schd_get_queues: get_queue_limits for %s failed.\n",
qptr->queue->qname));
}
return (0);
}
示例2: readstream
//
// Read data from stream.
//
static int readstream(obex_t *handle, obex_object_t *object)
{
int actual;
obexsrv_t *srv = OBEX_GetUserData(handle);
const uint8_t *buf;
int len;
if (srv->sfd < 0) {
/* create temporary storage for an object */
srv->name = strdup("/tmp/obex_tmp_XXXXXX");
if (!srv->name)
return -1;
srv->sfd = mkstemp(srv->name);
if (srv->sfd < 0) {
DBPRT("unable to create tmp file: %s\n", srv->name);
free(srv->name);
srv->name = NULL;
return srv->sfd;
}
DBPRT("created tmp file: %s\n", srv->name);
srv->flags = 0x01;
}
srv->streamming = TRUE;
actual = OBEX_ObjectReadStream(handle, object, &buf);
DBPRT("got stream: %d\n", actual);
if (actual > 0) {
len = write(srv->sfd, buf, actual);
}
return actual;
}
示例3: mem_sum
/**
* @brief
* Internal session memory usage function.
*
* @param[in] job - job pointer
*
* @return ulong
* @retval the total number of bytes of address
* space consumed by all current processes within the job.
*
*/
static unsigned long
mem_sum(job *pjob)
{
int i;
int inproc = 0;
rlim64_t segadd;
prpsinfo_t *pi;
DBPRT(("%s: entered pagesize %d\n", __func__, pagesize))
segadd = 0;
if (pjob->ji_globid == NULL)
return (segadd);
for (i=0; i<nproc; i++) {
pi = &proc_array[i].info;
if (!injob(pjob, &proc_array[i].procash))
if (!inproc)
continue;
else
break;
DBPRT(("%s: %s(%d:%d) mem %llu\n",
__func__, pi->pr_fname, pi->pr_sid, pi->pr_pid,
(rlim64_t)((rlim64_t)pi->pr_size * (rlim64_t)pagesize)))
segadd += (rlim64_t)((rlim64_t)pi->pr_size*(rlim64_t)pagesize);
}
DBPRT(("%s: total mem %llu\n\n", __func__, segadd))
return (segadd);
}
示例4: obexsrv_reqdone
void obexsrv_reqdone(obex_t *handle, obex_object_t *object, int obex_cmd, int obex_rsp)
{
obexsrv_t *srv = OBEX_GetUserData(handle);
DBPRT("Server request finished!");
switch (obex_cmd) {
case OBEX_CMD_DISCONNECT:
DBPRT("Disconnect done!");
srv->state = SRVSTATE_CLOSED;
srv->disconnect(srv);
break;
default:
DBPRT(" Command (%02x) has now finished", obex_cmd);
srv->serverdone = TRUE;
break;
}
/* cleanup resources */
if (srv->sfd >= 0) {
close(srv->sfd);
srv->sfd = -1;
}
if (srv->name) {
if (srv->flags & 0x01)
unlink(srv->name);
free(srv->name);
srv->name = NULL;
}
if (srv->buf) {
free(srv->buf);
srv->buf = NULL;
}
srv->streamming = FALSE; /* disable streaming */
}
示例5: resi_sum
/**
* @brief
* Internal session resident memory size function. COMPLEX VERSION
*
* @param[in] job - job pointer
*
* @return (a 64 bit integer) the number of bytes used by session
*
*/
static rlim64_t
resi_sum(job *pjob)
{
int i;
int inproc = 0;
rlim64_t resisize, resisub;
prpsinfo_t *pi;
DBPRT(("%s: entered pagesize %d\n", __func__, pagesize))
resisize = 0;
for (i=0; i<nproc; i++) {
pi = &proc_array[i].info;
if (!injob(pjob, &proc_array[i].procash))
if (!inproc)
continue;
else
break;
DBPRT(("%s: %s(%d:%d) rss %llu (%lu pages)\n",
__func__, pi->pr_fname, pi->pr_sid, pi->pr_pid,
(rlim64_t)((rlim64_t)pi->pr_rssize*(rlim64_t)pagesize),
pi->pr_rssize))
resisize += (rlim64_t)((rlim64_t)pagesize * pi->pr_rssize);
}
DBPRT(("%s: total rss %llu\n\n", __func__, resisize))
return (resisize);
}
示例6: save_node_status
int save_node_status(
struct pbsnode *np,
pbs_attribute *temp)
{
int rc = PBSE_NONE;
char date_attrib[MAXLINE];
/* it's nice to know when the last update happened */
snprintf(date_attrib, sizeof(date_attrib), "rectime=%ld", (long)time(NULL));
if (decode_arst(temp, NULL, NULL, date_attrib, 0))
{
DBPRT(("is_stat_get: cannot add date_attrib\n"));
}
/* insert the information from "temp" into np */
if ((rc = node_status_list(temp, np, ATR_ACTION_ALTER)) != PBSE_NONE)
{
DBPRT(("is_stat_get: cannot set node status list\n"));
}
free_arst(temp);
return(rc);
} /* END save_node_status() */
示例7: user_running
static int
user_running(Queue *queue, char *user)
{
/*char *id = "user_running";*/
Job *job;
int jobs_running;
DBPRT(("%s(%s, %s)\n", id, user, queue->qname));
jobs_running = 0;
/*
* Count the jobs in the queue's job list that are running and owned
* by this user.
*/
for (job = queue->jobs; job != NULL; job = job->next)
{
if ((job->state != 'R') && (!strcmp(job->owner, user)))
jobs_running++;
}
DBPRT((" user %s has %d job%s running in queue '%s'\n",
user, jobs_running, jobs_running == 1 ? "" : "s", queue->qname));
return (jobs_running);
}
示例8: obexsrv_connect
void obexsrv_connect(obex_t *handle, obex_object_t *object)
{
obex_headerdata_t hv;
uint8_t hi;
int hlen;
uint8_t *nonhdrdata;
obex_target_t target = {0, NULL};
obexsrv_t *srv = OBEX_GetUserData(handle);
int err;
DBPRT("");
if(OBEX_ObjectGetNonHdrData(object, &nonhdrdata) == 4) {
#ifdef CONFIG_AFFIX_DEBUG
obex_connect_hdr_t *hdr = (obex_connect_hdr_t*)nonhdrdata;
DBPRT("Version: 0x%02x. Flags: 0x%02x OBEX packet length:%d",
hdr->version, hdr->flags, ntohs(hdr->mtu));
#endif
} else {
BTERROR("Invalid packet content.");
}
while(OBEX_ObjectGetNextHeader(handle, object, &hi, &hv, &hlen)) {
switch (hi) {
case OBEX_HDR_TARGET:
target.data = (void*)hv.bs;
target.len = hlen;
if (hlen == 16)
DBPRT("got TARGET. uuid_t: %08X-%04X-%04X-%04X-%08X%04X",
*(uint32_t *)&target.data[0], *(uint16_t *)&target.data[4],
*(uint16_t *)&target.data[6], *(uint16_t *)&target.data[8],
*(uint32_t *)&target.data[10], *(uint16_t *)&target.data[14]);
else
DBPRT("got TARGET. unknown fmt");
break;
default:
DBPRT(" Skipped header %02x", hi);
break;
}
}
// call handler
err = srv->connect(srv, &target);
if (err < 0) {
/* error */
OBEX_ObjectSetRsp(object, OBEX_RSP_INTERNAL_SERVER_ERROR, OBEX_RSP_INTERNAL_SERVER_ERROR);
} else {
OBEX_ObjectSetRsp(object, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS);
if (target.data) {
hv.bq4 = err; /* set connection id */
OBEX_ObjectAddHeader(handle, object, OBEX_HDR_CONNECTION, hv, 4, 0);
hv.bs = target.data;
OBEX_ObjectAddHeader(handle, object, OBEX_HDR_WHO, hv, target.len, 0);
}
}
}
示例9: obexsrv_req
void obexsrv_req(obex_t *handle, obex_object_t *object, int cmd)
{
switch(cmd) {
case OBEX_CMD_CONNECT:
obexsrv_connect(handle, object);
break;
case OBEX_CMD_DISCONNECT:
DBPRT("We got a disconnect-request");
OBEX_ObjectSetRsp(object, OBEX_RSP_SUCCESS, OBEX_RSP_SUCCESS);
break;
case OBEX_CMD_GET:
obexsrv_get(handle, object);
break;
case OBEX_CMD_PUT:
obexsrv_put(handle, object);
break;
case OBEX_CMD_SETPATH:
obexsrv_setpath(handle, object);
break;
default:
BTERROR(" Denied %02x request", cmd);
OBEX_ObjectSetRsp(object, OBEX_RSP_NOT_IMPLEMENTED, OBEX_RSP_NOT_IMPLEMENTED);
break;
}
return;
}
示例10: writestream
//
// Add more data to stream.
//
static int writestream(obex_t *handle, obex_object_t *object)
{
int actual;
obexsrv_t *srv = OBEX_GetUserData(handle);
obex_headerdata_t hv;
actual = read(srv->sfd, srv->buf, OBEX_STREAM_CHUNK);
DBPRT("sent %d bytes\n", actual);
if(actual > 0) {
/* Read was ok! */
hv.bs = srv->buf;
OBEX_ObjectAddHeader(handle, object, OBEX_HDR_BODY,
hv, actual, OBEX_FL_STREAM_DATA);
} else if(actual == 0) {
/* EOF */
hv.bs = srv->buf;
OBEX_ObjectAddHeader(handle, object, OBEX_HDR_BODY,
hv, 0, OBEX_FL_STREAM_DATAEND);
} else {
/* Error */
hv.bs = NULL;
OBEX_ObjectAddHeader(handle, object, OBEX_HDR_BODY,
hv, 0, OBEX_FL_STREAM_DATA);
}
return actual;
}
示例11: rmkdir
int rmkdir(char *new_dir, int mode)
{
size_t i = 0;
DBPRT("new_dir: %s\n", new_dir);
if (new_dir == NULL || new_dir[0] == '\0')
return -1;
if (access(new_dir, R_OK|X_OK) == 0)
return 0;
if (new_dir[0] == '/')
i++;
for (; new_dir[i] != '\0'; i++) {
if (new_dir[i] == '/') {
char tmpdir[PATH_MAX + 1];
strncpy (tmpdir, new_dir, i);
tmpdir[i] = '\0';
if ((mkdir(tmpdir, mode) == -1) && (errno != EEXIST))
return -1;
}
}
if (mkdir(new_dir, mode) == -1 && errno != EEXIST)
return -1;
return 0;
}
示例12: event_handler
int event_handler(HCI_Event_Packet_Header *event, int devnum)
{
int err = 0;
DBFENTER;
DBPRT("Manager has an event: 0x%02x\n", event->EventCode);
switch (event->EventCode) {
case HCI_E_CONNECTION_REQUEST:
err = connection_request((void*)event, devnum);
break;
case HCI_E_PIN_CODE_REQUEST:
pin_code_request((void*)event, devnum);
break;
case HCI_E_LINK_KEY_REQUEST:
link_key_request((void*)event, devnum);
break;
#ifdef CONFIG_AFFIX_UPDATE_CLOCKOFFSET
case HCI_E_READ_CLOCK_OFFSET_COMPLETE:
read_clock_offset_complete((void*)event, devnum);
break;
#endif
default:
break;
}
DBFEXIT;
return err;
}
示例13: mach_restart
/**
* @brief
* Restart the job from the checkpoint file.
*
* @param[in] ptask - pointer to task
* @param[in] file - filename
*
* @return long
* @retval session id Success
* @retval -1 Error
*/
long
mach_restart(task *ptask, char *file)
{
#if MOM_CHECKPOINT == 1
ckpt_id_t rc;
ash_t momash;
ash_t oldash = 0;
char cvtbuf[20];
cpr_flags = CKPT_NQE;
/* KLUDGE to work-around SGI problem, for some reason ckpt_restart() */
/* passes open file descriptor to /proc to restarted process */
if (pdir)
closedir(pdir);
/* To restart the job with its old ASH, Mom must be in that ASH */
/* When she does the restart. However, before changing to that */
/* ASH, Mom must put herself in a new ASH all by herself, otherwise */
/* she will take other system daemons with her into the job's ASH */
momash = getash();
newarraysess(); /* isolate Mom in a ASH by herself */
if (ptask->ti_job->ji_globid != NULL) {
/* now get job's old ASH and set it */
sscanf(ptask->ti_job->ji_globid, "%llx", &oldash);
if (setash(oldash) == -1) {
DBPRT(("setash failed before restart, errno = %d", errno))
}
}
示例14: end_proc
/**
* @brief
* Don't need any periodic processing.
*/
void
end_proc()
{
DWORD now, delta;
DWORD nrun;
now = timeGetTime();
delta = now - last_time;
if (delta <= SAMPLE_DELTA*1000) {
return;
}
wait_time = SAMPLE_DELTA;
if (!get_profile(&mom_prof)) {
return;
}
nrun = mom_prof.value + num_acpus + nrun_factor;
load = ((load * CEXP) +
(nrun * (FSCALE - CEXP) * FSCALE)) >> PROF_FSHIFT;
DBPRT(("load = %d, mom_prof=%d num_acpus=%d nrun_factor=%d", load, mom_prof.value, num_acpus, nrun_factor))
last_time = now;
return;
}
示例15: mom_do_poll
/**
* @brief
* State whether MOM main loop has to poll this job to determine if some
* limits are being exceeded.
*
* @param[in] pjob - job pointer
*
* @return int
* @retval TRUE if polling is necessary
* @retval FALSE otherwise.
*
* NOTE: Actual polling is done using the mom_over_limit machine-dependent function.
*
*/
int
mom_do_poll(job *pjob)
{
char *pname;
resource *pres;
DBPRT(("%s: entered\n", __func__))
assert(pjob != NULL);
assert(pjob->ji_wattr[(int)JOB_ATR_resource].at_type == ATR_TYPE_RESC);
pres = (resource *)
GET_NEXT(pjob->ji_wattr[(int)JOB_ATR_resource].at_val.at_list);
while (pres != NULL) {
assert(pres->rs_defin != NULL);
pname = pres->rs_defin->rs_name;
assert(pname != NULL);
assert(*pname != '\0');
if (strcmp(pname, "walltime") == 0 ||
strcmp(pname, "mem") == 0 ||
strcmp(pname, "ncpus") == 0 ||
strcmp(pname, "cput") == 0 ||
strcmp(pname, "mem") == 0 ||
strcmp(pname, "vmem") == 0)
return (TRUE);
pres = (resource *)GET_NEXT(pres->rs_link);
}
return (FALSE);
}