Commit 0749ed8a authored by Jeff Dike's avatar Jeff Dike

Merge jdike.wstearns.org:/home/jdike/linux/linus-2.5

into jdike.wstearns.org:/home/jdike/linux/fixes-2.5
parents 2005ca71 1aacb689
......@@ -280,11 +280,6 @@ static int eth_configure(struct uml_net *device, int n)
device->dev = dev;
(*device->kern->init)(dev, device->transport_index);
rtnl_lock();
err = register_netdevice(dev);
rtnl_unlock();
if(err)
return(1);
dev->mtu = device->user->max_packet;
dev->open = uml_net_open;
......@@ -298,7 +293,38 @@ static int eth_configure(struct uml_net *device, int n)
dev->do_ioctl = uml_net_ioctl;
dev->watchdog_timeo = (HZ >> 1);
dev->irq = UM_ETH_IRQ;
dev->init = NULL;
dev->master = NULL;
dev->neigh_setup = NULL;
dev->owner = NULL;
dev->state = 0;
dev->next_sched = 0;
dev->get_wireless_stats = 0;
dev->wireless_handlers = 0;
dev->gflags = 0;
dev->mc_list = NULL;
dev->mc_count = 0;
dev->promiscuity = 0;
dev->atalk_ptr = NULL;
dev->ip_ptr = NULL;
dev->dn_ptr = NULL;
dev->ip6_ptr = NULL;
dev->ec_ptr = NULL;
atomic_set(&dev->refcnt, 0);
dev->features = 0;
dev->uninit = NULL;
dev->destructor = NULL;
dev->set_config = NULL;
dev->accept_fastpath = 0;
dev->br_port = 0;
dev->mem_start = 0;
dev->mem_end = 0;
rtnl_lock();
err = register_netdevice(dev);
rtnl_unlock();
if(err)
return(1);
lp = dev->priv;
/* lp.user is the first four bytes of the transport data, which
......
......@@ -53,7 +53,7 @@ static void pipe_interrupt(int irq, void *data, struct pt_regs *regs)
fd = os_rcv_fd(conn->socket[0], &conn->helper_pid);
if(fd < 0){
printk("os_accept_connection returned %d\n", -fd);
printk("os_rcv_fd returned %d\n", -fd);
os_close_file(conn->fd);
}
conn->fd = fd;
......
......@@ -118,7 +118,7 @@ int port_listen_fd(int port)
goto out;
}
if(listen(fd, 1) < 0){
if((listen(fd, 1) < 0) || (os_set_fd_block(fd, 0))){
err = -errno;
goto out;
}
......@@ -190,7 +190,8 @@ int port_connection(int fd, int *socket, int *pid_out)
"/usr/lib/uml/port-helper", NULL };
struct port_pre_exec_data data;
if((new = accept(fd, NULL, 0)) < 0) return(-errno);
if((new = os_accept_connection(fd)) < 0)
return(-errno);
err = os_pipe(socket, 0, 0);
if(err) goto out_close;
......
......@@ -9,7 +9,10 @@ struct slip_data {
char *addr;
char *gate_addr;
int slave;
char buf[2 * BUF_SIZE];
/* two bytes each for a (pathological) max packet of escaped chars +
* terminating END char + inital END char
*/
char buf[2 * BUF_SIZE + 2];
int pos;
int esc;
};
......
......@@ -25,6 +25,7 @@ extern void *sbrk(int increment);
extern void *malloc(int size);
extern void perror(char *err);
extern int kill(int pid, int sig);
extern int getpid(void);
extern int getuid(void);
extern int pause(void);
extern int write(int, const void *, int);
......
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __TIME_USER_H__
#define __TIME_USER_H__
extern void timer(void);
extern void get_profile_timer(void);
extern void disable_profile_timer(void);
extern void switch_timers(int to_real);
extern void user_time_init(void);
extern void set_timers(int set_signal);
extern void idle_sleep(int secs);
#endif
......@@ -64,10 +64,6 @@ extern void signal_init(void);
extern int start_fork_tramp(void *arg, unsigned long temp_stack,
int clone_flags, int (*tramp)(void *));
extern void trace_myself(void);
extern void timer(void);
extern void get_profile_timer(void);
extern void disable_profile_timer(void);
extern void set_timers(int set_signal);
extern int clone_and_wait(int (*fn)(void *), void *arg, void *sp, int flags);
extern int input_loop(void);
extern void continue_execing_proc(int pid);
......@@ -81,7 +77,6 @@ extern void save_signal_state(int *sig_ptr);
extern void *um_kmalloc(int size);
extern int raw(int fd, int complain);
extern int switcheroo(int fd, int prot, void *from, void *to, int size);
extern void idle_sleep(int secs);
extern void setup_machinename(char *machine_out);
extern void setup_hostinfo(void);
extern void add_arg(char *cmd_line, char *arg);
......@@ -109,7 +104,6 @@ extern int user_write(int fd, char *buf, int len);
extern void write_sigio_workaround(void);
extern void arch_check_bugs(void);
extern int arch_handle_signal(int sig, struct uml_pt_regs *regs);
extern void user_time_init(void);
extern unsigned long pid_pc(int pid);
extern int arch_fixup(unsigned long address, void *sc_ptr);
extern void forward_pending_sigio(int target);
......
......@@ -61,7 +61,7 @@ void sigio_handler(int sig, struct uml_pt_regs *regs)
for(i = 0; i < pollfds_num; i++){
if(pollfds[i].revents != 0){
irq_fd->current_events = pollfds[i].revents;
pollfds[i].events = 0;
pollfds[i].fd = -1;
}
irq_fd = irq_fd->next;
}
......@@ -185,7 +185,8 @@ static void free_irq_by_cb(int (*test)(struct irq_fd *, void *), void *arg)
while(*prev != NULL){
if((*test)(*prev, arg)){
struct irq_fd *old_fd = *prev;
if(pollfds[i].fd != (*prev)->fd){
if((pollfds[i].fd != -1) &&
(pollfds[i].fd != (*prev)->fd)){
printk("free_irq_by_cb - mismatch between "
"active_fds and pollfds, fd %d vs %d\n",
(*prev)->fd, pollfds[i].fd);
......@@ -250,7 +251,7 @@ static struct irq_fd *find_irq_by_fd(int fd, int irqnum, int *index_out)
printk("find_irq_by_fd doesn't have descriptor %d\n", fd);
return(NULL);
}
if(pollfds[i].fd != fd){
if((pollfds[i].fd != -1) && (pollfds[i].fd != fd)){
printk("find_irq_by_fd - mismatch between active_fds and "
"pollfds, fd %d vs %d, need %d\n", irq->fd,
pollfds[i].fd, fd);
......@@ -283,7 +284,7 @@ void reactivate_fd(int fd, int irqnum)
irq = find_irq_by_fd(fd, irqnum, &i);
if(irq == NULL) return;
pollfds[i].events = irq->events;
pollfds[i].fd = irq->fd;
maybe_sigio_broken(fd, irq->type);
}
......@@ -294,7 +295,7 @@ void deactivate_fd(int fd, int irqnum)
irq = find_irq_by_fd(fd, irqnum, &i);
if(irq == NULL) return;
pollfds[i].events = 0;
pollfds[i].fd = -1;
}
void forward_ipi(int fd, int pid)
......
......@@ -49,7 +49,7 @@ mmu_gather_t mmu_gathers[NR_CPUS];
int kmalloc_ok = 0;
#define NREGIONS (phys_region_index(0xffffffff) - phys_region_index(0x0))
#define NREGIONS (phys_region_index(0xffffffff) - phys_region_index(0x0) + 1)
struct mem_region *regions[NREGIONS] = { [ 0 ... NREGIONS - 1 ] = NULL };
#define REGION_SIZE ((0xffffffff & ~REGION_MASK) + 1)
......
......@@ -35,6 +35,7 @@
#include "irq_user.h"
#include "syscall_user.h"
#include "ptrace_user.h"
#include "time_user.h"
#include "init.h"
#include "os.h"
......
......@@ -34,6 +34,7 @@
#include "init.h"
#include "irq_user.h"
#include "mem_user.h"
#include "time_user.h"
#include "tlb.h"
#include "frame_kern.h"
#include "sigcontext.h"
......
......@@ -53,6 +53,28 @@ static void set_interval(int timer_type)
panic("setitimer failed - errno = %d\n", errno);
}
void switch_timers(int to_real)
{
struct itimerval disable = ((struct itimerval) { { 0, 0 }, { 0, 0 }});
struct itimerval enable = ((struct itimerval) { { 0, 1000000/hz() },
{ 0, 1000000/hz() }});
int old, new;
if(to_real){
old = ITIMER_VIRTUAL;
new = ITIMER_REAL;
}
else {
old = ITIMER_REAL;
new = ITIMER_VIRTUAL;
}
if((setitimer(old, &disable, NULL) < 0) ||
(setitimer(new, &enable, NULL)))
printk("switch_timers - setitimer failed, errno = %d\n",
errno);
}
void idle_timer(void)
{
if(signal(SIGVTALRM, SIG_IGN) == SIG_ERR)
......
......@@ -16,6 +16,7 @@
#include "asm/current.h"
#include "kern_util.h"
#include "user_util.h"
#include "time_user.h"
u64 jiffies_64;
......
......@@ -99,7 +99,7 @@ void flush_kernel_range(unsigned long start, unsigned long end, int update_seq)
int updated = 0, err;
mm = &init_mm;
for(addr = start_vm; addr < end_vm;){
for(addr = start; addr < end;){
pgd = pgd_offset(mm, addr);
pmd = pmd_offset(pgd, addr);
if(pmd_present(*pmd)){
......
......@@ -34,6 +34,7 @@
#include "frame_user.h"
#include "syscall_user.h"
#include "ptrace_user.h"
#include "time_user.h"
#include "task.h"
#include "os.h"
......@@ -517,7 +518,14 @@ void alarm_handler(int sig, struct sigcontext sc)
user = user_context(SC_SP(&sc));
if(!user && !kern_timer_on) return;
if(!user && jail_timer_off) return;
if(sig == SIGALRM)
switch_timers(0);
sig_handler_common(sig, &sc);
if(sig == SIGALRM)
switch_timers(1);
}
void do_longjmp(void *p)
......
......@@ -227,12 +227,12 @@ int os_set_fd_block(int fd, int blocking)
int os_accept_connection(int fd)
{
int err;
int new;
err = accept(fd, NULL, 0);
if(err)
new = accept(fd, NULL, 0);
if(new < 0)
return(-errno);
return(0);
return(new);
}
#ifndef SHUT_RD
......
......@@ -233,11 +233,25 @@ static inline void set_pte(pte_t *pteptr, pte_t pteval)
* The following only work if pte_present() is true.
* Undefined behaviour if not..
*/
static inline int pte_read(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
static inline int pte_exec(pte_t pte) { return pte_val(pte) & _PAGE_USER; }
static inline int pte_read(pte_t pte)
{
return((pte_val(pte) & _PAGE_USER) &&
!(pte_val(pte) & _PAGE_PROTNONE));
}
static inline int pte_exec(pte_t pte){
return((pte_val(pte) & _PAGE_USER) &&
!(pte_val(pte) & _PAGE_PROTNONE));
}
static inline int pte_write(pte_t pte)
{
return((pte_val(pte) & _PAGE_RW) &&
!(pte_val(pte) & _PAGE_PROTNONE));
}
static inline int pte_dirty(pte_t pte) { return pte_val(pte) & _PAGE_DIRTY; }
static inline int pte_young(pte_t pte) { return pte_val(pte) & _PAGE_ACCESSED; }
static inline int pte_write(pte_t pte) { return pte_val(pte) & _PAGE_RW; }
static inline int pte_newpage(pte_t pte) { return pte_val(pte) & _PAGE_NEWPAGE; }
static inline int pte_newprot(pte_t pte)
{
......
#ifndef __UM_XOR_H
#define __UM_XOR_H
#include "asm-generic/xor.h"
#endif
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