<commit_before>/***************************************************************
 *
 * Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
 * University of Wisconsin-Madison, WI.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License.  You may
 * obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************/

#include "condor_common.h"

#if defined(AIX32)
#	include <sys/id.h>
#   include <sys/wait.h>
#   include <sys/m_wait.h>
#	include "condor_fdset.h"
#endif

#include "write_user_log.h"
#include "proc.h"
#include "condor_debug.h"
#include "condor_classad.h"
#include "condor_attributes.h"
#include "std_univ_io.h"
#include "condor_config.h"
#include "condor_qmgr.h"
#include "classad_helpers.h"
#include "condor_getcwd.h"
#include "structproc.h"

#if !defined( WCOREDUMP )
#define  WCOREDUMP(stat)      ((stat)&WCOREFLG)
#endif
extern WriteUserLog		ULog;

extern int JobStatus;
extern "C" PROC  *Proc;
extern ClassAd *JobAd;

extern StdUnivSock *syscall_sock;

/* This used to be static, but now handle_terminate_pending() can modify this
variable to true so it doesn't get emitted when it isn't supposed to. */
int WroteExecuteEvent = 0;

extern char* ExecutingHost;

// count of total network bytes previously send and received for this
// job from previous runs (i.e., includes ckpt transfers)
float	TotalBytesSent = 0.0, TotalBytesRecvd = 0.0;

// count of network bytes send and received outside of CEDAR RSC
// socket during this run
float	BytesSent = 0.0, BytesRecvd = 0.0;

/* a stupid hack to amend the in memory job ad with statistics about job
	un/suspensions */
void record_suspension_hack(unsigned int action);

extern "C" void
log_execute (char *host)
{
	if( WroteExecuteEvent ) {
		return;
	}
	// log execute event
	ExecuteEvent event;
	strcpy (event.executeHost, host);
	if( !ULog.writeEvent(&event) ) {
		dprintf (D_ALWAYS, "Unable to log ULOG_EXECUTE event\n");
	} else {
		WroteExecuteEvent = 1;
	}
}
	

extern "C" void
check_execute_event( void )
{
	if( ! WroteExecuteEvent ) {
		log_execute( ExecutingHost );
	}
}


extern "C" void 
initializeUserLog ()
{
	MyString logfilename;
	MyString gjid;<commit_msg>Fix std uni compile problem<commit_after>/***************************************************************
 *
 * Copyright (C) 1990-2007, Condor Team, Computer Sciences Department,
 * University of Wisconsin-Madison, WI.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"); you
 * may not use this file except in compliance with the License.  You may
 * obtain a copy of the License at
 * 
 *    http://www.apache.org/licenses/LICENSE-2.0
 * 
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 *
 ***************************************************************/

#include "condor_common.h"

#if defined(AIX32)
#	include <sys/id.h>
#   include <sys/wait.h>
#   include <sys/m_wait.h>
#	include "condor_fdset.h"
#endif

#include "write_user_log.h"
#include "proc.h"
#include "condor_debug.h"
#include "condor_classad.h"
#include "condor_attributes.h"
#include "std_univ_io.h"
#include "condor_config.h"
#include "condor_qmgr.h"
#include "classad_helpers.h"
#include "condor_getcwd.h"
#include "structproc.h"

#if !defined( WCOREDUMP )
#define  WCOREDUMP(stat)      ((stat)&WCOREFLG)
#endif
extern WriteUserLog		ULog;

extern int JobStatus;
extern "C" PROC  *Proc;
extern ClassAd *JobAd;

extern StdUnivSock *syscall_sock;

/* This used to be static, but now handle_terminate_pending() can modify this
variable to true so it doesn't get emitted when it isn't supposed to. */
int WroteExecuteEvent = 0;

extern char* ExecutingHost;

// count of total network bytes previously send and received for this
// job from previous runs (i.e., includes ckpt transfers)
float	TotalBytesSent = 0.0, TotalBytesRecvd = 0.0;

// count of network bytes send and received outside of CEDAR RSC
// socket during this run
float	BytesSent = 0.0, BytesRecvd = 0.0;

/* a stupid hack to amend the in memory job ad with statistics about job
	un/suspensions */
void record_suspension_hack(unsigned int action);

extern "C" void
log_execute (char *host)
{
	if( WroteExecuteEvent ) {
		return;
	}
	// log execute event
	ExecuteEvent event;
	event.setExecuteHost(host);
	if( !ULog.writeEvent(&event) ) {
		dprintf (D_ALWAYS, "Unable to log ULOG_EXECUTE event\n");
	} else {
		WroteExecuteEvent = 1;
	}
}
	

extern "C" void
check_execute_event( void )
{
	if( ! WroteExecuteEvent ) {
		log_execute( ExecutingHost );
	}
}


extern "C" void 
initializeUserLog ()
{
	MyString logfilename;
	MyString gjid;
{'fraction_non_alphanumeric': 0.1437994722955145, 'fraction_numerical': 0.009046362608367886, 'mean_word_length': 4.510903426791277, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4537402', 'n_tokens_mistral': 1788, 'n_tokens_neox': 1679, 'n_words': 577}