| delorie.com/archives/browse.cgi | search |
| X-Spam-Check-By: | sourceware.org |
| Date: | Wed, 21 Jun 2006 11:03:55 +0200 |
| From: | Corinna Vinschen <corinna-cygwin AT cygwin DOT com> |
| 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 |
| 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 |
| List-Unsubscribe: | <mailto:cygwin-unsubscribe-archive-cygwin=delorie DOT com AT cygwin DOT com> |
| List-Subscribe: | <mailto:cygwin-subscribe AT cygwin DOT com> |
| List-Archive: | <http://sourceware.org/ml/cygwin/> |
| List-Post: | <mailto:cygwin AT cygwin DOT com> |
| List-Help: | <mailto:cygwin-help AT cygwin DOT com>, <http://sourceware.org/ml/#faqs> |
| 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 <sys/stat.h>
>
> 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/
| webmaster | delorie software privacy |
| Copyright © 2019 by DJ Delorie | Updated Jul 2019 |