From owner-freebsd-hackers Mon Oct 21 8: 0:33 2002 Delivered-To: freebsd-hackers@freebsd.org Received: from mx1.FreeBSD.org (mx1.freebsd.org [216.136.204.125]) by hub.freebsd.org (Postfix) with ESMTP id 0248F37B401 for ; Mon, 21 Oct 2002 08:00:32 -0700 (PDT) Received: from milla.ask33.net (milla.ask33.net [217.197.166.60]) by mx1.FreeBSD.org (Postfix) with ESMTP id 7C8E243E65 for ; Mon, 21 Oct 2002 08:00:31 -0700 (PDT) (envelope-from nick@milla.ask33.net) Received: by milla.ask33.net (Postfix, from userid 1001) id D682C3ABB06; Mon, 21 Oct 2002 17:03:16 +0200 (CEST) Date: Mon, 21 Oct 2002 17:03:16 +0200 From: Pawel Jakub Dawidek To: freebsd-hackers@freebsd.org Subject: SMP and race conditions. Message-ID: <20021021150316.GT80034@garage.freebsd.pl> Mime-Version: 1.0 Content-Type: multipart/signed; micalg=pgp-md5; protocol="application/pgp-signature"; boundary="8+odlFQADydc3R4z" Content-Disposition: inline X-PGP-Key-URL: http://garage.freebsd.pl/jules.asc X-OS: FreeBSD 4.6-STABLE i386 User-Agent: Mutt/1.5.1i Sender: owner-freebsd-hackers@FreeBSD.ORG Precedence: bulk List-ID: List-Archive: (Web Archive) List-Help: (List Instructions) List-Subscribe: List-Unsubscribe: X-Loop: FreeBSD.ORG --8+odlFQADydc3R4z Content-Type: text/plain; charset=iso-8859-2 Content-Disposition: inline Content-Transfer-Encoding: quoted-printable Hello hackers... We got for example a kld module and we have catched some syscall. Now we want to change effective uid of process, but not curproc. How to lock this process? struct proc *proc; uid_t olduid; [...] if ((proc =3D pfind(123)) =3D=3D NULL) return (ESRCH); olduid =3D pc->pc_ucred->cr_uid; change_euid(proc, 0); /* now some simple action */ change_euid(proc, olduid); How to be sure that process 'proc' arn't running on other CPU? Function lockmgr() is used for problems like this one? Where I could find some more information about it? For now I've wrote only comments in /sys/sys/lock.h, etc. There are any papers about programming in SMP? --=20 Pawel Jakub Dawidek UNIX Systems Administrator http://garage.freebsd.pl Am I Evil? Yes, I Am. --8+odlFQADydc3R4z Content-Type: application/pgp-signature Content-Disposition: inline -----BEGIN PGP SIGNATURE----- Version: GnuPG v1.0.7 (FreeBSD) iQCVAwUBPbQXND/PhmMH/Mf1AQEbfgP/TByep1661N/MZAI8/c3cFNwra7Q/ymP8 v0nNZTgx2rOzmb0nQbR2PSjQt8sHOqaIScb0OZdi+6qyCnRxYkCeTNw7HDeU7IM3 YmSmLtSZ0Kc+ye5GICXCySwcFTk6PqHZNVGKEPIyWb1r94pwuvuQsOz7ongPS4Gv mupFuR/IR9s= =VnHw -----END PGP SIGNATURE----- --8+odlFQADydc3R4z-- To Unsubscribe: send mail to majordomo@FreeBSD.org with "unsubscribe freebsd-hackers" in the body of the message