/*
 * wnix, a Unix-like operating system for WebAssembly applications.
 * Copyright (C) 2025  Xavier Del Campo Romero
 *
 * This program is free software: you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License as published by
 * the Free Software Foundation, either version 3 of the License, or
 * (at your option) any later version.
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU Affero General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program.  If not, see <https://www.gnu.org/licenses/>.
 */

#ifndef BIN_WNIX_ROUTINES_H
#define BIN_WNIX_ROUTINES_H

#include <bin.h>
#include <bin/types.h>
#include <nanowasm/nw.h>

struct bin_readstr
{
    unsigned long addr;
    struct bin_proc *p;
    char **str;
    int (*error)(struct bin_proc *, int, struct nw_next *);
};

struct bin_set_errno
{
    int error;
    unsigned long addr;
    struct bin_proc *p;
};

int bin_wnix_readstr(const struct bin_readstr *cfg, struct nw_next *next);
int bin_wnix_set_errno(const struct bin_set_errno *cfg, struct nw_next *next);

#endif
