Skip to contentSkip to conversation

vl.c -EAGAIN

Qemu-devel Vladimir N. Oleynik 2 participants 3 messages May 17, 2004 1 message not in the archive

lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

Hi.

I confused with code from vl.c (1714 line in 0.5.5)

	} else if (errno != -EAGAIN) {
		ioh->fd_read(ioh->opaque, NULL, -errno);

Why -EAGAIN? Copy-paste from kernel? ;-)

May be

	} else if (errno != EAGAIN) {
		ioh->fd_read(ioh->opaque, NULL, ioh->max_size);

?

--w
vodz

#2 lore raw

[Qemu-devel] portable to old compiler and kernel

In reply to a message not in the archive

Hi.

I make qemu 0.5.5 with egcs and kernel 2.2.X with changes:

1) target-i386.c have duplicate initialize (egcs stoped with errors):

[INDEX_op_cmpxchgb_T0_T1_EAX_cc] = CC_OSZAPC,
[INDEX_op_cmpxchgw_T0_T1_EAX_cc] = CC_OSZAPC,
[INDEX_op_cmpxchgl_T0_T1_EAX_cc] = CC_OSZAPC,
and with generate from
DEF_WRITEF( )

2) oss.c, hw/ dma.c fdc.c sb16.c
change macros
#define lwarn(...)
#define linfo(...)
#define ldebug(...)
to
#define lwarn(...)
#define linfo(args...)
#define ldebug(args...)

3) hw/fdc.c
#define FLOPPY_ERROR(fmt, args...) \
do { printf("FLOPPY ERROR: %s: " fmt, __func__ , ##args); } while (0) to
#define FLOPPY_ERROR(fmt, args...) \
do { printf("FLOPPY ERROR: %s: " fmt, __FUNCTION__ , ##args); } while (0)

4) my glibc have declaration with "int" type from signal.h, I unset from vl.c //extern void __sigaction();

My kernel 2.2.X dont have linux/if_tun.h
I make new preprocessor CONFIG_IF_TUN option and change vl.c

#ifdef CONFIG_IF_TUN
#include <linux/if_tun.h>
#endif

and

static int tun_open(char *ifname, int ifname_size) {

#if CONFIG_IF_TUN
    struct ifreq ifr;
    int fd, ret;

    fd = open("/dev/net/tun", O_RDWR);
    if (fd < 0) {
        fprintf(stderr, "warning: could not open /dev/net/tun: no virtual 
network emulation\n");
        return -1;
    }
    memset(&ifr, 0, sizeof(ifr));
    ifr.ifr_flags = IFF_TAP | IFF_NO_PI;
    pstrcpy(ifr.ifr_name, IFNAMSIZ, "tun%d");
    ret = ioctl(fd, TUNSETIFF, (void *) &ifr);
    if (ret != 0) {
        close(fd);
#endif
        fprintf(stderr, "warning: could not configure /dev/net/tun: no virtual 
network emulation\n");
        return -1;
#if CONFIG_IF_TUN
    }
    printf("Connected to host network interface: %s\n", ifr.ifr_name);
    pstrcpy(ifname, ifname_size, ifr.ifr_name);
    fcntl(fd, F_SETFL, O_NONBLOCK);
    return fd;

#endif
}

Its works now.

--w
vodz

#3 lore raw

Re: [Qemu-devel] portable to old compiler and kernel

Quoted 2 lines · Vladimir N. Oleynik

Hi.

Hello,

Quoted 6 lines

3) hw/fdc.c
#define FLOPPY_ERROR(fmt, args...) \
do { printf("FLOPPY ERROR: %s: " fmt, __func__ , ##args); } while (0) to
#define FLOPPY_ERROR(fmt, args...) \
do { printf("FLOPPY ERROR: %s: " fmt, __FUNCTION__ , ##args); } while (0)

Don't do that. __func__ is ISO C, __FUNCTION__ isn't. You'd better add this somewhere:

#if __GNUC__ <= 2 && __GNUC_MINOR__ < 95
#define __func__ __FUNCTION__
#endif

which makes egcs happy and doesn't make gcc 3.xx warn about deprecated features.

Signature · 2 lines
J. Mayer <[email protected]>
Never organized