Fix network on windows

This commit is contained in:
Ivan Baravy 2023-02-06 14:16:35 +00:00
parent e1f01e0156
commit 6a479621e9
5 changed files with 6 additions and 10 deletions

View File

@ -62,7 +62,7 @@ umka_shell: umka_shell.o umka.o shell.o trace.o trace_lbr.o vdisk.o \
$(HOST)/vnet/tap.o vnet/file.o lodepng.o $(HOST)/pci.o \
$(HOST)/thread.o umkaio.o umkart.o deps/optparse/optparse.o \
deps/isocline/src/isocline.o
$(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld $(LIBS)
$(CC) $(LDFLAGS_32) $^ -o $@ -T umka.ld $(LIBS) -lws2_32
umka_fuse: umka_fuse.o umka.o trace.o trace_lbr.o vdisk.o vdisk/raw.o \
vdisk/qcow2.o deps/em_inflate/em_inflate.o $(HOST)/pci.o \

View File

@ -1510,7 +1510,7 @@ cmd_set_keyboard_layout(struct shell_ctx *ctx, int argc, char **argv) {
uint8_t layout[KOS_LAYOUT_SIZE];
if (!strcmp(argv[3], "-f") && argc == 5) {
const char *fname = argv[4];
FILE *f = fopen(fname, "r");
FILE *f = fopen(fname, "rb");
if (!f) {
fprintf(ctx->fout, "can't open file: %s\n", fname);
fputs(usage, ctx->fout);
@ -2877,7 +2877,6 @@ cmd_load_dll(struct shell_ctx *ctx, int argc, char **argv) {
}
#ifndef _WIN32
static void
cmd_stack_init(struct shell_ctx *ctx, int argc, char **argv) {
@ -3630,7 +3629,6 @@ cmd_net_arp_del_entry(struct shell_ctx *ctx, int argc, char **argv) {
}
}
#endif // _WIN32
static void
cmd_osloop(struct shell_ctx *ctx, int argc, char **argv) {
@ -3901,7 +3899,6 @@ func_table_t cmd_cmds[] = {
{ "ls80", cmd_ls80 },
{ "move_window", cmd_move_window },
{ "mouse_move", cmd_mouse_move },
#ifndef _WIN32
{ "stack_init", cmd_stack_init },
{ "net_accept", cmd_net_accept },
{ "net_add_device", cmd_net_add_device },
@ -3934,7 +3931,6 @@ func_table_t cmd_cmds[] = {
{ "net_ipv4_set_subnet", cmd_net_ipv4_set_subnet },
{ "net_listen", cmd_net_listen },
{ "net_open_socket", cmd_net_open_socket },
#endif // _WIN32
{ "osloop", cmd_osloop },
{ "pci_get_path", cmd_pci_get_path },
{ "pci_set_path", cmd_pci_set_path },

View File

@ -144,8 +144,8 @@ pubsym acpi_node_alloc_cnt, 'kos_acpi_node_alloc_cnt'
pubsym acpi_node_free_cnt, 'kos_acpi_node_free_cnt'
pubsym acpi.count_nodes, 'kos_acpi_count_nodes', 4
pubsym stack_init, 'kos_stack_init'
pubsym net_add_device
pubsym stack_init, 'kos_stack_init', no_mangle
pubsym net_add_device, no_mangle
pubsym draw_data
pubsym img_background

View File

@ -213,7 +213,7 @@ vdisk_init_qcow2(const char *fname, struct umka_io *io) {
};
d->vdisk.io = io;
d->prev_cluster_index = ~(uint64_t)0;
if (!(d->fd = open(fname, O_RDONLY))) {
if (!(d->fd = open(fname, O_RDONLY | O_BINARY))) {
fprintf(stderr, "[vdisk.qcow2] can't open file '%s': %s\n", fname,
strerror(errno));
vdisk_qcow2_close(d);

View File

@ -55,7 +55,7 @@ vdisk_raw_write(void *userdata, void *buffer, off_t startsector,
struct vdisk*
vdisk_init_raw(const char *fname, struct umka_io *io) {
int fd = open(fname, O_RDONLY);
int fd = open(fname, O_RDONLY | O_BINARY);
if (!fd) {
printf("[vdisk.raw]: can't open file '%s': %s\n", fname, strerror(errno));
return NULL;