本文整理汇总了C++中Daemon::error方法的典型用法代码示例。如果您正苦于以下问题:C++ Daemon::error方法的具体用法?C++ Daemon::error怎么用?C++ Daemon::error使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Daemon
的用法示例。
在下文中一共展示了Daemon::error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C++代码示例。
示例1: setPPstyle
int
main (int argc, char *argv[])
{
#if !defined(WIN32)
install_sig_handler(SIGPIPE, (SIG_HANDLER)SIG_IGN );
#endif
// initialize to read from config file
myDistro->Init( argc, argv );
myName = argv[0];
config();
dprintf_config_tool_on_error(0);
// The arguments take two passes to process --- the first pass
// figures out the mode, after which we can instantiate the required
// query object. We add implied constraints from the command line in
// the second pass.
firstPass (argc, argv);
// if the mode has not been set, it is STARTD_NORMAL
if (mode == MODE_NOTSET) {
setMode (MODE_STARTD_NORMAL, 0, DEFAULT);
}
// instantiate query object
if (!(query = new CondorQuery (type))) {
dprintf_WriteOnErrorBuffer(stderr, true);
fprintf (stderr, "Error: Out of memory\n");
exit (1);
}
// if a first-pass setMode set a mode_constraint, apply it now to the query object
if (mode_constraint && ! explicit_format) {
query->addANDConstraint(mode_constraint);
}
// set pretty print style implied by the type of entity being queried
// but do it with default priority, so that explicitly requested options
// can override it
switch (type)
{
#ifdef HAVE_EXT_POSTGRESQL
case QUILL_AD:
setPPstyle(PP_QUILL_NORMAL, 0, DEFAULT);
break;
#endif /* HAVE_EXT_POSTGRESQL */
case DEFRAG_AD:
setPPstyle(PP_GENERIC_NORMAL, 0, DEFAULT);
break;
case STARTD_AD:
setPPstyle(PP_STARTD_NORMAL, 0, DEFAULT);
break;
case SCHEDD_AD:
setPPstyle(PP_SCHEDD_NORMAL, 0, DEFAULT);
break;
case MASTER_AD:
setPPstyle(PP_MASTER_NORMAL, 0, DEFAULT);
break;
case CKPT_SRVR_AD:
setPPstyle(PP_CKPT_SRVR_NORMAL, 0, DEFAULT);
break;
case COLLECTOR_AD:
setPPstyle(PP_COLLECTOR_NORMAL, 0, DEFAULT);
break;
case STORAGE_AD:
setPPstyle(PP_STORAGE_NORMAL, 0, DEFAULT);
break;
case NEGOTIATOR_AD:
setPPstyle(PP_NEGOTIATOR_NORMAL, 0, DEFAULT);
break;
case GRID_AD:
setPPstyle(PP_GRID_NORMAL, 0, DEFAULT);
break;
case GENERIC_AD:
setPPstyle(PP_GENERIC, 0, DEFAULT);
break;
case ANY_AD:
setPPstyle(PP_ANY_NORMAL, 0, DEFAULT);
break;
default:
setPPstyle(PP_VERBOSE, 0, DEFAULT);
}
// set the constraints implied by the mode
switch (mode) {
#ifdef HAVE_EXT_POSTGRESQL
case MODE_QUILL_NORMAL:
#endif /* HAVE_EXT_POSTGRESQL */
//.........这里部分代码省略.........
示例2: main
int main( int argc, char *argv[] )
{
char *machine_name = 0;
char *log_name = 0;
char *pool=0;
int i;
daemon_t type = DT_MASTER;
myDistro->Init( argc, argv );
config();
for( i=1; i<argc; i++ ) {
if(!strcmp(argv[i],"-help")) {
usage(argv[0]);
exit(0);
} else if(!strcmp(argv[i],"-pool")) {
i++;
if(!argv[i]) {
fprintf(stderr,"-pool requires an argument.\n\n");
usage(argv[0]);
exit(1);
}
pool = argv[i];
} else if(!strcmp(argv[i],"-version")) {
version();
exit(0);
} else if(!strcmp(argv[i],"-debug")) {
dprintf_set_tool_debug("TOOL", 0);
} else if(argv[i][0]=='-') {
type = stringToDaemonType(&argv[i][1]);
if( type == DT_NONE || type == DT_DAGMAN) {
usage(argv[0]);
exit(1);
}
} else if(argv[i][0]!='-') {
if(!machine_name) {
machine_name = argv[i];
} else if(!log_name) {
log_name = argv[i];
} else {
fprintf(stderr,"Extra argument: %s\n\n",argv[i]);
usage(argv[0]);
exit(1);
}
} else {
usage(argv[0]);
exit(1);
}
}
if( !machine_name || !log_name ) {
usage(argv[0]);
exit(1);
}
Daemon *daemon;
ReliSock *sock;
if (pool) {
DCCollector col( pool );
if( ! col.addr() ) {
fprintf( stderr, "Error: %s\n", col.error() );
exit(1);
}
daemon = new Daemon( type, machine_name, col.addr() );
} else {
daemon = new Daemon( type, machine_name );
}
dprintf(D_FULLDEBUG,"Locating daemon process on %s...\n",machine_name);
if(!daemon->locate()) {
fprintf(stderr,"Couldn't locate daemon on %s: %s\n",machine_name,daemon->error());
exit(1);
}
dprintf(D_FULLDEBUG,"Daemon %s is %s\n",daemon->hostname(),daemon->addr());
sock = (ReliSock*)daemon->startCommand( DC_FETCH_LOG, Sock::reli_sock);
if(!sock) {
fprintf(stderr,"couldn't connect to daemon %s at %s\n",daemon->hostname(),daemon->addr());
return 1;
}
int commandType = DC_FETCH_LOG_TYPE_PLAIN;
if ((strcmp(log_name, "HISTORY") == 0) || (strcmp(log_name, "STARTD_HISTORY") == 0)) {
commandType = DC_FETCH_LOG_TYPE_HISTORY;
}
if ((strcmp(log_name, "STARTD.PER_JOB_HISTORY_DIR") == 0) || (strcmp(log_name, "STARTD.PER_JOB_HISTORY_DIR") == 0)) {
commandType = DC_FETCH_LOG_TYPE_HISTORY_DIR;
}
sock->put( commandType );
sock->put( log_name );
sock->end_of_message();
//.........这里部分代码省略.........