<commit_before>#include <stdarg.h>
#include <sys/asm/syscall.h>
#include <sys/syscall.h>

/* returns the number of argument taken by a particular
 * syscall */
static int arg_count(int number)
{
    switch (number) {
        case SYS_exit:
            return 1;
        case SYS_open: case SYS_read: case SYS_write:
           return 3;
        default:
            return 0;
      
    }
}

int syscall(int number, ...)
{
    const int n_args = arg_count(number);
    unsigned long ret;

    va_list args;
    va_start(args, number);

    switch (n_args) {
        case 0:
            ret = _asm_syscall0(number);
            break;
        case 1:
            ret = _asm_syscall1(number, va_arg(args, unsigned long));
            break;
        case 2:
            ret = _asm_syscall2(number, va_arg(args, unsigned long),
                    va_arg(args, unsigned long));
            break;
        case 3:
            ret = _asm_syscall3(number, va_arg(args, unsigned long),
                    va_arg(args, unsigned long), va_arg(args, unsigned long));
            break;
        case 4:
            ret = _asm_syscall4(number, va_arg(args, unsigned long),
                    va_arg(args, unsigned long), va_arg(args, unsigned long),
                    va_arg(args, unsigned long));
            break;
        case 5:
            ret = _asm_syscall5(number, va_arg(args, unsigned long),
                    va_arg(args, unsigned long), va_arg(args, unsigned long),
                    va_arg(args, unsigned long), va_arg(args, unsigned long));
            break;
    }

    va_end(args);

    return ret;
}
<commit_msg>syscall.c: add SYS_close case<commit_after>#include <stdarg.h>
#include <sys/asm/syscall.h>
#include <sys/syscall.h>

/* returns the number of argument taken by a particular
 * syscall */
static int arg_count(int number)
{
    switch (number) {
        case SYS_exit: case SYS_close:
            return 1;
        case SYS_open: case SYS_read: case SYS_write:
           return 3;
        default:
            return 0;
    }
}

int syscall(int number, ...)
{
    const int n_args = arg_count(number);
    unsigned long ret;

    va_list args;
    va_start(args, number);

    switch (n_args) {
        case 0:
            ret = _asm_syscall0(number);
            break;
        case 1:
            ret = _asm_syscall1(number, va_arg(args, unsigned long));
            break;
        case 2:
            ret = _asm_syscall2(number, va_arg(args, unsigned long),
                    va_arg(args, unsigned long));
            break;
        case 3:
            ret = _asm_syscall3(number, va_arg(args, unsigned long),
                    va_arg(args, unsigned long), va_arg(args, unsigned long));
            break;
        case 4:
            ret = _asm_syscall4(number, va_arg(args, unsigned long),
                    va_arg(args, unsigned long), va_arg(args, unsigned long),
                    va_arg(args, unsigned long));
            break;
        case 5:
            ret = _asm_syscall5(number, va_arg(args, unsigned long),
                    va_arg(args, unsigned long), va_arg(args, unsigned long),
                    va_arg(args, unsigned long), va_arg(args, unsigned long));
            break;
    }

    va_end(args);

    return ret;
}

{'fraction_non_alphanumeric': 0.09923664122137404, 'fraction_numerical': 0.00916030534351145, 'mean_word_length': 1.795221843003413, 'pattern_counts': {'":': 0, '<': 9, '<?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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2178006', 'n_tokens_mistral': 1048, 'n_tokens_neox': 965, 'n_words': 267}