* [PATCH] Ansi-C compatibility fixes
@ 2012-07-19 22:37 Juan Perez-Sanchez
2012-07-22 8:45 ` ht-lab
2012-08-11 15:22 ` Jody Bruchon
0 siblings, 2 replies; 5+ messages in thread
From: Juan Perez-Sanchez @ 2012-07-19 22:37 UTC (permalink / raw)
To: linux-8086
[-- Attachment #1: Type: text/plain, Size: 867 bytes --]
Hi,
This patch makes another round of fixes to improve ansi-C
compatibility, this time using the open-watcom compiler. An effort was
done to make the right changes to code, not just wipe out the errors
or warnings. For example, if prototypes, definition and usage of
functions differ, examined the purpose and uses of the function to
determine the right fix.
The partial list of fixes includes:
- Missing prototypes of functions.
- Assignment of variables without appropriate casting.
- Inadequate typing of variables.
- Differences in definition, prototypes and use.
- Functions defined to return some value but did not return anything.
- Definition of zero length arrays.
Code size is unchanged.
The Image builded without errors. The kernel was tested with QEMU and
dioscuri emulators. Also in a PPro pc booting from floppy.
Greetings,
Juan
[-- Attachment #2: elksN.patch --]
[-- Type: application/octet-stream, Size: 20403 bytes --]
diff -Nurb elks.orig/arch/i86/drivers/char/lp.c elks/arch/i86/drivers/char/lp.c
--- elks.orig/arch/i86/drivers/char/lp.c 2012-05-11 13:26:27.000000000 -0500
+++ elks/arch/i86/drivers/char/lp.c 2012-07-18 11:28:10.000000000 -0500
@@ -24,7 +24,7 @@
#endif
struct lp_info {
- unsigned short io;
+ char *io;
char irq;
char flags;
};
@@ -142,7 +142,7 @@
}
/* send character to port */
- outb_p((unsigned char) c, (void *) lpp->io);
+ outb_p((unsigned char) c, lpp->io);
{
register char *waitp;
@@ -251,7 +251,7 @@
register char *waitp;
/* send 0 to port */
- outb_p((unsigned char) (LP_DUMMY), (void *) lp->io);
+ outb_p((unsigned char) (LP_DUMMY), lp->io);
/* 5 us delay */
while (((int)waitp) != LP_WAIT)
@@ -299,7 +299,7 @@
/* only ports 0, 1, 2 and 3 may exist according to RB's intlist */
for (ip = 0; ((int)ip) < LP_PORTS; ip++) {
/* 8 is offset for LPT info, 2 bytes for each entry */
- lp->io = peekw(0x40, (__u16) (2 * ((int)ip) + 8));
+ lp->io = (char *)peekw(0x40, (__u16) (2 * ((int)ip) + 8));
/* returns 0 if port wasn't detected by BIOS at bootup */
if (!lp->io)
break; /* there can be no more ports */
diff -Nurb elks.orig/arch/i86/drivers/char/serial.c elks/arch/i86/drivers/char/serial.c
--- elks.orig/arch/i86/drivers/char/serial.c 2012-06-27 17:51:51.000000000 -0500
+++ elks/arch/i86/drivers/char/serial.c 2012-07-18 15:10:14.000000000 -0500
@@ -15,7 +15,7 @@
extern struct tty ttys[];
struct serial_info {
- unsigned short io;
+ char *io;
unsigned char irq;
unsigned char flags;
unsigned char lcr;
@@ -49,10 +49,10 @@
#define MAX_RX_BUFFER_SIZE 16
static struct serial_info ports[4] = {
- {0x3f8, 4, 0, DEFAULT_LCR, DEFAULT_MCR, NULL},
- {0x2f8, 3, 0, DEFAULT_LCR, DEFAULT_MCR, NULL},
- {0x3e8, 5, 0, DEFAULT_LCR, DEFAULT_MCR, NULL},
- {0x2e8, 2, 0, DEFAULT_LCR, DEFAULT_MCR, NULL},
+ {(char *)0x3f8, 4, 0, DEFAULT_LCR, DEFAULT_MCR, NULL},
+ {(char *)0x2f8, 3, 0, DEFAULT_LCR, DEFAULT_MCR, NULL},
+ {(char *)0x3e8, 5, 0, DEFAULT_LCR, DEFAULT_MCR, NULL},
+ {(char *)0x2e8, 2, 0, DEFAULT_LCR, DEFAULT_MCR, NULL},
};
static unsigned int divisors[16] = {
@@ -107,14 +107,14 @@
clr_irq();
/* Set the divisor latch bit */
- outb_p(port->lcr | UART_LCR_DLAB, (void *) (port->io + UART_LCR));
+ outb_p(port->lcr | UART_LCR_DLAB, port->io + UART_LCR);
/* Set the divisor low and high byte */
- outb_p(divisor & 0xff, (void *) (port->io + UART_DLL));
- outb_p((divisor >> 8) & 0xff, (void *)(port->io + UART_DLM));
+ outb_p(divisor & 0xff, port->io + UART_DLL);
+ outb_p((divisor >> 8) & 0xff, port->io + UART_DLM);
/* Clear the divisor latch bit */
- outb_p(port->lcr, (void *)(port->io + UART_LCR));
+ outb_p(port->lcr, port->io + UART_LCR);
set_irq();
}
@@ -127,7 +127,7 @@
debug("SERIAL: rs_release called\n");
port->flags &= ~SERF_INUSE;
- outb_p(0, (void *)(port->io + UART_IER));
+ outb_p(0, port->io + UART_IER);
}
static int get_serial_info(struct serial_info *info,
@@ -154,29 +154,29 @@
port->flags |= SERF_INUSE;
/* clear RX buffer */
- inb_p((void *)(port->io + UART_LSR));
+ inb_p(port->io + UART_LSR);
countp = (char *) MAX_RX_BUFFER_SIZE;
do
- inb_p((void *) (port->io + UART_RX));
- while (--countp && (inb_p((void *) (port->io + UART_LSR)) & UART_LSR_DR));
+ inb_p(port->io + UART_RX);
+ while (--countp && (inb_p(port->io + UART_LSR)) & UART_LSR_DR);
- inb_p((void *) (port->io + UART_IIR));
- inb_p((void *) (port->io + UART_MSR));
+ inb_p(port->io + UART_IIR);
+ inb_p(port->io + UART_MSR);
/* set serial port parameters to match ports[rs_minor] */
update_port(port);
- /* enable reciever data interrupt; FIXME: update code to utilize full interrupt interface */
- outb_p(UART_IER_RDI, (void *)(port->io + UART_IER));
+ /* enable receiver data interrupt; FIXME: update code to utilize full interrupt interface */
+ outb_p(UART_IER_RDI, port->io + UART_IER);
- outb_p(port->mcr, (void *)(port->io + UART_MCR));
+ outb_p(port->mcr, port->io + UART_MCR);
/* clear Line/Modem Status, Intr ID and RX register */
- inb_p((void *) (port->io + UART_LSR));
- inb_p((void *) (port->io + UART_RX));
- inb_p((void *) (port->io + UART_IIR));
- inb_p((void *) (port->io + UART_MSR));
+ inb_p(port->io + UART_LSR);
+ inb_p(port->io + UART_RX);
+ inb_p(port->io + UART_IIR);
+ inb_p(port->io + UART_MSR);
return 0;
}
@@ -184,9 +184,10 @@
static int set_serial_info(struct serial_info *info,
struct serial_info *new_info)
{
- register struct inode *inode;
+ register struct tty *tty;
register char *errp;
+ tty = info->tty;
errp = (char *) verified_memcpy_fromfs(info, new_info,
sizeof(struct serial_info));
if (!errp) {
@@ -195,9 +196,9 @@
/* witty cheat :) - either we do this (and waste some DS) or duplicate
* almost whole rs_release and rs_open (and waste much more CS)
*/
- inode->i_rdev = info->tty->minor;
- rs_release(inode, NULL);
- errp = (char *) rs_open(inode, NULL);
+ info->tty = tty;
+ rs_release(tty);
+ errp = (char *) rs_open(tty);
}
return (int) errp;
}
@@ -206,12 +207,16 @@
{
register struct serial_info *port = &ports[tty->minor - RS_MINOR_OFFSET];
unsigned char ch;
+ register char *i;
+ i = 0;
while (chq_getch(&tty->outq, &ch, 0) != -1) {
- while (!(inb_p((void *)(port->io + UART_LSR)) & UART_LSR_TEMT))
+ while (!(inb_p(port->io + UART_LSR) & UART_LSR_TEMT))
/* Do nothing */ ;
- outb(ch, (void *) (port->io + UART_TX));
+ outb(ch, port->io + UART_TX);
+ i++;
}
+ return (int)i;
}
int rs_ioctl(struct tty *tty, int cmd, char *arg)
@@ -249,14 +254,14 @@
q = &sp->tty->inq;
size = q->size - 1;
do {
- ch = inb_p((void *) (sp->io + UART_RX));
+ ch = inb_p(sp->io + UART_RX);
if (!tty_intcheck(sp->tty, ch)) {
if (q->len == size)
break;
q->buf[(q->tail + q->len) & size] = (char) ch;
q->len++;
}
- } while (inb_p((void *)(sp->io + UART_LSR)) & UART_LSR_DR);
+ } while (inb_p(sp->io + UART_LSR) & UART_LSR_DR);
wake_up(&q->wq);
}
@@ -269,14 +274,14 @@
debug1("SERIAL: Interrupt %d recieved.\n", irq);
sp = &ports[irq_port[irq - 2]];
do {
- statusp = (char *)inb_p((void *)(sp->io + UART_LSR));
+ statusp = (char *)inb_p(sp->io + UART_LSR);
if ((int)statusp & UART_LSR_DR)
receive_chars(sp);
#if 0
if (((int)statusp) & UART_LSR_THRE)
transmit_chars(sp);
#endif
- } while (!(inb_p((void *)(sp->io + UART_IIR)) & UART_IIR_NO_INT));
+ } while (!(inb_p(sp->io + UART_IIR) & UART_IIR_NO_INT));
}
int rs_probe(register struct serial_info *sp)
@@ -284,25 +289,25 @@
int status1, status2;
unsigned char scratch;
- scratch = inb((void *)(sp->io + UART_IER));
- outb_p(0, (void *)(sp->io + UART_IER));
- scratch = inb_p((void *)(sp->io + UART_IER));
- outb_p(scratch, (void *)(sp->io + UART_IER));
+ scratch = inb(sp->io + UART_IER);
+ outb_p(0, sp->io + UART_IER);
+ scratch = inb_p(sp->io + UART_IER);
+ outb_p(scratch, sp->io + UART_IER);
if (scratch)
return -1;
/* this code is weird, IMO */
- scratch = inb_p((void *)(sp->io + UART_LCR));
- outb_p(scratch | UART_LCR_DLAB, (void *)(sp->io + UART_LCR));
- outb_p(0, (void *)(sp->io + UART_EFR));
- outb_p(scratch, (void *)(sp->io + UART_LCR));
+ scratch = inb_p(sp->io + UART_LCR);
+ outb_p(scratch | UART_LCR_DLAB, sp->io + UART_LCR);
+ outb_p(0, sp->io + UART_EFR);
+ outb_p(scratch, sp->io + UART_LCR);
- outb_p(UART_FCR_ENABLE_FIFO, (void *)(sp->io + UART_FCR));
+ outb_p(UART_FCR_ENABLE_FIFO, sp->io + UART_FCR);
/* upper two bits of IIR define UART type, but according to both RB's
* intlist and HelpPC this code is wrong, see comments marked with [*]
*/
- scratch = inb_p((void *)(sp->io + UART_IIR)) >> 6;
+ scratch = inb_p(sp->io + UART_IIR) >> 6;
switch (scratch) {
case 0:
sp->flags = (unsigned char) (SERF_EXIST | ST_16450);
@@ -321,12 +326,12 @@
/* 8250 UART if scratch register isn't present */
if (!scratch) {
- scratch = inb_p((void *)(sp->io + UART_SCR));
- outb_p(0xA5, (void *)(sp->io + UART_SCR));
- status1 = inb_p((void *)(sp->io + UART_SCR));
- outb_p(0x5A, (void *)(sp->io + UART_SCR));
- status2 = inb_p((void *)(sp->io + UART_SCR));
- outb_p(scratch, (void *)(sp->io + UART_SCR));
+ scratch = inb_p(sp->io + UART_SCR);
+ outb_p(0xA5, sp->io + UART_SCR);
+ status1 = inb_p(sp->io + UART_SCR);
+ outb_p(0x5A, sp->io + UART_SCR);
+ status2 = inb_p(sp->io + UART_SCR);
+ outb_p(scratch, sp->io + UART_SCR);
if ((status1 != 0xA5) || (status2 != 0x5A))
sp->flags = (unsigned char) (SERF_EXIST | ST_8250);
}
@@ -335,18 +340,18 @@
* Reset the chip
*/
- outb_p(0x00, (void *)(sp->io + UART_MCR));
+ outb_p(0x00, sp->io + UART_MCR);
/* clear RX and TX FIFOs */
outb_p((unsigned char) (UART_FCR_CLEAR_RCVR | UART_FCR_CLEAR_XMIT),
- (void *)(sp->io + UART_FCR));
+ sp->io + UART_FCR);
/* clear RX register */
{
register char *countp = (char *) MAX_RX_BUFFER_SIZE;
do {
- inb_p((void *) (sp->io + UART_RX));
- } while (--countp && (inb_p((void *)(sp->io + UART_LSR)) & UART_LSR_DR));
+ inb_p(sp->io + UART_RX);
+ } while (--countp && (inb_p(sp->io + UART_LSR) & UART_LSR_DR));
}
return 0;
@@ -395,7 +400,7 @@
sp->tty = &ttys[ttyno++];
update_port(sp);
#if 0
- outb_p(? ? ? ?, (void *)(sp->io + UART_MCR));
+ outb_p(? ? ? ?, sp->io + UART_MCR);
#endif
}
}
@@ -420,7 +425,7 @@
void con_charout(char Ch)
{
if (con_init) {
- while (!(inb_p((void *)(ports[CONSOLE_PORT].io + UART_LSR)) & UART_LSR_TEMT));
+ while (!(inb_p(ports[CONSOLE_PORT].io + UART_LSR) & UART_LSR_TEMT));
outb(Ch, ports[CONSOLE_PORT].io + UART_TX);
}
}
diff -Nurb elks.orig/arch/i86/kernel/asm-offsets.c elks/arch/i86/kernel/asm-offsets.c
--- elks.orig/arch/i86/kernel/asm-offsets.c 2012-06-27 17:52:16.000000000 -0500
+++ elks/arch/i86/kernel/asm-offsets.c 2012-07-18 13:35:59.000000000 -0500
@@ -1,10 +1,14 @@
#include <linuxmt/kernel.h>
#include <linuxmt/sched.h>
-#ifndef __BCC__
-#include <stddef.h>
-#else
+#ifdef __BCC__
#define offsetof(s,m) (size_t)&(((s *)0)->m)
+#else
+#ifdef __WATCOMC__
+#define offsetof(__typ,__id) ((size_t)((char *)&(((__typ*)0)->__id) - (char *)0))
+#else
+#include <stddef.h>
+#endif
#endif
extern int TASK_KRNL_SP, TASK_USER_SP, TASK_USER_SS;
diff -Nurb elks.orig/arch/i86/kernel/process.c elks/arch/i86/kernel/process.c
--- elks.orig/arch/i86/kernel/process.c 2012-07-07 10:05:25.000000000 -0500
+++ elks/arch/i86/kernel/process.c 2012-07-18 11:28:10.000000000 -0500
@@ -344,7 +344,7 @@
memset(t, 0, sizeof(struct task_struct));
t->t_regs.ds = t->t_regs.ss = get_ds();
t->t_regs.ksp = ((__u16) t->t_kstack) + KSTACK_BYTES;
- t->t_regs.ksp -= fake_save_regs((FsR)t->t_regs.ksp,(FsR)addr);
+ t->t_regs.ksp -= fake_save_regs((__u16)t->t_regs.ksp,(__u16)addr);
t->state = TASK_UNINTERRUPTIBLE;
t->pid = get_pid();
diff -Nurb elks.orig/arch/i86/kernel/system.c elks/arch/i86/kernel/system.c
--- elks.orig/arch/i86/kernel/system.c 2012-07-07 10:05:12.000000000 -0500
+++ elks/arch/i86/kernel/system.c 2012-07-18 11:28:10.000000000 -0500
@@ -79,7 +79,7 @@
#ifndef CONFIG_ARCH_SIBO
- *end = setupw(0x2a) << 6 - RAM_REDUCE;
+ *end = (seg_t)(setupw(0x2a) << 6 - RAM_REDUCE);
/* XXX plac: free root ram disk */
diff -Nurb elks.orig/fs/file_table.c elks/fs/file_table.c
--- elks.orig/fs/file_table.c 2012-05-11 13:26:27.000000000 -0500
+++ elks/fs/file_table.c 2012-07-18 11:28:10.000000000 -0500
@@ -27,11 +27,10 @@
struct file *get_empty_filp(void)
{
- register struct file *f = file_array;
- register char *pi = nr_files;
+ register struct file *f;
- while (pi) { /* TODO: is nr_file const? */
- if (!f->f_count) {
+ for(f = file_array; f < &file_array[NR_FILE]; f++) {
+ if (!f->f_count) { /* TODO: is nr_file const? */
memset(f, 0, sizeof(*f));
f->f_count = 1;
#ifdef BLOAT_FS
@@ -39,8 +38,6 @@
#endif
return f;
}
- ++f;
- --pi;
}
return NULL;
diff -Nurb elks.orig/fs/namei.c elks/fs/namei.c
--- elks.orig/fs/namei.c 2012-05-11 13:26:27.000000000 -0500
+++ elks/fs/namei.c 2012-07-18 11:28:10.000000000 -0500
@@ -527,12 +527,12 @@
int sys_rmdir(char *pathname)
{
- __do_rmthing(pathname, 0);
+ return __do_rmthing(pathname, 0);
}
int sys_unlink(char *pathname)
{
- __do_rmthing(pathname, 1);
+ return __do_rmthing(pathname, 1);
}
int sys_symlink(char *oldname, char *newname)
diff -Nurb elks.orig/fs/pipe.c elks/fs/pipe.c
--- elks.orig/fs/pipe.c 2012-05-11 13:26:27.000000000 -0500
+++ elks/fs/pipe.c 2012-07-18 12:18:36.000000000 -0500
@@ -79,7 +79,7 @@
}
-static int pipe_read(register struct inode *inode, struct file *filp,
+static size_t pipe_read(register struct inode *inode, struct file *filp,
char *buf, int count)
{
size_t chars = 0, size = 0, read = 0;
@@ -128,7 +128,7 @@
return 0;
}
-static int pipe_write(register struct inode *inode, struct file *filp,
+static size_t pipe_write(register struct inode *inode, struct file *filp,
char *buf, int count)
{
register char *pipebuf;
@@ -181,7 +181,7 @@
}
inode->i_ctime = inode->i_mtime = CURRENT_TIME;
- return (int) written;
+ return written;
}
static void pipe_read_release(register struct inode *inode, struct file *filp)
@@ -242,7 +242,7 @@
return 0;
}
-static int bad_pipe_rw(struct inode *inode, struct file *filp,
+static size_t bad_pipe_rw(struct inode *inode, struct file *filp,
char *buf, int count)
{
debug("PIPE: bad rw called.\n");
diff -Nurb elks.orig/include/arch/segment.h elks/include/arch/segment.h
--- elks.orig/include/arch/segment.h 2012-07-07 10:05:12.000000000 -0500
+++ elks/include/arch/segment.h 2012-07-18 11:28:10.000000000 -0500
@@ -20,7 +20,7 @@
#endif
-extern __u16 setupw(unsigned short int *);
+extern __u16 setupw(unsigned short int);
#define setupb(p) ((char)setupw(p))
diff -Nurb elks.orig/include/linuxmt/chqueue.h elks/include/linuxmt/chqueue.h
--- elks.orig/include/linuxmt/chqueue.h 2012-05-11 13:26:27.000000000 -0500
+++ elks/include/linuxmt/chqueue.h 2012-07-18 12:30:09.000000000 -0500
@@ -9,8 +9,8 @@
int size, tail, len;
};
-extern int chq_init(register struct ch_queue *,unsigned char *,int);
-extern int chq_erase(register struct ch_queue *);
+extern void chq_init(register struct ch_queue *,unsigned char *,int);
+extern void chq_erase(register struct ch_queue *);
extern int chq_addch(register struct ch_queue *,unsigned char,int);
extern int chq_delch(register struct ch_queue *);
extern int chq_peekch(register struct ch_queue *);
diff -Nurb elks.orig/include/linuxmt/kdev_t.h elks/include/linuxmt/kdev_t.h
--- elks.orig/include/linuxmt/kdev_t.h 2012-05-11 13:26:27.000000000 -0500
+++ elks/include/linuxmt/kdev_t.h 2012-07-18 13:13:56.000000000 -0500
@@ -16,6 +16,10 @@
#define INCLUDE_OK
#endif
+#ifdef __WATCOMC__
+#define INCLUDE_OK
+#endif
+
#ifdef S_SPLINT_S
#define INCLUDE_OK
#endif
diff -Nurb elks.orig/include/linuxmt/minix_fs.h elks/include/linuxmt/minix_fs.h
--- elks.orig/include/linuxmt/minix_fs.h 2012-05-11 13:26:27.000000000 -0500
+++ elks/include/linuxmt/minix_fs.h 2012-07-18 11:28:10.000000000 -0500
@@ -60,7 +60,7 @@
struct minix_dir_entry {
__u16 inode;
- char name[0];
+ char name[];
};
#ifdef __KERNEL__
diff -Nurb elks.orig/include/linuxmt/romfs_fs.h elks/include/linuxmt/romfs_fs.h
--- elks.orig/include/linuxmt/romfs_fs.h 2012-05-11 13:26:27.000000000 -0500
+++ elks/include/linuxmt/romfs_fs.h 2012-07-18 11:28:10.000000000 -0500
@@ -28,7 +28,7 @@
__u32 word1;
__u32 size;
__u32 checksum;
- char name[0]; /* volume name */
+ char name[]; /* volume name */
};
/* On disk inode */
@@ -38,7 +38,7 @@
__u32 spec;
__u32 size;
__u32 checksum;
- char name[0];
+ char name[];
};
#define ROMFH_TYPE 7
diff -Nurb elks.orig/include/linuxmt/sched.h elks/include/linuxmt/sched.h
--- elks.orig/include/linuxmt/sched.h 2012-05-11 13:26:27.000000000 -0500
+++ elks/include/linuxmt/sched.h 2012-07-18 11:41:18.000000000 -0500
@@ -158,9 +158,7 @@
extern void wake_up_process(struct task_struct *);
-#ifdef S_SPLINT_S
-extern void kill_process(pid_t,sig_t,int);
-#endif
+extern int kill_process(pid_t,sig_t,int);
extern void add_to_runqueue(struct task_struct *);
diff -Nurb elks.orig/include/linuxmt/string.h elks/include/linuxmt/string.h
--- elks.orig/include/linuxmt/string.h 2012-05-11 13:26:27.000000000 -0500
+++ elks/include/linuxmt/string.h 2012-07-18 15:14:40.000000000 -0500
@@ -35,6 +35,7 @@
*/
extern void *memscan(void *,int,size_t);
+extern int atoi(char *);
/*@+namechecks@*/
diff -Nurb elks.orig/kernel/exit.c elks/kernel/exit.c
--- elks.orig/kernel/exit.c 2012-07-07 10:05:25.000000000 -0500
+++ elks/kernel/exit.c 2012-07-18 11:28:10.000000000 -0500
@@ -56,7 +56,7 @@
if (current->mm.dseg)
mm_free(current->mm.dseg);
- current->mm.cseg = current->mm.dseg = NULL;
+ current->mm.cseg = current->mm.dseg = 0;
/* Keep all of the family stuff straight */
if ((task = current->p_prevsib)) {
diff -Nurb elks.orig/kernel/fork.c elks/kernel/fork.c
--- elks.orig/kernel/fork.c 2012-07-07 10:05:25.000000000 -0500
+++ elks/kernel/fork.c 2012-07-18 11:28:10.000000000 -0500
@@ -119,7 +119,7 @@
/* Set up our family tree */
t->p_parent = currentp;
- t->p_nextsib = t->p_child = /* NULL; */
+ t->p_nextsib = t->p_child = NULL;
t->child_lastend = t->lastend_status = 0;
if ((t->p_prevsib = currentp->p_child) != NULL) {
currentp->p_child->p_nextsib = t;
diff -Nurb elks.orig/kernel/sched.c elks/kernel/sched.c
--- elks.orig/kernel/sched.c 2012-07-16 18:49:49.000000000 -0500
+++ elks/kernel/sched.c 2012-07-18 11:28:10.000000000 -0500
@@ -12,6 +12,7 @@
#include <linuxmt/kernel.h>
#include <linuxmt/sched.h>
#include <linuxmt/timer.h>
+#include <linuxmt/string.h>
#include <arch/irq.h>
diff -Nurb elks.orig/lib/chqueue.c elks/lib/chqueue.c
--- elks.orig/lib/chqueue.c 2012-05-11 13:26:27.000000000 -0500
+++ elks/lib/chqueue.c 2012-07-18 12:30:18.000000000 -0500
@@ -24,12 +24,12 @@
#include <linuxmt/types.h>
#include <linuxmt/debug.h>
-int chq_erase(register struct ch_queue *q)
+void chq_erase(register struct ch_queue *q)
{
q->len = q->tail = 0;
}
-int chq_init(register struct ch_queue *q, unsigned char *buf, int size)
+void chq_init(register struct ch_queue *q, unsigned char *buf, int size)
{
debug3("CHQ: chq_init(%d, %d, %d)\n", q, buf, size);
q->buf = (char *) buf;
diff -Nurb elks.orig/net/ipv4/af_inet.c elks/net/ipv4/af_inet.c
--- elks.orig/net/ipv4/af_inet.c 2012-05-11 13:26:27.000000000 -0500
+++ elks/net/ipv4/af_inet.c 2012-07-18 12:50:24.000000000 -0500
@@ -109,7 +109,7 @@
while (bufin_sem == 0)
interruptible_sleep_on(sock->wait);
- ret_data = tdin_buf;
+ ret_data = (struct tdb_return_data *)tdin_buf;
ret = ret_data->ret_value;
tcpdev_clear_data_avail();
if (ret < 0)
@@ -152,7 +152,7 @@
while (bufin_sem == 0)
interruptible_sleep_on(sock->wait);
- r = tdin_buf;
+ r = (struct tdb_return_data *)tdin_buf;
ret = r->ret_value;
tcpdev_clear_data_avail();
@@ -191,7 +191,7 @@
return -ERESTARTSYS;
}
- ret_data = tdin_buf;
+ ret_data = (struct tdb_return_data *)tdin_buf;
ret = ret_data->ret_value;
tcpdev_clear_data_avail();
@@ -223,7 +223,7 @@
}
}
- ret_data = tdin_buf;
+ ret_data = (struct tdb_accept_ret *)tdin_buf;
ret = ret_data->ret_value;
tcpdev_clear_data_avail();
@@ -266,7 +266,7 @@
down(&sock->sem);
- r = tdin_buf;
+ r = (struct tdb_return_data *)tdin_buf;
ret = r->ret_value;
if (ret > 0) {
@@ -317,7 +317,7 @@
interruptible_sleep_on(sock->wait);
}
- r = tdin_buf;
+ r = (struct tdb_return_data *)tdin_buf;
ret = r->ret_value;
tcpdev_clear_data_avail();
if (ret < 0) {
^ permalink raw reply [flat|nested] 5+ messages in thread* Re: [PATCH] Ansi-C compatibility fixes
2012-07-19 22:37 [PATCH] Ansi-C compatibility fixes Juan Perez-Sanchez
@ 2012-07-22 8:45 ` ht-lab
2012-08-11 15:22 ` Jody Bruchon
1 sibling, 0 replies; 5+ messages in thread
From: ht-lab @ 2012-07-22 8:45 UTC (permalink / raw)
To: Juan Perez-Sanchez; +Cc: linux-8086
Hi Juan,
You seem to be doing a lot of good work, I would be interested to hear
what it is that you are working on,
Regards,
Hans
www.ht-lab.com
On 19/07/2012 23:37, Juan Perez-Sanchez wrote:
> Hi,
>
>
> This patch makes another round of fixes to improve ansi-C
> compatibility, this time using the open-watcom compiler. An effort was
> done to make the right changes to code, not just wipe out the errors
> or warnings. For example, if prototypes, definition and usage of
> functions differ, examined the purpose and uses of the function to
> determine the right fix.
>
> The partial list of fixes includes:
>
> - Missing prototypes of functions.
> - Assignment of variables without appropriate casting.
> - Inadequate typing of variables.
> - Differences in definition, prototypes and use.
> - Functions defined to return some value but did not return anything.
> - Definition of zero length arrays.
>
> Code size is unchanged.
>
> The Image builded without errors. The kernel was tested with QEMU and
> dioscuri emulators. Also in a PPro pc booting from floppy.
>
> Greetings,
>
> Juan
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Ansi-C compatibility fixes
2012-07-19 22:37 [PATCH] Ansi-C compatibility fixes Juan Perez-Sanchez
2012-07-22 8:45 ` ht-lab
@ 2012-08-11 15:22 ` Jody Bruchon
2012-08-20 19:30 ` Bojan Popovic
2012-11-12 23:17 ` Juan Perez-Sanchez
1 sibling, 2 replies; 5+ messages in thread
From: Jody Bruchon @ 2012-08-11 15:22 UTC (permalink / raw)
To: linux-8086
Juan and everyone else, I just wanted to let you all know that the
patches submitted to this point have been pushed to the Git repository
on SourceForge. Thank you Juan! You've done some pretty amazing work on
the ELKS project. I'm definitely impressed at what you've managed to do.
I'm thinking of dropping another "release" of 0.1.5 after some more
testing. It couldn't hurt to get these serious bug fixes out there as a
version bump.
Jody Bruchon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Ansi-C compatibility fixes
2012-08-11 15:22 ` Jody Bruchon
@ 2012-08-20 19:30 ` Bojan Popovic
2012-11-12 23:17 ` Juan Perez-Sanchez
1 sibling, 0 replies; 5+ messages in thread
From: Bojan Popovic @ 2012-08-20 19:30 UTC (permalink / raw)
To: linux-8086
Hi,
I tried building the current git snapshot. It builds fine (tested on
Slackware 14.0rc2) and the image runs nicely in Qemu 1.1.1.
But there is a small problem in elks/arch/i86/Makefile. Newline (\n)
is not parsed by echo and it gets in asm-offsets.h (ie: \n#endif instead
of #endif).
--- Makefile.orig 2012-08-20 20:54:06.000000000 +0200
+++ Makefile 2012-08-20 21:06:07.197644614 +0200
@@ -88,7 +88,7 @@
$(BASEDIR)/include/arch/asm-offsets.h: kernel/asm-offsets.c
$(CC) $(CFLAGS) -S -o asm-offsets.s kernel/asm-offsets.c
echo '#ifndef ASM_OFFSETS_H' >
$(BASEDIR)/include/arch/asm-offsets.h
- echo '#define ASM_OFFSETS_H\n' >>
$(BASEDIR)/include/arch/asm-offsets.h
+ echo -e '#define ASM_OFFSETS_H\n' >>
$(BASEDIR)/include/arch/asm-offsets.h sed -e '/^[^m].*/ d' \
-e 's/\],/ /' \
-e 's/ #/ /' \
@@ -97,7 +97,7 @@
-e 's/^.*\[_/#define /' \
-e 's/ax/0/' \
< asm-offsets.s | grep -e define >>
$(BASEDIR)/include/arch/asm-offsets.h
- echo '\n#endif' >> $(BASEDIR)/include/arch/asm-offsets.h
+ echo -e '\n#endif' >> $(BASEDIR)/include/arch/asm-offsets.h
rm asm-offsets.s
#########################################################################
Bojan.
On Sat, 11 Aug 2012 11:22:20 -0400
Jody Bruchon <jody@jodybruchon.com> wrote:
> Juan and everyone else, I just wanted to let you all know that the
> patches submitted to this point have been pushed to the Git
> repository on SourceForge. Thank you Juan! You've done some pretty
> amazing work on the ELKS project. I'm definitely impressed at what
> you've managed to do.
>
> I'm thinking of dropping another "release" of 0.1.5 after some more
> testing. It couldn't hurt to get these serious bug fixes out there as
> a version bump.
>
> Jody Bruchon
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] Ansi-C compatibility fixes
2012-08-11 15:22 ` Jody Bruchon
2012-08-20 19:30 ` Bojan Popovic
@ 2012-11-12 23:17 ` Juan Perez-Sanchez
1 sibling, 0 replies; 5+ messages in thread
From: Juan Perez-Sanchez @ 2012-11-12 23:17 UTC (permalink / raw)
To: Jody Bruchon; +Cc: linux-8086
Hi,
Thank you all for your encouraging words. I appreciate your
confidence on my work.
Now to the Hans question. Last year I was working on a project
requiring an small embedded processor. I personally am more
comfortable with unix, so I reviewed more closely ELKS. I concluded
that it has a lot of problems and decided to use Linux.
I think there is a need for an embedded OS for small cpu's and ELKS
has the potential to be that OS. At this moment I work on other things
and my interest is for hobby. Maybe in the future I will prefer ELKS.
Greetings,
Juan
>
> I'm thinking of dropping another "release" of 0.1.5 after some more testing.
> It couldn't hurt to get these serious bug fixes out there as a version bump.
>
> Jody Bruchon
> --
> To unsubscribe from this list: send the line "unsubscribe linux-8086" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at http://vger.kernel.org/majordomo-info.html
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2012-11-12 23:17 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2012-07-19 22:37 [PATCH] Ansi-C compatibility fixes Juan Perez-Sanchez
2012-07-22 8:45 ` ht-lab
2012-08-11 15:22 ` Jody Bruchon
2012-08-20 19:30 ` Bojan Popovic
2012-11-12 23:17 ` Juan Perez-Sanchez
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox