lkml.org 
[lkml]   [1999]   [Oct]   [8]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [patch] replacing "/dev/root" in /proc/mounts
On Fri Oct 08, 1999 at 09:44:05AM +0200, Andreas Schwab wrote:
> Erik Andersen <andersen@xmission.com> writes:
>
> |> #include <stdio.h>
> |> #include <sys/stat.h>
> |> #include <unistd.h>
> |> int main(int argc, char **argv)
> |> {
> |> struct stat statBuf;
> |> unsigned int major, minor;
> |> stat("/", &statBuf);
> |> major=minor=statBuf.st_dev;
> |> printf("/ is on device major %d, minor %d\n",
> |> major>>8, minor&0xff);
>
> This is bad, you should be using the major and minor macros.

Right.

I was guessing how Wakko might have written a stat based app, and then I
go on to say this violates the interface by peeking under the kernel's
skirt. I had already checked, and the MAJOR and MINOR macros in kdev_t.h
are wrapped up an inside #ifdef __KERNEL__, and so are not available to
user space. User space simply has no way of knowing what a dev_t might
be.

-Erik

--
Erik B. Andersen Web: http://www.xmission.com/~andersen/
email: andersee@debian.org
--This message was written using 73% post-consumer electrons--

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.rutgers.edu
Please read the FAQ at http://www.tux.org/lkml/

\
 
 \ /
  Last update: 2005-03-22 13:54    [W:0.131 / U:0.952 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site