getmntent(3c) 맨 페이지 - 윈디하나의 솔라나라

개요

섹션
맨 페이지 이름
검색(S)

getmntent(3c)

getmntent(3C)            Standard C Library Functions            getmntent(3C)

NAME
       getmntent, getmntany, getextmntent, hasmntopt, putmntent, resetmnttab -
       get mounted device information

SYNOPSIS
       #include <stdio.h>
       #include <sys/mnttab.h>

       int getmntent(FILE *fp, struct mnttab *mp);


       int getmntany(FILE *fp, struct mnttab *mp, struct mnttab *mpref);


       int getextmntent(FILE *fp, struct extmnttab *mp, int len);


       char *hasmntopt(struct mnttab *mnt, char *opt);


       int putmntent(FILE *iop, struct mnttab *mp);


       void resetmnttab(FILE *fp);

DESCRIPTION
   getmntent() and getmntany()
       The  getmntent()  and  getmntany() functions each fill in the structure
       pointed to by mp with the broken-out fields of a  line  in  the  mnttab
       file.  Each  line read from the file contains a mnttab structure, which
       is defined in the <sys/mnttab.h> header.  The  structure  contains  the
       following  members,  which  correspond  to the broken-out fields from a
       line in /etc/mnttab (see mnttab(5)).

         char   *mnt_special;     /* name of mounted resource */
         char   *mnt_mountp;      /* mount point */
         char   *mnt_fstype;      /* type of file system mounted */
         char   *mnt_mntopts;     /* options for this mount */
         char   *mnt_time;        /* time file system mounted */



       Fields with no actual content in /etc/mnttab  are  represented  in  the
       file  as  "-". To clearly distinguish empty fields, getmntent() set the
       corresponding field in mp to NULL.


       Each getmntent() call causes a new line to  be  read  from  the  mnttab
       file. Successive calls can be used to search the entire list. The getm‐
       ntany()  function  searches  the file referenced by fp until a match is
       found between a line in the file and mpref. A match occurs if all  non-
       null entries in mpref match the corresponding fields in the file. These
       functions do not open, close, or rewind the file.

   getextmntent()
       The  getextmntent()  function is an extended version of the getmntent()
       function that returns, in addition to the information that  getmntent()
       returns,  the  major  and minor number of the mounted resource to which
       the line in mnttab corresponds. The getextmntent() function also  fills
       in  the  extmntent  structure defined in the <sys/mnttab.h> header. For
       getextmntent() to function properly, it must be notified when the  mnt‐
       tab  file  has been reopened or rewound since a previous getextmntent()
       call. This notification is accomplished by calling resetmnttab().  Oth‐
       erwise, it behaves exactly as getmntent() described above


       The  data  pointed  to  by the mnttab structure members are stored in a
       static area and must be copied to be saved between successive calls.

   hasmntopt()
       The hasmntopt() function scans the mnt_mntopts  member  of  the  mnttab
       structure  mnt for a substring that matches opt. It returns the address
       of the substring if a match is found;  otherwise  it  returns  0.  Sub‐
       strings are delimited by commas and the end of the mnt_mntopts string.

   putmntent()
       The  putmntent() function is obsolete and no longer has any effect. En‐
       tries appear in mnttab as a side effect of a mount(2) call.  The  func‐
       tion name is still defined for transition purposes.

   resetmnttab()
       The  resetmnttab()  function notifies getextmntent() to reload from the
       kernel the device information that corresponds to the new  snapshot  of
       the mnttab information (see mnttab(5)). Subsequent getextmntent() calls
       then  return  correct  extmnttab  information.  This function should be
       called whenever the mnttab file is either rewound  or  closed  and  re‐
       opened before any calls are made to getextmntent().

RETURN VALUES
   getmntent() and getmntany()
       If  the  next  entry  is successfully read by getmntent() or a match is
       found with getmntany(), 0 is returned. If  an  EOF  is  encountered  on
       reading, these functions return −1. If an error is encountered, a value
       greater  than  0 is returned. The following error values are defined in
       <sys/mnttab.h>:

       MNT_TOOLONG    A line in the file exceeded the internal buffer size  of
                      MNT_LINE_MAX.


       MNT_TOOMANY    A line in the file contains too many fields.


       MNT_TOOFEW     A line in the file contains too few fields.


   hasmntopt()
       Upon successful completion, hasmntopt() returns the address of the sub‐
       string if a match is found. Otherwise, it returns 0.

   putmntent()
       The putmntent() is obsolete and always returns −1.

ATTRIBUTES
       See attributes(7) for descriptions of the following attributes:

       tab()  box; cw(2.75i) |cw(2.75i) lw(2.75i) |lw(2.75i) ATTRIBUTE TYPEAT‐
       TRIBUTE VALUE _ MT-LevelSafe


SEE ALSO
       mount(2), mnttab(5), attributes(7)

Oracle Solaris 11.4               22 Mar 2004                    getmntent(3C)
맨 페이지 내용의 저작권은 맨 페이지 작성자에게 있습니다.
RSS ATOM XHTML 5 CSS3