int use_proxy = 0;
-int (*user_jobs)(edg_wll_Context, edg_wlc_JobId **, edg_wll_JobStat **);
+int (*user_jobs)(edg_wll_Context, glite_jobid_t **, edg_wll_JobStat **);
void
no_of_runs = argc-1;
p_ctx = (edg_wll_Context*) calloc (sizeof(edg_wll_Context), no_of_runs);
- jobs = (edg_wlc_JobId**) calloc (sizeof(edg_wlc_JobId*), no_of_runs);
+ jobs = (glite_jobid_t**) calloc (sizeof(glite_jobid_t*), no_of_runs);
states = (edg_wll_JobStat**) calloc (sizeof(edg_wll_JobStat*), no_of_runs);
user_jobs = edg_wll_UserJobs;
printf("Jobs retrieved using file No. %d (%s)\n"
"------------------------------------------\n", k + 1, argv[k + 1]);
for (i=0; states[k][i].state != EDG_WLL_JOB_UNDEF; i++) {
- char *id = edg_wlc_JobIdUnparse(states[k][i].jobId),
+ char *id = glite_jobid_unparse(states[k][i].jobId),
*st = edg_wll_StatToString(states[k][i].state);
if (!states[k][i].parent_job) {
printf("%s %s .... %s %s\n", (states[k][i].jobtype==EDG_WLL_STAT_DAG)?"DAG ":"COLL",id, st, (states[k][i].state==EDG_WLL_JOB_DONE) ? edg_wll_done_codeToString(states[k][i].done_code) : "");
for (j=0; states[k][j].state != EDG_WLL_JOB_UNDEF; j++) {
if (states[k][j].parent_job) {
- char *par_id = edg_wlc_JobIdUnparse(states[k][j].parent_job);
+ char *par_id = glite_jobid_unparse(states[k][j].parent_job);
if (!strcmp(id,par_id)) {
- char *sub_id = edg_wlc_JobIdUnparse(states[k][j].jobId),
+ char *sub_id = glite_jobid_unparse(states[k][j].jobId),
*sub_st = edg_wll_StatToString(states[k][j].state);
printf(" `- %s .... %s %s\n", sub_id, sub_st, (states[k][j].state==EDG_WLL_JOB_DONE) ? edg_wll_done_codeToString(states[k][j].done_code) : "");
if (jobs) {
for (k=0; k < no_of_runs; k++) {
if (jobs[k])
- for (i=0; jobs[k][i]; i++) edg_wlc_JobIdFree(jobs[i]);
+ for (i=0; jobs[k][i]; i++) glite_jobid_free(*jobs[i]);
}
free(jobs);
}
{
case EDG_WLL_QUERY_ATTR_JOBID:
case EDG_WLL_QUERY_ATTR_PARENT:
- edg_wlc_JobIdFree(qr->value.j);
+ glite_jobid_free((glite_jobid_t)qr->value.j);
break;
case EDG_WLL_QUERY_ATTR_STATUS:
{
case EDG_WLL_QUERY_ATTR_JOBID:
case EDG_WLL_QUERY_ATTR_PARENT:
- if ( edg_wlc_JobIdParse(tmps, &cond->value.j) )
+ if ( glite_jobid_parse(tmps, (glite_jobid_t *)&cond->value.j) )
{
fprintf(stderr,"%s: %s: cannot parse jobId\n", myname, tmps);
return NULL;
case EDG_WLL_QUERY_OP_LESS: printf("<"); break;
case EDG_WLL_QUERY_OP_GREATER: printf(">"); break;
case EDG_WLL_QUERY_OP_WITHIN: printf("@"); break;
+ case EDG_WLL_QUERY_OP_CHANGED: printf("->"); break;
}
switch ( cond[i][j].attr )
{
extern int opterr,optind;
extern int edg_wll_DoLogEvent(edg_wll_Context context, edg_wll_LogLine logline);
-extern int edg_wll_DoLogEventProxy(edg_wll_Context context, edg_wll_LogLine logline);
-extern int edg_wll_DoLogEventDirect(edg_wll_Context context, edg_wll_LogLine logline);
+extern int edg_wll_DoLogEventServer(edg_wll_Context context, int flags,edg_wll_LogLine logline);
static const char *me;
int main(int argc,char **argv)
{
edg_wll_Context ctx;
- edg_wll_QueryRec chj[2], chs[2], *ch2[3] = { chj, chs, NULL };
+ edg_wll_QueryRec chj[2], chs[2];
+ const edg_wll_QueryRec const *ch2[3] = { chj, chs, NULL };
char *et,*ed;
edg_wll_NotifId id;
edg_wll_JobStat stat;
#include "glite/jobid/cjobid.h"
#include "glite/lb/notifid.h"
#include "glite/lb/events.h"
+#include "glite/lb/context.h"
+#include "glite/lb/context-int.h"
#include "producer.h"
#include "args.h"
#include "lb_perftest.h"
#include "il_msg.h"
+#include "context-int.h"
typedef struct {
char *event;
#include <sys/types.h>
#include <sys/stat.h>
#include <dirent.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#include <fcntl.h>
#include <sys/param.h>
static
int
-event_store_lock_ro(struct event_store *es)
-{
- assert(es != NULL);
-
- if(pthread_rwlock_rdlock(&es->commit_lock))
- abort();
-
- return(0);
-}
-
-
-static
-int
event_store_lock(struct event_store *es)
{
assert(es != NULL);
for(num = 0; num < 256; num++) {
struct stat st;
- snprintf(newname, MAXPATHLEN, "%s.%d%03d", es->event_file_name, timestamp, num);
+ snprintf(newname, MAXPATHLEN, "%s.%d%03d", es->event_file_name, (int) timestamp, num);
newname[MAXPATHLEN] = 0;
if(stat(newname, &st) < 0) {
if(errno == ENOENT) {
return 0;
}
+#if defined(IL_NOTIFICATIONS)
static
int
cmp_jobid(struct server_msg *msg, void *data)
}
return 0;
}
+#endif
/*
* event_store_recover()
ret = event_store_recover_jobid(es);
ret = (ret < 0) ? ret : 0;
return(ret);
-
-#if 0
- event_store_lock_ro(es);
- if(es->offset == offset)
- /* we are up to date */
- ret = 1;
- else if(es->offset > offset)
- /* we have already seen this event */
- ret = 0;
- else {
- /* es->offset < offset, i.e. we have missed some events */
- event_store_unlock(es);
- ret = event_store_recover(es);
- /* XXX possible room for intervention by another thread - is there
- * any other thread messing with us?
- * 1) After recover() es->offset is set at the end of file.
- * 2) es->offset is set only by recover() and next().
- * 3) Additional recover can not do much harm.
- * 4) And next() is only called by the same thread as sync().
- * 5) use_lock is in place, so no cleanup possible
- * => no one is messing with us right now */
- event_store_lock_ro(es);
- if(ret < 0)
- ret = -1;
- else
- if(es->offset <= offset) {
- /* Apparently there is something wrong - we are receiving an event
- * which is beyond the end of file. Someone must have removed the file
- * when we were not looking. The question is - what should we do with the event?
- * We have to send it, as this is the only one occasion when we see it.
- * However, we must not allow the es->offset to be set using this event,
- * as it would point after the end of file. Sort this out in event_store_next().
- */
- ret = 1;
- } else if(es->offset > offset) {
- /* we have seen at least this event */
- ret = 0;
- }
- }
- event_store_unlock(es);
- return(ret);
-#endif
}
{
assert(es != NULL);
- /* Commented out due to the fact that offset as received on socket
+ /* offset as received on socket
* has little to do with real event file at the moment. es->offset
* handling is left solely to the event_store_recover().
*/
-#if 0
- event_store_lock(es);
- /* Whoa, be careful now. The es->offset points right after the last enqueued event,
- * but it may not be the offset of the event WE have just enqueued, because:!
- * 1) someone could have removed the event file behind our back
- * 2) the file could have been recover()ed and more events read
- * In either case the offset should not be moved.
- */
- if(es->offset == offset) {
- es->offset += len;
- }
- event_store_unlock(es);
-#endif
-
return(0);
}
return(0);
}
- if(fd = pthread_rwlock_wrlock(&es->offset_lock)) {
+ if((fd = pthread_rwlock_wrlock(&es->offset_lock)) != 0) {
abort();
}
#if defined(IL_NOTIFICATIONS)
edg_wll_Event *notif_event;
edg_wll_Context context;
- char *dest_name = NULL;
-
#endif
glite_common_log(LOG_CATEGORY_LB_IL, LOG_PRIORITY_INFO,
/* XXX: what was that good for?
if(notif_event->notification.dest_host &&
(strlen(notif_event->notification.dest_host) > 0)) {
+ char *dest_name = NULL;
asprintf(&dest_name, "%s:%d", notif_event->notification.dest_host, notif_event->notification.dest_port);
}
*/
{
char *buffer, *p, *n;
int len, alen, i, chunk_size = DEFAULT_CHUNK_SIZE;
- static char buf[1024];
msg->data = NULL;
msg->len = 0;
(alen - (p - buffer)) is the free space,
*/
-#if 1
/* Reading events - optimized version. Attempts to increase chunks read by recv
* when there are more data, reads directly into destination memory (instead of
* copying from static buffer) etc.
}
} while ( (len > 0) && (n == NULL) );
-#else
- /* Reading events - original version.
- * Appears to behave quite good, anyway.
- */
- while((len=recv(sock, buf, sizeof(buf), MSG_PEEK | MSG_NOSIGNAL)) > 0) {
-
- /* we have to be prepared for sizeof(buf) bytes */
- if(alen - (p - buffer) < (int)sizeof(buf)) {
- alen += 8192;
- n = realloc(buffer, alen);
- if(n == NULL) {
- free(buffer);
- set_error(IL_NOMEM, ENOMEM, "read_event: no room for event");
- return(-1);
- }
- p = p - buffer + n;
- buffer = n;
- }
-
- /* copy all relevant bytes from buffer */
- n = (char*)memccpy(p, buf, EVENT_SEPARATOR, len);
- if(n) {
- /* separator found */
- n--; /* but do not preserve it */
- i = n - p;
- p = n;
- } else {
- /* separator not found */
- i = len;
- p += len;
- }
- /* This was definitely slowing us down:
- * for(i=0; (i < len) && (buf[i] != EVENT_SEPARATOR); i++)
- * *p++ = buf[i];
- */
-
- /* remove the data from queue */
- if(i > 0)
- if(recv(sock, buf, i, MSG_NOSIGNAL) != i) {
- set_error(IL_SYS, errno, "read_event: error reading data");
- free(buffer);
- return(-1);
- }
- if(i < len)
- /* the event is complete */
- break;
- }
-#endif
-
/* terminate buffer */
*p = 0;
int i,answer,answer_sent;
int msg_sock;
char *msg,*msg_begin;
- FILE *outfile;
- int filedesc,filelock_status,flags;
+ int filedesc,filelock_status;
long filepos;
- struct flock filelock;
int priority;
long lllid;
int unique;
#include <string.h>
#include <errno.h>
#include <assert.h>
+#include <stdio.h>
#include "glite/jobid/cjobid.h"
#include "glite/lb/context.h"
#endif
};
+#if !defined(IL_NOTIFICATIONS)
static struct event_queue *log_queue;
+#endif
static struct queue_list *queues;
#include <assert.h>
#include <errno.h>
#include <signal.h>
+#include <unistd.h>
#include "interlogd.h"
#include <stdio.h>
+#include <unistd.h>
#include <assert.h>
#include <errno.h>
#include <assert.h>
#include <errno.h>
#include <stdio.h>
-#ifdef HAVE_UNISTD_H
#include <unistd.h>
-#endif
#include <fcntl.h>
#include <sys/types.h>
#include <sys/socket.h>
{
char *msg=NULL;
int ret, code;
- int len, l;
+ int len;
struct timeval tv;
struct reader_data data;
#include <errno.h>
#include <assert.h>
#include <string.h>
+#include <stdio.h>
#include "interlogd.h"
#include "glite/lb/il_msg.h"
}
#endif
- if(p = strstr(event, "DG.EXPIRES")) {
- int n;
-
+ if((p = strstr(event, "DG.EXPIRES")) != NULL) {
p += 11;
*expires = atoi(p);
}
#endif /* GLITE_LB_SERVER_WITH_WS */
extern int edg_wll_StoreProto(edg_wll_Context ctx);
-extern int edg_wll_StoreProtoProxy(edg_wll_Context ctx);
extern char *lbproxy_ilog_socket_path;
extern char *lbproxy_ilog_file_prefix;
return err;
}
-#if 0
-static void free_hostent(struct hostent *h){
- int i;
-
- if (h) {
- if (h->h_name) free(h->h_name);
- if (h->h_aliases) {
- for (i=0; h->h_aliases[i]; i++) free(h->h_aliases[i]);
- free(h->h_aliases);
- }
- if (h->h_addr_list) {
- for (i=0; h->h_addr_list[i]; i++) free(h->h_addr_list[i]);
- free(h->h_addr_list);
- }
- free(h);
- }
-}
-#endif
-
struct asyn_result {
char *host;
char *service;
#include "get_events.h"
#include "glite/lb/context-int.h"
#include "glite/lb/events_parse.h"
+#include "glite/lb/ulm_parse.h"
#include "db_supp.h"
static void edg_wll_set_event_field(edg_wll_Event *,char *,char *);
free(ed);
return code;
}
-#warning: TODO: needed Sub_part in value???
+// XXX: needed Sub_part in value???
// else idx[nkeys][j].value.i = atoi(showcol[Sub_part]);
}
nkeys++;
intErr = 1; break;
}
ts = events[i].any.timestamp;
- if (!mints.tv_sec && !mints.tv_usec
- || ts.tv_sec < mints.tv_sec
+ if ((!mints.tv_sec && !mints.tv_usec)
+ || (ts.tv_sec < mints.tv_sec)
|| (ts.tv_sec == mints.tv_sec && ts.tv_usec < mints.tv_usec)) mints = ts;
}
/* no events or status computation error */
int edg_wll_UserNotifsToHTML(edg_wll_Context ctx, char **notifids, char **message);
int edg_wll_NotificationToHTML(edg_wll_Context ctx, notifInfo *ni, char **message);
char *edg_wll_ErrorToHTML(edg_wll_Context,int);
+int edg_wll_FileTransferStatusToHTML(edg_wll_Context ctx, edg_wll_JobStat stat, char **message);
#endif /* GLITE_LB_HTML_H */
#include <stdlib.h>
#include <time.h>
#include <assert.h>
+#include <ctype.h>
#ifdef __GNUC__
#define UNUSED_VAR __attribute__((unused))
#define TR(type, field) \
if (field){ \
- int l = asprintf(&pomA, type, (field)); \
+ int l = asprintf(&pomA, type, (field)); \
pomB = realloc(pomB, sizeof(*pomB)*(pomL+l+1)); \
strcpy(pomB+pomL, pomA); \
pomL += l; \
pomB = realloc(pomB, sizeof(*pomB)*(pomL+l+1)); \
strcpy(pomB+pomL, pomA); \
pomL += l; \
- free(pomA); pomA = NULL; \
+ free(pomA); pomA = NULL; \
}
static int store_user(edg_wll_Context,const char *,const char *);
static int store_job(edg_wll_Context,glite_jobid_const_t,const char *, int, int, int, int);
-/* FIXME: 'set_job_grey' defined but not used */
-static int set_job_grey(edg_wll_Context ctx, char *jobid);
static int store_flesh(edg_wll_Context,edg_wll_Event *,const char *ulm, char *,int);
/* FIXME: 'check_dup' defined but not used */
static int check_dup(edg_wll_Context,edg_wll_Event *);
}
-static int set_job_grey(edg_wll_Context ctx, char *jobid)
-{
- char *stmt;
-
- trio_asprintf(&stmt,"update jobs set grey='1' where jobid='%|Ss'", jobid);
- glite_common_log(LOG_CATEGORY_LB_SERVER_DB, LOG_PRIORITY_DEBUG, stmt);
-
- edg_wll_ExecSQL(ctx,stmt,NULL);
-
- free(stmt);
- return edg_wll_Error(ctx,NULL,NULL);
-}
-
/* test whether job shares LB proxy and server DB or not */
int is_job_local(edg_wll_Context ctx, glite_jobid_const_t jobId)
{