Commit 26ac8e19 authored by Linus Torvalds's avatar Linus Torvalds

Merge

parents 9ec5ff60 2167ac84
......@@ -117,7 +117,6 @@ archclean: sysclean
archdep:
for d in $(ARCH_SUBDIRS); do $(MAKE) -C $$d fastdep; done
@$(MAKEBOOT) dep
$(SYMLINK_HEADERS):
cd $(TOPDIR)/$(dir $@) ; \
......
......@@ -31,7 +31,7 @@ void *fd_init(char *str, int device, struct chan_opts *opts)
}
str++;
n = strtoul(str, &end, 0);
if(*end != '\0'){
if((*end != '\0') || (end == str)){
printk("fd_init : couldn't parse file descriptor '%s'\n", str);
return(NULL);
}
......
......@@ -92,7 +92,7 @@ int mcast_setup(char *str, char **mac_out, void *data)
if(port_str != NULL){
n = simple_strtoul(port_str, &last, 10);
if(*last != '\0'){
if((*last != '\0') || (last == port_str)){
printk(KERN_ERR "mcast_setup - Bad port : '%s'\n",
port_str);
return(0);
......@@ -102,7 +102,7 @@ int mcast_setup(char *str, char **mac_out, void *data)
if(ttl_str != NULL){
init->ttl = simple_strtoul(ttl_str, &last, 10);
if(*last != '\0'){
if((*last != '\0') || (last == ttl_str)){
printk(KERN_ERR "mcast_setup - Bad ttl : '%s'\n",
ttl_str);
return(0);
......
......@@ -32,8 +32,8 @@ struct port_list {
struct port_dev {
struct port_list *port;
int fd;
int helper_pid;
int telnetd_pid;
int helper_pid;
int telnetd_pid;
};
struct connection {
......@@ -50,7 +50,7 @@ static void pipe_interrupt(int irq, void *data, struct pt_regs *regs)
struct connection *conn = data;
int fd;
fd = os_rcv_fd(conn->socket[0], &conn->helper_pid);
fd = os_rcv_fd(conn->socket[0], &conn->helper_pid);
if(fd < 0){
if(fd == -EAGAIN)
return;
......@@ -190,9 +190,9 @@ void *port_data(int port_num)
goto out;
}
*dev = ((struct port_dev) { port : port,
fd : -1,
helper_pid : -1 });
*dev = ((struct port_dev) { port : port,
fd : -1,
helper_pid : -1 });
goto out;
out_free:
......
......@@ -42,7 +42,7 @@ void *port_init(char *str, int device, struct chan_opts *opts)
}
str++;
port = strtoul(str, &end, 0);
if(*end != '\0'){
if((*end != '\0') || (end == str)){
printk("port_init : couldn't parse port '%s'\n", str);
return(NULL);
}
......@@ -134,42 +134,6 @@ int port_listen_fd(int port)
return(err);
}
int port_rcv_fd(int fd)
{
int new, n;
char buf[CMSG_SPACE(sizeof(new))];
struct msghdr msg;
struct cmsghdr *cmsg;
msg.msg_name = NULL;
msg.msg_namelen = 0;
msg.msg_iov = NULL;
msg.msg_iovlen = 0;
msg.msg_control = buf;
msg.msg_controllen = sizeof(buf);
msg.msg_flags = 0;
n = recvmsg(fd, &msg, 0);
if(n < 0){
printk("rcv_fd : recvmsg failed - errno = %d\n", errno);
return(-1);
}
cmsg = CMSG_FIRSTHDR(&msg);
if(cmsg == NULL){
printk("rcv_fd didn't receive anything, error = %d\n", errno);
return(-1);
}
if((cmsg->cmsg_level != SOL_SOCKET) ||
(cmsg->cmsg_type != SCM_RIGHTS)){
printk("rcv_fd didn't receive a descriptor\n");
return(-1);
}
new = ((int *) CMSG_DATA(cmsg))[0];
return(new);
}
struct port_pre_exec_data {
int sock_fd;
int pipe_fd;
......
......@@ -218,7 +218,7 @@ static int ubd_setup_common(char *str, int *index_out)
return(0);
}
major = simple_strtoul(str, &end, 0);
if(*end != '\0'){
if((*end != '\0') || (end == str)){
printk(KERN_ERR
"ubd_setup : didn't parse major number\n");
return(1);
......@@ -520,7 +520,10 @@ static int ubd_add(int n)
struct ubd *dev = &ubd_dev[n];
int err;
if (!dev->file || dev->is_dir)
if(dev->is_dir)
return(-EISDIR);
if (!dev->file)
return(-ENODEV);
if (ubd_open_dev(dev))
......@@ -621,7 +624,7 @@ static int ubd_remove(char *str)
return(err); /* it should be a number 0-7/a-h */
n = *str - '0';
if(n > MAX_DEV)
if(n >= MAX_DEV)
return(err);
dev = &ubd_dev[n];
......
......@@ -473,6 +473,8 @@ void do_io(struct io_thread_req *req)
&req->sector_mask) == bit))
end++;
if(end != nsectors)
printk("end != nsectors\n");
off = req->offset + req->offsets[bit] +
start * req->sectorsize;
len = (end - start) * req->sectorsize;
......
......@@ -93,6 +93,9 @@ int xterm_open(int input, int output, int primary, void *d, char **dev_out)
"/usr/lib/uml/port-helper", "-uml-socket",
file, NULL };
if(access(argv[4], X_OK))
argv[4] = "port-helper";
fd = mkstemp(file);
if(fd < 0){
printk("xterm_open : mkstemp failed, errno = %d\n", errno);
......
......@@ -22,11 +22,13 @@ struct xterm_wait {
static void xterm_interrupt(int irq, void *data, struct pt_regs *regs)
{
struct xterm_wait *xterm = data;
int fd;
xterm->new_fd = os_rcv_fd(xterm->fd, &xterm->pid);
if(xterm->new_fd == -EAGAIN)
fd = os_rcv_fd(xterm->fd, &xterm->pid);
if(fd == -EAGAIN)
return;
xterm->new_fd = fd;
up(&xterm->sem);
}
......
......@@ -42,7 +42,7 @@ static int write_proc_exitcode(struct file *file, const char *buffer,
return(count);
}
int make_proc_exitcode(void)
static int make_proc_exitcode(void)
{
struct proc_dir_entry *ent;
......
......@@ -89,7 +89,10 @@ int run_helper(void (*pre_exec)(void *), void *pre_data, char **argv,
errno);
return(-errno);
}
else if(n != 0) pid = -err;
else if(n != 0){
waitpid(pid, NULL, 0);
pid = -err;
}
if(stack_out == NULL) free_stack(stack, 0);
else *stack_out = stack;
......
......@@ -188,7 +188,8 @@ int activate_fd(int irq, int fd, int type, void *dev_id)
pollfds_size++;
}
if(type == IRQ_WRITE) events = 0;
if(type == IRQ_WRITE)
fd = -1;
pollfds[pollfds_num] = ((struct pollfd) { fd : fd,
events : events,
......@@ -337,6 +338,7 @@ void reactivate_fd(int fd, int irqnum)
irq_unlock(flags);
return;
}
pollfds[i].fd = irq->fd;
irq_unlock(flags);
......
/*
* Copyright (C) 2000, 2002 Jeff Dike (jdike@karaya.com)
* Licensed under the GPL
*/
#include "asm/processor.h"
struct cpuinfo_um boot_cpu_data = { loops_per_jiffy : 0,
ipi_pipe : { -1, -1 } };
/*
* 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:
*/
......@@ -11,7 +11,8 @@
#include <sys/param.h>
#include "init.h"
char *tempdir = NULL;
/* Modified from create_mem_file and start_debugger */
static char *tempdir = NULL;
static void __init find_tempdir(void)
{
......
......@@ -103,7 +103,7 @@ static int __init set_tty_log_fd(char *name, int *add)
char *end;
tty_log_fd = strtoul(name, &end, 0);
if(*end != '\0'){
if((*end != '\0') || (end == name)){
printk("set_tty_log_fd - strtoul failed on '%s'\n", name);
tty_log_fd = -1;
}
......
......@@ -171,7 +171,8 @@ int os_pipe(int *fds, int stream, int close_on_exec)
int err, type = stream ? SOCK_STREAM : SOCK_DGRAM;
err = socketpair(AF_UNIX, type, 0, fds);
if(err) return(-errno);
if(err)
return(-errno);
if(!close_on_exec)
return(0);
......@@ -185,6 +186,7 @@ int os_pipe(int *fds, int stream, int close_on_exec)
int os_set_fd_async(int fd, int owner)
{
/* XXX This should do F_GETFL first */
if(fcntl(fd, F_SETFL, O_ASYNC | O_NONBLOCK) < 0){
printk("os_set_fd_async : failed to set O_ASYNC and "
"O_NONBLOCK on fd # %d, errno = %d\n", fd, errno);
......
......@@ -17,6 +17,7 @@
extern void *switch_to(void *prev, void *next, void *last);
extern int get_signals(void);
extern int set_signals(int enable);
extern int get_signals(void);
extern void block_signals(void);
......
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