Lines Matching refs:code
87 The programs @code{hostname}, @code{hostid}, and @code{domainname} work
100 The return value is @code{0} on success and @code{-1} on failure. In
101 @theglibc{}, @code{gethostname} fails if @var{size} is not large
103 @code{errno} error condition is defined for this function:
105 @table @code
112 length: @code{MAXHOSTNAMELEN}. It is defined in @file{sys/param.h}.
116 @code{gethostname} stores the beginning of the host name in @var{name}
119 error code.
127 The @code{sethostname} function sets the host name of the system that
131 Usually @code{sethostname} gets called just once, at system boot time.
133 file @code{/etc/hostname}.
139 The return value is @code{0} on success and @code{-1} on failure.
140 The following @code{errno} error condition is defined for this function:
142 @table @code
155 @code{getdomainname} returns the NIS (aka YP) domain name of the system
157 domain name. Get that with @code{gethostname}.
159 The specifics of this function are analogous to @code{gethostname}, above.
170 @code{setdomainname} sets the NIS (aka YP) domain name of the system
172 domain name. Set that with @code{sethostname}.
174 The specifics of this function are analogous to @code{sethostname}, above.
186 of that machine, converted to a @w{@code{long int}}. However, on some
193 The proper way to query the IP address is to use @code{gethostbyname}
194 on the results of @code{gethostname}. For more information on IP addresses,
201 The @code{sethostid} function sets the ``host ID'' of the host machine
207 the system's host name as returned by @code{gethostname}. For example,
210 See @code{gethostid} above for more information on host ids.
212 The return value is @code{0} on success and @code{-1} on failure.
213 The following @code{errno} error conditions are defined for this function:
215 @table @code
229 You can use the @code{uname} function to find out some information about
235 As a bonus, @code{uname} also gives some information identifying the
243 The @code{utsname} structure is used to hold information returned
244 by the @code{uname} function. It has the following members:
246 @table @code
272 Since the value in @code{machine} is supposed to describe just the
277 @code{"sparc-sun"},
278 @code{"i386-@var{anything}"},
279 @code{"m68k-hp"},
280 @code{"m68k-sony"},
281 @code{"m68k-sun"},
282 @code{"mips-dec"}
287 the value is the same as that returned by @code{gethostname};
290 @code{gethostname} is implemented with a call to @code{uname}.
294 @code{getdomainname}; see @ref{Host Identification}. This element
309 The @code{uname} function fills in the structure pointed to by
313 @code{-1} as the return value indicates an error. The only error possible is
314 @code{EFAULT}, which we normally don't mention as it is always a
361 describes all possibly mounted filesystems. The @code{mount} program
386 way to handle these files is to use the macros @code{_PATH_FSTAB},
387 defined in @file{fstab.h}, or @code{_PATH_MNTTAB}, defined in
389 @code{_PATH_MOUNTED}, also defined in @file{mntent.h} and
391 names @code{FSTAB}, @code{MNTTAB}, and @code{MOUNTED} defined but
393 The names @code{_PATH_MNTTAB} and @code{_PATH_MOUNTED} should always be used.
404 The internal representation for entries of the file is @w{@code{struct
409 This structure is used with the @code{getfsent}, @code{getfsspec}, and
410 @code{getfsfile} functions.
412 @table @code
419 Even though the element is not declared @code{const} it shouldn't be
420 modified. The missing @code{const} has historic reasons, since this
435 @code{mount} call. Again, this can be almost anything. There can be
437 consists of a name and an optional value part, introduced by an @code{=}
441 using the @code{getsubopt} function; see @ref{Suboptions}.
445 in the @code{fs_mntops} string) which describes the modes with which the
449 @vtable @code
463 Testing for equality with these values must happen using @code{strcmp}
472 related to the @code{dump} utility used on Unix systems.
496 and the @code{getfs*} functions can be used to read the entries of the
506 @code{setfsent} (explicitly or implicitly by calling @code{getfsent}) are
521 program start or the last call of @code{endfsent}, the file will be
524 The function returns a pointer to a variable of type @code{struct
526 function is not thread-safe. If an error occurred @code{getfsent}
527 returns a @code{NULL} pointer.
539 a string equal to @var{name} pointed to by the @code{fs_spec} element.
543 @file{fstab} since program start or the last call of @code{endfsent},
546 The function returns a pointer to a variable of type @code{struct
548 function is not thread-safe. If an error occurred @code{getfsent}
549 returns a @code{NULL} pointer.
561 a string equal to @var{name} pointed to by the @code{fs_file} element.
565 @file{fstab} since program start or the last call of @code{endfsent},
568 The function returns a pointer to a variable of type @code{struct
570 function is not thread-safe. If an error occurred @code{getfsent}
571 returns a @code{NULL} pointer.
581 This structure is used with the @code{getmntent}, @code{getmntent_r},
582 @code{addmntent}, and @code{hasmntopt} functions.
584 @table @code
588 the @code{fs_spec} element in @code{struct fstab}.
592 filesystem. It corresponds to the @code{fs_file} element in
593 @code{struct fstab}.
596 @code{mnt_type} describes the filesystem type and is therefore
597 equivalent to @code{fs_vfstype} in @code{struct fstab}. @file{mntent.h}
604 @vtable @code
606 This symbol expands to @code{"ignore"}. The value is sometimes used in
609 Expands to @code{"nfs"}. Using this macro sometimes could make sense
613 This symbol expands to @code{"swap"}. It names the special @file{fstab}
619 the filesystem. As for the equivalent element @code{fs_mntops} of
620 @code{struct fstab} it is best to use the function @code{getsubopt}
628 @vtable @code
630 Expands to @code{"defaults"}. This option should be used alone since it
634 Expands to @code{"ro"}. See the @code{FSTAB_RO} value, it means the
637 Expands to @code{"rw"}. See the @code{FSTAB_RW} value, it means the
640 Expands to @code{"suid"}. This means that the SUID bit (@pxref{How
644 Expands to @code{"nosuid"}. This is the opposite of @code{MNTOPT_SUID},
647 Expands to @code{"noauto"}. At startup time the @code{mount} program
648 will ignore this entry if it is started with the @code{-a} option to
652 As for the @code{FSTAB_*} entries introduced above it is important to
653 use @code{strcmp} to check for equality.
656 This elements corresponds to @code{fs_freq} and also specifies the
660 This element is equivalent to @code{fs_passno} with the same meaning
661 which is uninteresting for all programs beside @code{dump}.
680 The @code{setmntent} function prepares the file named @var{FILE} which
684 parameter for @code{fopen} (@pxref{Opening Streams}) can be chosen. If
687 If the file was successfully opened @code{setmntent} returns a file
688 handle for future use. Otherwise the return value is @code{NULL}
689 and @code{errno} is set accordingly.
698 previously was returned from the @code{setmntent} call.
699 @code{endmntent} closes the stream and frees all resources.
713 The @code{getmntent} function takes as the parameter a file handle
714 previously returned by a successful call to @code{setmntent}. It returns
715 a pointer to a static variable of type @code{struct mntent} which is
722 these characters are encoded in the files and the @code{getmntent}
724 @code{'\040'} is used to encode a space character, @code{'\011'} to
725 encode a tab character, @code{'\012'} to encode a newline character,
726 and @code{'\\'} to encode a backslash.
729 is @code{NULL}.
732 a pointer to the same static variable. @code{getmntent_r} should be
748 The @code{getmntent_r} function is the reentrant variant of
749 @code{getmntent}. It also returns the next entry from the file and
757 same way as it happens for @code{getmentent}.
759 The function returns a @code{NULL} pointer in error cases. Errors could be:
778 The @code{addmntent} function allows adding a new entry to the file
779 previously opened with @code{setmntent}. The new entries are always
791 the format described in the @code{getmntent} description above.
794 Otherwise the return value is @math{1} and @code{errno} is set
806 @code{mnt_opts} element of the variable pointed to by @var{mnt} contains
808 option in the @code{mnt_opts} element is returned. If no such option
809 exists the function returns @code{NULL}.
813 @code{getsubopt} function to iterate over all options in the string.
819 On a system with a Linux kernel and the @code{proc} filesystem, you can
821 @file{mounts} in the @code{proc} filesystem. Its format is similar to
846 @code{mount} mounts or remounts a filesystem. The two operations are
848 The @code{MS_REMOUNT} option, explained below, determines whether
849 @code{mount} mounts or remounts.
858 based on a device (e.g. ``proc''), @code{mount} instantiates a
871 and the @code{proc} filesystem, the list of possible values is in the
872 file @file{filesystems} in the @code{proc} filesystem (e.g. type
874 types of filesystems that @code{mount} can mount, and their type names,
877 @var{fstype} is @code{ext2}.
879 For a remount, @code{mount} ignores @var{fstype}.
887 options (but never @code{MS_RDONLY}) can be overridden for individual
888 file accesses via @code{ioctl}.
893 @vtable @code
896 @code{MS_MGC_VAL}, @code{mount} assumes all the following bits are zero and
908 while it is mounted. This cannot be overridden by @code{ioctl}. This
964 Appropriate arguments for @code{mount} are conventionally recorded in
968 it is @code{-1} and @code{errno} is set appropriately. The values of
969 @code{errno} are filesystem dependent, but here is a general list:
971 @table @code
1011 @code{MS_RDONLY} bit off).
1018 mounted with the @code{MS_NODEV} option.
1023 The table of dummy devices is full. @code{mount} needs to create a
1037 @code{umount2} unmounts a filesystem.
1046 @vtable @code
1051 busy, @code{umount2} fails with @code{errno} = @code{EBUSY}. Depending
1075 As part of unmounting, @code{umount2} syncs the filesystem.
1078 is @code{-1} and @code{errno} is set accordingly:
1080 @table @code
1087 this failure with the @code{MNT_FORCE} option.
1104 @code{umount} does the same thing as @code{umount2} with @var{flags} set
1105 to zeroes. It is more widely available than @code{umount2} but since it
1107 when @code{umount2} is also available.