<commit_before>(***********************************************************************)
(*                                                                     *)
(*                           Objective Caml                            *)
(*                                                                     *)
(*            <NAME>, projet Cristal, INRIA Rocquencourt         *)
(*                                                                     *)
(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
(*  Automatique.  Distributed only by permission.                      *)
(*                                                                     *)
(***********************************************************************)

(* $Id$ *)

(* Module [ThreadUnix]: thread-compatible system calls *)

open Unix

(*** Process handling *)

(* Disable the timer interrupt before doing exec, because some OS
   keep sending timer interrupts to the exec'ed code.
   Make sure we're not preempted just after disabling the timer... *)
let execv proc args =
  Thread.critical_section := true;
  Unix.setitimer ITIMER_VIRTUAL {it_interval = 0.0; it_value = 0.0};
  Unix.execv proc args

let execve proc args env =
  Thread.critical_section := true;
  Unix.setitimer ITIMER_VIRTUAL {it_interval = 0.0; it_value = 0.0};
  Unix.execv proc args

let execvp proc args =
  Thread.critical_section := true;
  Unix.setitimer ITIMER_VIRTUAL {it_interval = 0.0; it_value = 0.0};
  Unix.execv proc args

let wait () =
  Thread.wait_pid (-1)
  
let waitpid flags pid =
  if List.mem WNOHANG flags
  then Unix.waitpid flags pid
  else Thread.wait_pid pid

let system cmd =
  match fork() with
     0 -> execv "/bin/sh" [| "/bin/sh"; "-c"; cmd |]; exit 127
  | id -> snd(waitpid [] id)
<commit_msg>Typo dans execve et execvp<commit_after>(***********************************************************************)
(*                                                                     *)
(*                           Objective Caml                            *)
(*                                                                     *)
(*            <NAME>, projet Cristal, INRIA Rocquencourt         *)
(*                                                                     *)
(*  Copyright 1996 Institut National de Recherche en Informatique et   *)
(*  Automatique.  Distributed only by permission.                      *)
(*                                                                     *)
(***********************************************************************)

(* $Id$ *)

(* Module [ThreadUnix]: thread-compatible system calls *)

open Unix

(*** Process handling *)

(* Disable the timer interrupt before doing exec, because some OS
   keep sending timer interrupts to the exec'ed code.
   Make sure we're not preempted just after disabling the timer... *)
let execv proc args =
  Thread.critical_section := true;
  Unix.setitimer ITIMER_VIRTUAL {it_interval = 0.0; it_value = 0.0};
  Unix.execv proc args

let execve proc args env =
  Thread.critical_section := true;
  Unix.setitimer ITIMER_VIRTUAL {it_interval = 0.0; it_value = 0.0};
  Unix.execve proc args

let execvp proc args =
  Thread.critical_section := true;
  Unix.setitimer ITIMER_VIRTUAL {it_interval = 0.0; it_value = 0.0};
  Unix.execvp proc args

let wait () =
  Thread.wait_pid (-1)
  
let waitpid flags pid =
  if List.mem WNOHANG flags
  then Unix.waitpid flags pid
  else Thread.wait_pid pid

let system cmd =
  match fork() with
     0 -> execv "/bin/sh" [| "/bin/sh"; "-c"; cmd |]; exit 127
  | id -> snd(waitpid [] id)

{'fraction_non_alphanumeric': 0.16865464632454924, 'fraction_numerical': 0.011650485436893204, 'mean_word_length': 1.7802621434078643, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 9, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 16, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3199020', 'n_tokens_mistral': 972, 'n_tokens_neox': 913, 'n_words': 288}