diff options
| author | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 21:23:11 -0400 |
|---|---|---|
| committer | Jeff Garzik <jgarzik@pobox.com> | 2005-10-18 21:23:11 -0400 |
| commit | 4e0e329d9a2011f9f7a7c0a378dc3bff7b0a0283 (patch) | |
| tree | a802614e01460631c694dfa118642d54c3d5fc79 /arch/um/drivers/ubd_user.c | |
| parent | e33b9dfa3008fcaa908dc0c8c472a812c400f839 (diff) | |
| parent | 59a10b172fccaea793352c00fd9065f0a5b4ef70 (diff) | |
| download | linux-4e0e329d9a2011f9f7a7c0a378dc3bff7b0a0283.tar.gz linux-4e0e329d9a2011f9f7a7c0a378dc3bff7b0a0283.tar.bz2 linux-4e0e329d9a2011f9f7a7c0a378dc3bff7b0a0283.zip | |
Merge branch 'upstream'
Diffstat (limited to 'arch/um/drivers/ubd_user.c')
| -rw-r--r-- | arch/um/drivers/ubd_user.c | 75 |
1 files changed, 75 insertions, 0 deletions
diff --git a/arch/um/drivers/ubd_user.c b/arch/um/drivers/ubd_user.c new file mode 100644 index 000000000000..b94d2bc4fe06 --- /dev/null +++ b/arch/um/drivers/ubd_user.c @@ -0,0 +1,75 @@ +/* + * Copyright (C) 2000, 2001, 2002 Jeff Dike (jdike@karaya.com) + * Copyright (C) 2001 Ridgerun,Inc (glonnon@ridgerun.com) + * Licensed under the GPL + */ + +#include <stddef.h> +#include <unistd.h> +#include <errno.h> +#include <sched.h> +#include <signal.h> +#include <string.h> +#include <netinet/in.h> +#include <sys/time.h> +#include <sys/socket.h> +#include <sys/mman.h> +#include <sys/param.h> +#include "asm/types.h" +#include "user_util.h" +#include "kern_util.h" +#include "user.h" +#include "ubd_user.h" +#include "os.h" +#include "cow.h" + +#include <endian.h> +#include <byteswap.h> + +void ignore_sigwinch_sig(void) +{ + signal(SIGWINCH, SIG_IGN); +} + +int start_io_thread(unsigned long sp, int *fd_out) +{ + int pid, fds[2], err; + + err = os_pipe(fds, 1, 1); + if(err < 0){ + printk("start_io_thread - os_pipe failed, err = %d\n", -err); + goto out; + } + + kernel_fd = fds[0]; + *fd_out = fds[1]; + + pid = clone(io_thread, (void *) sp, CLONE_FILES | CLONE_VM | SIGCHLD, + NULL); + if(pid < 0){ + printk("start_io_thread - clone failed : errno = %d\n", errno); + err = -errno; + goto out_close; + } + + return(pid); + + out_close: + os_close_file(fds[0]); + os_close_file(fds[1]); + kernel_fd = -1; + *fd_out = -1; + out: + 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 + * adjust the settings for this buffer only. This must remain at the end + * of the file. + * --------------------------------------------------------------------------- + * Local variables: + * c-file-style: "linux" + * End: + */ |
