Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1422774AbXBAKOi (ORCPT ); Thu, 1 Feb 2007 05:14:38 -0500 Received: (majordomo@vger.kernel.org) by vger.kernel.org id S1422749AbXBAKOh (ORCPT ); Thu, 1 Feb 2007 05:14:37 -0500 Received: from netgear.net.ru ([195.178.208.66]:58561 "EHLO tservice.net.ru" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1422760AbXBAKMy convert rfc822-to-8bit (ORCPT ); Thu, 1 Feb 2007 05:12:54 -0500 Cc: David Miller , Ulrich Drepper , Andrew Morton , Evgeniy Polyakov , netdev , Zach Brown , Christoph Hellwig , Chase Venters , Johann Borck , linux-kernel@vger.kernel.org, Jeff Garzik , Jamal Hadi Salim , Ingo Molnar Subject: [take35 9/10] kevent: Private userspace notifications. In-Reply-To: <1170324754194@2ka.mipt.ru> X-Mailer: gregkh_patchbomb Date: Thu, 1 Feb 2007 13:12:34 +0300 Message-Id: <11703247541476@2ka.mipt.ru> Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Reply-To: Evgeniy Polyakov To: Evgeniy Polyakov Content-Transfer-Encoding: 7BIT From: Evgeniy Polyakov Sender: linux-kernel-owner@vger.kernel.org X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2317 Lines: 83 Private userspace notifications. Allows to register notifications of any private userspace events over kevent. Events can be marked as ready using kevent_ctl(KEVENT_READY) command. Signed-off-by: Evgeniy Polyakov diff --git a/kernel/kevent/kevent_unotify.c b/kernel/kevent/kevent_unotify.c new file mode 100644 index 0000000..618c09c --- /dev/null +++ b/kernel/kevent/kevent_unotify.c @@ -0,0 +1,62 @@ +/* + * 2006 Copyright (c) Evgeniy Polyakov + * All rights reserved. + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation; either version 2 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + +#include +#include + +static int kevent_unotify_callback(struct kevent *k) +{ + return 1; +} + +int kevent_unotify_enqueue(struct kevent *k) +{ + int err; + + err = kevent_storage_enqueue(&k->user->st, k); + if (err) + goto err_out_exit; + + if (k->event.req_flags & KEVENT_REQ_ALWAYS_QUEUE) + kevent_requeue(k); + + return 0; + +err_out_exit: + return err; +} + +int kevent_unotify_dequeue(struct kevent *k) +{ + kevent_storage_dequeue(k->st, k); + return 0; +} + +static int __init kevent_init_unotify(void) +{ + struct kevent_callbacks sc = { + .callback = &kevent_unotify_callback, + .enqueue = &kevent_unotify_enqueue, + .dequeue = &kevent_unotify_dequeue, + .flags = 0, + }; + + return kevent_add_callbacks(&sc, KEVENT_UNOTIFY); +} +module_init(kevent_init_unotify); - To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/