error = -EMFILE;
if (newfd >= current->rlim[RLIMIT_NOFILE].rlim_cur)
goto out;
+ if (!vx_files_avail(1))
+ goto out;
error = expand_files(files, newfd);
if (error < 0)
return error;
}
-static int dupfd(struct file *file, unsigned int start)
+int dupfd(struct file *file, unsigned int start)
{
struct files_struct * files = current->files;
int fd;
FD_SET(fd, files->open_fds);
FD_CLR(fd, files->close_on_exec);
spin_unlock(&files->file_lock);
+ vx_openfd_inc(fd);
fd_install(fd, file);
} else {
spin_unlock(&files->file_lock);
return fd;
}
+EXPORT_SYMBOL_GPL(dupfd);
+
asmlinkage long sys_dup2(unsigned int oldfd, unsigned int newfd)
{
int err = -EBADF;
FD_SET(newfd, files->open_fds);
FD_CLR(newfd, files->close_on_exec);
spin_unlock(&files->file_lock);
+ vx_openfd_inc(newfd);
if (tofree)
filp_close(tofree, files);
read_unlock(&fasync_lock);
}
}
-
EXPORT_SYMBOL(kill_fasync);
static int __init fasync_init(void)
{
fasync_cache = kmem_cache_create("fasync_cache",
- sizeof(struct fasync_struct), 0, 0, NULL, NULL);
- if (!fasync_cache)
- panic("cannot create fasync slab cache");
+ sizeof(struct fasync_struct), 0, SLAB_PANIC, NULL, NULL);
return 0;
}