www.delorie.com/archives/browse.cgi   search  
Mail Archives: cygwin-developers/1998/11/13/16:48:23

From: noer AT cygnus DOT com (Geoffrey Noer)
Subject: Re: New file `sysmacros.h'
13 Nov 1998 16:48:23 -0800 :
Message-ID: <19981113163832.20735.cygnus.cygwin32.developers@cygnus.com>
References: <364C9A40 DOT C8C14458 AT cityweb DOT de>
Mime-Version: 1.0
To: Corinna Vinschen <corinna DOT vinschen AT cityweb DOT de>
Cc: cygwin32-developers AT cygnus DOT com

> As mentioned in `gnu-win32 AT cygnus DOT com', it's important
> to have defines for `major', `minor' and `makedev' to
> compile the package file-3.XX.
> 
> So it would be nice, to have the file `sys/sysmacros.h'
> in the includes, as in Linux and others.

OK, I'll add it.

> ---- snip ----
> #ifndef _SYS_SYSMACROS_H
> #define _SYS_SYSMACROS_H
> 
> #define major(dev) (((unsigned) (dev))>>8)
> #define minor(dev) ((dev)&0xff)
> #define makedev(major,minor) (((major)<<8)|(minor))
> 
> #endif /* _SYS_SYSMACROS_H */

On question though.  On my linux box, the define for major/minor looks
like:

#define major(dev) ((int)(((dev) >> 8) & 0xff))
#define minor(dev) ((int)((dev) & 0xff))
#define makedev(major, minor) (((major) << 8) | (minor))

Which should I use?  Why does yours cast dev to unsigned whereas
the Linux one does not?

-- 
Geoffrey Noer
noer AT cygnus DOT com

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019