Commit 0789ed0a authored by Linus Torvalds's avatar Linus Torvalds

Merge http://jdike.stearns.org:5000/fixes-2.5

into home.transmeta.com:/home/torvalds/v2.5/linux
parents 83391bef a7152cf5
......@@ -43,9 +43,8 @@ ARCH_INCLUDE = $(TOPDIR)/$(ARCH_DIR)/include
# in CFLAGS. Otherwise, it would cause ld to complain about the two different
# errnos.
CFLAGS += $(DEBUG) $(PROFILE) $(ARCH_CFLAGS) -D__arch_um__ \
-DSUBARCH=\"$(SUBARCH)\" -D_LARGEFILE64_SOURCE -I$(ARCH_INCLUDE) \
-Derrno=kernel_errno
CFLAGS += $(DEBUG) $(PROFILE) -D__arch_um__ -DSUBARCH=\"$(SUBARCH)\" \
-D_LARGEFILE64_SOURCE -I$(ARCH_INCLUDE) -Derrno=kernel_errno
LINK_WRAPS = -Wl,--wrap,malloc -Wl,--wrap,free -Wl,--wrap,calloc
......
......@@ -4,7 +4,7 @@ else
TOP_ADDR = 0xc0000000
endif
ARCH_CFLAGS = -U__$(SUBARCH)__ -U$(SUBARCH)
CFLAGS += -U__$(SUBARCH)__ -U$(SUBARCH)
ELF_ARCH = $(SUBARCH)
ELF_FORMAT = elf32-$(SUBARCH)
......
......@@ -343,8 +343,6 @@ void line_register_devfs(struct lines *set, struct line_driver *line_driver,
driver->write_room = line_write_room;
driver->init_termios = tty_std_termios;
driver->refcount = &set->refcount;
if (tty_register_driver(driver))
panic("line_register_devfs : Couldn't register driver\n");
......@@ -439,7 +437,6 @@ static void winch_cleanup(void)
list_for_each(ele, &winch_handlers){
winch = list_entry(ele, struct winch, list);
close(winch->fd);
free_irq_by_fd(winch->fd);
if(winch->pid != -1) os_kill_process(winch->pid);
}
}
......
......@@ -519,8 +519,6 @@ __uml_help(eth_setup,
" Configure a network device.\n\n"
);
int ndev = 0;
static int eth_init(void)
{
struct list_head *ele, *next;
......
......@@ -184,7 +184,6 @@ static void free_port(void)
list_for_each(ele, &ports){
port = list_entry(ele, struct port_list, list);
free_irq(ACCEPT_IRQ, port);
os_close_file(port->fd);
}
}
......
......@@ -24,10 +24,13 @@
static int ssl_version = 1;
static struct tty_driver ssl_driver;
/* Referenced only by tty_driver below - presumably it's locked correctly
* by the tty driver.
*/
static int ssl_refcount = 0;
static struct tty_driver ssl_driver;
#define NR_PORTS 64
void ssl_announce(char *dev_name, int dev)
......@@ -153,6 +156,27 @@ void ssl_hangup(struct tty_struct *tty)
{
}
static struct tty_driver ssl_driver = {
refcount : &ssl_refcount,
open : ssl_open,
close : ssl_close,
write : ssl_write,
put_char : ssl_put_char,
flush_chars : ssl_flush_chars,
chars_in_buffer : ssl_chars_in_buffer,
flush_buffer : ssl_flush_buffer,
ioctl : ssl_ioctl,
throttle : ssl_throttle,
unthrottle : ssl_unthrottle,
set_termios : ssl_set_termios,
stop : ssl_stop,
start : ssl_start,
hangup : ssl_hangup
};
/* Changed by ssl_init and referenced by ssl_exit, which are both serialized
* by being an initcall and exitcall, respectively.
*/
static int ssl_init_done = 0;
int ssl_init(void)
......@@ -162,25 +186,6 @@ int ssl_init(void)
printk(KERN_INFO "Initializing software serial port version %d\n",
ssl_version);
ssl_driver = ((struct tty_driver)
{
refcount : &ssl_refcount,
open : ssl_open,
close : ssl_close,
write : ssl_write,
put_char : ssl_put_char,
flush_chars : ssl_flush_chars,
chars_in_buffer : ssl_chars_in_buffer,
flush_buffer : ssl_flush_buffer,
ioctl : ssl_ioctl,
throttle : ssl_throttle,
unthrottle : ssl_unthrottle,
set_termios : ssl_set_termios,
stop : ssl_stop,
start : ssl_start,
hangup : ssl_hangup
});
line_register_devfs(&lines, &driver, &ssl_driver, serial_lines,
sizeof(serial_lines)/sizeof(serial_lines[0]));
......
......@@ -130,15 +130,6 @@ int stdio_init(void)
printk(KERN_INFO "Initializing stdio console driver\n");
console_driver = ((struct tty_driver)
{
open : con_open,
close : con_close,
write : con_write,
chars_in_buffer : chars_in_buffer,
set_termios : set_termios
});
line_register_devfs(&console_lines, &driver, &console_driver, vts,
sizeof(vts)/sizeof(vts[0]));
......@@ -157,9 +148,20 @@ __initcall(stdio_init);
static void console_write(struct console *console, const char *string,
unsigned len)
{
if(con_init_done) down(&vts[console->index].sem);
console_write_chan(&vts[console->index].chan_list, string, len);
if(con_init_done) up(&vts[console->index].sem);
}
static struct tty_driver console_driver = {
refcount : &console_refcount,
open : con_open,
close : con_close,
write : con_write,
chars_in_buffer : chars_in_buffer,
set_termios : set_termios
};
static kdev_t console_device(struct console *c)
{
return mk_kdev(TTY_MAJOR, c->index);
......@@ -193,7 +195,6 @@ __channel_help(console_chan_setup, "con");
static void console_exit(void)
{
if(!con_init_done) return;
line_close(vts, NULL);
close_lines(vts, sizeof(vts)/sizeof(vts[0]));
}
......
......@@ -130,12 +130,7 @@ static int ubd0_init(void)
__initcall(ubd0_init);
static struct hd_driveid ubd_id = {
.cyls = 0,
.heads = 128,
.sectors = 32,
};
/* Only changed by fake_ide_setup which is a setup */
static int fake_ide = 0;
static struct proc_dir_entry *proc_ide_root = NULL;
static struct proc_dir_entry *proc_ide = NULL;
......@@ -161,7 +156,6 @@ static int proc_ide_read_media(char *page, char **start, off_t off, int count,
else len = count;
*start = page + off;
return len;
}
static void make_ide_entries(char *dev_name)
......@@ -380,8 +374,6 @@ void kill_io_thread(void)
__uml_exitcall(kill_io_thread);
int sync = 0;
static int ubd_file_size(struct ubd *dev, __u64 *size_out)
{
char *file;
......@@ -564,7 +556,7 @@ int ubd_driver_init(void){
unsigned long stack;
int err;
if(sync){
if(global_openflags.s){
printk(KERN_INFO "ubd : Synchronous mode\n");
return(0);
}
......@@ -588,9 +580,9 @@ device_initcall(ubd_driver_init);
static void ubd_close(struct ubd *dev)
{
close_fd(dev->fd);
os_close_file(dev->fd);
if(dev->cow.file != NULL) {
close_fd(dev->cow.fd);
os_close_file(dev->cow.fd);
vfree(dev->cow.bitmap);
dev->cow.bitmap = NULL;
}
......@@ -682,9 +674,6 @@ static int ubd_release(struct inode * inode, struct file * file)
return(0);
}
int cow_read = 0;
int cow_write = 0;
void cowify_req(struct io_thread_req *req, struct ubd *dev)
{
int i, update_bitmap, sector = req->offset >> 9;
......@@ -697,14 +686,12 @@ void cowify_req(struct io_thread_req *req, struct ubd *dev)
dev->cow.bitmap)){
ubd_set_bit(i, (unsigned char *)
&req->sector_mask);
cow_read++;
}
}
}
else {
update_bitmap = 0;
for(i = 0; i < req->length >> 9; i++){
cow_write++;
ubd_set_bit(i, (unsigned char *)
&req->sector_mask);
if(!ubd_test_bit(sector + i, (unsigned char *)
......@@ -806,6 +793,12 @@ static int ubd_ioctl(struct inode * inode, struct file * file,
struct hd_geometry *loc = (struct hd_geometry *) arg;
struct ubd *dev;
int n, min, err;
struct hd_driveid ubd_id = {
.cyls = 0,
.heads = 128,
.sectors = 32,
};
if(!inode) return(-EINVAL);
min = minor(inode->i_rdev);
......
......@@ -61,12 +61,9 @@ struct line {
struct lines {
int num;
int refcount;
};
#define LINES_INIT(n) \
{ num : n, \
refcount : 0 }
#define LINES_INIT(n) { num : n }
extern void line_interrupt(int irq, void *data, struct pt_regs *unused);
extern void line_write_interrupt(int irq, void *data, struct pt_regs *unused);
......
/*
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#ifndef __TEMPFILE_H__
#define __TEMPFILE_H__
extern int make_tempfile(const char *template, char **tempname, int do_unlink);
#endif
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
......@@ -48,32 +48,21 @@ extern unsigned long brk_start;
extern int pty_output_sigio;
extern int pty_close_sigio;
extern void *open_maps(void);
extern void close_maps(void *fd);
extern unsigned long get_brk(void);
extern void stop(void);
extern int proc_start_thread(unsigned long ip, unsigned long sp);
extern void stack_protections(unsigned long address);
extern void task_protections(unsigned long address);
extern void abandon_proc_space(int (*proc)(void *), unsigned long sp);
extern int signals(int (*init_proc)(void *), void *sp);
extern int __personality(int);
extern int wait_for_stop(int pid, int sig, int cont_type, void *relay);
extern void *add_signal_handler(int sig, void (*handler)(int));
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 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);
extern int linux_main(int argc, char **argv);
extern void remap_data(void *segment_start, void *segment_end, int w);
extern void set_cmdline(char *cmd);
extern void input_cb(void (*proc)(void *), void *arg, int arg_len);
extern void setup_input(void);
extern int get_pty(void);
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);
......@@ -82,15 +71,11 @@ extern void setup_hostinfo(void);
extern void add_arg(char *cmd_line, char *arg);
extern void init_new_thread(void *sig_stack, void (*usr1_handler)(int));
extern void attach_process(int pid);
extern void calc_sigframe_size(void);
extern int fork_tramp(void *sig_stack);
extern void do_exec(int old_pid, int new_pid);
extern void tracer_panic(char *msg, ...);
extern void close_fd(int);
extern int make_tempfile(const char *template, char **tempname, int do_unlink);
extern char *get_umid(int only_if_set);
extern void do_longjmp(void *p);
extern void term_handler(int sig);
extern void suspend_new_thread(int fd);
extern int detach(int pid, int sig);
extern int attach(int pid);
......@@ -99,12 +84,9 @@ extern int cont(int pid);
extern void check_ptrace(void);
extern void check_sigio(void);
extern int run_kernel_thread(int (*fn)(void *), void *arg, void **jmp_ptr);
extern int user_read(int fd, char *buf, int len);
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 unsigned long pid_pc(int pid);
extern int arch_fixup(unsigned long address, void *sc_ptr);
extern void forward_pending_sigio(int target);
......
......@@ -3,9 +3,9 @@ EXTRA_TARGETS := unmap_fin.o
obj-y = config.o exec_kern.o exec_user.o exitcode.o frame_kern.o frame.o \
helper.o init_task.o irq.o irq_user.o ksyms.o mem.o mem_user.o \
process.o process_kern.o ptrace.o reboot.o resource.o setup.o \
sigio_user.o sigio_kern.o signal_kern.o signal_user.o smp.o \
syscall_kern.o syscall_user.o sysrq.o sys_call_table.o time.o \
process.o process_kern.o ptrace.o reboot.o resource.o sigio_user.o \
sigio_kern.o signal_kern.o signal_user.o smp.o syscall_kern.o \
syscall_user.o sysrq.o sys_call_table.o tempfile.o time.o \
time_kern.o tlb.o trap_kern.o trap_user.o uaccess_user.o um_arch.o \
umid.o user_util.o
......@@ -14,8 +14,8 @@ obj-$(CONFIG_BLK_DEV_INITRD) += initrd_kern.o initrd_user.o
# user_syms.o not included here because Rules.make has its own ideas about
# building anything in export-objs
USER_OBJS := $(filter %_user.o,$(obj-y)) config.o frame.o helper.o process.o \
time.o tty_log.o umid.o user_util.o user_syms.o
USER_OBJS := $(filter %_user.o,$(obj-y)) config.o helper.o process.o \
tempfile.o time.o tty_log.o umid.o user_util.o user_syms.o
USER_OBJS := $(foreach file,$(USER_OBJS),arch/um/kernel/$(file))
export-objs := ksyms.o process_kern.o signal_kern.o gprof_syms.o gmon_syms.o
......@@ -51,6 +51,9 @@ arch/um/kernel/unmap.o: arch/um/kernel/unmap.c
arch/um/kernel/unmap_fin.o : arch/um/kernel/unmap.o
ld -r -o $@ $< -lc -L/usr/lib
arch/um/kernel/frame.o: arch/um/kernel/frame.c
$(CC) $(CFLAGS_$(notdir $@)) -c -o $@ $<
QUOTE = 'my $$config=`cat $(TOPDIR)/.config`; $$config =~ s/"/\\"/g ; while(<STDIN>) { $$_ =~ s/CONFIG/$$config/; print $$_ }'
arch/um/kernel/config.c : arch/um/kernel/config.c.in $(TOPDIR)/.config
......
......@@ -20,6 +20,7 @@ EXPORT_SYMBOL(__const_udelay);
EXPORT_SYMBOL(sys_waitpid);
EXPORT_SYMBOL(task_size);
EXPORT_SYMBOL(__do_copy_from_user);
EXPORT_SYMBOL(__do_copy_to_user);
EXPORT_SYMBOL(__do_strncpy_from_user);
EXPORT_SYMBOL(__do_strnlen_user);
EXPORT_SYMBOL(flush_tlb_range);
......
......@@ -229,7 +229,7 @@ void *switch_to(void *prev, void *next, void *last)
set_current(to);
reading = 0;
err = user_write(to->thread.switch_pipe[1], &c, sizeof(c));
err = os_write_file(to->thread.switch_pipe[1], &c, sizeof(c));
if(err != sizeof(c))
panic("write of switch_pipe failed, errno = %d", -err);
......@@ -237,7 +237,7 @@ void *switch_to(void *prev, void *next, void *last)
if((from->state == TASK_ZOMBIE) || (from->state == TASK_DEAD))
os_kill_process(os_getpid());
err = user_read(from->thread.switch_pipe[0], &c, sizeof(c));
err = os_read_file(from->thread.switch_pipe[0], &c, sizeof(c));
if(err != sizeof(c))
panic("read of switch_pipe failed, errno = %d", -err);
......
......@@ -57,7 +57,7 @@ int change_sig(int signal, int on)
sigemptyset(&sigset);
sigaddset(&sigset, signal);
sigprocmask(on ? SIG_UNBLOCK : SIG_BLOCK, &sigset, &old);
return(sigismember(&old, signal));
return(!sigismember(&old, signal));
}
static void change_signals(int type)
......
/*
* Copyright (C) 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <sys/param.h>
#include "init.h"
char *tempdir = NULL;
static void __init find_tempdir(void)
{
char *dirs[] = { "TMP", "TEMP", "TMPDIR", NULL };
int i;
char *dir = NULL;
if(tempdir != NULL) return; /* We've already been called */
for(i = 0; dirs[i]; i++){
dir = getenv(dirs[i]);
if(dir != NULL) break;
}
if(dir == NULL) dir = "/tmp";
else if(*dir == '\0') dir = NULL;
if(dir != NULL) {
tempdir = malloc(strlen(dir) + 2);
if(tempdir == NULL){
fprintf(stderr, "Failed to malloc tempdir, "
"errno = %d\n", errno);
return;
}
strcpy(tempdir, dir);
strcat(tempdir, "/");
}
}
int make_tempfile(const char *template, char **out_tempname, int do_unlink)
{
char tempname[MAXPATHLEN];
int fd;
find_tempdir();
if (*template != '/')
strcpy(tempname, tempdir);
else
*tempname = 0;
strcat(tempname, template);
if((fd = mkstemp(tempname)) < 0){
fprintf(stderr, "open - cannot create %s: %s\n", tempname,
strerror(errno));
return -1;
}
if(do_unlink && (unlink(tempname) < 0)){
perror("unlink");
return -1;
}
if(out_tempname){
if((*out_tempname = strdup(tempname)) == NULL){
perror("strdup");
return -1;
}
}
return(fd);
}
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
* adjust the settings for this buffer only. This must remain at the end
* of the file.
* ---------------------------------------------------------------------------
* Local variables:
* c-file-style: "linux"
* End:
*/
......@@ -86,6 +86,7 @@ long um_stime(int * tptr)
return 0;
}
/* XXX Needs to be moved under sys-i386 */
void __delay(um_udelay_t time)
{
/* Stolen from the i386 __loop_delay */
......
......@@ -99,6 +99,7 @@ static int signal_tramp(void *arg)
static void last_ditch_exit(int sig)
{
kmalloc_ok = 0;
signal(SIGINT, SIG_DFL);
signal(SIGTERM, SIG_DFL);
signal(SIGHUP, SIG_DFL);
......@@ -188,7 +189,7 @@ int signals(int (*init_proc)(void *), void *sp)
signal(SIGPIPE, SIG_IGN);
setup_tracer_winch();
tracing_pid = os_getpid();
printk("tracing thread pid = %d\n", tracing_pid);
printf("tracing thread pid = %d\n", tracing_pid);
pid = clone(signal_tramp, sp, CLONE_FILES | SIGCHLD, init_proc);
n = waitpid(pid, &status, WUNTRACED);
......@@ -207,7 +208,7 @@ int signals(int (*init_proc)(void *), void *sp)
set_handler(SIGTERM, last_ditch_exit, SA_ONESHOT | SA_NODEFER, -1);
set_handler(SIGHUP, last_ditch_exit, SA_ONESHOT | SA_NODEFER, -1);
if(debug_trace){
printk("Tracing thread pausing to be attached\n");
printf("Tracing thread pausing to be attached\n");
stop();
}
if(debug){
......@@ -219,14 +220,14 @@ int signals(int (*init_proc)(void *), void *sp)
init_parent_proxy(debugger_parent);
err = attach(debugger_parent);
if(err){
printk("Failed to attach debugger parent %d, "
printf("Failed to attach debugger parent %d, "
"errno = %d\n", debugger_parent, err);
debugger_parent = -1;
}
else {
if(ptrace(PTRACE_SYSCALL, debugger_parent,
0, 0) < 0){
printk("Failed to continue debugger "
printf("Failed to continue debugger "
"parent, errno = %d\n", errno);
debugger_parent = -1;
}
......@@ -237,7 +238,7 @@ int signals(int (*init_proc)(void *), void *sp)
while(1){
if((pid = waitpid(-1, &status, WUNTRACED)) <= 0){
if(errno != ECHILD){
printk("wait failed - errno = %d\n", errno);
printf("wait failed - errno = %d\n", errno);
}
continue;
}
......@@ -314,7 +315,7 @@ int signals(int (*init_proc)(void *), void *sp)
ptrace(PTRACE_KILL, pid, 0, 0);
return(op == OP_REBOOT);
case OP_NONE:
printk("Detaching pid %d\n", pid);
printf("Detaching pid %d\n", pid);
detach(pid, SIGSTOP);
continue;
default:
......
......@@ -104,7 +104,7 @@ static int __init set_tty_log_fd(char *name, int *add)
tty_log_fd = strtoul(name, &end, 0);
if(*end != '\0'){
printk("set_tty_log_dir - strtoul failed on '%s'\n", name);
printk("set_tty_log_fd - strtoul failed on '%s'\n", name);
tty_log_fd = -1;
}
return 0;
......
......@@ -316,11 +316,12 @@ int linux_main(int argc, char **argv)
end_vm = start_vm + virtmem_size;
if(virtmem_size < physmem_size)
printk(KERN_INFO "Kernel virtual memory size shrunk to %ld "
"bytes\n", virtmem_size);
printf("Kernel virtual memory size shrunk to %ld bytes\n",
virtmem_size);
err = reserve_vm(high_physmem, end_vm, &kernel_vm_reserved);
if(err) panic("Failed to reserve VM area for kernel VM\n");
if(err)
tracer_panic("Failed to reserve VM area for kernel VM\n");
uml_postsetup();
......
/*
* Copyright (C) 2000, 2001 Jeff Dike (jdike@karaya.com)
* Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
......@@ -184,85 +184,6 @@ void setup_hostinfo(void)
host.release, host.version, host.machine);
}
void close_fd(int fd)
{
close(fd);
}
char *tempdir = NULL;
static void __init find_tempdir(void)
{
char *dirs[] = { "TMP", "TEMP", "TMPDIR", NULL };
int i;
char *dir = NULL;
if(tempdir != NULL) return; /* We've already been called */
for(i = 0; dirs[i]; i++){
dir = getenv(dirs[i]);
if(dir != NULL) break;
}
if(dir == NULL) dir = "/tmp";
else if(*dir == '\0') dir = NULL;
if(dir != NULL) {
tempdir = malloc(strlen(dir) + 2);
if(tempdir == NULL){
fprintf(stderr, "Failed to malloc tempdir, "
"errno = %d\n", errno);
return;
}
strcpy(tempdir, dir);
strcat(tempdir, "/");
}
}
int make_tempfile(const char *template, char **out_tempname, int do_unlink)
{
char tempname[MAXPATHLEN];
int fd;
find_tempdir();
if (*template != '/')
strcpy(tempname, tempdir);
else
*tempname = 0;
strcat(tempname, template);
if((fd = mkstemp(tempname)) < 0){
fprintf(stderr, "open - cannot create %s: %s\n", tempname,
strerror(errno));
return -1;
}
if(do_unlink && (unlink(tempname) < 0)){
perror("unlink");
return -1;
}
if(out_tempname){
if((*out_tempname = strdup(tempname)) == NULL){
perror("strdup");
return -1;
}
}
return(fd);
}
int user_read(int fd, char *buf, int len)
{
int err;
err = read(fd, buf, len);
if(err < 0) return(-errno);
else return(err);
}
int user_write(int fd, char *buf, int len)
{
int err;
err = write(fd, buf, len);
if(err < 0) return(-errno);
else return(err);
}
/*
* Overrides for Emacs so that we follow Linus's tabbing style.
* Emacs will notice this stuff at the end of the file and automatically
......
......@@ -30,6 +30,7 @@ Jeff Dike (jdike@karaya.com) : Modified for integration into uml
#include "user_util.h"
#include "user.h"
#include "os.h"
#include "tempfile.h"
static int debugger_wait(debugger_state *debugger, int *status, int options,
int (*syscall)(debugger_state *debugger, pid_t child),
......
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