X-Spam-Check-By: sourceware.org Date: Wed, 21 Jun 2006 11:03:55 +0200 From: Corinna Vinschen To: cygwin AT cygwin DOT com Subject: Re: Problem creating device files Message-ID: <20060621090355.GL29251@calimero.vinschen.de> Reply-To: cygwin AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com References: <0F788535AE8C7D4CB24CADB2A1BA8AF41B1FDE AT server25 DOT nibv DOT neopost DOT com> Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <0F788535AE8C7D4CB24CADB2A1BA8AF41B1FDE@server25.nibv.neopost.com> User-Agent: Mutt/1.4.2i Mailing-List: contact cygwin-help AT cygwin DOT com; run by ezmlm Precedence: bulk List-Unsubscribe: List-Subscribe: List-Archive: List-Post: List-Help: , Sender: cygwin-owner AT cygwin DOT com Mail-Followup-To: cygwin AT cygwin DOT com Delivered-To: mailing list cygwin AT cygwin DOT com On Jun 21 10:47, Nicolas Boudin wrote: > > Hello, > > I get strange results when trying to create device files with this program: > > #include > > int main (void) > { > int major, minor; > dev_t dev; > > major = 5; > minor = 1; > dev = (major << 8) | minor; > > mknod ("test", S_IFCHR | 0666, dev); > > return 0; > } > > After running it, I get: > > # ls -al test > crw-rw-rw- 1 NBoudin mkgroup-l-d 0, 1281 Jun 21 10:44 test > > However, with "mknod test2 c 5 1": > crw-rw-rw- 1 NBoudin mkgroup-l-d 5, 1 Jun 21 10:44 test2 > > Why do I get this result? You are making invalid assumptions. Have a look into /usr/include/cygwin/types.h and /usr/include/sys/sysmacros.h and see the light. After that, make a mental note: "Never create a device number other than by using the makedev macro" Corinna -- Corinna Vinschen Please, send mails regarding Cygwin to Cygwin Project Co-Leader cygwin AT cygwin DOT com Red Hat -- Unsubscribe info: http://cygwin.com/ml/#unsubscribe-simple Problem reports: http://cygwin.com/problems.html Documentation: http://cygwin.com/docs.html FAQ: http://cygwin.com/faq/