From owner-freebsd-questions@FreeBSD.ORG Tue Mar 16 22:12:24 2004 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 8B1EE16A4CE for ; Tue, 16 Mar 2004 22:12:24 -0800 (PST) Received: from pd4mo2so.prod.shaw.ca (shawidc-mo1.cg.shawcable.net [24.71.223.10]) by mx1.FreeBSD.org (Postfix) with ESMTP id 5D23A43D2D for ; Tue, 16 Mar 2004 22:12:24 -0800 (PST) (envelope-from timmssimon@shaw.ca) Received: from pd2mr4so.prod.shaw.ca (pd2mr4so-ser.prod.shaw.ca [10.0.141.107])2003))freebsd-questions@freebsd.org; Tue, 16 Mar 2004 23:09:57 -0700 (MST) Received: from pn2ml2so.prod.shaw.ca (pn2ml2so-qfe0.prod.shaw.ca [10.0.121.146]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HUP0038FIGL95@l-daemon> for freebsd-questions@freebsd.org; Tue, 16 Mar 2004 23:09:57 -0700 (MST) Received: from simmain ([68.146.53.93]) by l-daemon (iPlanet Messaging Server 5.2 HotFix 1.18 (built Jul 28 2003)) with ESMTP id <0HUP00A6QIFZUR@l-daemon> for freebsd-questions@freebsd.org; Tue, 16 Mar 2004 23:09:57 -0700 (MST) Date: Tue, 16 Mar 2004 23:09:36 -0700 From: Simon Timms To: freebsd-questions@freebsd.org Message-id: <000401c40be6$705c5760$0c00a8c0@simmain> MIME-version: 1.0 X-MIMEOLE: Produced By Microsoft MimeOLE V6.00.2727.1300 X-Mailer: Microsoft Outlook, Build 10.0.2616 Importance: Normal X-Priority: 3 (Normal) X-MSMail-priority: Normal Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7BIT X-Content-Filtered-By: Mailman/MimeDel 2.1.1 Subject: KLD and UID X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.1 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 17 Mar 2004 06:12:24 -0000 Hi there, I am playing around with kernel modules trying to learn something and hopefully not destroy my computer too badly. Right now my goal is to print out the user id from an open() call. I am basing my work around that found at http://www.nux-acid.org/src/open.c. To that basic code I added (in the new_open method) printf("uid %u\n", p->p_ucred->cr_uid); However this completely doesn't work and I end up crashing the kernel. I notice in other places people do things like uid_t uid = p->p_cred->p_svuid; however I don't see a p_cred member in the proc structure. Is there something obvious I am missing here? Complete code listing at http://simon.ma.cx/module.c. Any additional comments/criticisms always appreciated. Thanks, Simon