tech-userlevel archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

Re: S_IFMT not mentioned in any man page



Mouse <mouse%Rodents-Montreal.ORG@localhost> wrote:
 |>   FUTURE DIRECTIONS
 |>     No new S_IFMT symbolic names for the file type values of
 |>     mode_t will be defined by POSIX.1-2008; if new file types are
 |>     required, they will only be testable through S_ISxx( ) or
 |>     S_TYPEISxxx( ) macros instead.
 |
 |That strikes me as stupid of them.  You can't write
 |
 | switch (st_mode satisfying)
 |  { case S_ISTHINGY(selector):
 |       ...;
 |}
 |
 |(though arguably maybe you should be able to :-).

I had them mapped to Sys::IO::enum FileType as s_sock etc., but
i think i've practically always accessed that via
Sys::IO::FileInfo.isXy() (not even plain .fileType()).  I think
most of the time you're interested in one or two specific things.
And since you need a mask to get there it is possibly better, in
this particular case, to hide details from end-user programmers.
As you say, the problem was possibly the direct access to st_mode,
instead of at some S_FILETYPE(struct stat) or whatever,
restricting the scope of system library implementors.

 |Of course, NetBSD can define new S_ITHINGY names even if POSIX won't.

Of course (they can do whatever they want).  (Or not.)

--steffen


Home | Main Index | Thread Index | Old Index