<commit_before>#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdbool.h>
#include <limits.h>
#include <signal.h>

#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>

#include "crtools.h"
#include "compiler.h"
#include "types.h"
#include "util.h"
#include "ptrace.h"

int unseize_task(pid_t pid, enum cr_task_state st)
{
	if (st == CR_TASK_STOP)
		return ptrace(PTRACE_DETACH, pid, NULL, NULL);
	else if (st == CR_TASK_KILL)
		return ptrace(PTRACE_KILL, pid, NULL, NULL);
	else {
		BUG_ON(1);
		return -1;
	}
}

/*
 * This routine seizes task putting it into a special
 * state where we can manipulate the task via ptrace
 * inteface, and finally we can detach ptrace out of
 * of it so the task would not know if it was saddled<commit_msg>ptrace: Kill task with -9 explicitly when detaching<commit_after>#include <stdlib.h>
#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <errno.h>
#include <unistd.h>
#include <stdbool.h>
#include <limits.h>
#include <signal.h>

#include <sys/types.h>
#include <sys/time.h>
#include <sys/resource.h>
#include <sys/wait.h>

#include "crtools.h"
#include "compiler.h"
#include "types.h"
#include "util.h"
#include "ptrace.h"

int unseize_task(pid_t pid, enum cr_task_state st)
{
	if (st == CR_TASK_STOP)
		return ptrace(PTRACE_DETACH, pid, NULL, NULL);
	else if (st == CR_TASK_KILL) {
		kill(pid, SIGKILL);
		return ptrace(PTRACE_KILL, pid, NULL, NULL);
	} else {
		BUG_ON(1);
		return -1;
	}
}

/*
 * This routine seizes task putting it into a special
 * state where we can manipulate the task via ptrace
 * inteface, and finally we can detach ptrace out of
 * of it so the task would not know if it was saddled
{'fraction_non_alphanumeric': 0.13646532438478748, 'fraction_numerical': 0.002796420581655481, 'mean_word_length': 4.470948012232416, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '5536005', 'n_tokens_mistral': 715, 'n_tokens_neox': 691, 'n_words': 212}