From owner-p4-projects@FreeBSD.ORG Sun Sep 2 17:01:56 2007 Return-Path: Delivered-To: p4-projects@freebsd.org Received: by hub.freebsd.org (Postfix, from userid 32767) id A557E16A419; Sun, 2 Sep 2007 17:01:56 +0000 (UTC) Delivered-To: perforce@FreeBSD.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 575E216A417 for ; Sun, 2 Sep 2007 17:01:56 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (repoman.freebsd.org [IPv6:2001:4f8:fff6::29]) by mx1.freebsd.org (Postfix) with ESMTP id 6131613C469 for ; Sun, 2 Sep 2007 17:01:56 +0000 (UTC) (envelope-from rdivacky@FreeBSD.org) Received: from repoman.freebsd.org (localhost [127.0.0.1]) by repoman.freebsd.org (8.14.1/8.14.1) with ESMTP id l82H1uVC033226 for ; Sun, 2 Sep 2007 17:01:56 GMT (envelope-from rdivacky@FreeBSD.org) Received: (from perforce@localhost) by repoman.freebsd.org (8.14.1/8.14.1/Submit) id l82H1uXT033223 for perforce@freebsd.org; Sun, 2 Sep 2007 17:01:56 GMT (envelope-from rdivacky@FreeBSD.org) Date: Sun, 2 Sep 2007 17:01:56 GMT Message-Id: <200709021701.l82H1uXT033223@repoman.freebsd.org> X-Authentication-Warning: repoman.freebsd.org: perforce set sender to rdivacky@FreeBSD.org using -f From: Roman Divacky To: Perforce Change Reviews Cc: Subject: PERFORCE change 125976 for review X-BeenThere: p4-projects@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: p4 projects tree changes List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 02 Sep 2007 17:01:57 -0000 http://perforce.freebsd.org/chv.cgi?CH=125976 Change 125976 by rdivacky@rdivacky_witten on 2007/09/02 17:00:56 Implement F_SETSIG. This is for sockets only now. The LINUX_F_SETSIG will be moved to linux_file.h once this is created with *at patch import. This enables user-mode linux to mount rootfs. Tested by: "Yuriy Tsibizov" Affected files ... .. //depot/projects/soc2007/rdivacky/linux_fixes/sys/compat/linux/linux_file.c#2 edit .. //depot/projects/soc2007/rdivacky/linux_fixes/sys/kern/kern_descrip.c#3 edit .. //depot/projects/soc2007/rdivacky/linux_fixes/sys/kern/kern_sig.c#2 edit .. //depot/projects/soc2007/rdivacky/linux_fixes/sys/sys/sigio.h#2 edit Differences ... ==== //depot/projects/soc2007/rdivacky/linux_fixes/sys/compat/linux/linux_file.c#2 (text+ko) ==== @@ -47,6 +47,7 @@ #include #include #include +#include #include #include #include @@ -1131,8 +1132,29 @@ struct file *fp; long arg; int error, result; + struct socket *so; switch (args->cmd) { +#define LINUX_F_SETSIG 10 + case LINUX_F_SETSIG: + error = fget(td, args->fd, &fp); + if (error) + return (error); + /* XXX: should be extended for non-socket files too */ + if (fp->f_type == DTYPE_SOCKET) { + so = (struct socket *)fp->f_data; + if (so->so_sigio == NULL) { + error = fsetown(td->td_proc->p_pid, &so->so_sigio); + if (error) { + fdrop(fp, td); + return (error); + } + } + so->so_sigio->sig = args->arg; + } + error = EINVAL; + fdrop(fp, td); + return (error); case LINUX_F_DUPFD: return (kern_fcntl(td, args->fd, F_DUPFD, args->arg)); ==== //depot/projects/soc2007/rdivacky/linux_fixes/sys/kern/kern_descrip.c#3 (text+ko) ==== @@ -891,6 +891,7 @@ sigio->sio_pgid = pgid; sigio->sio_ucred = crhold(curthread->td_ucred); sigio->sio_myref = sigiop; + sigio->sig = 0; sx_slock(&proctree_lock); if (pgid > 0) { ==== //depot/projects/soc2007/rdivacky/linux_fixes/sys/kern/kern_sig.c#2 (text+ko) ==== @@ -3187,6 +3187,9 @@ SIGIO_UNLOCK(); return; } + if (sigio->sig != 0) + sig = sigio->sig; + if (sigio->sio_pgid > 0) { PROC_LOCK(sigio->sio_proc); if (CANSIGIO(sigio->sio_ucred, sigio->sio_proc->p_ucred)) ==== //depot/projects/soc2007/rdivacky/linux_fixes/sys/sys/sigio.h#2 (text+ko) ==== @@ -53,6 +53,7 @@ * the reference to this structure */ struct ucred *sio_ucred; /* (c) current credentials */ pid_t sio_pgid; /* (c) pgid for signals */ + int sig; /* (pg) signal to be sent */ }; #define sio_proc sio_u.siu_proc #define sio_pgrp sio_u.siu_pgrp