# This fixes the interface of make_pipe, which doesn't need to initialize # filehandles. Instead, it is just a wrapper around pipe which just reclaims # descriptors if the initial call to pipe failes with -EMFILE. Index: linux-2.6.17/arch/um/include/filehandle.h =================================================================== --- linux-2.6.17.orig/arch/um/include/filehandle.h 2007-11-19 10:52:01.000000000 -0500 +++ linux-2.6.17/arch/um/include/filehandle.h 2007-11-19 10:56:20.000000000 -0500 @@ -36,6 +36,6 @@ extern void not_reclaimable(struct file_ extern void is_reclaimable(struct file_handle *fh, char *(name_proc)(void *), void *arg); extern int filehandle_fd(struct file_handle *fh); -extern int make_pipe(struct file_handle *fhs); +extern int make_pipe(int *fds); #endif Index: linux-2.6.17/arch/um/kernel/filehandle.c =================================================================== --- linux-2.6.17.orig/arch/um/kernel/filehandle.c 2007-11-19 10:52:01.000000000 -0500 +++ linux-2.6.17/arch/um/kernel/filehandle.c 2007-11-19 10:56:20.000000000 -0500 @@ -99,6 +99,8 @@ void is_reclaimable(struct file_handle * fh->get_name = name_proc; fh->arg = arg; + if(!list_empty(&fh->list)) + panic("filehandle reclaimable twice"); spin_lock(&open_files_lock); list_add(&fh->list, &open_files); spin_unlock(&open_files_lock); @@ -234,9 +236,9 @@ int truncate_file(struct file_handle *fh return os_truncate_fd(fh->fd, size); } -int make_pipe(struct file_handle *fhs) +int make_pipe(int *fds) { - int fds[2], err; + int err; err = os_pipe(fds, 1, 1); if(err && (err != -EMFILE)) @@ -246,10 +248,6 @@ int make_pipe(struct file_handle *fhs) reclaim_fds(); err = os_pipe(fds, 1, 1); } - if(err) - return err; - init_filehandle(&fhs[0], fds[0], OPENFLAGS()); - init_filehandle(&fhs[1], fds[1], OPENFLAGS()); - return 0; + return err; }