Commit afcc8eca authored by Jeff Dike's avatar Jeff Dike

A number of small fixes.

The port and xterm drivers handle -EAGAIN from os_rcv_fd gracefully,
fixing a crash in the xterm driver.
The ubd driver handles devfs_register failures better.
More symbols were exported.
parent de3d8010
ARCH_DIR = arch/um
OS := $(shell uname -s)
EXTRAVERSION := $(EXTRAVERSION)-1um
EXTRAVERSION := $(EXTRAVERSION)-3um
include/linux/version.h: arch/$(ARCH)/Makefile
# Recalculate MODLIB to reflect the EXTRAVERSION changes (via KERNELRELEASE)
......
......@@ -15,7 +15,7 @@ CHAN_OBJS := chan_kern.o chan_user.o line.o
# So, what this does is figure out by hand (crudely) what file -lpcap really
# is and just use it.
PCAP = $(shell for f in echo {/lib,/usr/lib}/libpcap.{a,so}; do \
PCAP = $(shell for f in echo {/lib,/usr/lib}/libpcap.a; do \
[ -f $$f ] && echo $$f ; done | head -1)
slip-objs := slip_kern.o slip_user.o
......
......@@ -50,13 +50,17 @@ static void pipe_interrupt(int irq, void *data, struct pt_regs *regs)
struct connection *conn = data;
int fd;
list_del(&conn->list);
fd = os_rcv_fd(conn->socket[0], &conn->helper_pid);
if(fd < 0){
if(fd == -EAGAIN)
return;
printk("os_rcv_fd returned %d\n", -fd);
os_close_file(conn->fd);
}
list_del(&conn->list);
conn->fd = fd;
list_add(&conn->list, &conn->port->connections);
......
......@@ -423,7 +423,6 @@ devfs_handle_t ubd_fake_dir_handle;
static int ubd_add(int n)
{
devfs_handle_t real, fake;
char name[sizeof("nnnnnn\0")];
struct ubd *dev = &ubd_dev[n];
struct gendisk *disk, *fake_disk = NULL;
......@@ -465,24 +464,18 @@ static int ubd_add(int n)
}
sprintf(name, "%d", n);
real = devfs_register(ubd_dir_handle, name, DEVFS_FL_REMOVABLE,
MAJOR_NR, n << UBD_SHIFT,
S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |S_IWGRP,
&ubd_blops, NULL);
if(real == NULL)
goto out;
ubd_dev[n].real = real;
dev->real = devfs_register(ubd_dir_handle, name, DEVFS_FL_REMOVABLE,
MAJOR_NR, n << UBD_SHIFT, S_IFBLK |
S_IRUSR | S_IWUSR | S_IRGRP |S_IWGRP,
&ubd_blops, NULL);
if (fake_major) {
fake = devfs_register(ubd_fake_dir_handle, name,
DEVFS_FL_REMOVABLE, fake_major,
n << UBD_SHIFT,
S_IFBLK | S_IRUSR | S_IWUSR | S_IRGRP |
S_IWGRP, &ubd_blops, NULL);
if(fake == NULL)
goto out_unregister;
ubd_dev[n].fake = fake;
dev->fake = devfs_register(ubd_fake_dir_handle, name,
DEVFS_FL_REMOVABLE, fake_major,
n << UBD_SHIFT,
S_IFBLK | S_IRUSR | S_IWUSR |
S_IRGRP | S_IWGRP, &ubd_blops,
NULL);
add_disk(fake_disk);
}
......@@ -490,9 +483,6 @@ static int ubd_add(int n)
make_ide_entries(disk->disk_name);
return(0);
out_unregister:
devfs_unregister(real);
ubd_dev[n].real = NULL;
out:
return(-1);
}
......@@ -700,11 +690,12 @@ static int ubd_open(struct inode *inode, struct file *filp)
{
int n = DEVICE_NR(inode->i_rdev);
struct ubd *dev = &ubd_dev[n];
int err = 0;
int err = -EISDIR;
if(dev->is_dir == 1)
goto out;
err = 0;
if(dev->count == 0){
dev->openflags = dev->boot_openflags;
......
......@@ -8,6 +8,7 @@
#include "asm/semaphore.h"
#include "asm/irq.h"
#include "irq_user.h"
#include "kern_util.h"
#include "os.h"
#include "xterm.h"
......@@ -23,6 +24,9 @@ static void xterm_interrupt(int irq, void *data, struct pt_regs *regs)
struct xterm_wait *xterm = data;
xterm->new_fd = os_rcv_fd(xterm->fd, &xterm->pid);
if(xterm->new_fd == -EAGAIN)
return;
up(&xterm->sem);
}
......@@ -52,6 +56,8 @@ int xterm_fd(int socket, int *pid_out)
}
down(&data->sem);
free_irq(XTERM_IRQ, data);
ret = data->new_fd;
*pid_out = data->pid;
kfree(data);
......
......@@ -39,12 +39,15 @@ EXPORT_SYMBOL(page_mem_map);
EXPORT_SYMBOL(get_signals);
EXPORT_SYMBOL(page_to_phys);
EXPORT_SYMBOL(phys_to_page);
EXPORT_SYMBOL(high_physmem);
EXPORT_SYMBOL(os_open_file);
EXPORT_SYMBOL(os_read_file);
EXPORT_SYMBOL(os_write_file);
EXPORT_SYMBOL(os_seek_file);
EXPORT_SYMBOL(os_pipe);
EXPORT_SYMBOL(os_file_type);
EXPORT_SYMBOL(os_close_file);
EXPORT_SYMBOL(helper_wait);
EXPORT_SYMBOL(os_shutdown_socket);
EXPORT_SYMBOL(os_connect_socket);
......@@ -71,4 +74,6 @@ EXPORT_SYMBOL_NOVERS(__write_lock_failed);
extern void FASTCALL( __read_lock_failed(rwlock_t *rw));
EXPORT_SYMBOL_NOVERS(__read_lock_failed);
EXPORT_SYMBOL(smp_num_cpus);
#endif
......@@ -76,6 +76,16 @@ void show_trace(unsigned long * stack)
printk("\n");
}
/*
* The architecture-independent dump_stack generator
*/
void dump_stack(void)
{
unsigned long stack;
show_trace(&stack);
}
void show_trace_task(struct task_struct *tsk)
{
unsigned long esp = PT_REGS_SP(&tsk->thread.regs);
......
......@@ -283,10 +283,9 @@ int os_rcv_fd(int fd, int *helper_pid_out)
msg.msg_flags = 0;
n = recvmsg(fd, &msg, 0);
if(n < 0){
printk("rcv_fd : recvmsg failed - errno = %d\n", errno);
return(-1);
}
if(n < 0)
return(-errno);
else if(n != sizeof(iov.iov_len))
*helper_pid_out = -1;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment