<commit_before>#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include "plr.h"
#include "plrLog.h"
#include "libc_func.h"
#include "crc32_util.h"

#include <stdio.h>

typedef struct {
  int err;
  ssize_t ret;
  off_t offs;
} writeShmData_t;

ssize_t write(int fd, const void *buf, size_t count) {  
  // Get libc syscall function pointer & offset in image
  libc_func(write, ssize_t, int, const void *, size_t);
    
  if (plr_checkInsidePLR()) {
    // If already inside PLR code, just call original syscall & return
    return _write(fd, buf, count);
  } else {
    plr_setInsidePLR();
    plrlog(LOG_SYSCALL, "[%d:write] Write %ld bytes to fd %d\n", getpid(), count, fd);
    
    // Not comparing buf argument, different processes could have different
    // VM mappings and still be valid
    syscallArgs_t args = {
      .addr = _off_write,
      .arg[0] = fd,
      .arg[1] = crc32(0, buf, count),
      .arg[2] = count<commit_msg>Remove incorrect comment in write function<commit_after>#include <sys/types.h>
#include <unistd.h>
#include <errno.h>
#include "plr.h"
#include "plrLog.h"
#include "libc_func.h"
#include "crc32_util.h"

#include <stdio.h>

typedef struct {
  int err;
  ssize_t ret;
  off_t offs;
} writeShmData_t;

ssize_t write(int fd, const void *buf, size_t count) {  
  // Get libc syscall function pointer & offset in image
  libc_func(write, ssize_t, int, const void *, size_t);
    
  if (plr_checkInsidePLR()) {
    // If already inside PLR code, just call original syscall & return
    return _write(fd, buf, count);
  } else {
    plr_setInsidePLR();
    plrlog(LOG_SYSCALL, "[%d:write] Write %ld bytes to fd %d\n", getpid(), count, fd);
    
    syscallArgs_t args = {
      .addr = _off_write,
      .arg[0] = fd,
      .arg[1] = crc32(0, buf, count),
      .arg[2] = count
{'fraction_non_alphanumeric': 0.1332967635765222, 'fraction_numerical': 0.00877674163466813, 'mean_word_length': 3.291764705882353, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 11, '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': '2926295', 'n_tokens_mistral': 719, 'n_tokens_neox': 685, 'n_words': 195}