1 # SOME DESCRIPTIVE TITLE
2 # Copyright (C) YEAR Free Software Foundation, Inc.
3 # This file is distributed under the same license as the PACKAGE package.
4 # FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
9 "Project-Id-Version: PACKAGE VERSION\n"
10 "POT-Creation-Date: 2012-03-22 04:26+0900\n"
11 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
12 "Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
13 "Language-Team: LANGUAGE <LL@li.org>\n"
16 "Content-Type: text/plain; charset=UTF-8\n"
17 "Content-Transfer-Encoding: 8bit\n"
20 #: build/C/man3/asprintf.3:25
26 #: build/C/man3/asprintf.3:25
32 #: build/C/man3/asprintf.3:25 build/C/man3/ctermid.3:24 build/C/man3/dprintf.3:25 build/C/man3/fclose.3:42 build/C/man3/fcloseall.3:24 build/C/man3/fflush.3:43 build/C/man3/fgetwc.3:16 build/C/man3/fmemopen.3:6 build/C/man3/fopen.3:42 build/C/man3/fputwc.3:14 build/C/man3/fread.3:43 build/C/man3/fseek.3:40 build/C/man3/getline.3:24 build/C/man3/gets.3:25 build/C/man3/getw.3:23 build/C/man3/popen.3:38 build/C/man3/printf.3:34 build/C/man3/puts.3:24 build/C/man3/remove.3:31 build/C/man3/scanf.3:50 build/C/man3/wprintf.3:14
38 #: build/C/man3/asprintf.3:25 build/C/man3/ctermid.3:24 build/C/man3/dprintf.3:25 build/C/man3/fclose.3:42 build/C/man3/fcloseall.3:24 build/C/man3/ferror.3:42 build/C/man3/fflush.3:43 build/C/man3/fgetwc.3:16 build/C/man3/flockfile.3:23 build/C/man3/fmemopen.3:6 build/C/man3/fmtmsg.3:9 build/C/man3/fopen.3:42 build/C/man3/fopencookie.3:24 build/C/man3/fpurge.3:23 build/C/man3/fputwc.3:14 build/C/man3/fread.3:43 build/C/man3/fseek.3:40 build/C/man3/fseeko.3:23 build/C/man3/getline.3:24 build/C/man3/gets.3:25 build/C/man3/getw.3:23 build/C/man2/link.2:31 build/C/man2/llseek.2:26 build/C/man2/lseek.2:45 build/C/man3/lseek64.3:23 build/C/man2/open.2:52 build/C/man3/perror.3:30 build/C/man2/pipe.2:36 build/C/man3/popen.3:38 build/C/man3/printf.3:34 build/C/man3/puts.3:24 build/C/man2/read.2:35 build/C/man2/readlink.2:41 build/C/man2/readv.2:30 build/C/man3/remove.3:31 build/C/man2/rename.2:32 build/C/man2/rmdir.2:30 build/C/man3/scanf.3:50 build/C/man3/setbuf.3:46 build/C/man3/stdin.3:9 build/C/man3/stdio.3:37 build/C/man3/stdio_ext.3:23 build/C/man2/symlink.2:32 build/C/man7/symlink.7:35 build/C/man3/tempnam.3:23 build/C/man3/tmpfile.3:29 build/C/man3/tmpnam.3:25 build/C/man2/unlink.2:32 build/C/man3/unlocked_stdio.3:23 build/C/man3/wprintf.3:14 build/C/man2/write.2:39
40 msgid "Linux Programmer's Manual"
44 #: build/C/man3/asprintf.3:26 build/C/man3/ctermid.3:25 build/C/man3/dprintf.3:26 build/C/man3/fclose.3:43 build/C/man3/fcloseall.3:25 build/C/man3/ferror.3:43 build/C/man3/fflush.3:44 build/C/man3/fgetwc.3:17 build/C/man3/flockfile.3:24 build/C/man3/fmemopen.3:7 build/C/man3/fmtmsg.3:10 build/C/man3/fopen.3:43 build/C/man3/fopencookie.3:25 build/C/man3/fpurge.3:24 build/C/man3/fputwc.3:15 build/C/man3/fread.3:44 build/C/man3/fseek.3:41 build/C/man3/fseeko.3:24 build/C/man3/getline.3:25 build/C/man3/gets.3:26 build/C/man3/getw.3:24 build/C/man2/link.2:32 build/C/man2/llseek.2:27 build/C/man2/lseek.2:46 build/C/man3/lseek64.3:24 build/C/man2/open.2:53 build/C/man3/perror.3:31 build/C/man2/pipe.2:37 build/C/man3/popen.3:39 build/C/man3/printf.3:35 build/C/man3/puts.3:25 build/C/man2/read.2:36 build/C/man2/readlink.2:42 build/C/man2/readv.2:31 build/C/man3/remove.3:32 build/C/man2/rename.2:33 build/C/man2/rmdir.2:31 build/C/man3/scanf.3:51 build/C/man3/setbuf.3:47 build/C/man3/stdin.3:10 build/C/man3/stdio.3:38 build/C/man3/stdio_ext.3:24 build/C/man2/symlink.2:33 build/C/man7/symlink.7:36 build/C/man3/tempnam.3:24 build/C/man3/tmpfile.3:30 build/C/man3/tmpnam.3:26 build/C/man2/unlink.2:33 build/C/man3/unlocked_stdio.3:24 build/C/man3/wprintf.3:15 build/C/man2/write.2:40
50 #: build/C/man3/asprintf.3:28
51 msgid "asprintf, vasprintf - print to allocated string"
55 #: build/C/man3/asprintf.3:28 build/C/man3/ctermid.3:27 build/C/man3/dprintf.3:28 build/C/man3/fclose.3:45 build/C/man3/fcloseall.3:27 build/C/man3/ferror.3:45 build/C/man3/fflush.3:46 build/C/man3/fgetwc.3:19 build/C/man3/flockfile.3:26 build/C/man3/fmemopen.3:9 build/C/man3/fmtmsg.3:12 build/C/man3/fopen.3:45 build/C/man3/fopencookie.3:27 build/C/man3/fpurge.3:26 build/C/man3/fputwc.3:17 build/C/man3/fread.3:46 build/C/man3/fseek.3:43 build/C/man3/fseeko.3:26 build/C/man3/getline.3:27 build/C/man3/gets.3:28 build/C/man3/getw.3:26 build/C/man2/link.2:34 build/C/man2/llseek.2:29 build/C/man2/lseek.2:48 build/C/man3/lseek64.3:26 build/C/man2/open.2:55 build/C/man3/perror.3:33 build/C/man2/pipe.2:39 build/C/man3/popen.3:41 build/C/man3/printf.3:38 build/C/man3/puts.3:27 build/C/man2/read.2:38 build/C/man2/readlink.2:44 build/C/man2/readv.2:33 build/C/man3/remove.3:34 build/C/man2/rename.2:35 build/C/man2/rmdir.2:33 build/C/man3/scanf.3:53 build/C/man3/setbuf.3:49 build/C/man3/stdin.3:12 build/C/man3/stdio.3:40 build/C/man3/stdio_ext.3:28 build/C/man2/symlink.2:35 build/C/man3/tempnam.3:26 build/C/man3/tmpfile.3:32 build/C/man3/tmpnam.3:28 build/C/man2/unlink.2:35 build/C/man3/unlocked_stdio.3:27 build/C/man3/wprintf.3:18 build/C/man2/write.2:42
61 #: build/C/man3/asprintf.3:30
62 msgid "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */"
66 #: build/C/man3/asprintf.3:32 build/C/man3/dprintf.3:30 build/C/man3/fclose.3:47 build/C/man3/ferror.3:47 build/C/man3/fflush.3:48 build/C/man3/fseek.3:45 build/C/man3/perror.3:35 build/C/man3/printf.3:40 build/C/man3/remove.3:36 build/C/man2/rename.2:37 build/C/man3/stdio.3:42 build/C/man3/stdio_ext.3:30
67 msgid "B<#include E<lt>stdio.hE<gt>>"
71 #: build/C/man3/asprintf.3:34
72 msgid "B<int asprintf(char **>I<strp>B<, const char *>I<fmt>B<, ...);>"
76 #: build/C/man3/asprintf.3:36
78 "B<int vasprintf(char **>I<strp>B<, const char *>I<fmt>B<, va_list "
83 #: build/C/man3/asprintf.3:36 build/C/man3/ctermid.3:44 build/C/man3/dprintf.3:54 build/C/man3/fclose.3:49 build/C/man3/fcloseall.3:34 build/C/man3/ferror.3:63 build/C/man3/fflush.3:50 build/C/man3/fgetwc.3:28 build/C/man3/flockfile.3:49 build/C/man3/fmemopen.3:42 build/C/man3/fmtmsg.3:22 build/C/man3/fopen.3:63 build/C/man3/fopencookie.3:35 build/C/man3/fpurge.3:40 build/C/man3/fputwc.3:26 build/C/man3/fread.3:56 build/C/man3/fseek.3:55 build/C/man3/fseeko.3:35 build/C/man3/getline.3:56 build/C/man3/gets.3:44 build/C/man3/getw.3:57 build/C/man2/link.2:38 build/C/man2/llseek.2:38 build/C/man2/lseek.2:54 build/C/man3/lseek64.3:34 build/C/man2/open.2:66 build/C/man3/perror.3:54 build/C/man2/pipe.2:51 build/C/man3/popen.3:62 build/C/man3/printf.3:76 build/C/man3/puts.3:41 build/C/man2/read.2:44 build/C/man2/readlink.2:61 build/C/man2/readv.2:56 build/C/man3/remove.3:38 build/C/man2/rename.2:39 build/C/man2/rmdir.2:37 build/C/man3/scanf.3:85 build/C/man3/setbuf.3:71 build/C/man3/stdin.3:20 build/C/man3/stdio.3:48 build/C/man3/stdio_ext.3:52 build/C/man2/symlink.2:52 build/C/man3/tempnam.3:40 build/C/man3/tmpfile.3:38 build/C/man3/tmpnam.3:34 build/C/man2/unlink.2:39 build/C/man3/unlocked_stdio.3:104 build/C/man3/wprintf.3:58 build/C/man2/write.2:46
89 #: build/C/man3/asprintf.3:51
91 "The functions B<asprintf>() and B<vasprintf>() are analogs of "
92 "B<sprintf>(3) and B<vsprintf>(3), except that they allocate a string large "
93 "enough to hold the output including the terminating null byte, and return a "
94 "pointer to it via the first argument. This pointer should be passed to "
95 "B<free>(3) to release the allocated storage when it is no longer needed."
99 #: build/C/man3/asprintf.3:51 build/C/man3/ctermid.3:57 build/C/man3/fclose.3:57 build/C/man3/fcloseall.3:49 build/C/man3/fflush.3:72 build/C/man3/fgetwc.3:53 build/C/man3/flockfile.3:112 build/C/man3/fmemopen.3:172 build/C/man3/fmtmsg.3:148 build/C/man3/fopen.3:189 build/C/man3/fopencookie.3:235 build/C/man3/fpurge.3:56 build/C/man3/fputwc.3:52 build/C/man3/fread.3:81 build/C/man3/fseek.3:117 build/C/man3/fseeko.3:63 build/C/man3/getline.3:108 build/C/man3/gets.3:109 build/C/man3/getw.3:71 build/C/man2/link.2:52 build/C/man2/llseek.2:57 build/C/man2/lseek.2:151 build/C/man2/open.2:466 build/C/man2/pipe.2:92 build/C/man3/popen.3:121 build/C/man3/puts.3:82 build/C/man2/read.2:63 build/C/man2/readlink.2:75 build/C/man2/readv.2:175 build/C/man3/remove.3:60 build/C/man2/rename.2:91 build/C/man2/rmdir.2:40 build/C/man3/scanf.3:528 build/C/man3/setbuf.3:150 build/C/man2/symlink.2:84 build/C/man3/tempnam.3:85 build/C/man3/tmpfile.3:45 build/C/man3/tmpnam.3:68 build/C/man2/unlink.2:55 build/C/man3/wprintf.3:185 build/C/man2/write.2:89
105 #: build/C/man3/asprintf.3:59
107 "When successful, these functions return the number of bytes printed, just "
108 "like B<sprintf>(3). If memory allocation wasn't possible, or some other "
109 "error occurs, these functions will return -1, and the contents of I<strp> is "
114 #: build/C/man3/asprintf.3:59 build/C/man3/ctermid.3:59 build/C/man3/dprintf.3:68 build/C/man3/fclose.3:88 build/C/man3/fcloseall.3:54 build/C/man3/ferror.3:105 build/C/man3/fflush.3:91 build/C/man3/fgetwc.3:65 build/C/man3/flockfile.3:119 build/C/man3/fmemopen.3:191 build/C/man3/fmtmsg.3:221 build/C/man3/fopen.3:246 build/C/man3/fopencookie.3:242 build/C/man3/fpurge.3:68 build/C/man3/fputwc.3:63 build/C/man3/fread.3:96 build/C/man3/fseek.3:164 build/C/man3/fseeko.3:75 build/C/man3/getline.3:132 build/C/man3/gets.3:136 build/C/man3/getw.3:78 build/C/man2/link.2:128 build/C/man2/llseek.2:76 build/C/man2/lseek.2:189 build/C/man2/open.2:612 build/C/man3/perror.3:107 build/C/man2/pipe.2:118 build/C/man3/popen.3:167 build/C/man3/printf.3:807 build/C/man3/puts.3:101 build/C/man2/read.2:155 build/C/man2/readlink.2:123 build/C/man2/readv.2:212 build/C/man3/remove.3:70 build/C/man2/rename.2:229 build/C/man2/rmdir.2:127 build/C/man3/scanf.3:575 build/C/man3/setbuf.3:162 build/C/man3/stdin.3:109 build/C/man3/stdio.3:244 build/C/man2/symlink.2:144 build/C/man3/tempnam.3:94 build/C/man3/tmpfile.3:74 build/C/man3/tmpnam.3:75 build/C/man2/unlink.2:141 build/C/man3/unlocked_stdio.3:111 build/C/man3/wprintf.3:193 build/C/man2/write.2:179
116 msgid "CONFORMING TO"
120 #: build/C/man3/asprintf.3:65
122 "These functions are GNU extensions, not in C or POSIX. They are also "
123 "available under *BSD. The FreeBSD implementation sets I<strp> to NULL on "
128 #: build/C/man3/asprintf.3:65 build/C/man3/ctermid.3:69 build/C/man3/dprintf.3:94 build/C/man3/fclose.3:100 build/C/man3/fcloseall.3:56 build/C/man3/ferror.3:112 build/C/man3/fflush.3:106 build/C/man3/fgetwc.3:82 build/C/man3/flockfile.3:127 build/C/man3/fmemopen.3:273 build/C/man3/fmtmsg.3:293 build/C/man3/fopen.3:301 build/C/man3/fopencookie.3:434 build/C/man3/fpurge.3:78 build/C/man3/fputwc.3:80 build/C/man3/fread.3:98 build/C/man3/fseek.3:166 build/C/man3/fseeko.3:81 build/C/man3/getline.3:166 build/C/man3/gets.3:171 build/C/man3/getw.3:84 build/C/man2/link.2:177 build/C/man2/llseek.2:82 build/C/man2/lseek.2:234 build/C/man3/lseek64.3:157 build/C/man2/open.2:851 build/C/man3/perror.3:135 build/C/man2/pipe.2:190 build/C/man3/popen.3:196 build/C/man3/printf.3:1074 build/C/man3/puts.3:110 build/C/man2/read.2:178 build/C/man2/readlink.2:212 build/C/man2/readv.2:282 build/C/man3/remove.3:81 build/C/man2/rename.2:242 build/C/man2/rmdir.2:132 build/C/man3/scanf.3:717 build/C/man3/setbuf.3:198 build/C/man3/stdin.3:150 build/C/man3/stdio.3:248 build/C/man3/stdio_ext.3:130 build/C/man2/symlink.2:159 build/C/man7/symlink.7:470 build/C/man3/tempnam.3:164 build/C/man3/tmpfile.3:86 build/C/man3/tmpnam.3:151 build/C/man2/unlink.2:148 build/C/man3/unlocked_stdio.3:134 build/C/man3/wprintf.3:229 build/C/man2/write.2:205
134 #: build/C/man3/asprintf.3:69
135 msgid "B<free>(3), B<malloc>(3), B<printf>(3)"
139 #: build/C/man3/asprintf.3:69 build/C/man3/ctermid.3:71 build/C/man3/dprintf.3:96 build/C/man3/fclose.3:106 build/C/man3/fcloseall.3:62 build/C/man3/ferror.3:117 build/C/man3/fflush.3:114 build/C/man3/fgetwc.3:87 build/C/man3/flockfile.3:129 build/C/man3/fmemopen.3:276 build/C/man3/fmtmsg.3:296 build/C/man3/fopen.3:307 build/C/man3/fopencookie.3:439 build/C/man3/fpurge.3:83 build/C/man3/fputwc.3:84 build/C/man3/fread.3:104 build/C/man3/fseek.3:169 build/C/man3/fseeko.3:83 build/C/man3/getline.3:173 build/C/man3/gets.3:187 build/C/man3/getw.3:90 build/C/man2/link.2:187 build/C/man2/llseek.2:85 build/C/man2/lseek.2:241 build/C/man3/lseek64.3:160 build/C/man2/open.2:873 build/C/man3/perror.3:140 build/C/man2/pipe.2:197 build/C/man3/popen.3:206 build/C/man3/printf.3:1083 build/C/man3/puts.3:122 build/C/man2/read.2:191 build/C/man2/readlink.2:220 build/C/man2/readv.2:286 build/C/man3/remove.3:92 build/C/man2/rename.2:251 build/C/man2/rmdir.2:141 build/C/man3/scanf.3:724 build/C/man3/setbuf.3:206 build/C/man3/stdin.3:156 build/C/man3/stdio.3:255 build/C/man3/stdio_ext.3:133 build/C/man2/symlink.2:171 build/C/man7/symlink.7:488 build/C/man3/tempnam.3:169 build/C/man3/tmpfile.3:92 build/C/man3/tmpnam.3:156 build/C/man2/unlink.2:161 build/C/man3/unlocked_stdio.3:137 build/C/man3/wprintf.3:236 build/C/man2/write.2:217
145 #: build/C/man3/asprintf.3:76 build/C/man3/ctermid.3:78 build/C/man3/dprintf.3:103 build/C/man3/fclose.3:113 build/C/man3/fcloseall.3:69 build/C/man3/ferror.3:124 build/C/man3/fflush.3:121 build/C/man3/fgetwc.3:94 build/C/man3/flockfile.3:136 build/C/man3/fmemopen.3:283 build/C/man3/fmtmsg.3:303 build/C/man3/fopen.3:314 build/C/man3/fopencookie.3:446 build/C/man3/fpurge.3:90 build/C/man3/fputwc.3:91 build/C/man3/fread.3:111 build/C/man3/fseek.3:176 build/C/man3/fseeko.3:90 build/C/man3/getline.3:180 build/C/man3/gets.3:194 build/C/man3/getw.3:97 build/C/man2/link.2:194 build/C/man2/llseek.2:92 build/C/man2/lseek.2:248 build/C/man3/lseek64.3:167 build/C/man2/open.2:880 build/C/man3/perror.3:147 build/C/man2/pipe.2:204 build/C/man3/popen.3:213 build/C/man3/printf.3:1090 build/C/man3/puts.3:129 build/C/man2/read.2:198 build/C/man2/readlink.2:227 build/C/man2/readv.2:293 build/C/man3/remove.3:99 build/C/man2/rename.2:258 build/C/man2/rmdir.2:148 build/C/man3/scanf.3:731 build/C/man3/setbuf.3:213 build/C/man3/stdin.3:163 build/C/man3/stdio.3:262 build/C/man3/stdio_ext.3:140 build/C/man2/symlink.2:178 build/C/man7/symlink.7:495 build/C/man3/tempnam.3:176 build/C/man3/tmpfile.3:99 build/C/man3/tmpnam.3:163 build/C/man2/unlink.2:168 build/C/man3/unlocked_stdio.3:144 build/C/man3/wprintf.3:243 build/C/man2/write.2:224
147 "This page is part of release 3.37 of the Linux I<man-pages> project. A "
148 "description of the project, and information about reporting bugs, can be "
149 "found at http://www.kernel.org/doc/man-pages/."
153 #: build/C/man3/ctermid.3:24
159 #: build/C/man3/ctermid.3:24 build/C/man3/perror.3:30
165 #: build/C/man3/ctermid.3:27
166 msgid "ctermid - get controlling terminal name"
170 #: build/C/man3/ctermid.3:32 build/C/man3/fgetwc.3:22 build/C/man3/flockfile.3:29 build/C/man3/fmemopen.3:12 build/C/man3/fopen.3:48 build/C/man3/fputwc.3:20 build/C/man3/fread.3:49 build/C/man3/fseeko.3:29 build/C/man3/getline.3:30 build/C/man3/gets.3:31 build/C/man3/getw.3:29 build/C/man3/popen.3:44 build/C/man3/puts.3:30 build/C/man3/scanf.3:56 build/C/man3/setbuf.3:52 build/C/man3/stdin.3:15 build/C/man3/tempnam.3:29 build/C/man3/tmpfile.3:35 build/C/man3/tmpnam.3:31 build/C/man3/unlocked_stdio.3:30
172 msgid "B<#include E<lt>stdio.hE<gt>>\n"
176 #: build/C/man3/ctermid.3:34
178 msgid "B<char *ctermid(char *>I<s>B<);>\n"
182 #: build/C/man3/ctermid.3:39 build/C/man3/dprintf.3:38 build/C/man3/ferror.3:59 build/C/man3/flockfile.3:40 build/C/man3/fmemopen.3:25 build/C/man3/fopen.3:59 build/C/man3/getline.3:40 build/C/man3/getw.3:38 build/C/man3/perror.3:49 build/C/man3/popen.3:53 build/C/man3/printf.3:63 build/C/man2/readlink.2:52 build/C/man2/readv.2:51 build/C/man3/scanf.3:71 build/C/man3/setbuf.3:66 build/C/man2/symlink.2:43 build/C/man3/tempnam.3:36 build/C/man3/unlocked_stdio.3:66 build/C/man3/wprintf.3:37
183 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
186 #. From <unistd.h>: _XOPEN_SOURCE
188 #: build/C/man3/ctermid.3:44
189 msgid "B<ctermid>(): _POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE"
193 #: build/C/man3/ctermid.3:57
195 "B<ctermid>() returns a string which is the pathname for the current "
196 "controlling terminal for this process. If I<s> is NULL, a static buffer is "
197 "used, otherwise I<s> points to a buffer used to hold the terminal pathname. "
198 "The symbolic constant B<L_ctermid> is the maximum number of characters in "
199 "the returned pathname."
203 #: build/C/man3/ctermid.3:59
204 msgid "The pointer to the pathname."
208 #: build/C/man3/ctermid.3:61
209 msgid "Svr4, POSIX.1-2001."
213 #: build/C/man3/ctermid.3:61 build/C/man3/fmemopen.3:201 build/C/man3/gets.3:150 build/C/man3/getw.3:80 build/C/man2/link.2:171 build/C/man2/open.2:840 build/C/man3/popen.3:173 build/C/man3/printf.3:930 build/C/man3/puts.3:103 build/C/man2/readv.2:256 build/C/man3/remove.3:78 build/C/man2/rename.2:231 build/C/man2/rmdir.2:129 build/C/man3/scanf.3:682 build/C/man3/setbuf.3:168 build/C/man3/tempnam.3:154 build/C/man3/tmpnam.3:144 build/C/man2/unlink.2:145
219 #: build/C/man3/ctermid.3:65
221 "The path returned may not uniquely identify the controlling terminal; it "
222 "may, for example, be I</dev/tty>."
225 #. in glibc 2.3.x, x >= 4, the glibc headers threw an error
226 #. if ctermid() was given an argument; fixed in 2.4.
228 #: build/C/man3/ctermid.3:69
229 msgid "It is not assured that the program can open the terminal."
233 #: build/C/man3/ctermid.3:71
234 msgid "B<ttyname>(3)"
238 #: build/C/man3/dprintf.3:25
244 #: build/C/man3/dprintf.3:25 build/C/man3/fmemopen.3:6
250 #: build/C/man3/dprintf.3:28
251 msgid "dprintf, vdprintf - print to a file descriptor"
255 #: build/C/man3/dprintf.3:32
256 msgid "B<int dprintf(int >I<fd>B<, const char *>I<format>B<, ...);>"
260 #: build/C/man3/dprintf.3:34
261 msgid "B<int vdprintf(int >I<fd>B<, const char *>I<format>B<, va_list >I<ap>B<);>"
265 #: build/C/man3/dprintf.3:42
266 msgid "B<dprintf>(), B<vdprintf>():"
270 #: build/C/man3/dprintf.3:45 build/C/man3/fmemopen.3:33 build/C/man3/getline.3:47
272 msgid "Since glibc 2.10:"
276 #: build/C/man3/dprintf.3:48 build/C/man3/fmemopen.3:36
277 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 700 || _POSIX_C_SOURCE\\ E<gt>=\\ 200809L"
281 #: build/C/man3/dprintf.3:48 build/C/man3/fmemopen.3:36 build/C/man3/getline.3:50
283 msgid "Before glibc 2.10:"
287 #: build/C/man3/dprintf.3:51 build/C/man3/fmemopen.3:39 build/C/man3/getline.3:53 build/C/man3/unlocked_stdio.3:102
292 #: build/C/man3/dprintf.3:68
294 "The functions B<dprintf>() and B<vdprintf>() (as found in the glibc2 "
295 "library) are exact analogs of B<fprintf>(3) and B<vfprintf>(3), except that "
296 "they output to a file descriptor I<fd> instead of to a I<stdio> stream."
300 #. These functions are GNU extensions, not in C or POSIX.
301 #. Clearly, the names were badly chosen.
302 #. Many systems (like MacOS) have incompatible functions called
304 #. usually some debugging version of
306 #. perhaps with a prototype like
308 #. .BI "void dprintf(int level, const char *" format ", ...);"
310 #. where the first argument is a debugging level (and output is to
316 #. is also a popular macro name for a debugging printf.
317 #. So, probably, it is better to avoid this function in programs
318 #. intended to be portable.
320 #. A better name would have been
323 #: build/C/man3/dprintf.3:94
325 "These functions are GNU extensions that are nowadays specified in "
330 #: build/C/man3/dprintf.3:96
335 #: build/C/man3/fclose.3:42
341 #: build/C/man3/fclose.3:42 build/C/man3/fopen.3:42 build/C/man2/read.2:35
347 #: build/C/man3/fclose.3:45
348 msgid "fclose - close a stream"
352 #: build/C/man3/fclose.3:49
353 msgid "B<int fclose(FILE *>I<fp>B<);>"
357 #: build/C/man3/fclose.3:57
359 "The B<fclose>() function will flushes the stream pointed to by I<fp> "
360 "(writing any buffered output data using B<fflush>(3)) and closes the "
361 "underlying file descriptor."
365 #: build/C/man3/fclose.3:68
367 "Upon successful completion 0 is returned. Otherwise, B<EOF> is returned and "
368 "I<errno> is set to indicate the error. In either case any further access "
369 "(including another call to B<fclose>()) to the stream results in undefined "
374 #: build/C/man3/fclose.3:68 build/C/man3/ferror.3:95 build/C/man3/fflush.3:79 build/C/man3/fgetwc.3:59 build/C/man3/flockfile.3:117 build/C/man3/fopen.3:201 build/C/man3/fpurge.3:63 build/C/man3/fputwc.3:58 build/C/man3/fseek.3:132 build/C/man3/fseeko.3:72 build/C/man3/getline.3:120 build/C/man2/link.2:57 build/C/man2/llseek.2:64 build/C/man2/lseek.2:159 build/C/man2/open.2:474 build/C/man2/pipe.2:97 build/C/man3/popen.3:141 build/C/man2/read.2:77 build/C/man2/readlink.2:83 build/C/man2/readv.2:186 build/C/man3/remove.3:65 build/C/man2/rename.2:96 build/C/man2/rmdir.2:45 build/C/man3/scanf.3:545 build/C/man2/symlink.2:89 build/C/man3/tempnam.3:90 build/C/man3/tmpfile.3:52 build/C/man3/tmpnam.3:73 build/C/man2/unlink.2:60 build/C/man2/write.2:107
380 #: build/C/man3/fclose.3:69 build/C/man3/fflush.3:80 build/C/man3/fpurge.3:64 build/C/man3/fseek.3:133 build/C/man2/llseek.2:65 build/C/man2/lseek.2:160 build/C/man2/read.2:96 build/C/man3/scanf.3:551 build/C/man2/write.2:126
385 #. This error cannot occur unless you are mixing ANSI C stdio operations and
386 #. low-level file operations on the same stream. If you do get this error,
387 #. you must have closed the stream's low-level file descriptor using
388 #. something like close(fileno(fp)).
390 #: build/C/man3/fclose.3:78
391 msgid "The file descriptor underlying I<fp> is not valid."
395 #: build/C/man3/fclose.3:88
397 "The B<fclose>() function may also fail and set I<errno> for any of the "
398 "errors specified for the routines B<close>(2), B<write>(2) or B<fflush>(3)."
402 #: build/C/man3/fclose.3:90 build/C/man3/fseek.3:166 build/C/man3/puts.3:103
407 #: build/C/man3/fclose.3:90 build/C/man3/fflush.3:97 build/C/man3/fgetwc.3:67 build/C/man3/fmemopen.3:195 build/C/man3/fmtmsg.3:236 build/C/man3/fopen.3:255 build/C/man3/fpurge.3:76 build/C/man3/fputwc.3:65 build/C/man3/fseeko.3:77 build/C/man2/link.2:133 build/C/man2/llseek.2:79 build/C/man2/lseek.2:199 build/C/man2/open.2:638 build/C/man3/perror.3:120 build/C/man3/printf.3:868 build/C/man2/read.2:157 build/C/man2/readlink.2:128 build/C/man2/readv.2:224 build/C/man3/remove.3:72 build/C/man3/scanf.3:606 build/C/man3/stdin.3:118 build/C/man2/symlink.2:150 build/C/man3/tempnam.3:99 build/C/man3/tmpfile.3:76 build/C/man3/tmpnam.3:80 build/C/man3/wprintf.3:195 build/C/man2/write.2:188
413 #: build/C/man3/fclose.3:100
415 "Note that B<fclose>() only flushes the user space buffers provided by the C "
416 "library. To ensure that the data is physically stored on disk the kernel "
417 "buffers must be flushed too, for example, with B<sync>(2) or B<fsync>(2)."
421 #: build/C/man3/fclose.3:106
422 msgid "B<close>(2), B<fcloseall>(3), B<fflush>(3), B<fopen>(3), B<setbuf>(3)"
426 #: build/C/man3/fcloseall.3:24
432 #: build/C/man3/fcloseall.3:24
438 #: build/C/man3/fcloseall.3:27
439 msgid "fcloseall - close all open streams"
443 #: build/C/man3/fcloseall.3:31 build/C/man3/fopencookie.3:31
446 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
447 "B<#include E<lt>stdio.hE<gt>>\n"
451 #: build/C/man3/fcloseall.3:33
453 msgid "B<int fcloseall(void);>\n"
457 #: build/C/man3/fcloseall.3:42
459 "The B<fcloseall>() function closes all of the calling process's open "
460 "streams. Buffered output for each stream is written before it is closed (as "
461 "for B<fflush>(3)); buffered input is discarded."
465 #: build/C/man3/fcloseall.3:49
466 msgid "The standard streams, I<stdin>, I<stdout>, and I<stderr> are also closed."
470 #: build/C/man3/fcloseall.3:54
472 "This function returns 0 if all files were successfully closed; on error, "
473 "B<EOF> is returned."
477 #: build/C/man3/fcloseall.3:56
478 msgid "This function is a GNU extension."
482 #: build/C/man3/fcloseall.3:62
483 msgid "B<close>(2), B<fclose>(3), B<fflush>(3), B<fopen>(3), B<setbuf>(3)"
487 #: build/C/man3/ferror.3:42
493 #: build/C/man3/ferror.3:42 build/C/man3/flockfile.3:23 build/C/man3/unlocked_stdio.3:23
499 #: build/C/man3/ferror.3:45
500 msgid "clearerr, feof, ferror, fileno - check and reset stream status"
504 #: build/C/man3/ferror.3:49
505 msgid "B<void clearerr(FILE *>I<stream>B<);>"
509 #: build/C/man3/ferror.3:51
510 msgid "B<int feof(FILE *>I<stream>B<);>"
514 #: build/C/man3/ferror.3:53
515 msgid "B<int ferror(FILE *>I<stream>B<);>"
519 #: build/C/man3/ferror.3:55
520 msgid "B<int fileno(FILE *>I<stream>B<);>"
524 #: build/C/man3/ferror.3:63
525 msgid "B<fileno>(): _POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE"
529 #: build/C/man3/ferror.3:68
531 "The function B<clearerr>() clears the end-of-file and error indicators for "
532 "the stream pointed to by I<stream>."
536 #: build/C/man3/ferror.3:77
538 "The function B<feof>() tests the end-of-file indicator for the stream "
539 "pointed to by I<stream>, returning nonzero if it is set. The end-of-file "
540 "indicator can only be cleared by the function B<clearerr>()."
544 #: build/C/man3/ferror.3:86
546 "The function B<ferror>() tests the error indicator for the stream pointed "
547 "to by I<stream>, returning nonzero if it is set. The error indicator can "
548 "only be reset by the B<clearerr>() function."
552 #: build/C/man3/ferror.3:92
554 "The function B<fileno>() examines the argument I<stream> and returns its "
555 "integer descriptor."
559 #: build/C/man3/ferror.3:95 build/C/man3/fgetwc.3:53 build/C/man3/fputwc.3:52 build/C/man3/fread.3:81 build/C/man3/gets.3:109 build/C/man3/puts.3:82
560 msgid "For nonlocking counterparts, see B<unlocked_stdio>(3)."
564 #: build/C/man3/ferror.3:105
566 "These functions should not fail and do not set the external variable "
567 "I<errno>. (However, in case B<fileno>() detects that its argument is not a "
568 "valid stream, it must return -1 and set I<errno> to B<EBADF>.)"
572 #: build/C/man3/ferror.3:112
574 "The functions B<clearerr>(), B<feof>(), and B<ferror>() conform to C89 and "
579 #: build/C/man3/ferror.3:117
580 msgid "B<open>(2), B<fdopen>(3), B<stdio>(3), B<unlocked_stdio>(3)"
584 #: build/C/man3/fflush.3:43
590 #: build/C/man3/fflush.3:43
596 #: build/C/man3/fflush.3:46
597 msgid "fflush - flush a stream"
601 #: build/C/man3/fflush.3:50
602 msgid "B<int fflush(FILE *>I<stream>B<);>"
606 #: build/C/man3/fflush.3:61
608 "For output streams, B<fflush>() forces a write of all user-space buffered "
609 "data for the given output or update I<stream> via the stream's underlying "
610 "write function. For input streams, B<fflush>() discards any buffered data "
611 "that has been fetched from the underlying file, but has not been consumed by "
612 "the application. The open status of the stream is unaffected."
616 #: build/C/man3/fflush.3:69
618 "If the I<stream> argument is NULL, B<fflush>() flushes I<all> open output "
623 #: build/C/man3/fflush.3:72
624 msgid "For a nonlocking counterpart, see B<unlocked_stdio>(3)."
628 #: build/C/man3/fflush.3:79
630 "Upon successful completion 0 is returned. Otherwise, B<EOF> is returned and "
631 "I<errno> is set to indicate the error."
635 #: build/C/man3/fflush.3:84
636 msgid "I<Stream> is not an open stream, or is not open for writing."
640 #: build/C/man3/fflush.3:91
642 "The function B<fflush>() may also fail and set I<errno> for any of the "
643 "errors specified for B<write>(2)."
647 #: build/C/man3/fflush.3:93
648 msgid "C89, C99, POSIX.1-2001, POSIX.1-2008."
651 #. Verified on: Solaris 8.
653 #: build/C/man3/fflush.3:97
655 "The standards do not specify the behavior for input streams. Most other "
656 "implementations behave the same as Linux."
660 #: build/C/man3/fflush.3:106
662 "Note that B<fflush>() only flushes the user space buffers provided by the C "
663 "library. To ensure that the data is physically stored on disk the kernel "
664 "buffers must be flushed too, for example, with B<sync>(2) or B<fsync>(2)."
668 #: build/C/man3/fflush.3:114
670 "B<fsync>(2), B<sync>(2), B<write>(2), B<fclose>(3), B<fopen>(3), "
671 "B<setbuf>(3), B<unlocked_stdio>(3)"
675 #: build/C/man3/fgetwc.3:16
681 #: build/C/man3/fgetwc.3:16 build/C/man3/fputwc.3:14
687 #: build/C/man3/fgetwc.3:19
688 msgid "fgetwc, getwc - read a wide character from a FILE stream"
692 #: build/C/man3/fgetwc.3:24 build/C/man3/fmemopen.3:18 build/C/man3/fputwc.3:22 build/C/man3/unlocked_stdio.3:52
694 msgid "B<#include E<lt>wchar.hE<gt>>\n"
698 #: build/C/man3/fgetwc.3:27
701 "B<wint_t fgetwc(FILE *>I<stream>B<);>\n"
702 "B<wint_t getwc(FILE *>I<stream>B<);>\n"
706 #: build/C/man3/fgetwc.3:42
708 "The B<fgetwc>() function is the wide-character equivalent of the "
709 "B<fgetc>(3) function. It reads a wide character from I<stream> and returns "
710 "it. If the end of stream is reached, or if I<ferror(stream)> becomes true, "
711 "it returns B<WEOF>. If a wide-character conversion error occurs, it sets "
712 "I<errno> to B<EILSEQ> and returns B<WEOF>."
716 #: build/C/man3/fgetwc.3:50
718 "The B<getwc>() function or macro functions identically to B<fgetwc>(). It "
719 "may be implemented as a macro, and may evaluate its argument more than "
720 "once. There is no reason ever to use it."
724 #: build/C/man3/fgetwc.3:59
726 "The B<fgetwc>() function returns the next wide-character from the stream, "
731 #: build/C/man3/fgetwc.3:61 build/C/man3/fputwc.3:60
732 msgid "Apart from the usual ones, there is"
736 #: build/C/man3/fgetwc.3:61 build/C/man3/fputwc.3:60 build/C/man3/scanf.3:556
742 #: build/C/man3/fgetwc.3:65
743 msgid "The data obtained from the input stream does not form a valid character."
747 #: build/C/man3/fgetwc.3:67 build/C/man3/fputwc.3:65
748 msgid "C99, POSIX.1-2001."
752 #: build/C/man3/fgetwc.3:74
754 "The behavior of B<fgetwc>() depends on the B<LC_CTYPE> category of the "
759 #: build/C/man3/fgetwc.3:82
761 "In the absence of additional information passed to the B<fopen>(3) call, it "
762 "is reasonable to expect that B<fgetwc>() will actually read a multibyte "
763 "sequence from the stream and then convert it to a wide character."
767 #: build/C/man3/fgetwc.3:87
768 msgid "B<fgetws>(3), B<fputwc>(3), B<ungetwc>(3), B<unlocked_stdio>(3)"
772 #: build/C/man3/flockfile.3:23
778 #: build/C/man3/flockfile.3:26
779 msgid "flockfile, ftrylockfile, funlockfile - lock FILE for stdio"
783 #: build/C/man3/flockfile.3:31
785 msgid "B<void flockfile(FILE *>I<filehandle>B<);>\n"
789 #: build/C/man3/flockfile.3:33
791 msgid "B<int ftrylockfile(FILE *>I<filehandle>B<);>\n"
795 #: build/C/man3/flockfile.3:35
797 msgid "B<void funlockfile(FILE *>I<filehandle>B<);>\n"
801 #: build/C/man3/flockfile.3:44 build/C/man3/wprintf.3:41
802 msgid "All functions shown above:"
806 #: build/C/man3/flockfile.3:47
808 "_POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE "
813 #: build/C/man3/flockfile.3:61
815 "The stdio functions are thread-safe. This is achieved by assigning to each "
816 "I<FILE> object a lockcount and (if the lockcount is nonzero) an owning "
817 "thread. For each library call, these functions wait until the I<FILE> "
818 "object is no longer locked by a different thread, then lock it, do the "
819 "requested I/O, and unlock the object again."
823 #: build/C/man3/flockfile.3:67
825 "(Note: this locking has nothing to do with the file locking done by "
826 "functions like B<flock>(2) and B<lockf>(3).)"
830 #: build/C/man3/flockfile.3:75
832 "All this is invisible to the C-programmer, but there may be two reasons to "
833 "wish for more detailed control. On the one hand, maybe a series of I/O "
834 "actions by one thread belongs together, and should not be interrupted by the "
835 "I/O of some other thread. On the other hand, maybe the locking overhead "
836 "should be avoided for greater efficiency."
840 #: build/C/man3/flockfile.3:92
842 "To this end, a thread can explicitly lock the I<FILE> object, then do its "
843 "series of I/O actions, then unlock. This prevents other threads from coming "
844 "in between. If the reason for doing this was to achieve greater efficiency, "
845 "one does the I/O with the nonlocking versions of the stdio functions: with "
846 "B<getc_unlocked>(3) and B<putc_unlocked>(3) instead of B<getc>(3) and "
851 #: build/C/man3/flockfile.3:99
853 "The B<flockfile>() function waits for I<*filehandle> to be no longer locked "
854 "by a different thread, then makes the current thread owner of "
855 "I<*filehandle>, and increments the lockcount."
859 #: build/C/man3/flockfile.3:103
860 msgid "The B<funlockfile>() function decrements the lock count."
864 #: build/C/man3/flockfile.3:112
866 "The B<ftrylockfile>() function is a nonblocking version of B<flockfile>(). "
867 "It does nothing in case some other thread owns I<*filehandle>, and it "
868 "obtains ownership and increments the lockcount otherwise."
872 #: build/C/man3/flockfile.3:117
874 "The B<ftrylockfile>() function returns zero for success (the lock was "
875 "obtained), and nonzero for failure."
879 #: build/C/man3/flockfile.3:119
884 #: build/C/man3/flockfile.3:121 build/C/man3/popen.3:169
885 msgid "POSIX.1-2001."
889 #: build/C/man3/flockfile.3:121
895 #: build/C/man3/flockfile.3:127
897 "These functions are available when B<_POSIX_THREAD_SAFE_FUNCTIONS> is "
898 "defined. They are in libc since libc 5.1.1 and in glibc since glibc 2.0."
902 #: build/C/man3/flockfile.3:129
903 msgid "B<unlocked_stdio>(3)"
907 #: build/C/man3/fmemopen.3:6
913 #: build/C/man3/fmemopen.3:9
914 msgid "fmemopen, open_memstream, open_wmemstream - open memory as stream"
918 #: build/C/man3/fmemopen.3:14
921 "B<FILE *fmemopen(void *>I<buf>B<, size_t >I<size>B<, const char "
926 #: build/C/man3/fmemopen.3:16
928 msgid "B<FILE *open_memstream(char **>I<ptr>B<, size_t *>I<sizeloc>B<);>\n"
932 #: build/C/man3/fmemopen.3:20
934 msgid "B<FILE *open_wmemstream(wchar_t **>I<ptr>B<, size_t *>I<sizeloc>B<);>\n"
938 #: build/C/man3/fmemopen.3:30
939 msgid "B<fmemopen>(), B<open_memstream>(), B<open_wmemstream>():"
943 #: build/C/man3/fmemopen.3:53
945 "The B<fmemopen>() function opens a stream that permits the access specified "
946 "by I<mode>. The stream allows I/O to be performed on the string or memory "
947 "buffer pointed to by I<buf>. This buffer must be at least I<size> bytes "
952 #: build/C/man3/fmemopen.3:73
954 "The argument I<mode> is the same as for B<fopen>(3). If I<mode> specifies "
955 "an append mode, then the initial file position is set to the location of the "
956 "first null byte (\\(aq\\e0\\(aq) in the buffer; otherwise the initial file "
957 "position is set to the start of the buffer. Since glibc 2.9, the letter 'b' "
958 "may be specified as the second character in I<mode>. This provides "
959 "\"binary\" mode: writes don't implicitly add a terminating null byte, and "
960 "B<fseek>(3) B<SEEK_END> is relative to the end of the buffer (i.e., the "
961 "value specified by the I<size> argument), rather than the current string "
966 #: build/C/man3/fmemopen.3:85
968 "When a stream that has been opened for writing is flushed (B<fflush>(3)) or "
969 "closed (B<fclose>(3)), a null byte is written at the end of the buffer if "
970 "there is space. The caller should ensure that an extra byte is available in "
971 "the buffer (and that I<size> counts that byte) to allow for this."
974 #. See http://sourceware.org/bugzilla/show_bug.cgi?id=1995
976 #. http://sources.redhat.com/ml/libc-alpha/2006-04/msg00064.html
978 #: build/C/man3/fmemopen.3:103
980 "Attempts to write more than I<size> bytes to the buffer result in an error. "
981 "(By default, such errors will only be visible when the I<stdio> buffer is "
982 "flushed. Disabling buffering with I<setbuf(fp,\\ NULL)> may be useful to "
983 "detect errors at the time of an output operation. Alternatively, the caller "
984 "can explicitly set I<buf> as the stdio stream buffer, at the same time "
985 "informing stdio of the buffer's size, using I<setbuffer(fp, buf, size)>.)"
989 #: build/C/man3/fmemopen.3:111
991 "In a stream opened for reading, null bytes (\\(aq\\e0\\(aq) in the buffer do "
992 "not cause read operations to return an end-of-file indication. A read from "
993 "the buffer will only indicate end-of-file when the file pointer advances "
994 "I<size> bytes past the start of the buffer."
998 #: build/C/man3/fmemopen.3:126
1000 "If I<buf> is specified as NULL, then B<fmemopen>() dynamically allocates a "
1001 "buffer I<size> bytes long. This is useful for an application that wants to "
1002 "write data to a temporary buffer and then read it back again. The buffer is "
1003 "automatically freed when the stream is closed. Note that the caller has no "
1004 "way to obtain a pointer to the temporary buffer allocated by this call (but "
1005 "see B<open_memstream>() below)."
1009 #: build/C/man3/fmemopen.3:137
1011 "The B<open_memstream>() function opens a stream for writing to a buffer. "
1012 "The buffer is dynamically allocated (as with B<malloc>(3)), and "
1013 "automatically grows as required. After closing the stream, the caller "
1014 "should B<free>(3) this buffer."
1018 #: build/C/man3/fmemopen.3:152
1020 "When the stream is closed (B<fclose>(3)) or flushed (B<fflush>(3)), the "
1021 "locations pointed to by I<ptr> and I<sizeloc> are updated to contain, "
1022 "respectively, a pointer to the buffer and the current size of the buffer. "
1023 "These values remain valid only as long as the caller performs no further "
1024 "output on the stream. If further output is performed, then the stream must "
1025 "again be flushed before trying to access these variables."
1029 #: build/C/man3/fmemopen.3:158
1031 "A null byte is maintained at the end of the buffer. This byte is I<not> "
1032 "included in the size value stored at I<sizeloc>."
1036 #: build/C/man3/fmemopen.3:166
1038 "The stream's file position can be changed with B<fseek>(3) or "
1039 "B<fseeko>(3). Moving the file position past the end of the data already "
1040 "written fills the intervening space with zeros."
1044 #: build/C/man3/fmemopen.3:172
1046 "The B<open_wmemstream>() is similar to B<open_memstream>(), but operates on "
1047 "wide characters instead of bytes."
1051 #: build/C/man3/fmemopen.3:184
1053 "Upon successful completion B<fmemopen>(), B<open_memstream>() and "
1054 "B<open_wmemstream>() return a I<FILE> pointer. Otherwise, NULL is returned "
1055 "and I<errno> is set to indicate the error."
1059 #: build/C/man3/fmemopen.3:184 build/C/man3/fmtmsg.3:218 build/C/man3/getline.3:130 build/C/man2/pipe.2:113 build/C/man2/readv.2:207
1065 #: build/C/man3/fmemopen.3:191
1067 "B<fmemopen>() and B<open_memstream>() were already available in glibc "
1068 "1.0.x. B<open_wmemstream>() is available since glibc 2.4."
1072 #: build/C/man3/fmemopen.3:195
1074 "POSIX.1-2008. These functions are not specified in POSIX.1-2001, and are "
1075 "not widely available on other systems."
1079 #: build/C/man3/fmemopen.3:201
1081 "There is no file descriptor associated with the file stream returned by "
1082 "these functions (i.e., B<fileno>(3) will return an error if called on the "
1086 #. http://sourceware.org/bugzilla/show_bug.cgi?id=1996
1088 #: build/C/man3/fmemopen.3:208
1090 "In glibc before version 2.7, seeking past the end of a stream created by "
1091 "B<open_memstream>() does not enlarge the buffer; instead the B<fseek>(3) "
1092 "call fails, returning -1."
1096 #: build/C/man3/fmemopen.3:208 build/C/man3/fmtmsg.3:240 build/C/man3/fopencookie.3:244 build/C/man3/getline.3:139 build/C/man2/pipe.2:124 build/C/man3/printf.3:974 build/C/man2/readlink.2:155 build/C/man2/readv.2:263
1102 #: build/C/man3/fmemopen.3:218
1104 "The program below uses B<fmemopen>() to open an input buffer, and "
1105 "B<open_memstream>() to open a dynamically sized output buffer. The program "
1106 "scans its input string (taken from the program's first command-line "
1107 "argument) reading integers, and writes the squares of these integers to the "
1108 "output buffer. An example of the output produced by this program is the "
1113 #: build/C/man3/fmemopen.3:223
1116 "$B< ./a.out \\(aq1 23 43\\(aq>\n"
1117 "size=11; ptr=1 529 1849\n"
1121 #: build/C/man3/fmemopen.3:225 build/C/man3/fopencookie.3:268
1123 msgid "Program source"
1127 #: build/C/man3/fmemopen.3:232
1130 "#define _GNU_SOURCE\n"
1131 "#include E<lt>string.hE<gt>\n"
1132 "#include E<lt>stdio.hE<gt>\n"
1133 "#include E<lt>stdlib.hE<gt>\n"
1137 #: build/C/man3/fmemopen.3:235
1140 "#define handle_error(msg) \\e\n"
1141 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
1145 #: build/C/man3/fmemopen.3:243
1149 "main(int argc, char *argv[])\n"
1151 " FILE *out, *in;\n"
1158 #: build/C/man3/fmemopen.3:248
1161 " if (argc != 2) {\n"
1162 "\tfprintf(stderr, \"Usage: %s E<lt>fileE<gt>\\en\", argv[0]);\n"
1163 "\texit(EXIT_FAILURE);\n"
1168 #: build/C/man3/fmemopen.3:252
1171 " in = fmemopen(argv[1], strlen(argv[1]), \"r\");\n"
1172 " if (in == NULL)\n"
1173 " handle_error(\"fmemopen\");\n"
1177 #: build/C/man3/fmemopen.3:256
1180 " out = open_memstream(&ptr, &size);\n"
1181 " if (out == NULL)\n"
1182 " handle_error(\"open_memstream\");\n"
1186 #: build/C/man3/fmemopen.3:261
1190 " s = fscanf(in, \"%d\", &v);\n"
1191 " if (s E<lt>= 0)\n"
1196 #: build/C/man3/fmemopen.3:272
1199 " s = fprintf(out, \"%d \", v * v);\n"
1201 " handle_error(\"fprintf\");\n"
1205 " printf(\"size=%ld; ptr=%s\\en\", (long) size, ptr);\n"
1207 " exit(EXIT_SUCCESS);\n"
1212 #: build/C/man3/fmemopen.3:276
1213 msgid "B<fopen>(3), B<fopencookie>(3)"
1217 #: build/C/man3/fmtmsg.3:9
1223 #: build/C/man3/fmtmsg.3:9
1229 #: build/C/man3/fmtmsg.3:12
1230 msgid "fmtmsg - print formatted error messages"
1234 #: build/C/man3/fmtmsg.3:15
1236 msgid "B<#include E<lt>fmtmsg.hE<gt>>\n"
1240 #: build/C/man3/fmtmsg.3:17
1242 msgid "B<int fmtmsg(long >I<classification>B<, const char *>I<label>B<,>\n"
1246 #: build/C/man3/fmtmsg.3:19
1248 msgid "B< int >I<severity>B<, const char *>I<text>B<,>\n"
1252 #: build/C/man3/fmtmsg.3:21
1254 msgid "B< const char *>I<action>B<, const char *>I<tag>B<);>\n"
1258 #: build/C/man3/fmtmsg.3:32
1260 "This function displays a message described by its arguments on the device(s) "
1261 "specified in the I<classification> argument. For messages written to "
1262 "I<stderr>, the format depends on the B<MSGVERB> environment variable."
1266 #: build/C/man3/fmtmsg.3:39
1268 "The I<label> argument identifies the source of the message. The string must "
1269 "consist of two colon separated parts where the first part has not more than "
1270 "10 and the second part not more than 14 characters."
1274 #: build/C/man3/fmtmsg.3:43
1275 msgid "The I<text> argument describes the condition of the error."
1279 #: build/C/man3/fmtmsg.3:48
1281 "The I<action> argument describes possible steps to recover from the error. "
1282 "If it is printed, it is prefixed by \"TO FIX: \"."
1286 #: build/C/man3/fmtmsg.3:56
1288 "The I<tag> argument is a reference to the online documentation where more "
1289 "information can be found. It should contain the I<label> value and a unique "
1290 "identification number."
1294 #: build/C/man3/fmtmsg.3:56
1296 msgid "Dummy arguments"
1300 #: build/C/man3/fmtmsg.3:75
1302 "Each of the arguments can have a dummy value. The dummy classification "
1303 "value B<MM_NULLMC> (0L) does not specify any output, so nothing is printed. "
1304 "The dummy severity value B<NO_SEV> (0) says that no severity is supplied. "
1305 "The values B<MM_NULLLBL>, B<MM_NULLTXT>, B<MM_NULLACT>, B<MM_NULLTAG> are "
1306 "synonyms for I<((char *) 0)>, the empty string, and B<MM_NULLSEV> is a "
1307 "synonym for B<NO_SEV>."
1311 #: build/C/man3/fmtmsg.3:75
1313 msgid "The classification argument"
1317 #: build/C/man3/fmtmsg.3:79
1319 "The I<classification> argument is the sum of values describing 4 types of "
1324 #: build/C/man3/fmtmsg.3:82
1325 msgid "The first value defines the output channel."
1329 #: build/C/man3/fmtmsg.3:82
1335 #: build/C/man3/fmtmsg.3:86
1336 msgid "Output to I<stderr>."
1340 #: build/C/man3/fmtmsg.3:86
1342 msgid "B<MM_CONSOLE>"
1346 #: build/C/man3/fmtmsg.3:89
1347 msgid "Output to the system console."
1351 #: build/C/man3/fmtmsg.3:89
1353 msgid "B<MM_PRINT | MM_CONSOLE>"
1357 #: build/C/man3/fmtmsg.3:92
1358 msgid "Output to both."
1362 #: build/C/man3/fmtmsg.3:94
1363 msgid "The second value is the source of the error:"
1367 #: build/C/man3/fmtmsg.3:94
1373 #: build/C/man3/fmtmsg.3:97
1374 msgid "A hardware error occurred."
1378 #: build/C/man3/fmtmsg.3:97
1384 #: build/C/man3/fmtmsg.3:100
1385 msgid "A firmware error occurred."
1389 #: build/C/man3/fmtmsg.3:100
1395 #: build/C/man3/fmtmsg.3:103
1396 msgid "A software error occurred."
1400 #: build/C/man3/fmtmsg.3:105
1401 msgid "The third value encodes the detector of the problem:"
1405 #: build/C/man3/fmtmsg.3:105
1411 #: build/C/man3/fmtmsg.3:108
1412 msgid "It is detected by an application."
1416 #: build/C/man3/fmtmsg.3:108
1422 #: build/C/man3/fmtmsg.3:111
1423 msgid "It is detected by a utility."
1427 #: build/C/man3/fmtmsg.3:111
1433 #: build/C/man3/fmtmsg.3:114
1434 msgid "It is detected by the operating system."
1438 #: build/C/man3/fmtmsg.3:116
1439 msgid "The fourth value shows the severity of the incident:"
1443 #: build/C/man3/fmtmsg.3:116
1445 msgid "B<MM_RECOVER>"
1449 #: build/C/man3/fmtmsg.3:119
1450 msgid "It is a recoverable error."
1454 #: build/C/man3/fmtmsg.3:119
1456 msgid "B<MM_NRECOV>"
1460 #: build/C/man3/fmtmsg.3:122
1461 msgid "It is a nonrecoverable error."
1465 #: build/C/man3/fmtmsg.3:122
1467 msgid "The severity argument"
1471 #: build/C/man3/fmtmsg.3:126
1472 msgid "The I<severity> argument can take one of the following values:"
1476 #: build/C/man3/fmtmsg.3:126
1482 #: build/C/man3/fmtmsg.3:129
1483 msgid "No severity is printed."
1487 #: build/C/man3/fmtmsg.3:129
1493 #: build/C/man3/fmtmsg.3:132
1494 msgid "This value is printed as HALT."
1498 #: build/C/man3/fmtmsg.3:132
1504 #: build/C/man3/fmtmsg.3:135
1505 msgid "This value is printed as ERROR."
1509 #: build/C/man3/fmtmsg.3:135
1511 msgid "B<MM_WARNING>"
1515 #: build/C/man3/fmtmsg.3:138
1516 msgid "This value is printed as WARNING."
1520 #: build/C/man3/fmtmsg.3:138
1526 #: build/C/man3/fmtmsg.3:141
1527 msgid "This value is printed as INFO."
1531 #: build/C/man3/fmtmsg.3:148
1533 "The numeric values are between 0 and 4. Using B<addseverity>(3) or the "
1534 "environment variable B<SEV_LEVEL> you can add more levels and strings to "
1539 #: build/C/man3/fmtmsg.3:150
1540 msgid "The function can return 4 values:"
1544 #: build/C/man3/fmtmsg.3:150
1550 #: build/C/man3/fmtmsg.3:153
1551 msgid "Everything went smooth."
1555 #: build/C/man3/fmtmsg.3:153
1561 #: build/C/man3/fmtmsg.3:156
1562 msgid "Complete failure."
1566 #: build/C/man3/fmtmsg.3:156
1572 #: build/C/man3/fmtmsg.3:160
1573 msgid "Error writing to I<stderr>."
1577 #: build/C/man3/fmtmsg.3:160
1583 #: build/C/man3/fmtmsg.3:163
1584 msgid "Error writing to the console."
1588 #: build/C/man3/fmtmsg.3:163
1594 #: build/C/man3/fmtmsg.3:174
1596 "The environment variable B<MSGVERB> (\"message verbosity\") can be used to "
1597 "suppress parts of the output to I<stderr>. (It does not influence output to "
1598 "the console.) When this variable is defined, is non-NULL, and is a "
1599 "colon-separated list of valid keywords, then only the parts of the message "
1600 "corresponding to these keywords is printed. Valid keywords are \"label\", "
1601 "\"severity\", \"text\", \"action\" and \"tag\"."
1605 #: build/C/man3/fmtmsg.3:186
1607 "The environment variable B<SEV_LEVEL> can be used to introduce new severity "
1608 "levels. By default, only the five severity levels described above are "
1609 "available. Any other numeric value would make B<fmtmsg>() print nothing. "
1610 "If the user puts B<SEV_LEVEL> with a format like"
1614 #: build/C/man3/fmtmsg.3:189
1615 msgid "SEV_LEVEL=[description[:description[:...]]]"
1619 #: build/C/man3/fmtmsg.3:194
1621 "in the environment of the process before the first call to B<fmtmsg>(), "
1622 "where each description is of the form"
1626 #: build/C/man3/fmtmsg.3:197
1627 msgid "severity-keyword,level,printstring"
1631 #: build/C/man3/fmtmsg.3:204
1633 "then B<fmtmsg>() will also accept the indicated values for the level (in "
1634 "addition to the standard levels 0-4), and use the indicated printstring when "
1635 "such a level occurs."
1639 #: build/C/man3/fmtmsg.3:218
1641 "The severity-keyword part is not used by B<fmtmsg>() but it has to be "
1642 "present. The level part is a string representation of a number. The "
1643 "numeric value must be a number greater than 4. This value must be used in "
1644 "the severity argument of B<fmtmsg>() to select this class. It is not "
1645 "possible to overwrite any of the predefined classes. The printstring is the "
1646 "string printed when a message of this class is processed by B<fmtmsg>()."
1650 #: build/C/man3/fmtmsg.3:221
1651 msgid "B<fmtmsg>() is provided in glibc since version 2.1."
1655 #: build/C/man3/fmtmsg.3:236
1657 "The functions B<fmtmsg>() and B<addseverity>(3), and environment variables "
1658 "B<MSGVERB> and B<SEV_LEVEL> come from System V. The function B<fmtmsg>() "
1659 "and the environment variable B<MSGVERB> are described in POSIX.1-2001."
1663 #: build/C/man3/fmtmsg.3:240
1665 "System V and UnixWare man pages tell us that these functions have been "
1666 "replaced by \"pfmt() and addsev()\" or by \"pfmt(), vpfmt(), lfmt(), and "
1667 "vlfmt()\", and will be removed later."
1671 #: build/C/man3/fmtmsg.3:245
1674 "#include E<lt>stdio.hE<gt>\n"
1675 "#include E<lt>stdlib.hE<gt>\n"
1676 "#include E<lt>fmtmsg.hE<gt>\n"
1680 #: build/C/man3/fmtmsg.3:251
1686 " long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;\n"
1691 #: build/C/man3/fmtmsg.3:272
1694 " err = fmtmsg(class, \"util-linux:mount\", MM_ERROR,\n"
1695 " \"unknown mount option\", \"See mount(8).\",\n"
1696 " \"util-linux:mount:017\");\n"
1701 " printf(\"Nothing printed\\en\");\n"
1704 " printf(\"Nothing printed to stderr\\en\");\n"
1707 " printf(\"No console output\\en\");\n"
1710 " printf(\"Unknown error from fmtmsg()\\en\");\n"
1712 " exit(EXIT_SUCCESS);\n"
1717 #: build/C/man3/fmtmsg.3:275
1718 msgid "The output should be:"
1722 #: build/C/man3/fmtmsg.3:279
1725 " util-linux:mount: ERROR: unknown mount option\n"
1726 " TO FIX: See mount(8). util-linux:mount:017\n"
1730 #: build/C/man3/fmtmsg.3:282
1735 #: build/C/man3/fmtmsg.3:285
1737 msgid " MSGVERB=text:action; export MSGVERB\n"
1741 #: build/C/man3/fmtmsg.3:288
1742 msgid "the output becomes:"
1746 #: build/C/man3/fmtmsg.3:292
1749 " unknown mount option\n"
1750 " TO FIX: See mount(8).\n"
1754 #: build/C/man3/fmtmsg.3:296
1755 msgid "B<addseverity>(3), B<perror>(3)"
1759 #: build/C/man3/fopen.3:42
1765 #: build/C/man3/fopen.3:45
1766 msgid "fopen, fdopen, freopen - stream open functions"
1770 #: build/C/man3/fopen.3:50
1772 msgid "B<FILE *fopen(const char *>I<path>B<, const char *>I<mode>B<);>\n"
1776 #: build/C/man3/fopen.3:52
1778 msgid "B<FILE *fdopen(int >I<fd>B<, const char *>I<mode>B<);>\n"
1782 #: build/C/man3/fopen.3:54
1785 "B<FILE *freopen(const char *>I<path>B<, const char *>I<mode>B<, FILE "
1786 "*>I<stream>B<);>\n"
1790 #: build/C/man3/fopen.3:63
1791 msgid "B<fdopen>(): _POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE"
1795 #: build/C/man3/fopen.3:69
1797 "The B<fopen>() function opens the file whose name is the string pointed to "
1798 "by I<path> and associates a stream with it."
1802 #: build/C/man3/fopen.3:74
1804 "The argument I<mode> points to a string beginning with one of the following "
1805 "sequences (Additional characters may follow these sequences.):"
1809 #: build/C/man3/fopen.3:74
1815 #: build/C/man3/fopen.3:78
1817 "Open text file for reading. The stream is positioned at the beginning of "
1822 #: build/C/man3/fopen.3:78
1828 #: build/C/man3/fopen.3:82
1830 "Open for reading and writing. The stream is positioned at the beginning of "
1835 #: build/C/man3/fopen.3:82
1841 #: build/C/man3/fopen.3:86
1843 "Truncate file to zero length or create text file for writing. The stream is "
1844 "positioned at the beginning of the file."
1848 #: build/C/man3/fopen.3:86
1854 #: build/C/man3/fopen.3:92
1856 "Open for reading and writing. The file is created if it does not exist, "
1857 "otherwise it is truncated. The stream is positioned at the beginning of the "
1862 #: build/C/man3/fopen.3:92 build/C/man3/scanf.3:444
1868 #: build/C/man3/fopen.3:97
1870 "Open for appending (writing at end of file). The file is created if it does "
1871 "not exist. The stream is positioned at the end of the file."
1875 #: build/C/man3/fopen.3:97
1881 #: build/C/man3/fopen.3:103
1883 "Open for reading and appending (writing at end of file). The file is "
1884 "created if it does not exist. The initial file position for reading is at "
1885 "the beginning of the file, but output is always appended to the end of the "
1890 #: build/C/man3/fopen.3:116
1892 "The I<mode> string can also include the letter \\(aqb\\(aq either as a last "
1893 "character or as a character between the characters in any of the "
1894 "two-character strings described above. This is strictly for compatibility "
1895 "with C89 and has no effect; the \\(aqb\\(aq is ignored on all POSIX "
1896 "conforming systems, including Linux. (Other systems may treat text files "
1897 "and binary files differently, and adding the \\(aqb\\(aq may be a good idea "
1898 "if you do I/O to a binary file and expect that your program may be ported to "
1899 "non-UNIX environments.)"
1903 #: build/C/man3/fopen.3:119
1904 msgid "See NOTES below for details of glibc extensions for I<mode>."
1908 #: build/C/man3/fopen.3:124
1910 "Any created files will have mode B<S_IRUSR> | B<S_IWUSR> | B<S_IRGRP> | "
1911 "B<S_IWGRP> | B<S_IROTH> | B<S_IWOTH> (0666), as modified by the process's "
1912 "umask value (see B<umask>(2))."
1916 #: build/C/man3/fopen.3:139
1918 "Reads and writes may be intermixed on read/write streams in any order. Note "
1919 "that ANSI C requires that a file positioning function intervene between "
1920 "output and input, unless an input operation encounters end-of-file. (If "
1921 "this condition is not met, then a read is allowed to return the result of "
1922 "writes other than the most recent.) Therefore it is good practice (and "
1923 "indeed sometimes necessary under Linux) to put an B<fseek>(3) or "
1924 "B<fgetpos>(3) operation between write and read operations on such a "
1925 "stream. This operation may be an apparent no-op (as in I<fseek(..., 0L, "
1926 "SEEK_CUR)> called for its synchronizing side effect."
1930 #: build/C/man3/fopen.3:144
1932 "Opening a file in append mode (B<a> as the first character of I<mode>) "
1933 "causes all subsequent write operations to this stream to occur at "
1934 "end-of-file, as if preceded by an"
1938 #: build/C/man3/fopen.3:147
1940 msgid " fseek(stream,0,SEEK_END);\n"
1944 #: build/C/man3/fopen.3:150
1949 #: build/C/man3/fopen.3:171
1951 "The B<fdopen>() function associates a stream with the existing file "
1952 "descriptor, I<fd>. The I<mode> of the stream (one of the values \"r\", "
1953 "\"r+\", \"w\", \"w+\", \"a\", \"a+\") must be compatible with the mode of "
1954 "the file descriptor. The file position indicator of the new stream is set "
1955 "to that belonging to I<fd>, and the error and end-of-file indicators are "
1956 "cleared. Modes \"w\" or \"w+\" do not cause truncation of the file. The "
1957 "file descriptor is not dup'ed, and will be closed when the stream created by "
1958 "B<fdopen>() is closed. The result of applying B<fdopen>() to a shared "
1959 "memory object is undefined."
1963 #: build/C/man3/fopen.3:189
1965 "The B<freopen>() function opens the file whose name is the string pointed "
1966 "to by I<path> and associates the stream pointed to by I<stream> with it. "
1967 "The original stream (if it exists) is closed. The I<mode> argument is used "
1968 "just as in the B<fopen>() function. The primary use of the B<freopen>() "
1969 "function is to change the file associated with a standard text stream "
1970 "(I<stderr>, I<stdin>, or I<stdout>)."
1974 #: build/C/man3/fopen.3:201
1976 "Upon successful completion B<fopen>(), B<fdopen>() and B<freopen>() return "
1977 "a I<FILE> pointer. Otherwise, NULL is returned and I<errno> is set to "
1978 "indicate the error."
1982 #: build/C/man3/fopen.3:202 build/C/man3/fseek.3:138 build/C/man3/getline.3:121 build/C/man2/llseek.2:72 build/C/man2/lseek.2:164 build/C/man2/pipe.2:102 build/C/man2/read.2:108 build/C/man2/read.2:119 build/C/man2/readlink.2:93 build/C/man2/readlink.2:102 build/C/man2/readv.2:198 build/C/man2/rename.2:136 build/C/man2/rmdir.2:67 build/C/man3/scanf.3:563 build/C/man2/write.2:148
1988 #: build/C/man3/fopen.3:212
1990 "The I<mode> provided to B<fopen>(), B<fdopen>(), or B<freopen>() was "
1995 #: build/C/man3/fopen.3:222
1997 "The B<fopen>(), B<fdopen>() and B<freopen>() functions may also fail and "
1998 "set I<errno> for any of the errors specified for the routine B<malloc>(3)."
2002 #: build/C/man3/fopen.3:229
2004 "The B<fopen>() function may also fail and set I<errno> for any of the "
2005 "errors specified for the routine B<open>(2)."
2009 #: build/C/man3/fopen.3:236
2011 "The B<fdopen>() function may also fail and set I<errno> for any of the "
2012 "errors specified for the routine B<fcntl>(2)."
2016 #: build/C/man3/fopen.3:246
2018 "The B<freopen>() function may also fail and set I<errno> for any of the "
2019 "errors specified for the routines B<open>(2), B<fclose>(3) and "
2024 #: build/C/man3/fopen.3:255
2026 "The B<fopen>() and B<freopen>() functions conform to C89. The B<fdopen>() "
2027 "function conforms to POSIX.1-1990."
2031 #: build/C/man3/fopen.3:256
2037 #: build/C/man3/fopen.3:259
2039 "The GNU C library allows the following extensions for the string specified "
2044 #: build/C/man3/fopen.3:259
2046 msgid "B<c> (since glibc 2.3.3)"
2050 #: build/C/man3/fopen.3:264
2052 "Do not make the open operation, or subsequent read and write operations, "
2053 "thread cancellation points."
2057 #: build/C/man3/fopen.3:264
2059 msgid "B<e> (since glibc 2.7)"
2063 #: build/C/man3/fopen.3:272
2065 "Open the file with the B<O_CLOEXEC> flag. See B<open>(2) for more "
2070 #: build/C/man3/fopen.3:272
2072 msgid "B<m> (since glibc 2.3)"
2077 #: build/C/man3/fopen.3:284
2079 "Attempt to access the file using B<mmap>(2), rather than I/O system calls "
2080 "(B<read>(2), B<write>(2)). Currently, use of B<mmap>(2) is only attempted "
2081 "for a file opened for reading."
2085 #: build/C/man3/fopen.3:284 build/C/man3/scanf.3:418
2091 #. FIXME document /,ccs= charset/
2093 #: build/C/man3/fopen.3:301
2095 "Open the file exclusively (like the B<O_EXCL> flag of B<open>(2)). If the "
2096 "file already exists, B<fopen>() fails, and sets I<errno> to B<EEXIST>. "
2097 "This flag is ignored for B<fdopen>()."
2101 #: build/C/man3/fopen.3:307
2102 msgid "B<open>(2), B<fclose>(3), B<fileno>(3), B<fmemopen>(3), B<fopencookie>(3)"
2106 #: build/C/man3/fopencookie.3:24
2112 #: build/C/man3/fopencookie.3:24
2118 #: build/C/man3/fopencookie.3:24 build/C/man2/link.2:31 build/C/man2/llseek.2:26 build/C/man2/lseek.2:45 build/C/man3/lseek64.3:23 build/C/man2/open.2:52 build/C/man2/pipe.2:36 build/C/man2/read.2:35 build/C/man2/readlink.2:41 build/C/man2/readv.2:30 build/C/man2/rename.2:32 build/C/man2/rmdir.2:30 build/C/man3/setbuf.3:46 build/C/man3/stdin.3:9 build/C/man2/symlink.2:32 build/C/man7/symlink.7:35 build/C/man2/unlink.2:32 build/C/man2/write.2:39
2124 #: build/C/man3/fopencookie.3:27
2125 msgid "fopencookie - opening a custom stream"
2129 #: build/C/man3/fopencookie.3:34
2132 "B<FILE *fopencookie(void *>I<cookie>B<, const char *>I<mode>B<,>\n"
2133 "B< cookie_io_functions_t >I<io_funcs>B<);>\n"
2137 #: build/C/man3/fopencookie.3:47
2139 "The B<fopencookie>() function allows the programmer to create a custom "
2140 "implementation for a standard I/O stream. This implementation can store the "
2141 "stream's data at a location of its own choosing; for example, "
2142 "B<fopencookie>() is used to implement B<fmemopen>(3), which provides a "
2143 "stream interface to data that is stored in a buffer in memory."
2147 #: build/C/man3/fopencookie.3:49
2148 msgid "In order to create a custom stream the programmer must:"
2152 #: build/C/man3/fopencookie.3:49 build/C/man3/fopencookie.3:52 build/C/man3/fopencookie.3:63 build/C/man3/scanf.3:669 build/C/man3/scanf.3:674 build/C/man3/scanf.3:680 build/C/man7/symlink.7:248 build/C/man7/symlink.7:258 build/C/man7/symlink.7:288 build/C/man7/symlink.7:348 build/C/man7/symlink.7:377 build/C/man7/symlink.7:406 build/C/man7/symlink.7:437 build/C/man7/symlink.7:450
2158 #: build/C/man3/fopencookie.3:52
2160 "Implement four \"hook\" functions that are used internally by the standard "
2161 "I/O library when performing I/O on the stream."
2165 #: build/C/man3/fopencookie.3:63
2167 "Define a \"cookie\" data type, a structure that provides bookkeeping "
2168 "information (e.g., where to store data) used by the aforementioned hook "
2169 "functions. The standard I/O package knows nothing about the contents of "
2170 "this cookie (thus it is typed as I<void\\ *> when passed to "
2171 "B<fopencookie>()), but automatically supplies the cookie as the first "
2172 "argument when calling the hook functions."
2176 #: build/C/man3/fopencookie.3:68
2178 "Call B<fopencookie>() to open a new stream and associate the cookie and "
2179 "hook functions with that stream."
2183 #: build/C/man3/fopencookie.3:76
2185 "The B<fopencookie>() function serves a purpose similar to B<fopen>(3): it "
2186 "opens a new stream and returns a pointer to a I<FILE> object that is used to "
2187 "operate on that stream."
2191 #: build/C/man3/fopencookie.3:83
2193 "The I<cookie> argument is a pointer to the caller's cookie structure that is "
2194 "to be associated with the new stream. This pointer is supplied as the first "
2195 "argument when the standard I/O library invokes any of the hook functions "
2200 #: build/C/man3/fopencookie.3:99
2202 "The I<mode> argument serves the same purpose as for B<fopen>(3). The "
2203 "following modes are supported: I<r>, I<w>, I<a>, I<r+>, I<w+>, and I<a+>. "
2204 "See B<fopen>(3) for details."
2208 #: build/C/man3/fopencookie.3:105
2210 "The I<io_funcs> argument is a structure that contains four fields pointing "
2211 "to the programmer-defined hook functions that are used to implement this "
2212 "stream. The structure is defined as follows"
2216 #: build/C/man3/fopencookie.3:114
2219 "struct cookie_io_functions_t {\n"
2220 " cookie_read_function_t *read;\n"
2221 " cookie_write_function_t *write;\n"
2222 " cookie_seek_function_t *seek;\n"
2223 " cookie_close_function_t *close;\n"
2228 #: build/C/man3/fopencookie.3:118
2229 msgid "The four fields are as follows:"
2233 #: build/C/man3/fopencookie.3:118
2235 msgid "I<cookie_read_function_t *read>"
2239 #: build/C/man3/fopencookie.3:122
2241 "This function implements read operations for the stream. When called, it "
2242 "receives three arguments:"
2246 #: build/C/man3/fopencookie.3:124
2248 msgid " ssize_t read(void *cookie, char *buf, size_t size);\n"
2252 #: build/C/man3/fopencookie.3:139
2254 "The I<buf> and I<size> arguments are, respectively, a buffer into which "
2255 "input data can be placed and the size of that buffer. As its function "
2256 "result, the I<read> function should return the number of bytes copied into "
2257 "I<buf>, 0 on end of file, or -1 on error. The I<read> function should "
2258 "update the stream offset appropriately."
2262 #: build/C/man3/fopencookie.3:144
2264 "If I<*read> is a NULL pointer, then reads from the custom stream always "
2265 "return end of file."
2269 #: build/C/man3/fopencookie.3:144
2271 msgid "I<cookie_write_function_t *write>"
2275 #: build/C/man3/fopencookie.3:148
2277 "This function implements write operations for the stream. When called, it "
2278 "receives three arguments:"
2282 #: build/C/man3/fopencookie.3:150
2284 msgid " ssize_t write(void *cookie, const char *buf, size_t size);\n"
2288 #: build/C/man3/fopencookie.3:165
2290 "The I<buf> and I<size> arguments are, respectively, a buffer of data to be "
2291 "output to the stream and the size of that buffer. As its function result, "
2292 "the I<write> function should return the number of bytes copied from I<buf>, "
2293 "or -1 on error. The I<write> function should update the stream offset "
2298 #: build/C/man3/fopencookie.3:170
2299 msgid "If I<*write> is a NULL pointer, then output to the stream is discarded."
2303 #: build/C/man3/fopencookie.3:170
2305 msgid "I<cookie_seek_function_t *seek>"
2309 #: build/C/man3/fopencookie.3:174
2311 "This function implements seek operations on the stream. When called, it "
2312 "receives three arguments:"
2316 #: build/C/man3/fopencookie.3:176
2318 msgid " int seek(void *cookie, off64_t *offset, int whence);\n"
2322 #: build/C/man3/fopencookie.3:182
2324 "The I<*offset> argument specifies the new file offset depending on which of "
2325 "the following three values is supplied in I<whence>:"
2329 #: build/C/man3/fopencookie.3:183 build/C/man2/lseek.2:65
2335 #: build/C/man3/fopencookie.3:188
2337 "The stream offset should be set I<*offset> bytes from the start of the "
2342 #: build/C/man3/fopencookie.3:188 build/C/man2/lseek.2:70
2348 #: build/C/man3/fopencookie.3:192
2349 msgid "I<*offset> should be added to the current stream offset."
2353 #: build/C/man3/fopencookie.3:192 build/C/man2/lseek.2:75
2359 #: build/C/man3/fopencookie.3:196
2360 msgid "The stream offset should be set to the size of the stream plus I<*offset>."
2364 #: build/C/man3/fopencookie.3:203
2366 "Before returning, the I<seek> function should update I<*offset> to indicate "
2367 "the new stream offset."
2371 #: build/C/man3/fopencookie.3:207
2373 "As its function result, the I<seek> function should return 0 on success, and "
2378 #: build/C/man3/fopencookie.3:212
2380 "If I<*seek> is a NULL pointer, then it is not possible to perform seek "
2381 "operations on the stream."
2385 #: build/C/man3/fopencookie.3:212
2387 msgid "I<cookie_close_function_t *close>"
2391 #: build/C/man3/fopencookie.3:218
2393 "This function closes the stream. The hook function can do things such as "
2394 "freeing buffers allocated for the stream. When called, it receives one "
2399 #: build/C/man3/fopencookie.3:220
2401 msgid " int close(void *cookie);\n"
2405 #: build/C/man3/fopencookie.3:225
2407 "The I<cookie> argument is the cookie that the programmer supplied when "
2408 "calling B<fopencookie>()."
2412 #: build/C/man3/fopencookie.3:231
2414 "As its function result, the I<close> function should return 0 on success, "
2415 "and B<EOF> on error."
2419 #: build/C/man3/fopencookie.3:235
2421 "If I<*close> is NULL, then no special action is performed when the stream is "
2426 #. It's not clear if errno ever gets set...
2428 #: build/C/man3/fopencookie.3:242
2430 "On success B<fopencookie>() returns a pointer to the new stream. On error, "
2435 #: build/C/man3/fopencookie.3:244
2436 msgid "This function is a nonstandard GNU extension."
2440 #: build/C/man3/fopencookie.3:253
2442 "The program below implements a custom stream whose functionality is similar "
2443 "(but not identical) to that available via B<fmemopen>(3). It implements a "
2444 "stream whose data is stored in a memory buffer. The program writes its "
2445 "command-line arguments to the stream, and then seeks through the stream "
2446 "reading two out of every five characters and writing them to standard "
2447 "output. The following shell session demonstrates the use of the program:"
2451 #: build/C/man3/fopencookie.3:261
2454 "$B< ./a.out \\(aqhello world\\(aq>\n"
2458 "Reached end of file\n"
2462 #: build/C/man3/fopencookie.3:268
2464 "Note that a more general version of the program below could be improved to "
2465 "more robustly handle various error situations (e.g., opening a stream with a "
2466 "cookie that already has an open stream; closing a stream that has already "
2471 #: build/C/man3/fopencookie.3:277
2474 "#define _GNU_SOURCE\n"
2475 "#include E<lt>sys/types.hE<gt>\n"
2476 "#include E<lt>stdio.hE<gt>\n"
2477 "#include E<lt>stdlib.hE<gt>\n"
2478 "#include E<lt>unistd.hE<gt>\n"
2479 "#include E<lt>string.hE<gt>\n"
2483 #: build/C/man3/fopencookie.3:279
2485 msgid "#define INIT_BUF_SIZE 4\n"
2489 #: build/C/man3/fopencookie.3:286
2492 "struct memfile_cookie {\n"
2493 " char *buf; /* Dynamically sized buffer for data */\n"
2494 " size_t allocated; /* Size of buf */\n"
2495 " size_t endpos; /* Number of characters in buf */\n"
2496 " off_t offset; /* Current file offset in buf */\n"
2501 #: build/C/man3/fopencookie.3:292
2505 "memfile_write(void *c, const char *buf, size_t size)\n"
2507 " char *new_buff;\n"
2508 " struct memfile_cookie *cookie = c;\n"
2512 #: build/C/man3/fopencookie.3:294
2514 msgid " /* Buffer too small? Keep doubling size until big enough */\n"
2518 #: build/C/man3/fopencookie.3:304
2521 " while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n"
2522 " new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n"
2523 " if (new_buff == NULL) {\n"
2526 " cookie-E<gt>allocated *= 2;\n"
2527 " cookie-E<gt>buf = new_buff;\n"
2533 #: build/C/man3/fopencookie.3:306
2535 msgid " memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n"
2539 #: build/C/man3/fopencookie.3:310
2542 " cookie-E<gt>offset += size;\n"
2543 " if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n"
2544 " cookie-E<gt>endpos = cookie-E<gt>offset;\n"
2548 #: build/C/man3/fopencookie.3:313
2556 #: build/C/man3/fopencookie.3:319
2560 "memfile_read(void *c, char *buf, size_t size)\n"
2562 " ssize_t xbytes;\n"
2563 " struct memfile_cookie *cookie = c;\n"
2567 #: build/C/man3/fopencookie.3:321
2569 msgid " /* Fetch minimum of bytes requested and bytes available */\n"
2573 #: build/C/man3/fopencookie.3:327
2577 " if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n"
2578 " xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n"
2579 " if (xbytes E<lt> 0) /* offset may be past endpos */\n"
2584 #: build/C/man3/fopencookie.3:329
2586 msgid " memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n"
2590 #: build/C/man3/fopencookie.3:333
2593 " cookie-E<gt>offset += xbytes;\n"
2599 #: build/C/man3/fopencookie.3:339
2603 "memfile_seek(void *c, off64_t *offset, int whence)\n"
2605 " off64_t new_offset;\n"
2606 " struct memfile_cookie *cookie = c;\n"
2610 #: build/C/man3/fopencookie.3:348
2613 " if (whence == SEEK_SET)\n"
2614 " new_offset = *offset;\n"
2615 " else if (whence == SEEK_END)\n"
2616 " new_offset = cookie-E<gt>endpos + *offset;\n"
2617 " else if (whence == SEEK_CUR)\n"
2618 " new_offset = cookie-E<gt>offset + *offset;\n"
2624 #: build/C/man3/fopencookie.3:351
2627 " if (new_offset E<lt> 0)\n"
2632 #: build/C/man3/fopencookie.3:356
2635 " cookie-E<gt>offset = new_offset;\n"
2636 " *offset = new_offset;\n"
2642 #: build/C/man3/fopencookie.3:361
2646 "memfile_close(void *c)\n"
2648 " struct memfile_cookie *cookie = c;\n"
2652 #: build/C/man3/fopencookie.3:365
2655 " free(cookie-E<gt>buf);\n"
2656 " cookie-E<gt>allocated = 0;\n"
2657 " cookie-E<gt>buf = NULL;\n"
2661 #: build/C/man3/fopencookie.3:368
2669 #: build/C/man3/fopencookie.3:384
2673 "main(int argc, char *argv[])\n"
2675 " cookie_io_functions_t memfile_func = {\n"
2676 " .read = memfile_read,\n"
2677 " .write = memfile_write,\n"
2678 " .seek = memfile_seek,\n"
2679 " .close = memfile_close\n"
2682 " struct memfile_cookie mycookie;\n"
2686 " char buf[1000];\n"
2690 #: build/C/man3/fopencookie.3:386
2692 msgid " /* Set up the cookie before calling fopencookie() */\n"
2696 #: build/C/man3/fopencookie.3:392
2699 " mycookie.buf = malloc(INIT_BUF_SIZE);\n"
2700 " if (mycookie.buf == NULL) {\n"
2701 " perror(\"malloc\");\n"
2702 " exit(EXIT_FAILURE);\n"
2707 #: build/C/man3/fopencookie.3:396
2710 " mycookie.allocated = INIT_BUF_SIZE;\n"
2711 " mycookie.offset = 0;\n"
2712 " mycookie.endpos = 0;\n"
2716 #: build/C/man3/fopencookie.3:402
2719 " fp = fopencookie(&mycookie,\"w+\", memfile_func);\n"
2720 " if (fp == NULL) {\n"
2721 " perror(\"fopencookie\");\n"
2722 " exit(EXIT_FAILURE);\n"
2727 #: build/C/man3/fopencookie.3:404
2729 msgid " /* Write command-line arguments to our file */\n"
2733 #: build/C/man3/fopencookie.3:410
2736 " for (j = 1; j E<lt> argc; j++)\n"
2737 " if (fputs(argv[j], fp) == EOF) {\n"
2738 " perror(\"fputs\");\n"
2739 " exit(EXIT_FAILURE);\n"
2744 #: build/C/man3/fopencookie.3:412
2746 msgid " /* Read two bytes out of every five, until EOF */\n"
2750 #: build/C/man3/fopencookie.3:427
2753 " for (p = 0; ; p += 5) {\n"
2754 " if (fseek(fp, p, SEEK_SET) == -1) {\n"
2755 " perror(\"fseek\");\n"
2756 " exit(EXIT_FAILURE);\n"
2758 " nread = fread(buf, 1, 2, fp);\n"
2759 " if (nread == -1) {\n"
2760 " perror(\"fread\");\n"
2761 " exit(EXIT_FAILURE);\n"
2763 " if (nread == 0) {\n"
2764 " printf(\"Reached end of file\\en\");\n"
2770 #: build/C/man3/fopencookie.3:430
2773 " printf(\"/%.*s/\\en\", nread, buf);\n"
2778 #: build/C/man3/fopencookie.3:433 build/C/man2/readlink.2:211
2781 " exit(EXIT_SUCCESS);\n"
2786 #: build/C/man3/fopencookie.3:439
2787 msgid "B<fclose>(3), B<fmemopen>(3), B<fopen>(3), B<fseek>(3)"
2791 #: build/C/man3/fpurge.3:23
2797 #: build/C/man3/fpurge.3:23
2803 #: build/C/man3/fpurge.3:26
2804 msgid "fpurge, __fpurge - purge a stream"
2808 #: build/C/man3/fpurge.3:30
2811 "/* unsupported */\n"
2812 "B<#include E<lt>stdio.hE<gt>>\n"
2816 #: build/C/man3/fpurge.3:32
2818 msgid "B<int fpurge(FILE *>I<stream>B<);>\n"
2822 #: build/C/man3/fpurge.3:35
2826 "B<#include E<lt>stdio.hE<gt>>\n"
2830 #: build/C/man3/fpurge.3:37
2832 msgid "B<#include E<lt>stdio_ext.hE<gt>>\n"
2836 #: build/C/man3/fpurge.3:39
2838 msgid "B<void __fpurge(FILE *>I<stream>B<);>\n"
2842 #: build/C/man3/fpurge.3:52
2844 "The function B<fpurge>() clears the buffers of the given stream. For "
2845 "output streams this discards any unwritten output. For input streams this "
2846 "discards any input read from the underlying object but not yet obtained via "
2847 "B<getc>(3); this includes any text pushed back via B<ungetc>(3). See also "
2852 #: build/C/man3/fpurge.3:56
2854 "The function B<__fpurge>() does precisely the same, but without returning a "
2859 #: build/C/man3/fpurge.3:63
2861 "Upon successful completion B<fpurge>() returns 0. On error, it returns -1 "
2862 "and sets I<errno> appropriately."
2866 #: build/C/man3/fpurge.3:68
2867 msgid "I<stream> is not an open stream."
2871 #: build/C/man3/fpurge.3:76
2873 "These functions are nonstandard and not portable. The function B<fpurge>() "
2874 "was introduced in 4.4BSD and is not available under Linux. The function "
2875 "B<__fpurge>() was introduced in Solaris, and is present in glibc 2.1.95 and "
2880 #: build/C/man3/fpurge.3:78
2881 msgid "Usually it is a mistake to want to discard input buffers."
2886 #: build/C/man3/fpurge.3:83
2887 msgid "B<fflush>(3), B<setbuf>(3), B<stdio_ext>(3)"
2891 #: build/C/man3/fputwc.3:14
2897 #: build/C/man3/fputwc.3:17
2898 msgid "fputwc, putwc - write a wide character to a FILE stream"
2902 #: build/C/man3/fputwc.3:25
2905 "B<wint_t fputwc(wchar_t >I<wc>B<, FILE *>I<stream>B<);>\n"
2906 "B<wint_t putwc(wchar_t >I<wc>B<, FILE *>I<stream>B<);>\n"
2910 #: build/C/man3/fputwc.3:41
2912 "The B<fputwc>() function is the wide-character equivalent of the "
2913 "B<fputc>(3) function. It writes the wide character I<wc> to I<stream>. If "
2914 "I<ferror(stream)> becomes true, it returns B<WEOF>. If a wide-character "
2915 "conversion error occurs, it sets I<errno> to B<EILSEQ> and returns B<WEOF>. "
2916 "Otherwise it returns I<wc>."
2920 #: build/C/man3/fputwc.3:49
2922 "The B<putwc>() function or macro functions identically to B<fputwc>(). It "
2923 "may be implemented as a macro, and may evaluate its argument more than "
2924 "once. There is no reason ever to use it."
2928 #: build/C/man3/fputwc.3:58
2930 "The B<fputwc>() function returns I<wc> if no error occurred, or B<WEOF> to "
2931 "indicate an error."
2935 #: build/C/man3/fputwc.3:63
2936 msgid "Conversion of I<wc> to the stream's encoding fails."
2940 #: build/C/man3/fputwc.3:72
2942 "The behavior of B<fputwc>() depends on the B<LC_CTYPE> category of the "
2947 #: build/C/man3/fputwc.3:80
2949 "In the absence of additional information passed to the B<fopen>(3) call, it "
2950 "is reasonable to expect that B<fputwc>() will actually write the multibyte "
2951 "sequence corresponding to the wide character I<wc>."
2955 #: build/C/man3/fputwc.3:84
2956 msgid "B<fgetwc>(3), B<fputws>(3), B<unlocked_stdio>(3)"
2960 #: build/C/man3/fread.3:43
2966 #: build/C/man3/fread.3:43
2972 #: build/C/man3/fread.3:46
2973 msgid "fread, fwrite - binary stream input/output"
2977 #: build/C/man3/fread.3:52
2980 "B<size_t fread(void *>I<ptr>B<, size_t >I<size>B<, size_t >I<nmemb>B<, FILE "
2981 "*>I<stream>B<);>\n"
2985 #: build/C/man3/fread.3:55
2988 "B<size_t fwrite(const void *>I<ptr>B<, size_t >I<size>B<, size_t "
2990 "B< FILE *>I<stream>B<);>\n"
2994 #: build/C/man3/fread.3:67
2996 "The function B<fread>() reads I<nmemb> elements of data, each I<size> bytes "
2997 "long, from the stream pointed to by I<stream>, storing them at the location "
3002 #: build/C/man3/fread.3:78
3004 "The function B<fwrite>() writes I<nmemb> elements of data, each I<size> "
3005 "bytes long, to the stream pointed to by I<stream>, obtaining them from the "
3006 "location given by I<ptr>."
3010 #: build/C/man3/fread.3:89
3012 "B<fread>() and B<fwrite>() return the number of items successfully read or "
3013 "written (i.e., not the number of characters). If an error occurs, or the "
3014 "end-of-file is reached, the return value is a short item count (or zero)."
3018 #: build/C/man3/fread.3:96
3020 "B<fread>() does not distinguish between end-of-file and error, and callers "
3021 "must use B<feof>(3) and B<ferror>(3) to determine which occurred."
3025 #: build/C/man3/fread.3:98
3026 msgid "C89, POSIX.1-2001."
3030 #: build/C/man3/fread.3:104
3031 msgid "B<read>(2), B<write>(2), B<feof>(3), B<ferror>(3), B<unlocked_stdio>(3)"
3035 #: build/C/man3/fseek.3:40
3041 #: build/C/man3/fseek.3:40
3047 #: build/C/man3/fseek.3:43
3048 msgid "fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream"
3052 #: build/C/man3/fseek.3:47
3053 msgid "B<int fseek(FILE *>I<stream>B<, long >I<offset>B<, int >I<whence>B<);>"
3057 #: build/C/man3/fseek.3:49
3058 msgid "B<long ftell(FILE *>I<stream>B<);>"
3062 #: build/C/man3/fseek.3:51
3063 msgid "B<void rewind(FILE *>I<stream>B<);>"
3067 #: build/C/man3/fseek.3:53
3068 msgid "B<int fgetpos(FILE *>I<stream>B<, fpos_t *>I<pos>B<);>"
3072 #: build/C/man3/fseek.3:55
3073 msgid "B<int fsetpos(FILE *>I<stream>B<, fpos_t *>I<pos>B<);>"
3077 #: build/C/man3/fseek.3:79
3079 "The B<fseek>() function sets the file position indicator for the stream "
3080 "pointed to by I<stream>. The new position, measured in bytes, is obtained "
3081 "by adding I<offset> bytes to the position specified by I<whence>. If "
3082 "I<whence> is set to B<SEEK_SET>, B<SEEK_CUR>, or B<SEEK_END>, the offset is "
3083 "relative to the start of the file, the current position indicator, or "
3084 "end-of-file, respectively. A successful call to the B<fseek>() function "
3085 "clears the end-of-file indicator for the stream and undoes any effects of "
3086 "the B<ungetc>(3) function on the same stream."
3090 #: build/C/man3/fseek.3:85
3092 "The B<ftell>() function obtains the current value of the file position "
3093 "indicator for the stream pointed to by I<stream>."
3097 #: build/C/man3/fseek.3:92
3099 "The B<rewind>() function sets the file position indicator for the stream "
3100 "pointed to by I<stream> to the beginning of the file. It is equivalent to:"
3104 #: build/C/man3/fseek.3:95
3105 msgid "(void) fseek(stream, 0L, SEEK_SET)"
3109 #: build/C/man3/fseek.3:99
3111 "except that the error indicator for the stream is also cleared (see "
3116 #: build/C/man3/fseek.3:117
3118 "The B<fgetpos>() and B<fsetpos>() functions are alternate interfaces "
3119 "equivalent to B<ftell>() and B<fseek>() (with whence set to B<SEEK_SET>), "
3120 "setting and storing the current value of the file offset into or from the "
3121 "object referenced by I<pos>. On some non-UNIX systems an I<fpos_t> object "
3122 "may be a complex object and these routines may be the only way to portably "
3123 "reposition a text stream."
3127 #: build/C/man3/fseek.3:132
3129 "The B<rewind>() function returns no value. Upon successful completion, "
3130 "B<fgetpos>(), B<fseek>(), B<fsetpos>() return 0, and B<ftell>() returns "
3131 "the current offset. Otherwise, -1 is returned and I<errno> is set to "
3132 "indicate the error."
3136 #: build/C/man3/fseek.3:138
3137 msgid "The I<stream> specified is not a seekable stream."
3141 #: build/C/man3/fseek.3:149
3143 "The I<whence> argument to B<fseek>() was not B<SEEK_SET>, B<SEEK_END>, or "
3148 #: build/C/man3/fseek.3:164
3150 "The functions B<fgetpos>(), B<fseek>(), B<fsetpos>(), and B<ftell>() may "
3151 "also fail and set I<errno> for any of the errors specified for the routines "
3152 "B<fflush>(3), B<fstat>(2), B<lseek>(2), and B<malloc>(3)."
3156 #: build/C/man3/fseek.3:169
3157 msgid "B<lseek>(2), B<fseeko>(3)"
3161 #: build/C/man3/fseeko.3:23
3167 #: build/C/man3/fseeko.3:23
3173 #: build/C/man3/fseeko.3:26
3174 msgid "fseeko, ftello - seek to or report file position"
3178 #: build/C/man3/fseeko.3:31
3180 msgid "B<int fseeko(FILE *>I<stream>B<, off_t >I<offset>B<, int >I<whence>B<);>\n"
3184 #: build/C/man3/fseeko.3:34
3187 "B<off_t ftello(FILE *>I<stream>B<);>\n"
3192 #: build/C/man3/fseeko.3:52
3194 "The B<fseeko>() and B<ftello>() functions are identical to B<fseek>(3) "
3195 "and B<ftell>(3) (see B<fseek>(3)), respectively, except that the I<offset> "
3196 "argument of B<fseeko>() and the return value of B<ftello>() is of type "
3197 "I<off_t> instead of I<long>."
3201 #: build/C/man3/fseeko.3:55
3203 "On many architectures both I<off_t> and I<long> are 32-bit types, but "
3208 #: build/C/man3/fseeko.3:59 build/C/man3/lseek64.3:79
3210 msgid "#define _FILE_OFFSET_BITS 64\n"
3214 #: build/C/man3/fseeko.3:63
3215 msgid "will turn I<off_t> into a 64-bit type."
3219 #: build/C/man3/fseeko.3:72
3221 "On successful completion, B<fseeko>() returns 0, while B<ftello>() returns "
3222 "the current offset. Otherwise, -1 is returned and I<errno> is set to "
3223 "indicate the error."
3227 #: build/C/man3/fseeko.3:75
3228 msgid "See the ERRORS in B<fseek>(3)."
3232 #: build/C/man3/fseeko.3:77
3233 msgid "SUSv2, POSIX.1-2001."
3237 #: build/C/man3/fseeko.3:81
3239 "These functions are found on System V-like systems. They are not present in "
3240 "libc4, libc5, glibc 2.0 but are available since glibc 2.1."
3244 #: build/C/man3/fseeko.3:83
3249 #: build/C/man3/getline.3:24
3255 #: build/C/man3/getline.3:24
3261 #: build/C/man3/getline.3:27
3262 msgid "getline, getdelim - delimited string input"
3266 #: build/C/man3/getline.3:32
3269 "B<ssize_t getline(char **>I<lineptr>B<, size_t *>I<n>B<, FILE "
3270 "*>I<stream>B<);>\n"
3274 #: build/C/man3/getline.3:35
3277 "B<ssize_t getdelim(char **>I<lineptr>B<, size_t *>I<n>B<, int >I<delim>B<, "
3278 "FILE *>I<stream>B<);>\n"
3282 #: build/C/man3/getline.3:45
3283 msgid "B<getline>(), B<getdelim>():"
3287 #: build/C/man3/getline.3:50
3288 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 200809L || _XOPEN_SOURCE\\ E<gt>=\\ 700"
3292 #: build/C/man3/getline.3:63
3294 "B<getline>() reads an entire line from I<stream>, storing the address of "
3295 "the buffer containing the text into I<*lineptr>. The buffer is "
3296 "null-terminated and includes the newline character, if one was found."
3300 #: build/C/man3/getline.3:73
3302 "If I<*lineptr> is NULL, then B<getline>() will allocate a buffer for "
3303 "storing the line, which should be freed by the user program. (In this case, "
3304 "the value in I<*n> is ignored.)"
3308 #: build/C/man3/getline.3:91
3310 "Alternatively, before calling B<getline>(), I<*lineptr> can contain a "
3311 "pointer to a B<malloc>(3)-allocated buffer I<*n> bytes in size. If the "
3312 "buffer is not large enough to hold the line, B<getline>() resizes it with "
3313 "B<realloc>(3), updating I<*lineptr> and I<*n> as necessary."
3317 #: build/C/man3/getline.3:97
3319 "In either case, on a successful call, I<*lineptr> and I<*n> will be updated "
3320 "to reflect the buffer address and allocated size respectively."
3324 #: build/C/man3/getline.3:108
3326 "B<getdelim>() works like B<getline>(), except that a line delimiter other "
3327 "than newline can be specified as the I<delimiter> argument. As with "
3328 "B<getline>(), a delimiter character is not added if one was not present in "
3329 "the input before end of file was reached."
3333 #: build/C/man3/getline.3:117
3335 "On success, B<getline>() and B<getdelim>() return the number of characters "
3336 "read, including the delimiter character, but not including the terminating "
3337 "null byte. This value can be used to handle embedded null bytes in the line "
3342 #: build/C/man3/getline.3:120
3344 "Both functions return -1 on failure to read a line (including end-of-file "
3349 #: build/C/man3/getline.3:130
3350 msgid "Bad arguments (I<n> or I<lineptr> is NULL, or I<stream> is not valid)."
3354 #: build/C/man3/getline.3:132
3355 msgid "These functions are available since libc 4.6.27."
3359 #: build/C/man3/getline.3:139
3361 "Both B<getline>() and B<getdelim>() were originally GNU extensions. They "
3362 "were standardized in POSIX.1-2008."
3366 #: build/C/man3/getline.3:144
3369 "#define _GNU_SOURCE\n"
3370 "#include E<lt>stdio.hE<gt>\n"
3371 "#include E<lt>stdlib.hE<gt>\n"
3375 #: build/C/man3/getline.3:152
3382 " char *line = NULL;\n"
3383 " size_t len = 0;\n"
3388 #: build/C/man3/getline.3:156
3391 " fp = fopen(\"/etc/motd\", \"r\");\n"
3392 " if (fp == NULL)\n"
3393 " exit(EXIT_FAILURE);\n"
3397 #: build/C/man3/getline.3:161
3400 " while ((read = getline(&line, &len, fp)) != -1) {\n"
3401 " printf(\"Retrieved line of length %zu :\\en\", read);\n"
3402 " printf(\"%s\", line);\n"
3407 #: build/C/man3/getline.3:165
3411 " exit(EXIT_SUCCESS);\n"
3416 #: build/C/man3/getline.3:173
3417 msgid "B<read>(2), B<fgets>(3), B<fopen>(3), B<fread>(3), B<gets>(3), B<scanf>(3)"
3421 #: build/C/man3/gets.3:25
3427 #: build/C/man3/gets.3:25
3433 #: build/C/man3/gets.3:28
3434 msgid "fgetc, fgets, getc, getchar, gets, ungetc - input of characters and strings"
3438 #: build/C/man3/gets.3:33
3440 msgid "B<int fgetc(FILE *>I<stream>B<);>\n"
3444 #: build/C/man3/gets.3:35
3446 msgid "B<char *fgets(char *>I<s>B<, int >I<size>B<, FILE *>I<stream>B<);>\n"
3450 #: build/C/man3/gets.3:37
3452 msgid "B<int getc(FILE *>I<stream>B<);>\n"
3456 #: build/C/man3/gets.3:39
3458 msgid "B<int getchar(void);>\n"
3462 #: build/C/man3/gets.3:41
3464 msgid "B<char *gets(char *>I<s>B<);>\n"
3468 #: build/C/man3/gets.3:43
3470 msgid "B<int ungetc(int >I<c>B<, FILE *>I<stream>B<);>\n"
3474 #: build/C/man3/gets.3:55
3476 "B<fgetc>() reads the next character from I<stream> and returns it as an "
3477 "I<unsigned char> cast to an I<int>, or B<EOF> on end of file or error."
3481 #: build/C/man3/gets.3:62
3483 "B<getc>() is equivalent to B<fgetc>() except that it may be implemented as "
3484 "a macro which evaluates I<stream> more than once."
3488 #: build/C/man3/gets.3:66
3489 msgid "B<getchar>() is equivalent to B<getc(>I<stdin>B<)>."
3493 #: build/C/man3/gets.3:76
3495 "B<gets>() reads a line from I<stdin> into the buffer pointed to by I<s> "
3496 "until either a terminating newline or B<EOF>, which it replaces with a null "
3497 "byte (\\(aq\\e0\\(aq). No check for buffer overrun is performed (see BUGS "
3502 #: build/C/man3/gets.3:90
3504 "B<fgets>() reads in at most one less than I<size> characters from I<stream> "
3505 "and stores them into the buffer pointed to by I<s>. Reading stops after an "
3506 "B<EOF> or a newline. If a newline is read, it is stored into the buffer. A "
3507 "terminating null byte (\\(aq\\e0\\(aq) is stored after the last character "
3512 #: build/C/man3/gets.3:101
3514 "B<ungetc>() pushes I<c> back to I<stream>, cast to I<unsigned char>, where "
3515 "it is available for subsequent read operations. Pushed-back characters will "
3516 "be returned in reverse order; only one pushback is guaranteed."
3520 #: build/C/man3/gets.3:106
3522 "Calls to the functions described here can be mixed with each other and with "
3523 "calls to other input functions from the I<stdio> library for the same input "
3528 #: build/C/man3/gets.3:121
3530 "B<fgetc>(), B<getc>() and B<getchar>() return the character read as an "
3531 "I<unsigned char> cast to an I<int> or B<EOF> on end of file or error."
3535 #: build/C/man3/gets.3:129
3537 "B<gets>() and B<fgets>() return I<s> on success, and NULL on error or when "
3538 "end of file occurs while no characters have been read."
3542 #: build/C/man3/gets.3:136
3543 msgid "B<ungetc>() returns I<c> on success, or B<EOF> on error."
3547 #: build/C/man3/gets.3:138
3548 msgid "C89, C99, POSIX.1-2001."
3552 #: build/C/man3/gets.3:150
3554 "LSB deprecates B<gets>(). POSIX.1-2008 marks B<gets>() obsolescent. ISO "
3555 "C11 removes the specification of B<gets>() from the C language, and since "
3556 "version 2.16, glibc header files don't expose the function declaration if "
3557 "the B<_ISOC11_SOURCE> feature test macro is defined."
3561 #: build/C/man3/gets.3:164
3563 "Never use B<gets>(). Because it is impossible to tell without knowing the "
3564 "data in advance how many characters B<gets>() will read, and because "
3565 "B<gets>() will continue to store characters past the end of the buffer, it "
3566 "is extremely dangerous to use. It has been used to break computer "
3567 "security. Use B<fgets>() instead."
3571 #: build/C/man3/gets.3:171
3573 "It is not advisable to mix calls to input functions from the I<stdio> "
3574 "library with low-level calls to B<read>(2) for the file descriptor "
3575 "associated with the input stream; the results will be undefined and very "
3576 "probably not what you want."
3580 #: build/C/man3/gets.3:187
3582 "B<read>(2), B<write>(2), B<ferror>(3), B<fgetwc>(3), B<fgetws>(3), "
3583 "B<fopen>(3), B<fread>(3), B<fseek>(3), B<getline>(3), B<getwchar>(3), "
3584 "B<puts>(3), B<scanf>(3), B<ungetwc>(3), B<unlocked_stdio>(3), "
3585 "B<feature_test_macros>(7)"
3589 #: build/C/man3/getw.3:23
3595 #: build/C/man3/getw.3:23
3601 #: build/C/man3/getw.3:26
3602 msgid "getw, putw - input and output of words (ints)"
3606 #: build/C/man3/getw.3:31
3608 msgid "B<int getw(FILE *>I<stream>B<);>\n"
3612 #: build/C/man3/getw.3:33
3614 msgid "B<int putw(int >I<w>B<, FILE *>I<stream>B<);>\n"
3618 #: build/C/man3/getw.3:42
3619 msgid "B<getw>(), B<putw>():"
3623 #: build/C/man3/getw.3:45
3625 msgid "Since glibc 2.3.3:"
3629 #: build/C/man3/getw.3:48
3630 msgid "_SVID_SOURCE || _BSD_SOURCE ||"
3634 #: build/C/man3/getw.3:51
3637 "(_XOPEN_SOURCE &&\n"
3638 " !(_POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600))\n"
3642 #: build/C/man3/getw.3:51
3644 msgid "Before glibc 2.3.3:"
3648 #: build/C/man3/getw.3:54
3649 msgid "_SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE"
3653 #: build/C/man3/getw.3:64
3655 "B<getw>() reads a word (that is, an I<int>) from I<stream>. It's provided "
3656 "for compatibility with SVr4. We recommend you use B<fread>(3) instead."
3660 #: build/C/man3/getw.3:71
3662 "B<putw>() writes the word I<w> (that is, an I<int>) to I<stream>. It is "
3663 "provided for compatibility with SVr4, but we recommend you use B<fwrite>(3) "
3668 #: build/C/man3/getw.3:78
3670 "Normally, B<getw>() returns the word read, and B<putw>() returns 0. On "
3671 "error, they return B<EOF>."
3675 #: build/C/man3/getw.3:80
3676 msgid "SVr4, SUSv2. Not present in POSIX.1-2001."
3680 #: build/C/man3/getw.3:84
3682 "The value returned on error is also a legitimate data value. B<ferror>(3) "
3683 "can be used to distinguish between the two cases."
3687 #: build/C/man3/getw.3:90
3688 msgid "B<ferror>(3), B<fread>(3), B<fwrite>(3), B<getc>(3), B<putc>(3)"
3692 #: build/C/man2/link.2:31
3698 #: build/C/man2/link.2:31
3704 #: build/C/man2/link.2:34
3705 msgid "link - make a new name for a file"
3709 #: build/C/man2/link.2:36 build/C/man2/lseek.2:52 build/C/man3/lseek64.3:32 build/C/man2/readlink.2:46 build/C/man2/rmdir.2:35 build/C/man2/symlink.2:37 build/C/man2/unlink.2:37 build/C/man2/write.2:44
3710 msgid "B<#include E<lt>unistd.hE<gt>>"
3714 #: build/C/man2/link.2:38
3715 msgid "B<int link(const char *>I<oldpath>B<, const char *>I<newpath>B<);>"
3719 #: build/C/man2/link.2:41
3721 "B<link>() creates a new link (also known as a hard link) to an existing "
3726 #: build/C/man2/link.2:47 build/C/man2/symlink.2:84
3727 msgid "If I<newpath> exists it will I<not> be overwritten."
3731 #: build/C/man2/link.2:52
3733 "This new name may be used exactly as the old one for any operation; both "
3734 "names refer to the same file (and so have the same permissions and "
3735 "ownership) and it is impossible to tell which name was the \"original\"."
3739 #: build/C/man2/link.2:57 build/C/man2/pipe.2:97 build/C/man3/remove.3:65 build/C/man2/rename.2:96 build/C/man2/rmdir.2:45 build/C/man2/symlink.2:89 build/C/man2/unlink.2:60
3741 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
3746 #: build/C/man2/link.2:58 build/C/man2/open.2:475 build/C/man2/readlink.2:84 build/C/man2/rename.2:97 build/C/man2/rmdir.2:46 build/C/man2/symlink.2:90 build/C/man3/tmpfile.3:53 build/C/man2/unlink.2:61
3752 #: build/C/man2/link.2:69
3754 "Write access to the directory containing I<newpath> is denied, or search "
3755 "permission is denied for one of the directories in the path prefix of "
3756 "I<oldpath> or I<newpath>. (See also B<path_resolution>(7).)"
3760 #: build/C/man2/link.2:69 build/C/man2/open.2:484 build/C/man2/symlink.2:99 build/C/man3/tmpfile.3:56
3766 #: build/C/man2/link.2:73 build/C/man2/symlink.2:103
3767 msgid "I<newpath> already exists."
3771 #: build/C/man2/link.2:73 build/C/man2/llseek.2:69 build/C/man2/open.2:490 build/C/man2/pipe.2:98 build/C/man2/read.2:100 build/C/man2/readlink.2:89 build/C/man2/rename.2:133 build/C/man2/rmdir.2:64 build/C/man2/symlink.2:103 build/C/man2/unlink.2:80 build/C/man2/write.2:135
3777 #: build/C/man2/link.2:76 build/C/man2/rename.2:136 build/C/man2/symlink.2:106
3778 msgid "I<oldpath> or I<newpath> points outside your accessible address space."
3782 #: build/C/man2/link.2:76 build/C/man2/read.2:129 build/C/man2/readlink.2:105 build/C/man2/symlink.2:106 build/C/man2/unlink.2:84 build/C/man2/write.2:159
3788 #: build/C/man2/link.2:79 build/C/man2/symlink.2:109 build/C/man2/unlink.2:87
3789 msgid "An I/O error occurred."
3793 #: build/C/man2/link.2:79 build/C/man2/open.2:514 build/C/man2/readlink.2:108 build/C/man2/rename.2:146 build/C/man2/rmdir.2:73 build/C/man2/symlink.2:109 build/C/man2/unlink.2:92
3799 #: build/C/man2/link.2:83 build/C/man2/rename.2:150
3801 "Too many symbolic links were encountered in resolving I<oldpath> or "
3806 #: build/C/man2/link.2:83 build/C/man2/rename.2:150
3812 #: build/C/man2/link.2:88
3814 "The file referred to by I<oldpath> already has the maximum number of links "
3819 #: build/C/man2/link.2:88 build/C/man2/open.2:524 build/C/man2/readlink.2:111 build/C/man2/rename.2:157 build/C/man2/rmdir.2:77 build/C/man2/symlink.2:113 build/C/man2/unlink.2:96
3821 msgid "B<ENAMETOOLONG>"
3825 #: build/C/man2/link.2:91 build/C/man2/rename.2:160 build/C/man2/symlink.2:116
3826 msgid "I<oldpath> or I<newpath> was too long."
3830 #: build/C/man2/link.2:91 build/C/man2/open.2:538 build/C/man2/readlink.2:114 build/C/man2/rename.2:160 build/C/man2/rmdir.2:80 build/C/man2/symlink.2:116 build/C/man2/unlink.2:99
3836 #: build/C/man2/link.2:96
3838 "A directory component in I<oldpath> or I<newpath> does not exist or is a "
3839 "dangling symbolic link."
3843 #: build/C/man2/link.2:96 build/C/man2/open.2:545 build/C/man2/readlink.2:117 build/C/man2/rename.2:173 build/C/man2/rmdir.2:85 build/C/man3/scanf.3:568 build/C/man2/symlink.2:123 build/C/man3/tempnam.3:91 build/C/man2/unlink.2:106
3849 #: build/C/man2/link.2:99 build/C/man2/open.2:548 build/C/man2/readlink.2:120 build/C/man2/rename.2:176 build/C/man2/rmdir.2:88 build/C/man2/symlink.2:126 build/C/man2/unlink.2:109
3850 msgid "Insufficient kernel memory was available."
3854 #: build/C/man2/link.2:99 build/C/man2/open.2:548 build/C/man2/rename.2:176 build/C/man2/symlink.2:126 build/C/man3/tmpfile.3:68 build/C/man2/write.2:162
3860 #: build/C/man2/link.2:103 build/C/man2/rename.2:180 build/C/man2/symlink.2:130
3861 msgid "The device containing the file has no room for the new directory entry."
3865 #: build/C/man2/link.2:103 build/C/man2/open.2:554 build/C/man2/readlink.2:120 build/C/man2/rename.2:180 build/C/man2/rmdir.2:88 build/C/man2/symlink.2:130 build/C/man2/unlink.2:109
3871 #: build/C/man2/link.2:108
3873 "A component used as a directory in I<oldpath> or I<newpath> is not, in fact, "
3878 #: build/C/man2/link.2:108 build/C/man2/link.2:112 build/C/man2/open.2:587 build/C/man2/rmdir.2:107 build/C/man2/rmdir.2:118 build/C/man2/symlink.2:135 build/C/man2/unlink.2:114
3884 #: build/C/man2/link.2:112
3885 msgid "I<oldpath> is a directory."
3889 #: build/C/man2/link.2:117
3891 "The file system containing I<oldpath> and I<newpath> does not support the "
3892 "creation of hard links."
3896 #: build/C/man2/link.2:117 build/C/man2/open.2:595 build/C/man2/rename.2:218 build/C/man2/rmdir.2:123 build/C/man2/symlink.2:140 build/C/man3/tmpfile.3:71 build/C/man2/unlink.2:137
3902 #: build/C/man2/link.2:120 build/C/man2/rename.2:221
3903 msgid "The file is on a read-only file system."
3907 #: build/C/man2/link.2:120 build/C/man2/rename.2:221
3913 #: build/C/man2/link.2:128
3915 "I<oldpath> and I<newpath> are not on the same mounted file system. (Linux "
3916 "permits a file system to be mounted at multiple points, but B<link>() does "
3917 "not work across different mount points, even if the same file system is "
3921 #. SVr4 documents additional ENOLINK and
3922 #. EMULTIHOP error conditions; POSIX.1 does not document ELOOP.
3923 #. X/OPEN does not document EFAULT, ENOMEM or EIO.
3925 #: build/C/man2/link.2:133
3926 msgid "SVr4, 4.3BSD, POSIX.1-2001 (but see NOTES)."
3930 #: build/C/man2/link.2:140
3932 "Hard links, as created by B<link>(), cannot span file systems. Use "
3933 "B<symlink>(2) if this is required."
3936 #. more precisely: since kernel 1.3.56
3937 #. For example, the default Solaris compilation environment
3938 #. behaves like Linux, and contributors to a March 2005
3939 #. thread in the Austin mailing list reported that some
3940 #. other (System V) implementations did/do the same -- MTK, Apr 05
3942 #: build/C/man2/link.2:171
3944 "POSIX.1-2001 says that B<link>() should dereference I<oldpath> if it is a "
3945 "symbolic link. However, since kernel 2.0, Linux does not do so: if "
3946 "I<oldpath> is a symbolic link, then I<newpath> is created as a (hard) link "
3947 "to the same symbolic link file (i.e., I<newpath> becomes a symbolic link to "
3948 "the same file that I<oldpath> refers to). Some other implementations behave "
3949 "in the same manner as Linux. POSIX.1-2008 changes the specification of "
3950 "B<link>(), making it implementation-dependent whether or not I<oldpath> is "
3951 "dereferenced if it is a symbolic link. For precise control over the "
3952 "treatment of symbolic links when creating a link, see B<linkat>(2)."
3956 #: build/C/man2/link.2:177
3958 "On NFS file systems, the return code may be wrong in case the NFS server "
3959 "performs the link creation and dies before it can say so. Use B<stat>(2) "
3960 "to find out if the link got created."
3964 #: build/C/man2/link.2:187
3966 "B<ln>(1), B<linkat>(2), B<open>(2), B<rename>(2), B<stat>(2), B<symlink>(2), "
3967 "B<unlink>(2), B<path_resolution>(7), B<symlink>(7)"
3971 #: build/C/man2/llseek.2:26
3977 #: build/C/man2/llseek.2:26
3983 #: build/C/man2/llseek.2:29
3984 msgid "_llseek - reposition read/write file offset"
3988 #: build/C/man2/llseek.2:33
3991 "B<#include E<lt>sys/types.hE<gt>>\n"
3992 "B<#include E<lt>unistd.hE<gt>>\n"
3996 #: build/C/man2/llseek.2:37
3999 "B<int _llseek(unsigned int >I<fd>B<, unsigned long >I<offset_high>B<,>\n"
4000 "B< unsigned long >I<offset_low>B<, loff_t *>I<result>B<,>\n"
4001 "B< unsigned int >I<whence>B<);>\n"
4005 #: build/C/man2/llseek.2:57
4007 "The B<_llseek>() function repositions the offset of the open file "
4008 "associated with the file descriptor I<fd> to I<(offset_highE<lt>E<lt>32) | "
4009 "offset_low> bytes relative to the beginning of the file, the current "
4010 "position in the file, or the end of the file, depending on whether I<whence> "
4011 "is B<SEEK_SET>, B<SEEK_CUR>, or B<SEEK_END>, respectively. It returns the "
4012 "resulting file position in the argument I<result>."
4016 #: build/C/man2/llseek.2:64
4018 "Upon successful completion, B<_llseek>() returns 0. Otherwise, a value of "
4019 "-1 is returned and I<errno> is set to indicate the error."
4023 #: build/C/man2/llseek.2:69 build/C/man2/lseek.2:164
4024 msgid "I<fd> is not an open file descriptor."
4028 #: build/C/man2/llseek.2:72
4029 msgid "Problem with copying results to user space."
4033 #: build/C/man2/llseek.2:76
4034 msgid "I<whence> is invalid."
4038 #: build/C/man2/llseek.2:79
4040 "This function is Linux-specific, and should not be used in programs intended "
4045 #: build/C/man2/llseek.2:82
4047 "Glibc does not provide a wrapper for this system call; call it using "
4052 #: build/C/man2/llseek.2:85
4053 msgid "B<lseek>(2), B<lseek64>(3)"
4057 #: build/C/man2/lseek.2:45
4063 #: build/C/man2/lseek.2:45
4069 #: build/C/man2/lseek.2:48
4070 msgid "lseek - reposition read/write file offset"
4074 #: build/C/man2/lseek.2:50 build/C/man3/lseek64.3:30
4075 msgid "B<#include E<lt>sys/types.hE<gt>>"
4079 #: build/C/man2/lseek.2:54
4080 msgid "B<off_t lseek(int >I<fd>B<, off_t >I<offset>B<, int >I<whence>B<);>"
4084 #: build/C/man2/lseek.2:65
4086 "The B<lseek>() function repositions the offset of the open file associated "
4087 "with the file descriptor I<fd> to the argument I<offset> according to the "
4088 "directive I<whence> as follows:"
4092 #: build/C/man2/lseek.2:70
4093 msgid "The offset is set to I<offset> bytes."
4097 #: build/C/man2/lseek.2:75
4098 msgid "The offset is set to its current location plus I<offset> bytes."
4102 #: build/C/man2/lseek.2:80
4103 msgid "The offset is set to the size of the file plus I<offset> bytes."
4107 #: build/C/man2/lseek.2:88
4109 "The B<lseek>() function allows the file offset to be set beyond the end of "
4110 "the file (but this does not change the size of the file). If data is later "
4111 "written at this point, subsequent reads of the data in the gap (a \"hole\") "
4112 "return null bytes (\\(aq\\e0\\(aq) until data is actually written into the "
4117 #: build/C/man2/lseek.2:88
4119 msgid "Seeking file data and holes"
4123 #: build/C/man2/lseek.2:91
4125 "Since version 3.1, Linux supports the following additional values for "
4130 #: build/C/man2/lseek.2:91
4132 msgid "B<SEEK_DATA>"
4136 #: build/C/man2/lseek.2:102
4138 "Adjust the file offset to the next location in the file greater than or "
4139 "equal to I<offset> containing data. If I<offset> points to data, then the "
4140 "file offset is set to I<offset>."
4144 #: build/C/man2/lseek.2:102
4146 msgid "B<SEEK_HOLE>"
4150 #: build/C/man2/lseek.2:116
4152 "Adjust the file offset to the next hole in the file greater than or equal to "
4153 "I<offset>. If I<offset> points into the middle of a hole, then the file "
4154 "offset is set to I<offset>. If there is no hole past I<offset>, then the "
4155 "file offset is adjusted to the end of the file (i.e., there is an implicit "
4156 "hole at the end of any file)."
4160 #: build/C/man2/lseek.2:122
4162 "In both of the above cases, B<lseek>() fails if I<offset> points past the "
4167 #: build/C/man2/lseek.2:128
4169 "These operations allow applications to map holes in a sparsely allocated "
4170 "file. This can be useful for applications such as file backup tools, which "
4171 "can save space when creating backups and preserve holes, if they have a "
4172 "mechanism for discovering holes."
4175 #. https://lkml.org/lkml/2011/4/22/79
4176 #. http://lwn.net/Articles/440255/
4177 #. http://blogs.oracle.com/bonwick/entry/seek_hole_and_seek_data
4179 #: build/C/man2/lseek.2:151
4181 "For the purposes of these operations, a hole is a sequence of zeros that "
4182 "(normally) has not been allocated in the underlying file storage. However, "
4183 "a file system is not obliged to report holes, so these operations are not a "
4184 "guaranteed mechanism for mapping the storage space actually allocated to a "
4185 "file. (Furthermore, a sequence of zeros that actually has been written to "
4186 "the underlying storage may not be reported as a hole.) In the simplest "
4187 "implementation, a file system can support the operations by making "
4188 "B<SEEK_HOLE> always return the offset of the end of the file, and making "
4189 "B<SEEK_DATA> always return I<offset> (i.e., even if the location referred to "
4190 "by I<offset> is a hole, it can be considered to consist of data that is a "
4191 "sequence of zeros)."
4195 #: build/C/man2/lseek.2:159
4197 "Upon successful completion, B<lseek>() returns the resulting offset "
4198 "location as measured in bytes from the beginning of the file. On error, the "
4199 "value I<(off_t)\\ -1> is returned and I<errno> is set to indicate the error."
4202 #. Some systems may allow negative offsets for character devices
4203 #. and/or for remote file systems.
4205 #: build/C/man2/lseek.2:172
4207 "I<whence> is not valid. Or: the resulting file offset would be negative, or "
4208 "beyond the end of a seekable device."
4212 #: build/C/man2/lseek.2:172 build/C/man2/open.2:567
4214 msgid "B<EOVERFLOW>"
4217 #. HP-UX 11 says EINVAL for this case (but POSIX.1 says EOVERFLOW)
4219 #: build/C/man2/lseek.2:177
4220 msgid "The resulting file offset cannot be represented in an I<off_t>."
4224 #: build/C/man2/lseek.2:177
4230 #: build/C/man2/lseek.2:181
4231 msgid "I<fd> is associated with a pipe, socket, or FIFO."
4235 #: build/C/man2/lseek.2:181 build/C/man2/open.2:561
4241 #: build/C/man2/lseek.2:189
4243 "I<whence> is B<SEEK_DATA> or B<SEEK_HOLE>, and the current file offset is "
4244 "beyond the end of the file."
4247 #. SVr4 documents additional error
4248 #. conditions EDEADLK, ENOLCK, ENOLNK, ENOSR, ENXIO, or ERANGE.
4250 #: build/C/man2/lseek.2:191 build/C/man2/read.2:157 build/C/man2/rmdir.2:129 build/C/man2/symlink.2:150 build/C/man2/unlink.2:145 build/C/man2/write.2:183
4251 msgid "SVr4, 4.3BSD, POSIX.1-2001."
4254 #. FIXME . Review http://austingroupbugs.net/view.php?id=415 in the future
4256 #: build/C/man2/lseek.2:199
4258 "B<SEEK_DATA> and B<SEEK_HOLE> are nonstandard extensions also present in "
4259 "Solaris, FreeBSD, and DragonFly BSD; they are proposed for inclusion in the "
4260 "next POSIX revision (Issue 8)."
4264 #: build/C/man2/lseek.2:203
4266 "Some devices are incapable of seeking and POSIX does not specify which "
4267 "devices must support B<lseek>()."
4270 #. Other systems return the number of written characters,
4271 #. using SEEK_SET to set the counter. (Of written characters.)
4273 #: build/C/man2/lseek.2:210
4274 msgid "On Linux, using B<lseek>() on a tty device returns B<ESPIPE>."
4278 #: build/C/man2/lseek.2:213
4280 "When converting old code, substitute values for I<whence> with the following "
4285 #: build/C/man2/lseek.2:216
4291 #: build/C/man2/lseek.2:217
4293 msgid "0\tSEEK_SET\n"
4297 #: build/C/man2/lseek.2:218
4299 msgid "1\tSEEK_CUR\n"
4303 #: build/C/man2/lseek.2:219
4305 msgid "2\tSEEK_END\n"
4309 #: build/C/man2/lseek.2:220
4311 msgid "L_SET\tSEEK_SET\n"
4315 #: build/C/man2/lseek.2:221
4317 msgid "L_INCR\tSEEK_CUR\n"
4321 #: build/C/man2/lseek.2:222
4323 msgid "L_XTND\tSEEK_END\n"
4327 #: build/C/man2/lseek.2:234
4329 "Note that file descriptors created by B<dup>(2) or B<fork>(2) share the "
4330 "current file position pointer, so seeking on such files may be subject to "
4335 #: build/C/man2/lseek.2:241
4337 "B<dup>(2), B<fork>(2), B<open>(2), B<fseek>(3), B<lseek64>(3), "
4338 "B<posix_fallocate>(3)"
4342 #: build/C/man3/lseek64.3:23
4348 #: build/C/man3/lseek64.3:23
4354 #: build/C/man3/lseek64.3:26
4355 msgid "lseek64 - reposition 64-bit read/write file offset"
4359 #: build/C/man3/lseek64.3:28
4360 msgid "B<#define _LARGEFILE64_SOURCE> /* See feature_test_macros(7) */"
4364 #: build/C/man3/lseek64.3:34
4365 msgid "B<off64_t lseek64(int >I<fd>B<, off64_t >I<offset>B<, int >I<whence>B<);>"
4369 #: build/C/man3/lseek64.3:51
4371 "The B<lseek>(2) family of functions reposition the offset of the open file "
4372 "associated with the file descriptor I<fd> to I<offset> bytes relative to the "
4373 "start, current position, or end of the file, when I<whence> has the value "
4374 "B<SEEK_SET>, B<SEEK_CUR>, or B<SEEK_END>, respectively."
4378 #: build/C/man3/lseek64.3:54
4379 msgid "For more details, return value, and errors, see B<lseek>(2)."
4383 #: build/C/man3/lseek64.3:61
4385 "Four interfaces are available: B<lseek>(2), B<lseek64>(), B<llseek>(2), and "
4386 "the raw system call B<_llseek>(2)."
4390 #: build/C/man3/lseek64.3:61
4396 #: build/C/man3/lseek64.3:63 build/C/man3/lseek64.3:85 build/C/man3/lseek64.3:114
4401 #: build/C/man3/lseek64.3:67
4403 msgid "B<off_t lseek(int >I<fd>B<, off_t >I<offset>B<, int >I<whence>B<);>\n"
4407 #: build/C/man3/lseek64.3:75
4409 "B<lseek>(2) uses the type I<off_t>. This is a 32-bit signed type on 32-bit "
4410 "architectures, unless one compiles with"
4414 #: build/C/man3/lseek64.3:83
4415 msgid "in which case it is a 64-bit signed type."
4419 #: build/C/man3/lseek64.3:83
4425 #: build/C/man3/lseek64.3:89
4427 msgid "B<off64_t lseek64(int >I<fd>B<, off64_t >I<offset>B<, int >I<whence>B<);>\n"
4431 #: build/C/man3/lseek64.3:100
4433 "The library routine B<lseek64>() uses a 64-bit type even when I<off_t> is a "
4434 "32-bit type. Its prototype (and the type I<off64_t>) is available only "
4435 "when one compiles with"
4439 #: build/C/man3/lseek64.3:104
4441 msgid "#define _LARGEFILE64_SOURCE\n"
4444 #. in glibc 2.0.94, not in 2.0.6
4446 #: build/C/man3/lseek64.3:112
4448 "The function B<lseek64>() is available since glibc 2.1, and is defined to "
4449 "be an alias for B<llseek>()."
4453 #: build/C/man3/lseek64.3:112
4459 #: build/C/man3/lseek64.3:118
4461 msgid "B<loff_t llseek(int >I<fd>B<, loff_t >I<offset>B<, int >I<whence>B<);>\n"
4464 #. in libc 5.0.9, not in 4.7.6
4466 #: build/C/man3/lseek64.3:137
4468 "The type I<loff_t> is a 64-bit signed type. The library routine B<llseek>() "
4469 "is available in libc5 and glibc and works without special defines. Its "
4470 "prototype was given in I<E<lt>unistd.hE<gt>> with libc5, but glibc does not "
4471 "provide a prototype. This is bad, since a prototype is needed. Users "
4472 "should add the above prototype, or something equivalent, to their own "
4473 "source. When users complained about data loss caused by a miscompilation of "
4474 "B<e2fsck>(8), glibc 2.1.3 added the link-time warning"
4478 #: build/C/man3/lseek64.3:140
4479 msgid "the \\`llseek\\' function may be dangerous; use \\`lseek64\\' instead."
4483 #: build/C/man3/lseek64.3:144
4484 msgid "This makes this function unusable if one desires a warning-free compilation."
4488 #: build/C/man3/lseek64.3:144
4494 #: build/C/man3/lseek64.3:147
4496 "All the above functions are implemented in terms of this system call. The "
4501 #: build/C/man3/lseek64.3:152
4504 "B<int _llseek(int >I<fd>B<, off_t >I<offset_hi>B<, off_t >I<offset_lo>B<,>\n"
4505 "B< loff_t *>I<result>B<, int >I<whence>B<);>\n"
4509 #: build/C/man3/lseek64.3:157
4510 msgid "For more details, see B<llseek>(2)."
4514 #: build/C/man3/lseek64.3:160
4515 msgid "B<llseek>(2), B<lseek>(2)"
4519 #: build/C/man2/open.2:52
4525 #: build/C/man2/open.2:52
4531 #: build/C/man2/open.2:55
4532 msgid "open, creat - open and possibly create a file or device"
4536 #: build/C/man2/open.2:60
4539 "B<#include E<lt>sys/types.hE<gt>>\n"
4540 "B<#include E<lt>sys/stat.hE<gt>>\n"
4541 "B<#include E<lt>fcntl.hE<gt>>\n"
4545 #: build/C/man2/open.2:63
4548 "B<int open(const char *>I<pathname>B<, int >I<flags>B<);>\n"
4549 "B<int open(const char *>I<pathname>B<, int >I<flags>B<, mode_t "
4554 #: build/C/man2/open.2:65
4556 msgid "B<int creat(const char *>I<pathname>B<, mode_t >I<mode>B<);>\n"
4560 #: build/C/man2/open.2:76
4562 "Given a I<pathname> for a file, B<open>() returns a file descriptor, a "
4563 "small, nonnegative integer for use in subsequent system calls (B<read>(2), "
4564 "B<write>(2), B<lseek>(2), B<fcntl>(2), etc.). The file descriptor returned "
4565 "by a successful call will be the lowest-numbered file descriptor not "
4566 "currently open for the process."
4570 #: build/C/man2/open.2:88
4572 "By default, the new file descriptor is set to remain open across an "
4573 "B<execve>(2) (i.e., the B<FD_CLOEXEC> file descriptor flag described in "
4574 "B<fcntl>(2) is initially disabled; the B<O_CLOEXEC> flag, described below, "
4575 "can be used to change this default). The file offset is set to the "
4576 "beginning of the file (see B<lseek>(2))."
4580 #: build/C/man2/open.2:107
4582 "A call to B<open>() creates a new I<open file description>, an entry in the "
4583 "system-wide table of open files. This entry records the file offset and the "
4584 "file status flags (modifiable via the B<fcntl>(2) B<F_SETFL> operation). A "
4585 "file descriptor is a reference to one of these entries; this reference is "
4586 "unaffected if I<pathname> is subsequently removed or modified to refer to a "
4587 "different file. The new open file description is initially not shared with "
4588 "any other process, but sharing may arise via B<fork>(2)."
4592 #: build/C/man2/open.2:115
4594 "The argument I<flags> must include one of the following I<access modes>: "
4595 "B<O_RDONLY>, B<O_WRONLY>, or B<O_RDWR>. These request opening the file "
4596 "read-only, write-only, or read/write, respectively."
4599 #. FIXME . Actually is it true that the "file status flags" are all of the
4600 #. remaining flags listed below? SUSv4 divides the flags into:
4604 #. * Other (O_CLOEXEC, O_DIRECTORY, O_NOFOLLOW)
4605 #. though it's not clear what the difference between "other" and
4606 #. "File creation" flags is. (I've raised an Aardvark to see if this
4607 #. can be clarified in SUSv4; 10 Oct 2008.)
4609 #: build/C/man2/open.2:142
4611 "In addition, zero or more file creation flags and file status flags can be "
4612 "bitwise-I<or>'d in I<flags>. The I<file creation flags> are B<O_CREAT>, "
4613 "B<O_EXCL>, B<O_NOCTTY>, and B<O_TRUNC>. The I<file status flags> are all of "
4614 "the remaining flags listed below. The distinction between these two groups "
4615 "of flags is that the file status flags can be retrieved and (in some cases) "
4616 "modified using B<fcntl>(2). The full list of file creation flags and file "
4617 "status flags is as follows:"
4621 #: build/C/man2/open.2:142
4626 #. For more background, see
4627 #. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453946
4628 #. http://nfs.sourceforge.net/
4630 #: build/C/man2/open.2:159
4632 "The file is opened in append mode. Before each B<write>(2), the file offset "
4633 "is positioned at the end of the file, as if with B<lseek>(2). B<O_APPEND> "
4634 "may lead to corrupted files on NFS file systems if more than one process "
4635 "appends data to a file at once. This is because NFS does not support "
4636 "appending to a file, so the client kernel has to simulate it, which can't be "
4637 "done without a race condition."
4641 #: build/C/man2/open.2:159
4647 #: build/C/man2/open.2:172
4649 "Enable signal-driven I/O: generate a signal (B<SIGIO> by default, but this "
4650 "can be changed via B<fcntl>(2)) when input or output becomes possible on "
4651 "this file descriptor. This feature is only available for terminals, "
4652 "pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See "
4653 "B<fcntl>(2) for further details."
4657 #: build/C/man2/open.2:172
4659 msgid "B<O_CLOEXEC> (Since Linux 2.6.23)"
4662 #. This flag fixes only one form of the race condition;
4663 #. The race can also occur with, for example, descriptors
4664 #. returned by accept(), pipe(), etc.
4666 #: build/C/man2/open.2:197
4668 "Enable the close-on-exec flag for the new file descriptor. Specifying this "
4669 "flag permits a program to avoid additional B<fcntl>(2) B<F_SETFD> "
4670 "operations to set the B<FD_CLOEXEC> flag. Additionally, use of this flag is "
4671 "essential in some multithreaded programs since using a separate B<fcntl>(2) "
4672 "B<F_SETFD> operation to set the B<FD_CLOEXEC> flag does not suffice to avoid "
4673 "race conditions where one thread opens a file descriptor at the same time as "
4674 "another thread does a B<fork>(2) plus B<execve>(2)."
4678 #: build/C/man2/open.2:197
4683 #. As at 2.6.25, bsdgroups is supported by ext2, ext3, ext4, and
4684 #. XFS (since 2.6.14).
4686 #: build/C/man2/open.2:213
4688 "If the file does not exist it will be created. The owner (user ID) of the "
4689 "file is set to the effective user ID of the process. The group ownership "
4690 "(group ID) is set either to the effective group ID of the process or to the "
4691 "group ID of the parent directory (depending on file system type and mount "
4692 "options, and the mode of the parent directory, see the mount options "
4693 "I<bsdgroups> and I<sysvgroups> described in B<mount>(8))."
4697 #: build/C/man2/open.2:236
4699 "I<mode> specifies the permissions to use in case a new file is created. "
4700 "This argument must be supplied when B<O_CREAT> is specified in I<flags>; if "
4701 "B<O_CREAT> is not specified, then I<mode> is ignored. The effective "
4702 "permissions are modified by the process's I<umask> in the usual way: The "
4703 "permissions of the created file are I<(mode\\ &\\ ~umask)>. Note that this "
4704 "mode only applies to future accesses of the newly created file; the "
4705 "B<open>() call that creates a read-only file may well return a read/write "
4710 #: build/C/man2/open.2:239
4711 msgid "The following symbolic constants are provided for I<mode>:"
4715 #: build/C/man2/open.2:239
4721 #: build/C/man2/open.2:242
4722 msgid "00700 user (file owner) has read, write and execute permission"
4726 #: build/C/man2/open.2:242
4732 #: build/C/man2/open.2:245
4733 msgid "00400 user has read permission"
4737 #: build/C/man2/open.2:245
4743 #: build/C/man2/open.2:248
4744 msgid "00200 user has write permission"
4748 #: build/C/man2/open.2:248
4754 #: build/C/man2/open.2:251
4755 msgid "00100 user has execute permission"
4759 #: build/C/man2/open.2:251
4765 #: build/C/man2/open.2:254
4766 msgid "00070 group has read, write and execute permission"
4770 #: build/C/man2/open.2:254
4776 #: build/C/man2/open.2:257
4777 msgid "00040 group has read permission"
4781 #: build/C/man2/open.2:257
4787 #: build/C/man2/open.2:260
4788 msgid "00020 group has write permission"
4792 #: build/C/man2/open.2:260
4798 #: build/C/man2/open.2:263
4799 msgid "00010 group has execute permission"
4803 #: build/C/man2/open.2:263
4809 #: build/C/man2/open.2:266
4810 msgid "00007 others have read, write and execute permission"
4814 #: build/C/man2/open.2:266
4820 #: build/C/man2/open.2:269
4821 msgid "00004 others have read permission"
4825 #: build/C/man2/open.2:269
4831 #: build/C/man2/open.2:272
4832 msgid "00002 others have write permission"
4836 #: build/C/man2/open.2:272
4842 #: build/C/man2/open.2:275
4843 msgid "00001 others have execute permission"
4847 #: build/C/man2/open.2:276
4849 msgid "B<O_DIRECT> (Since Linux 2.4.10)"
4853 #: build/C/man2/open.2:295
4855 "Try to minimize cache effects of the I/O to and from this file. In general "
4856 "this will degrade performance, but it is useful in special situations, such "
4857 "as when applications do their own caching. File I/O is done directly "
4858 "to/from user space buffers. The B<O_DIRECT> flag on its own makes an effort "
4859 "to transfer data synchronously, but does not give the guarantees of the "
4860 "B<O_SYNC> flag that data and necessary metadata are transferred. To "
4861 "guarantee synchronous I/O, B<O_SYNC> must be used in addition to "
4862 "B<O_DIRECT>. See B<NOTES> below for further discussion."
4866 #: build/C/man2/open.2:299
4868 "A semantically similar (but deprecated) interface for block devices is "
4869 "described in B<raw>(8)."
4873 #: build/C/man2/open.2:299
4875 msgid "B<O_DIRECTORY>"
4878 #. But see the following and its replies:
4879 #. http://marc.theaimsgroup.com/?t=112748702800001&r=1&w=2
4880 #. [PATCH] open: O_DIRECTORY and O_CREAT together should fail
4881 #. O_DIRECTORY | O_CREAT causes O_DIRECTORY to be ignored.
4883 #: build/C/man2/open.2:313
4885 "If I<pathname> is not a directory, cause the open to fail. This flag is "
4886 "Linux-specific, and was added in kernel version 2.1.126, to avoid "
4887 "denial-of-service problems if B<opendir>(3) is called on a FIFO or tape "
4888 "device, but should not be used outside of the implementation of "
4893 #: build/C/man2/open.2:313
4899 #: build/C/man2/open.2:323
4901 "Ensure that this call creates the file: if this flag is specified in "
4902 "conjunction with B<O_CREAT>, and I<pathname> already exists, then B<open>() "
4906 #. POSIX.1-2001 explicitly requires this behavior.
4908 #: build/C/man2/open.2:331
4910 "When these two flags are specified, symbolic links are not followed: if "
4911 "I<pathname> is a symbolic link, then B<open>() fails regardless of where "
4912 "the symbolic link points to."
4916 #: build/C/man2/open.2:347
4918 "In general, the behavior of B<O_EXCL> is undefined if it is used without "
4919 "B<O_CREAT>. There is one exception: on Linux 2.6 and later, B<O_EXCL> can "
4920 "be used without B<O_CREAT> if I<pathname> refers to a block device. If the "
4921 "block device is in use by the system (e.g., mounted), B<open>() fails with "
4922 "the error B<EBUSY>."
4926 #: build/C/man2/open.2:369
4928 "On NFS, B<O_EXCL> is only supported when using NFSv3 or later on kernel 2.6 "
4929 "or later. In NFS environments where B<O_EXCL> support is not provided, "
4930 "programs that rely on it for performing locking tasks will contain a race "
4931 "condition. Portable programs that want to perform atomic file locking using "
4932 "a lockfile, and need to avoid reliance on NFS support for B<O_EXCL>, can "
4933 "create a unique file on the same file system (e.g., incorporating hostname "
4934 "and PID), and use B<link>(2) to make a link to the lockfile. If B<link>(2) "
4935 "returns 0, the lock is successful. Otherwise, use B<stat>(2) on the unique "
4936 "file to check if its link count has increased to 2, in which case the lock "
4937 "is also successful."
4941 #: build/C/man2/open.2:369
4943 msgid "B<O_LARGEFILE>"
4947 #: build/C/man2/open.2:391
4949 "(LFS) Allow files whose sizes cannot be represented in an I<off_t> (but can "
4950 "be represented in an I<off64_t>) to be opened. The B<_LARGEFILE64_SOURCE> "
4951 "macro must be defined (before including I<any> header files) in order to "
4952 "obtain this definition. Setting the B<_FILE_OFFSET_BITS> feature test macro "
4953 "to 64 (rather than using B<O_LARGEFILE>) is the preferred method of "
4954 "accessing large files on 32-bit systems (see B<feature_test_macros>(7))."
4958 #: build/C/man2/open.2:391
4960 msgid "B<O_NOATIME> (Since Linux 2.6.8)"
4963 #. The O_NOATIME flag also affects the treatment of st_atime
4964 #. by mmap() and readdir(2), MTK, Dec 04.
4966 #: build/C/man2/open.2:402
4968 "Do not update the file last access time (st_atime in the inode) when the "
4969 "file is B<read>(2). This flag is intended for use by indexing or backup "
4970 "programs, where its use can significantly reduce the amount of disk "
4971 "activity. This flag may not be effective on all file systems. One example "
4972 "is NFS, where the server maintains the access time."
4976 #: build/C/man2/open.2:402
4982 #: build/C/man2/open.2:410
4984 "If I<pathname> refers to a terminal device\\(emsee B<tty>(4)\\(em it will "
4985 "not become the process's controlling terminal even if the process does not "
4990 #: build/C/man2/open.2:410
4992 msgid "B<O_NOFOLLOW>"
4995 #. The headers from glibc 2.0.100 and later include a
4996 #. definition of this flag; \fIkernels before 2.1.126 will ignore it if
4999 #: build/C/man2/open.2:419
5001 "If I<pathname> is a symbolic link, then the open fails. This is a FreeBSD "
5002 "extension, which was added to Linux in version 2.1.126. Symbolic links in "
5003 "earlier components of the pathname will still be followed."
5007 #: build/C/man2/open.2:419
5009 msgid "B<O_NONBLOCK> or B<O_NDELAY>"
5013 #: build/C/man2/open.2:432
5015 "When possible, the file is opened in nonblocking mode. Neither the "
5016 "B<open>() nor any subsequent operations on the file descriptor which is "
5017 "returned will cause the calling process to wait. For the handling of FIFOs "
5018 "(named pipes), see also B<fifo>(7). For a discussion of the effect of "
5019 "B<O_NONBLOCK> in conjunction with mandatory file locks and with file leases, "
5024 #: build/C/man2/open.2:432
5030 #: build/C/man2/open.2:440
5032 "The file is opened for synchronous I/O. Any B<write>(2)s on the resulting "
5033 "file descriptor will block the calling process until the data has been "
5034 "physically written to the underlying hardware. I<But see NOTES below>."
5038 #: build/C/man2/open.2:440
5044 #: build/C/man2/open.2:454
5046 "If the file already exists and is a regular file and the open mode allows "
5047 "writing (i.e., is B<O_RDWR> or B<O_WRONLY>) it will be truncated to length "
5048 "0. If the file is a FIFO or terminal device file, the B<O_TRUNC> flag is "
5049 "ignored. Otherwise the effect of B<O_TRUNC> is unspecified."
5053 #: build/C/man2/open.2:458
5055 "Some of these optional flags can be altered using B<fcntl>(2) after the "
5056 "file has been opened."
5060 #: build/C/man2/open.2:466
5062 "B<creat>() is equivalent to B<open>() with I<flags> equal to "
5063 "B<O_CREAT|O_WRONLY|O_TRUNC>."
5067 #: build/C/man2/open.2:474
5069 "B<open>() and B<creat>() return the new file descriptor, or -1 if an error "
5070 "occurred (in which case, I<errno> is set appropriately)."
5074 #: build/C/man2/open.2:484
5076 "The requested access to the file is not allowed, or search permission is "
5077 "denied for one of the directories in the path prefix of I<pathname>, or the "
5078 "file did not exist yet and write access to the parent directory is not "
5079 "allowed. (See also B<path_resolution>(7).)"
5083 #: build/C/man2/open.2:490
5084 msgid "I<pathname> already exists and B<O_CREAT> and B<O_EXCL> were used."
5088 #: build/C/man2/open.2:494 build/C/man2/rmdir.2:67 build/C/man2/unlink.2:84
5089 msgid "I<pathname> points outside your accessible address space."
5093 #: build/C/man2/open.2:494 build/C/man2/write.2:139
5099 #: build/C/man2/open.2:498
5100 msgid "See B<EOVERFLOW>."
5104 #: build/C/man2/open.2:498 build/C/man2/read.2:104 build/C/man3/scanf.3:559 build/C/man3/tmpfile.3:59 build/C/man2/write.2:144
5110 #: build/C/man2/open.2:505
5112 "While blocked waiting to complete an open of a slow device (e.g., a FIFO; "
5113 "see B<fifo>(7)), the call was interrupted by a signal handler; see "
5118 #: build/C/man2/open.2:505 build/C/man2/read.2:140 build/C/man2/rename.2:140 build/C/man2/unlink.2:87
5124 #: build/C/man2/open.2:514
5126 "I<pathname> refers to a directory and the access requested involved writing "
5127 "(that is, B<O_WRONLY> or B<O_RDWR> is set)."
5131 #: build/C/man2/open.2:521
5133 "Too many symbolic links were encountered in resolving I<pathname>, or "
5134 "B<O_NOFOLLOW> was specified but I<pathname> was a symbolic link."
5138 #: build/C/man2/open.2:521 build/C/man2/pipe.2:107 build/C/man3/tmpfile.3:62
5144 #: build/C/man2/open.2:524
5145 msgid "The process already has the maximum number of files open."
5149 #: build/C/man2/open.2:528 build/C/man2/rmdir.2:80 build/C/man2/unlink.2:99
5150 msgid "I<pathname> was too long."
5154 #: build/C/man2/open.2:528 build/C/man2/pipe.2:110 build/C/man3/tmpfile.3:65
5160 #: build/C/man2/open.2:531 build/C/man2/pipe.2:113
5161 msgid "The system limit on the total number of open files has been reached."
5165 #: build/C/man2/open.2:531
5171 #: build/C/man2/open.2:538
5173 "I<pathname> refers to a device special file and no corresponding device "
5174 "exists. (This is a Linux kernel bug; in this situation B<ENXIO> must be "
5179 #: build/C/man2/open.2:545
5181 "B<O_CREAT> is not set and the named file does not exist. Or, a directory "
5182 "component in I<pathname> does not exist or is a dangling symbolic link."
5186 #: build/C/man2/open.2:554
5188 "I<pathname> was to be created but the device containing I<pathname> has no "
5189 "room for the new file."
5193 #: build/C/man2/open.2:561
5195 "A component used as a directory in I<pathname> is not, in fact, a directory, "
5196 "or B<O_DIRECTORY> was specified and I<pathname> was not a directory."
5200 #: build/C/man2/open.2:567
5202 "B<O_NONBLOCK> | B<O_WRONLY> is set, the named file is a FIFO and no process "
5203 "has the file open for reading. Or, the file is a device special file and no "
5204 "corresponding device exists."
5207 #. See http://bugzilla.kernel.org/show_bug.cgi?id=7253
5208 #. "Open of a large file on 32-bit fails with EFBIG, should be EOVERFLOW"
5209 #. Reported 2006-10-03
5211 #: build/C/man2/open.2:587
5213 "I<pathname> refers to a regular file that is too large to be opened. The "
5214 "usual scenario here is that an application compiled on a 32-bit platform "
5215 "without I<-D_FILE_OFFSET_BITS=64> tried to open a file whose size exceeds "
5216 "I<(2E<lt>E<lt>31)-1> bits; see also B<O_LARGEFILE> above. This is the error "
5217 "specified by POSIX.1-2001; in kernels before 2.6.24, Linux gave the error "
5218 "B<EFBIG> for this case."
5221 #. Strictly speaking, it's the file system UID... (MTK)
5223 #: build/C/man2/open.2:595
5225 "The B<O_NOATIME> flag was specified, but the effective user ID of the caller "
5226 "did not match the owner of the file and the caller was not privileged "
5231 #: build/C/man2/open.2:600
5233 "I<pathname> refers to a file on a read-only file system and write access was "
5238 #: build/C/man2/open.2:600
5244 #: build/C/man2/open.2:605
5246 "I<pathname> refers to an executable image which is currently being executed "
5247 "and write access was requested."
5251 #: build/C/man2/open.2:605
5253 msgid "B<EWOULDBLOCK>"
5257 #: build/C/man2/open.2:612
5259 "The B<O_NONBLOCK> flag was specified, and an incompatible lease was held on "
5260 "the file (see B<fcntl>(2))."
5264 #: build/C/man2/open.2:625
5266 "SVr4, 4.3BSD, POSIX.1-2001. The B<O_DIRECTORY>, B<O_NOATIME>, and "
5267 "B<O_NOFOLLOW> flags are Linux-specific, and one may need to define "
5268 "B<_GNU_SOURCE> (before including I<any> header files) to obtain their "
5273 #: build/C/man2/open.2:630
5275 "The B<O_CLOEXEC> flag is not specified in POSIX.1-2001, but is specified in "
5280 #: build/C/man2/open.2:638
5282 "B<O_DIRECT> is not specified in POSIX; one has to define B<_GNU_SOURCE> "
5283 "(before including I<any> header files) to get its definition."
5287 #: build/C/man2/open.2:646
5289 "Under Linux, the B<O_NONBLOCK> flag indicates that one wants to open but "
5290 "does not necessarily have the intention to read or write. This is typically "
5291 "used to open devices in order to get a file descriptor for use with "
5295 #. See for example util-linux's disk-utils/setfdprm.c
5296 #. For some background on access mode 3, see
5297 #. http://thread.gmane.org/gmane.linux.kernel/653123
5298 #. "[RFC] correct flags to f_mode conversion in __dentry_open"
5299 #. LKML, 12 Mar 2008
5301 #: build/C/man2/open.2:675
5303 "Unlike the other values that can be specified in I<flags>, the I<access "
5304 "mode> values B<O_RDONLY>, B<O_WRONLY>, and B<O_RDWR>, do not specify "
5305 "individual bits. Rather, they define the low order two bits of I<flags>, "
5306 "and are defined respectively as 0, 1, and 2. In other words, the "
5307 "combination B<O_RDONLY | O_WRONLY> is a logical error, and certainly does "
5308 "not have the same meaning as B<O_RDWR>. Linux reserves the special, "
5309 "nonstandard access mode 3 (binary 11) in I<flags> to mean: check for read "
5310 "and write permission on the file and return a descriptor that can't be used "
5311 "for reading or writing. This nonstandard access mode is used by some Linux "
5312 "drivers to return a descriptor that is only to be used for device-specific "
5313 "B<ioctl>(2) operations."
5316 #. Linux 2.0, 2.5: truncate
5317 #. Solaris 5.7, 5.8: truncate
5318 #. Irix 6.5: truncate
5319 #. Tru64 5.1B: truncate
5320 #. HP-UX 11.22: truncate
5321 #. FreeBSD 4.7: truncate
5323 #: build/C/man2/open.2:686
5325 "The (undefined) effect of B<O_RDONLY | O_TRUNC> varies among "
5326 "implementations. On many systems the file is actually truncated."
5330 #: build/C/man2/open.2:690
5332 "There are many infelicities in the protocol underlying NFS, affecting "
5333 "amongst others B<O_SYNC> and B<O_NDELAY>."
5337 #: build/C/man2/open.2:712
5339 "POSIX provides for three different variants of synchronized I/O, "
5340 "corresponding to the flags B<O_SYNC>, B<O_DSYNC>, and B<O_RSYNC>. Currently "
5341 "(2.6.31), Linux only implements B<O_SYNC>, but glibc maps B<O_DSYNC> and "
5342 "B<O_RSYNC> to the same numerical value as B<O_SYNC>. Most Linux file "
5343 "systems don't actually implement the POSIX B<O_SYNC> semantics, which "
5344 "require all metadata updates of a write to be on disk on returning to "
5345 "userspace, but only the B<O_DSYNC> semantics, which require only actual file "
5346 "data and metadata necessary to retrieve it to be on disk by the time the "
5347 "system call returns."
5351 #: build/C/man2/open.2:720
5353 "Note that B<open>() can open device special files, but B<creat>() cannot "
5354 "create them; use B<mknod>(2) instead."
5358 #: build/C/man2/open.2:733
5360 "On NFS file systems with UID mapping enabled, B<open>() may return a file "
5361 "descriptor but, for example, B<read>(2) requests are denied with "
5362 "B<EACCES>. This is because the client performs B<open>() by checking the "
5363 "permissions, but UID mapping is performed by the server upon read and write "
5368 #: build/C/man2/open.2:752
5370 "If the file is newly created, its I<st_atime>, I<st_ctime>, I<st_mtime> "
5371 "fields (respectively, time of last access, time of last status change, and "
5372 "time of last modification; see B<stat>(2)) are set to the current time, and "
5373 "so are the I<st_ctime> and I<st_mtime> fields of the parent directory. "
5374 "Otherwise, if the file is modified because of the B<O_TRUNC> flag, its "
5375 "st_ctime and st_mtime fields are set to the current time."
5379 #: build/C/man2/open.2:752
5385 #: build/C/man2/open.2:769
5387 "The B<O_DIRECT> flag may impose alignment restrictions on the length and "
5388 "address of userspace buffers and the file offset of I/Os. In Linux "
5389 "alignment restrictions vary by file system and kernel version and might be "
5390 "absent entirely. However there is currently no file system-independent "
5391 "interface for an application to discover these restrictions for a given file "
5392 "or file system. Some file systems provide their own interfaces for doing "
5393 "so, for example the B<XFS_IOC_DIOINFO> operation in B<xfsctl>(3)."
5397 #: build/C/man2/open.2:775
5399 "Under Linux 2.4, transfer sizes, and the alignment of the user buffer and "
5400 "the file offset must all be multiples of the logical block size of the file "
5401 "system. Under Linux 2.6, alignment to 512-byte boundaries suffices."
5405 #: build/C/man2/open.2:785
5407 "The B<O_DIRECT> flag was introduced in SGI IRIX, where it has alignment "
5408 "restrictions similar to those of Linux 2.4. IRIX has also a B<fcntl>(2) "
5409 "call to query appropriate alignments, and sizes. FreeBSD 4.x introduced a "
5410 "flag of the same name, but without alignment restrictions."
5414 #: build/C/man2/open.2:794
5416 "B<O_DIRECT> support was added under Linux in kernel version 2.4.10. Older "
5417 "Linux kernels simply ignore this flag. Some file systems may not implement "
5418 "the flag and B<open>() will fail with B<EINVAL> if it is used."
5422 #: build/C/man2/open.2:805
5424 "Applications should avoid mixing B<O_DIRECT> and normal I/O to the same "
5425 "file, and especially to overlapping byte regions in the same file. Even "
5426 "when the file system correctly handles the coherency issues in this "
5427 "situation, overall I/O throughput is likely to be slower than using either "
5428 "mode alone. Likewise, applications should avoid mixing B<mmap>(2) of files "
5429 "with direct I/O to the same files."
5433 #: build/C/man2/open.2:827
5435 "The behaviour of B<O_DIRECT> with NFS will differ from local file systems. "
5436 "Older kernels, or kernels configured in certain ways, may not support this "
5437 "combination. The NFS protocol does not support passing the flag to the "
5438 "server, so B<O_DIRECT> I/O will only bypass the page cache on the client; "
5439 "the server may still cache the I/O. The client asks the server to make the "
5440 "I/O synchronous to preserve the synchronous semantics of B<O_DIRECT>. Some "
5441 "servers will perform poorly under these circumstances, especially if the I/O "
5442 "size is small. Some servers may also be configured to lie to clients about "
5443 "the I/O having reached stable storage; this will avoid the performance "
5444 "penalty at some risk to data integrity in the event of server power "
5445 "failure. The Linux NFS client places no alignment restrictions on "
5450 #: build/C/man2/open.2:834
5452 "In summary, B<O_DIRECT> is a potentially powerful tool that should be used "
5453 "with caution. It is recommended that applications treat use of B<O_DIRECT> "
5454 "as a performance option which is disabled by default."
5458 #: build/C/man2/open.2:839
5460 "\"The thing that has always disturbed me about O_DIRECT is that the whole "
5461 "interface is just stupid, and was probably designed by a deranged monkey on "
5462 "some serious mind-controlling substances.\"\\(emLinus"
5465 #. FIXME . Check bugzilla report on open(O_ASYNC)
5466 #. See http://bugzilla.kernel.org/show_bug.cgi?id=5993
5468 #: build/C/man2/open.2:851
5470 "Currently, it is not possible to enable signal-driven I/O by specifying "
5471 "B<O_ASYNC> when calling B<open>(); use B<fcntl>(2) to enable this flag."
5475 #: build/C/man2/open.2:873
5477 "B<chmod>(2), B<chown>(2), B<close>(2), B<dup>(2), B<fcntl>(2), B<link>(2), "
5478 "B<lseek>(2), B<mknod>(2), B<mmap>(2), B<mount>(2), B<openat>(2), B<read>(2), "
5479 "B<socket>(2), B<stat>(2), B<umask>(2), B<unlink>(2), B<write>(2), "
5480 "B<fopen>(3), B<fifo>(7), B<path_resolution>(7), B<symlink>(7)"
5484 #: build/C/man3/perror.3:30
5490 #: build/C/man3/perror.3:33
5491 msgid "perror - print a system error message"
5495 #: build/C/man3/perror.3:37
5496 msgid "B<void perror(const char *>I<s>B<);>"
5500 #: build/C/man3/perror.3:39
5501 msgid "B<#include E<lt>errno.hE<gt>>"
5505 #: build/C/man3/perror.3:41
5506 msgid "B<const char *>I<sys_errlist>B<[];>"
5510 #: build/C/man3/perror.3:43
5511 msgid "B<int >I<sys_nerr>B<;>"
5515 #: build/C/man3/perror.3:45
5516 msgid "B<int >I<errno>B<;>"
5520 #: build/C/man3/perror.3:54
5521 msgid "I<sys_errlist>, I<sys_nerr>: _BSD_SOURCE"
5525 #: build/C/man3/perror.3:67
5527 "The routine B<perror>() produces a message on the standard error output, "
5528 "describing the last error encountered during a call to a system or library "
5529 "function. First (if I<s> is not NULL and I<*s> is not a null byte "
5530 "(\\(aq\\e0\\(aq)) the argument string I<s> is printed, followed by a colon "
5531 "and a blank. Then the message and a new-line."
5535 #: build/C/man3/perror.3:75
5537 "To be of most use, the argument string should include the name of the "
5538 "function that incurred the error. The error number is taken from the "
5539 "external variable I<errno>, which is set when errors occur but not cleared "
5540 "when successful calls are made."
5544 #: build/C/man3/perror.3:86
5546 "The global error list I<sys_errlist>[] indexed by I<errno> can be used to "
5547 "obtain the error message without the newline. The largest message number "
5548 "provided in the table is I<sys_nerr> -1. Be careful when directly accessing "
5549 "this list because new error values may not have been added to "
5554 #: build/C/man3/perror.3:107
5556 "When a system call fails, it usually returns -1 and sets the variable "
5557 "I<errno> to a value describing what went wrong. (These values can be found "
5558 "in I<E<lt>errno.hE<gt>>.) Many library functions do likewise. The function "
5559 "B<perror>() serves to translate this error code into human-readable form. "
5560 "Note that I<errno> is undefined after a successful library call: this call "
5561 "may well change this variable, even though it succeeds, for example because "
5562 "it internally used some other library function that failed. Thus, if a "
5563 "failing call is not immediately followed by a call to B<perror>(), the value "
5564 "of I<errno> should be saved."
5568 #: build/C/man3/perror.3:120
5570 "The function B<perror>() and the external I<errno> (see B<errno>(3)) "
5571 "conform to C89, C99, 4.3BSD, POSIX.1-2001. The externals I<sys_nerr> and "
5572 "I<sys_errlist> conform to BSD."
5575 #. and only when _BSD_SOURCE is defined.
5578 #. is defined, the symbols
5584 #: build/C/man3/perror.3:135
5586 "The externals I<sys_nerr> and I<sys_errlist> are defined by glibc, but in "
5587 "I<E<lt>stdio.hE<gt>>."
5591 #: build/C/man3/perror.3:140
5592 msgid "B<err>(3), B<errno>(3), B<error>(3), B<strerror>(3)"
5596 #: build/C/man2/pipe.2:36
5602 #: build/C/man2/pipe.2:36
5608 #: build/C/man2/pipe.2:39
5609 msgid "pipe, pipe2 - create pipe"
5613 #: build/C/man2/pipe.2:42 build/C/man2/read.2:41
5615 msgid "B<#include E<lt>unistd.hE<gt>>\n"
5619 #: build/C/man2/pipe.2:44
5621 msgid "B<int pipe(int >I<pipefd>B<[2]);>\n"
5625 #: build/C/man2/pipe.2:48
5628 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
5629 "B<#include E<lt>fcntl.hE<gt>> /* Obtain O_* constant "
5631 "B<#include E<lt>unistd.hE<gt>>\n"
5635 #: build/C/man2/pipe.2:50
5637 msgid "B<int pipe2(int >I<pipefd>B<[2], int >I<flags>B<);>\n"
5641 #: build/C/man2/pipe.2:66
5643 "B<pipe>() creates a pipe, a unidirectional data channel that can be used "
5644 "for interprocess communication. The array I<pipefd> is used to return two "
5645 "file descriptors referring to the ends of the pipe. I<pipefd[0]> refers to "
5646 "the read end of the pipe. I<pipefd[1]> refers to the write end of the "
5647 "pipe. Data written to the write end of the pipe is buffered by the kernel "
5648 "until it is read from the read end of the pipe. For further details, see "
5653 #: build/C/man2/pipe.2:76
5655 "If I<flags> is 0, then B<pipe2>() is the same as B<pipe>(). The following "
5656 "values can be bitwise ORed in I<flags> to obtain different behavior:"
5660 #: build/C/man2/pipe.2:76
5662 msgid "B<O_NONBLOCK>"
5666 #: build/C/man2/pipe.2:84
5668 "Set the B<O_NONBLOCK> file status flag on the two new open file "
5669 "descriptions. Using this flag saves extra calls to B<fcntl>(2) to achieve "
5674 #: build/C/man2/pipe.2:84
5676 msgid "B<O_CLOEXEC>"
5680 #: build/C/man2/pipe.2:92
5682 "Set the close-on-exec (B<FD_CLOEXEC>) flag on the two new file "
5683 "descriptors. See the description of the same flag in B<open>(2) for "
5684 "reasons why this may be useful."
5688 #: build/C/man2/pipe.2:102
5689 msgid "I<pipefd> is not valid."
5693 #: build/C/man2/pipe.2:107
5694 msgid "(B<pipe2>()) Invalid value in I<flags>."
5698 #: build/C/man2/pipe.2:110
5699 msgid "Too many file descriptors are in use by the process."
5703 #: build/C/man2/pipe.2:118
5705 "B<pipe2>() was added to Linux in version 2.6.27; glibc support is available "
5706 "starting with version 2.9."
5710 #: build/C/man2/pipe.2:121
5711 msgid "B<pipe>(): POSIX.1-2001."
5715 #: build/C/man2/pipe.2:124
5716 msgid "B<pipe2>() is Linux-specific."
5719 #. fork.2 refers to this example program.
5721 #: build/C/man2/pipe.2:140
5723 "The following program creates a pipe, and then B<fork>(2)s to create a child "
5724 "process; the child inherits a duplicate set of file descriptors that refer "
5725 "to the same pipe. After the B<fork>(2), each process closes the descriptors "
5726 "that it doesn't need for the pipe (see B<pipe>(7)). The parent then writes "
5727 "the string contained in the program's command-line argument to the pipe, and "
5728 "the child reads this string a byte at a time from the pipe and echoes it on "
5733 #: build/C/man2/pipe.2:147
5736 "#include E<lt>sys/wait.hE<gt>\n"
5737 "#include E<lt>stdio.hE<gt>\n"
5738 "#include E<lt>stdlib.hE<gt>\n"
5739 "#include E<lt>unistd.hE<gt>\n"
5740 "#include E<lt>string.hE<gt>\n"
5744 #: build/C/man2/pipe.2:154
5748 "main(int argc, char *argv[])\n"
5756 #: build/C/man2/pipe.2:159
5759 " if (argc != 2) {\n"
5760 "\tfprintf(stderr, \"Usage: %s E<lt>stringE<gt>\\en\", argv[0]);\n"
5761 "\texit(EXIT_FAILURE);\n"
5766 #: build/C/man2/pipe.2:164
5769 " if (pipe(pipefd) == -1) {\n"
5770 " perror(\"pipe\");\n"
5771 " exit(EXIT_FAILURE);\n"
5776 #: build/C/man2/pipe.2:170
5780 " if (cpid == -1) {\n"
5781 " perror(\"fork\");\n"
5782 " exit(EXIT_FAILURE);\n"
5787 #: build/C/man2/pipe.2:173
5790 " if (cpid == 0) { /* Child reads from pipe */\n"
5791 " close(pipefd[1]); /* Close unused write end */\n"
5795 #: build/C/man2/pipe.2:176
5798 " while (read(pipefd[0], &buf, 1) E<gt> 0)\n"
5799 " write(STDOUT_FILENO, &buf, 1);\n"
5803 #: build/C/man2/pipe.2:180
5806 " write(STDOUT_FILENO, \"\\en\", 1);\n"
5807 " close(pipefd[0]);\n"
5808 " _exit(EXIT_SUCCESS);\n"
5812 #: build/C/man2/pipe.2:189
5815 " } else { /* Parent writes argv[1] to pipe */\n"
5816 " close(pipefd[0]); /* Close unused read end */\n"
5817 " write(pipefd[1], argv[1], strlen(argv[1]));\n"
5818 " close(pipefd[1]); /* Reader will see EOF */\n"
5819 " wait(NULL); /* Wait for child */\n"
5820 " exit(EXIT_SUCCESS);\n"
5826 #: build/C/man2/pipe.2:197
5828 "B<fork>(2), B<read>(2), B<socketpair>(2), B<write>(2), B<popen>(3), "
5833 #: build/C/man3/popen.3:38
5839 #: build/C/man3/popen.3:38
5845 #: build/C/man3/popen.3:41
5846 msgid "popen, pclose - pipe stream to or from a process"
5850 #: build/C/man3/popen.3:46
5852 msgid "B<FILE *popen(const char *>I<command>B<, const char *>I<type>B<);>\n"
5856 #: build/C/man3/popen.3:48
5858 msgid "B<int pclose(FILE *>I<stream>B<);>\n"
5862 #: build/C/man3/popen.3:58
5863 msgid "B<popen>(), B<pclose>():"
5867 #: build/C/man3/popen.3:60
5868 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 2 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE"
5872 #: build/C/man3/popen.3:71
5874 "The B<popen>() function opens a process by creating a pipe, forking, and "
5875 "invoking the shell. Since a pipe is by definition unidirectional, the "
5876 "I<type> argument may specify only reading or writing, not both; the "
5877 "resulting stream is correspondingly read-only or write-only."
5881 #: build/C/man3/popen.3:95
5883 "The I<command> argument is a pointer to a null-terminated string containing "
5884 "a shell command line. This command is passed to I</bin/sh> using the B<-c> "
5885 "flag; interpretation, if any, is performed by the shell. The I<type> "
5886 "argument is a pointer to a null-terminated string which must contain either "
5887 "the letter \\(aqr\\(aq for reading or the letter \\(aqw\\(aq for writing. "
5888 "Since glibc 2.9, this argument can additionally include the letter "
5889 "\\(aqe\\(aq, which causes the close-on-exec flag (B<FD_CLOEXEC>) to be set "
5890 "on the underlying file descriptor; see the description of the B<O_CLOEXEC> "
5891 "flag in B<open>(2) for reasons why this may be useful."
5895 #: build/C/man3/popen.3:111
5897 "The return value from B<popen>() is a normal standard I/O stream in all "
5898 "respects save that it must be closed with B<pclose>() rather than "
5899 "B<fclose>(3). Writing to such a stream writes to the standard input of the "
5900 "command; the command's standard output is the same as that of the process "
5901 "that called B<popen>(), unless this is altered by the command itself. "
5902 "Conversely, reading from a \"popened\" stream reads the command's standard "
5903 "output, and the command's standard input is the same as that of the process "
5904 "that called B<popen>()."
5908 #: build/C/man3/popen.3:115
5909 msgid "Note that output B<popen>() streams are fully buffered by default."
5913 #: build/C/man3/popen.3:121
5915 "The B<pclose>() function waits for the associated process to terminate and "
5916 "returns the exit status of the command as returned by B<wait4>(2)."
5920 #: build/C/man3/popen.3:129
5922 "The B<popen>() function returns NULL if the B<fork>(2) or B<pipe>(2) "
5923 "calls fail, or if it cannot allocate memory."
5926 #. These conditions actually give undefined results, so I commented
5929 #. is not associated with a "popen()ed" command, if
5931 #. already "pclose()d", or if
5933 #: build/C/man3/popen.3:141
5935 "The B<pclose>() function returns -1 if B<wait4>(2) returns an error, or "
5936 "some other error is detected."
5940 #: build/C/man3/popen.3:160
5942 "The B<popen>() function does not set I<errno> if memory allocation fails. "
5943 "If the underlying B<fork>(2) or B<pipe>(2) fails, I<errno> is set "
5944 "appropriately. If the I<type> argument is invalid, and this condition is "
5945 "detected, I<errno> is set to B<EINVAL>."
5949 #: build/C/man3/popen.3:167
5951 "If B<pclose>() cannot obtain the child status, I<errno> is set to "
5956 #: build/C/man3/popen.3:173
5957 msgid "The \\(aqe\\(aq value for I<type> is a Linux extension."
5961 #: build/C/man3/popen.3:186
5963 "Since the standard input of a command opened for reading shares its seek "
5964 "offset with the process that called B<popen>(), if the original process has "
5965 "done a buffered read, the command's input position may not be as expected. "
5966 "Similarly, the output from a command opened for writing may become "
5967 "intermingled with that of the original process. The latter can be avoided "
5968 "by calling B<fflush>(3) before B<popen>()."
5976 #. function appeared in Version 7 AT&T UNIX.
5978 #: build/C/man3/popen.3:196
5980 "Failure to execute the shell is indistinguishable from the shell's failure "
5981 "to execute command, or an immediate exit of the command. The only hint is "
5982 "an exit status of 127."
5986 #: build/C/man3/popen.3:206
5988 "B<sh>(1), B<fork>(2), B<pipe>(2), B<wait4>(2), B<fclose>(3), B<fflush>(3), "
5989 "B<fopen>(3), B<stdio>(3), B<system>(3)"
5993 #: build/C/man3/printf.3:34
5999 #: build/C/man3/printf.3:34 build/C/man3/puts.3:24 build/C/man3/scanf.3:50
6005 #: build/C/man3/printf.3:38
6007 "printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - "
6008 "formatted output conversion"
6012 #: build/C/man3/printf.3:42
6013 msgid "B<int printf(const char *>I<format>B<, ...);>"
6017 #: build/C/man3/printf.3:44
6018 msgid "B<int fprintf(FILE *>I<stream>B<, const char *>I<format>B<, ...);>"
6022 #: build/C/man3/printf.3:46
6023 msgid "B<int sprintf(char *>I<str>B<, const char *>I<format>B<, ...);>"
6027 #: build/C/man3/printf.3:48
6029 "B<int snprintf(char *>I<str>B<, size_t >I<size>B<, const char *>I<format>B<, "
6034 #: build/C/man3/printf.3:50
6035 msgid "B<#include E<lt>stdarg.hE<gt>>"
6039 #: build/C/man3/printf.3:52
6040 msgid "B<int vprintf(const char *>I<format>B<, va_list >I<ap>B<);>"
6044 #: build/C/man3/printf.3:54
6046 "B<int vfprintf(FILE *>I<stream>B<, const char *>I<format>B<, va_list "
6051 #: build/C/man3/printf.3:56
6053 "B<int vsprintf(char *>I<str>B<, const char *>I<format>B<, va_list "
6058 #: build/C/man3/printf.3:59
6060 "B<int vsnprintf(char *>I<str>B<, size_t >I<size>B<, const char "
6061 "*>I<format>B<, va_list >I<ap>B<);>"
6065 #: build/C/man3/printf.3:68
6066 msgid "B<snprintf>(), B<vsnprintf>():"
6070 #: build/C/man3/printf.3:71
6072 "_BSD_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _ISOC99_SOURCE || "
6073 "_POSIX_C_SOURCE\\ E<gt>=\\ 200112L;"
6077 #: build/C/man3/printf.3:74 build/C/man3/scanf.3:83
6078 msgid "or I<cc -std=c99>"
6082 #: build/C/man3/printf.3:101
6084 "The functions in the B<printf>() family produce output according to a "
6085 "I<format> as described below. The functions B<printf>() and B<vprintf>() "
6086 "write output to I<stdout>, the standard output stream; B<fprintf>() and "
6087 "B<vfprintf>() write output to the given output I<stream>; B<sprintf>(), "
6088 "B<snprintf>(), B<vsprintf>() and B<vsnprintf>() write to the character "
6093 #: build/C/man3/printf.3:110
6095 "The functions B<snprintf>() and B<vsnprintf>() write at most I<size> bytes "
6096 "(including the terminating null byte (\\(aq\\e0\\(aq)) to I<str>."
6100 #: build/C/man3/printf.3:134
6102 "The functions B<vprintf>(), B<vfprintf>(), B<vsprintf>(), B<vsnprintf>() "
6103 "are equivalent to the functions B<printf>(), B<fprintf>(), B<sprintf>(), "
6104 "B<snprintf>(), respectively, except that they are called with a I<va_list> "
6105 "instead of a variable number of arguments. These functions do not call the "
6106 "I<va_end> macro. Because they invoke the I<va_arg> macro, the value of "
6107 "I<ap> is undefined after the call. See B<stdarg>(3)."
6111 #: build/C/man3/printf.3:141
6113 "These eight functions write the output under the control of a I<format> "
6114 "string that specifies how subsequent arguments (or arguments accessed via "
6115 "the variable-length argument facilities of B<stdarg>(3)) are converted for "
6120 #: build/C/man3/printf.3:152
6122 "C99 and POSIX.1-2001 specify that the results are undefined if a call to "
6123 "B<sprintf>(), B<snprintf>(), B<vsprintf>(), or B<vsnprintf>() would cause "
6124 "copying to take place between objects that overlap (e.g., if the target "
6125 "string array and one of the supplied input arguments refer to the same "
6126 "buffer). See NOTES."
6130 #: build/C/man3/printf.3:152
6132 msgid "Return value"
6136 #: build/C/man3/printf.3:155
6138 "Upon successful return, these functions return the number of characters "
6139 "printed (excluding the null byte used to end output to strings)."
6143 #: build/C/man3/printf.3:171
6145 "The functions B<snprintf>() and B<vsnprintf>() do not write more than "
6146 "I<size> bytes (including the terminating null byte (\\(aq\\e0\\(aq)). If "
6147 "the output was truncated due to this limit then the return value is the "
6148 "number of characters (excluding the terminating null byte) which would have "
6149 "been written to the final string if enough space had been available. Thus, "
6150 "a return value of I<size> or more means that the output was truncated. (See "
6151 "also below under NOTES.)"
6155 #: build/C/man3/printf.3:173
6156 msgid "If an output error is encountered, a negative value is returned."
6160 #: build/C/man3/printf.3:173
6162 msgid "Format of the format string"
6166 #: build/C/man3/printf.3:195
6168 "The format string is a character string, beginning and ending in its initial "
6169 "shift state, if any. The format string is composed of zero or more "
6170 "directives: ordinary characters (not B<%>), which are copied unchanged to "
6171 "the output stream; and conversion specifications, each of which results in "
6172 "fetching zero or more subsequent arguments. Each conversion specification "
6173 "is introduced by the character B<%>, and ends with a I<conversion "
6174 "specifier>. In between there may be (in this order) zero or more I<flags>, "
6175 "an optional minimum I<field width>, an optional I<precision> and an optional "
6176 "I<length modifier>."
6180 #: build/C/man3/printf.3:208
6182 "The arguments must correspond properly (after type promotion) with the "
6183 "conversion specifier. By default, the arguments are used in the order "
6184 "given, where each \\(aq*\\(aq and each conversion specifier asks for the "
6185 "next argument (and it is an error if insufficiently many arguments are "
6186 "given). One can also specify explicitly which argument is taken, at each "
6187 "place where an argument is required, by writing \"%m$\" instead of "
6188 "\\(aq%\\(aq and \"*m$\" instead of \\(aq*\\(aq, where the decimal integer m "
6189 "denotes the position in the argument list of the desired argument, indexed "
6190 "starting from 1. Thus,"
6194 #: build/C/man3/printf.3:212
6196 msgid "printf(\"%*d\", width, num);\n"
6200 #: build/C/man3/printf.3:216
6205 #: build/C/man3/printf.3:220
6207 msgid "printf(\"%2$*1$d\", width, num);\n"
6211 #: build/C/man3/printf.3:236
6213 "are equivalent. The second style allows repeated references to the same "
6214 "argument. The C99 standard does not include the style using \\(aq$\\(aq, "
6215 "which comes from the Single UNIX Specification. If the style using "
6216 "\\(aq$\\(aq is used, it must be used throughout for all conversions taking "
6217 "an argument and all width and precision arguments, but it may be mixed with "
6218 "\"%%\" formats which do not consume an argument. There may be no gaps in "
6219 "the numbers of arguments specified using \\(aq$\\(aq; for example, if "
6220 "arguments 1 and 3 are specified, argument 2 must also be specified somewhere "
6221 "in the format string."
6225 #: build/C/man3/printf.3:246
6227 "For some numeric conversions a radix character (\"decimal point\") or "
6228 "thousands' grouping character is used. The actual character used depends on "
6229 "the B<LC_NUMERIC> part of the locale. The POSIX locale uses \\(aq.\\(aq as "
6230 "radix character, and does not have a grouping character. Thus,"
6234 #: build/C/man3/printf.3:250
6236 msgid " printf(\"%\\(aq.2f\", 1234567.89);\n"
6240 #: build/C/man3/printf.3:255
6242 "results in \"1234567.89\" in the POSIX locale, in \"1234567,89\" in the "
6243 "nl_NL locale, and in \"1.234.567,89\" in the da_DK locale."
6247 #: build/C/man3/printf.3:255
6249 msgid "The flag characters"
6253 #: build/C/man3/printf.3:257
6254 msgid "The character % is followed by zero or more of the following flags:"
6258 #: build/C/man3/printf.3:257
6264 #: build/C/man3/printf.3:291
6266 "The value should be converted to an \"alternate form\". For B<o> "
6267 "conversions, the first character of the output string is made zero (by "
6268 "prefixing a 0 if it was not zero already). For B<x> and B<X> conversions, a "
6269 "nonzero result has the string \"0x\" (or \"0X\" for B<X> conversions) "
6270 "prepended to it. For B<a>, B<A>, B<e>, B<E>, B<f>, B<F>, B<g>, and B<G> "
6271 "conversions, the result will always contain a decimal point, even if no "
6272 "digits follow it (normally, a decimal point appears in the results of those "
6273 "conversions only if a digit follows). For B<g> and B<G> conversions, "
6274 "trailing zeros are not removed from the result as they would otherwise be. "
6275 "For other conversions, the result is undefined."
6279 #: build/C/man3/printf.3:291
6285 #: build/C/man3/printf.3:331
6287 "The value should be zero padded. For B<d>, B<i>, B<o>, B<u>, B<x>, B<X>, "
6288 "B<a>, B<A>, B<e>, B<E>, B<f>, B<F>, B<g>, and B<G> conversions, the "
6289 "converted value is padded on the left with zeros rather than blanks. If the "
6290 "B<\\&0> and B<-> flags both appear, the B<\\&0> flag is ignored. If a "
6291 "precision is given with a numeric conversion (B<d>, B<i>, B<o>, B<u>, B<x>, "
6292 "and B<X>), the B<\\&0> flag is ignored. For other conversions, the behavior "
6297 #: build/C/man3/printf.3:331
6303 #: build/C/man3/printf.3:344
6305 "The converted value is to be left adjusted on the field boundary. (The "
6306 "default is right justification.) Except for B<n> conversions, the converted "
6307 "value is padded on the right with blanks, rather than on the left with "
6308 "blanks or zeros. A B<-> overrides a B<\\&0> if both are given."
6312 #: build/C/man3/printf.3:344
6314 msgid "B<\\(aq \\(aq>"
6318 #: build/C/man3/printf.3:348
6320 "(a space) A blank should be left before a positive number (or empty string) "
6321 "produced by a signed conversion."
6325 #: build/C/man3/printf.3:348
6331 #: build/C/man3/printf.3:356
6333 "A sign (+ or -) should always be placed before a number produced by a signed "
6334 "conversion. By default a sign is used only for negative numbers. A B<+> "
6335 "overrides a space if both are used."
6339 #: build/C/man3/printf.3:359
6341 "The five flag characters above are defined in the C standard. The SUSv2 "
6342 "specifies one further flag character."
6346 #: build/C/man3/printf.3:359
6352 #: build/C/man3/printf.3:376
6354 "For decimal conversion (B<i>, B<d>, B<u>, B<f>, B<F>, B<g>, B<G>) the "
6355 "output is to be grouped with thousands' grouping characters if the locale "
6356 "information indicates any. Note that many versions of B<gcc>(1) cannot "
6357 "parse this option and will issue a warning. SUSv2 does not include "
6362 #: build/C/man3/printf.3:378
6363 msgid "glibc 2.2 adds one further flag character."
6367 #: build/C/man3/printf.3:378
6372 #. outdigits keyword in locale file
6374 #: build/C/man3/printf.3:388
6376 "For decimal integer conversion (B<i>, B<d>, B<u>) the output uses the "
6377 "locale's alternative output digits, if any. For example, since glibc 2.2.3 "
6378 "this will give Arabic-Indic digits in the Persian (\"fa_IR\") locale."
6382 #: build/C/man3/printf.3:388
6384 msgid "The field width"
6388 #: build/C/man3/printf.3:404
6390 "An optional decimal digit string (with nonzero first digit) specifying a "
6391 "minimum field width. If the converted value has fewer characters than the "
6392 "field width, it will be padded with spaces on the left (or right, if the "
6393 "left-adjustment flag has been given). Instead of a decimal digit string one "
6394 "may write \"*\" or \"*m$\" (for some decimal integer I<m>) to specify that "
6395 "the field width is given in the next argument, or in the I<m>-th argument, "
6396 "respectively, which must be of type I<int>. A negative field width is taken "
6397 "as a \\(aq-\\(aq flag followed by a positive field width. In no case does a "
6398 "nonexistent or small field width cause truncation of a field; if the result "
6399 "of a conversion is wider than the field width, the field is expanded to "
6400 "contain the conversion result."
6404 #: build/C/man3/printf.3:404
6406 msgid "The precision"
6410 #: build/C/man3/printf.3:440
6412 "An optional precision, in the form of a period (\\(aq.\\(aq) followed by an "
6413 "optional decimal digit string. Instead of a decimal digit string one may "
6414 "write \"*\" or \"*m$\" (for some decimal integer m) to specify that the "
6415 "precision is given in the next argument, or in the m-th argument, "
6416 "respectively, which must be of type I<int>. If the precision is given as "
6417 "just \\(aq.\\(aq, or the precision is negative, the precision is taken to be "
6418 "zero. This gives the minimum number of digits to appear for B<d>, B<i>, "
6419 "B<o>, B<u>, B<x>, and B<X> conversions, the number of digits to appear after "
6420 "the radix character for B<a>, B<A>, B<e>, B<E>, B<f>, and B<F> conversions, "
6421 "the maximum number of significant digits for B<g> and B<G> conversions, or "
6422 "the maximum number of characters to be printed from a string for B<s> and "
6427 #: build/C/man3/printf.3:440
6429 msgid "The length modifier"
6433 #: build/C/man3/printf.3:450
6435 "Here, \"integer conversion\" stands for B<d>, B<i>, B<o>, B<u>, B<x>, or "
6440 #: build/C/man3/printf.3:450 build/C/man3/scanf.3:291
6446 #: build/C/man3/printf.3:461
6448 "A following integer conversion corresponds to a I<signed char> or I<unsigned "
6449 "char> argument, or a following B<n> conversion corresponds to a pointer to a "
6450 "I<signed char> argument."
6454 #: build/C/man3/printf.3:461 build/C/man3/scanf.3:281
6460 #: build/C/man3/printf.3:472
6462 "A following integer conversion corresponds to a I<short int> or I<unsigned "
6463 "short int> argument, or a following B<n> conversion corresponds to a pointer "
6464 "to a I<short int> argument."
6468 #: build/C/man3/printf.3:472 build/C/man3/scanf.3:308
6474 #: build/C/man3/printf.3:491
6476 "(ell) A following integer conversion corresponds to a I<long int> or "
6477 "I<unsigned long int> argument, or a following B<n> conversion corresponds to "
6478 "a pointer to a I<long int> argument, or a following B<c> conversion "
6479 "corresponds to a I<wint_t> argument, or a following B<s> conversion "
6480 "corresponds to a pointer to I<wchar_t> argument."
6484 #: build/C/man3/printf.3:491
6490 #: build/C/man3/printf.3:503
6492 "(ell-ell). A following integer conversion corresponds to a I<long long int> "
6493 "or I<unsigned long long int> argument, or a following B<n> conversion "
6494 "corresponds to a pointer to a I<long long int> argument."
6498 #: build/C/man3/printf.3:503 build/C/man3/scanf.3:335
6504 #: build/C/man3/printf.3:519
6506 "A following B<a>, B<A>, B<e>, B<E>, B<f>, B<F>, B<g>, or B<G> conversion "
6507 "corresponds to a I<long double> argument. (C99 allows %LF, but SUSv2 does "
6512 #: build/C/man3/printf.3:519 build/C/man3/scanf.3:351
6518 #: build/C/man3/printf.3:525
6520 "(\"quad\". 4.4BSD and Linux libc5 only. Don't use.) This is a synonym for "
6525 #: build/C/man3/printf.3:525 build/C/man3/scanf.3:299
6531 #: build/C/man3/printf.3:532
6533 "A following integer conversion corresponds to an I<intmax_t> or I<uintmax_t> "
6538 #: build/C/man3/printf.3:532 build/C/man3/scanf.3:363
6544 #: build/C/man3/printf.3:543
6546 "A following integer conversion corresponds to a I<size_t> or I<ssize_t> "
6547 "argument. (Linux libc5 has B<Z> with this meaning. Don't use it.)"
6551 #: build/C/man3/printf.3:543 build/C/man3/scanf.3:356
6557 #: build/C/man3/printf.3:548
6558 msgid "A following integer conversion corresponds to a I<ptrdiff_t> argument."
6562 #: build/C/man3/printf.3:577
6564 "The SUSv2 only knows about the length modifiers B<h> (in B<hd>, B<hi>, "
6565 "B<ho>, B<hx>, B<hX>, B<hn>) and B<l> (in B<ld>, B<li>, B<lo>, B<lx>, B<lX>, "
6566 "B<ln>, B<lc>, B<ls>) and B<L> (in B<Le>, B<LE>, B<Lf>, B<Lg>, B<LG>)."
6570 #: build/C/man3/printf.3:577
6572 msgid "The conversion specifier"
6576 #: build/C/man3/printf.3:580
6578 "A character that specifies the type of conversion to be applied. The "
6579 "conversion specifiers and their meanings are:"
6583 #: build/C/man3/printf.3:580
6589 #: build/C/man3/printf.3:590
6591 "The I<int> argument is converted to signed decimal notation. The precision, "
6592 "if any, gives the minimum number of digits that must appear; if the "
6593 "converted value requires fewer digits, it is padded on the left with zeros. "
6594 "The default precision is 1. When 0 is printed with an explicit precision 0, "
6595 "the output is empty."
6599 #: build/C/man3/printf.3:590
6601 msgid "B<o>, B<u>, B<x>, B<X>"
6605 #: build/C/man3/printf.3:617
6607 "The I<unsigned int> argument is converted to unsigned octal (B<o>), unsigned "
6608 "decimal (B<u>), or unsigned hexadecimal (B<x> and B<X>) notation. The "
6609 "letters B<abcdef> are used for B<x> conversions; the letters B<ABCDEF> are "
6610 "used for B<X> conversions. The precision, if any, gives the minimum number "
6611 "of digits that must appear; if the converted value requires fewer digits, it "
6612 "is padded on the left with zeros. The default precision is 1. When 0 is "
6613 "printed with an explicit precision 0, the output is empty."
6617 #: build/C/man3/printf.3:617
6623 #: build/C/man3/printf.3:622
6624 msgid "The I<double> argument is rounded and converted in the style"
6628 #: build/C/man3/printf.3:637
6630 "[-]dB<\\&.>dddB<e>\\*(Pmdd where there is one digit before the decimal-point "
6631 "character and the number of digits after it is equal to the precision; if "
6632 "the precision is missing, it is taken as 6; if the precision is zero, no "
6633 "decimal-point character appears. An B<E> conversion uses the letter B<E> "
6634 "(rather than B<e>) to introduce the exponent. The exponent always contains "
6635 "at least two digits; if the value is zero, the exponent is 00."
6639 #: build/C/man3/printf.3:637
6645 #: build/C/man3/printf.3:648
6647 "The I<double> argument is rounded and converted to decimal notation in the "
6648 "style [-]dddB<\\&.>ddd, where the number of digits after the decimal-point "
6649 "character is equal to the precision specification. If the precision is "
6650 "missing, it is taken as 6; if the precision is explicitly zero, no "
6651 "decimal-point character appears. If a decimal point appears, at least one "
6652 "digit appears before it."
6656 #: build/C/man3/printf.3:659
6658 "(The SUSv2 does not know about B<F> and says that character string "
6659 "representations for infinity and NaN may be made available. The C99 "
6660 "standard specifies \"[-]inf\" or \"[-]infinity\" for infinity, and a string "
6661 "starting with \"nan\" for NaN, in the case of B<f> conversion, and "
6662 "\"[-]INF\" or \"[-]INFINITY\" or \"NAN*\" in the case of B<F> conversion.)"
6666 #: build/C/man3/printf.3:659
6672 #: build/C/man3/printf.3:684
6674 "The I<double> argument is converted in style B<f> or B<e> (or B<F> or B<E> "
6675 "for B<G> conversions). The precision specifies the number of significant "
6676 "digits. If the precision is missing, 6 digits are given; if the precision "
6677 "is zero, it is treated as 1. Style B<e> is used if the exponent from its "
6678 "conversion is less than -4 or greater than or equal to the precision. "
6679 "Trailing zeros are removed from the fractional part of the result; a decimal "
6680 "point appears only if it is followed by at least one digit."
6684 #: build/C/man3/printf.3:684
6690 #: build/C/man3/printf.3:708
6692 "(C99; not in SUSv2) For B<a> conversion, the I<double> argument is converted "
6693 "to hexadecimal notation (using the letters abcdef) in the style "
6694 "[-]B<0x>hB<\\&.>hhhhB<p>\\*(Pmd; for B<A> conversion the prefix B<0X>, the "
6695 "letters ABCDEF, and the exponent separator B<P> is used. There is one "
6696 "hexadecimal digit before the decimal point, and the number of digits after "
6697 "it is equal to the precision. The default precision suffices for an exact "
6698 "representation of the value if an exact representation in base 2 exists and "
6699 "otherwise is sufficiently large to distinguish values of type I<double>. "
6700 "The digit before the decimal point is unspecified for nonnormalized numbers, "
6701 "and nonzero but otherwise unspecified for normalized numbers."
6705 #: build/C/man3/printf.3:708 build/C/man3/scanf.3:456 build/C/man3/wprintf.3:132
6711 #: build/C/man3/printf.3:726
6713 "If no B<l> modifier is present, the I<int> argument is converted to an "
6714 "I<unsigned char>, and the resulting character is written. If an B<l> "
6715 "modifier is present, the I<wint_t> (wide character) argument is converted to "
6716 "a multibyte sequence by a call to the B<wcrtomb>(3) function, with a "
6717 "conversion state starting in the initial state, and the resulting multibyte "
6718 "string is written."
6722 #: build/C/man3/printf.3:726 build/C/man3/scanf.3:448 build/C/man3/wprintf.3:146
6728 #: build/C/man3/printf.3:741
6730 "If no B<l> modifier is present: The I<const char *> argument is expected to "
6731 "be a pointer to an array of character type (pointer to a string). "
6732 "Characters from the array are written up to (but not including) a "
6733 "terminating null byte (\\(aq\\e0\\(aq); if a precision is specified, no more "
6734 "than the number specified are written. If a precision is given, no null "
6735 "byte need be present; if the precision is not specified, or is greater than "
6736 "the size of the array, the array must contain a terminating null byte."
6740 #: build/C/man3/printf.3:768
6742 "If an B<l> modifier is present: The I<const wchar_t *> argument is expected "
6743 "to be a pointer to an array of wide characters. Wide characters from the "
6744 "array are converted to multibyte characters (each by a call to the "
6745 "B<wcrtomb>(3) function, with a conversion state starting in the initial "
6746 "state before the first wide character), up to and including a terminating "
6747 "null wide character. The resulting multibyte characters are written up to "
6748 "(but not including) the terminating null byte. If a precision is specified, "
6749 "no more bytes than the number specified are written, but no partial "
6750 "multibyte characters are written. Note that the precision determines the "
6751 "number of I<bytes> written, not the number of I<wide characters> or I<screen "
6752 "positions>. The array must contain a terminating null wide character, "
6753 "unless a precision is given and it is so small that the number of bytes "
6754 "written exceeds it before the end of the array is reached."
6758 #: build/C/man3/printf.3:768
6764 #: build/C/man3/printf.3:774
6765 msgid "(Not in C99, but in SUSv2.) Synonym for B<lc>. Don't use."
6769 #: build/C/man3/printf.3:774
6775 #: build/C/man3/printf.3:780
6776 msgid "(Not in C99, but in SUSv2.) Synonym for B<ls>. Don't use."
6780 #: build/C/man3/printf.3:780 build/C/man3/scanf.3:500
6786 #: build/C/man3/printf.3:788
6788 "The I<void *> pointer argument is printed in hexadecimal (as if by B<%#x> or "
6793 #: build/C/man3/printf.3:788 build/C/man3/scanf.3:508
6799 #: build/C/man3/printf.3:795
6801 "The number of characters written so far is stored into the integer indicated "
6802 "by the I<int *> (or variant) pointer argument. No argument is converted."
6806 #: build/C/man3/printf.3:795
6812 #: build/C/man3/printf.3:801
6814 "(Glibc extension.) Print output of I<strerror(errno)>. No argument is "
6819 #: build/C/man3/printf.3:801 build/C/man3/scanf.3:374
6825 #: build/C/man3/printf.3:807
6827 "A \\(aq%\\(aq is written. No argument is converted. The complete "
6828 "conversion specification is \\(aq%%\\(aq."
6832 #: build/C/man3/printf.3:822
6834 "The B<fprintf>(), B<printf>(), B<sprintf>(), B<vprintf>(), B<vfprintf>(), "
6835 "and B<vsprintf>() functions conform to C89 and C99. The B<snprintf>() and "
6836 "B<vsnprintf>() functions conform to C99."
6840 #: build/C/man3/printf.3:835
6842 "Concerning the return value of B<snprintf>(), SUSv2 and C99 contradict each "
6843 "other: when B<snprintf>() is called with I<size>=0 then SUSv2 stipulates an "
6844 "unspecified return value less than 1, while C99 allows I<str> to be NULL in "
6845 "this case, and gives the return value (as always) as the number of "
6846 "characters that would have been written in case the output string has been "
6851 #: build/C/man3/printf.3:849
6853 "Linux libc4 knows about the five C standard flags. It knows about the "
6854 "length modifiers B<h>, B<l>, B<L>, and the conversions B<c>, B<d>, B<e>, "
6855 "B<E>, B<f>, B<F>, B<g>, B<G>, B<i>, B<n>, B<o>, B<p>, B<s>, B<u>, B<x>, and "
6856 "B<X>, where B<F> is a synonym for B<f>. Additionally, it accepts B<D>, "
6857 "B<O>, and B<U> as synonyms for B<ld>, B<lo>, and B<lu>. (This is bad, and "
6858 "caused serious bugs later, when support for B<%D> disappeared.) No "
6859 "locale-dependent radix character, no thousands' separator, no NaN or "
6860 "infinity, no \"%m$\" and \"*m$\"."
6864 #: build/C/man3/printf.3:860
6866 "Linux libc5 knows about the five C standard flags and the \\(aq flag, "
6867 "locale, \"%m$\" and \"*m$\". It knows about the length modifiers B<h>, "
6868 "B<l>, B<L>, B<Z>, and B<q>, but accepts B<L> and B<q> both for I<long "
6869 "double> and for I<long long int> (this is a bug). It no longer recognizes "
6870 "B<F>, B<D>, B<O>, and B<U>, but adds the conversion character B<m>, which "
6871 "outputs I<strerror(errno)>."
6875 #: build/C/man3/printf.3:862
6876 msgid "glibc 2.0 adds conversion characters B<C> and B<S>."
6880 #: build/C/man3/printf.3:865
6882 "glibc 2.1 adds length modifiers B<hh>, B<j>, B<t>, and B<z> and conversion "
6883 "characters B<a> and B<A>."
6887 #: build/C/man3/printf.3:868
6889 "glibc 2.2 adds the conversion character B<F> with C99 semantics, and the "
6890 "flag character B<I>."
6894 #: build/C/man3/printf.3:870
6895 msgid "Some programs imprudently rely on code such as the following"
6899 #: build/C/man3/printf.3:872
6901 msgid " sprintf(buf, \"%s some further text\", buf);\n"
6904 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7075
6906 #: build/C/man3/printf.3:888
6908 "to append text to I<buf>. However, the standards explicitly note that the "
6909 "results are undefined if source and destination buffers overlap when calling "
6910 "B<sprintf>(), B<snprintf>(), B<vsprintf>(), and B<vsnprintf>(). Depending "
6911 "on the version of B<gcc>(1) used, and the compiler options employed, calls "
6912 "such as the above will B<not> produce the expected results."
6916 #. UNIX V7 defines the three routines
6920 #. and has the flag \-, the width or precision *, the length modifier l,
6921 #. and the conversions doxfegcsu, and also D,O,U,X as synonyms for ld,lo,lu,lx.
6922 #. This is still true for 2.9.1BSD, but 2.10BSD has the flags
6923 #. #, + and <space> and no longer mentions D,O,U,X.
6928 #. and warns not to use D,O,U,X.
6929 #. 4.3BSD Reno has the flag 0, the length modifiers h and L,
6930 #. and the conversions n, p, E, G, X (with current meaning)
6931 #. and deprecates D,O,U.
6932 #. 4.4BSD introduces the functions
6935 #. .BR vsnprintf (),
6936 #. and the length modifier q.
6937 #. FreeBSD also has functions
6940 #. .BR vasprintf (),
6941 #. that allocate a buffer large enough for
6943 #. In glibc there are functions
6947 #. that print to a file descriptor instead of a stream.
6949 #: build/C/man3/printf.3:930
6951 "The glibc implementation of the functions B<snprintf>() and B<vsnprintf>() "
6952 "conforms to the C99 standard, that is, behaves as described above, since "
6953 "glibc version 2.1. Until glibc 2.0.6 they would return -1 when the output "
6958 #: build/C/man3/printf.3:947
6960 "Because B<sprintf>() and B<vsprintf>() assume an arbitrarily long string, "
6961 "callers must be careful not to overflow the actual space; this is often "
6962 "impossible to assure. Note that the length of the strings produced is "
6963 "locale-dependent and difficult to predict. Use B<snprintf>() and "
6964 "B<vsnprintf>() instead (or B<asprintf>(3) and B<vasprintf>(3))."
6968 #: build/C/man3/printf.3:960
6970 "Linux libc4.[45] does not have a B<snprintf>(), but provides a libbsd that "
6971 "contains an B<snprintf>() equivalent to B<sprintf>(), that is, one that "
6972 "ignores the I<size> argument. Thus, the use of B<snprintf>() with early "
6973 "libc4 leads to serious security problems."
6977 #. Some floating-point conversions under early libc4
6978 #. caused memory leaks.
6980 #: build/C/man3/printf.3:974
6982 "Code such as B<printf(>I<foo>B<);> often indicates a bug, since I<foo> may "
6983 "contain a % character. If I<foo> comes from untrusted user input, it may "
6984 "contain B<%n>, causing the B<printf>() call to write to memory and creating "
6989 #: build/C/man3/printf.3:977
6990 msgid "To print \\*(Pi to five decimal places:"
6994 #: build/C/man3/printf.3:983
6997 "#include E<lt>math.hE<gt>\n"
6998 "#include E<lt>stdio.hE<gt>\n"
6999 "fprintf(stdout, \"pi = %.5f\\en\", 4 * atan(1.0));\n"
7003 #: build/C/man3/printf.3:992
7005 "To print a date and time in the form \"Sunday, July 3, 10:02\", where "
7006 "I<weekday> and I<month> are pointers to strings:"
7010 #: build/C/man3/printf.3:998
7013 "#include E<lt>stdio.hE<gt>\n"
7014 "fprintf(stdout, \"%s, %s %d, %.2d:%.2d\\en\",\n"
7015 " weekday, month, day, hour, min);\n"
7019 #: build/C/man3/printf.3:1004
7021 "Many countries use the day-month-year order. Hence, an internationalized "
7022 "version must be able to print the arguments in an order specified by the "
7027 #: build/C/man3/printf.3:1010
7030 "#include E<lt>stdio.hE<gt>\n"
7031 "fprintf(stdout, format,\n"
7032 " weekday, month, day, hour, min);\n"
7036 #: build/C/man3/printf.3:1017
7038 "where I<format> depends on locale, and may permute the arguments. With the "
7043 #: build/C/man3/printf.3:1021
7045 msgid "\"%1$s, %3$d. %2$s, %4$d:%5$.2d\\en\"\n"
7049 #: build/C/man3/printf.3:1025
7050 msgid "one might obtain \"Sonntag, 3. Juli, 10:02\"."
7054 #: build/C/man3/printf.3:1028
7056 "To allocate a sufficiently large string and print into it (code correct for "
7057 "both glibc 2.0 and glibc 2.1):"
7061 #: build/C/man3/printf.3:1033
7064 "#include E<lt>stdio.hE<gt>\n"
7065 "#include E<lt>stdlib.hE<gt>\n"
7066 "#include E<lt>stdarg.hE<gt>\n"
7070 #: build/C/man3/printf.3:1041
7074 "make_message(const char *fmt, ...)\n"
7077 " int size = 100; /* Guess we need no more than 100 bytes. */\n"
7083 #: build/C/man3/printf.3:1044
7086 " if ((p = malloc(size)) == NULL)\n"
7091 #: build/C/man3/printf.3:1046
7093 msgid " while (1) {\n"
7097 #: build/C/man3/printf.3:1048
7099 msgid " /* Try to print in the allocated space. */\n"
7103 #: build/C/man3/printf.3:1052
7106 " va_start(ap, fmt);\n"
7107 " n = vsnprintf(p, size, fmt, ap);\n"
7112 #: build/C/man3/printf.3:1054
7114 msgid " /* If that worked, return the string. */\n"
7118 #: build/C/man3/printf.3:1057
7121 " if (n E<gt> -1 && n E<lt> size)\n"
7126 #: build/C/man3/printf.3:1059
7128 msgid " /* Else try again with more space. */\n"
7132 #: build/C/man3/printf.3:1064
7135 " if (n E<gt> -1) /* glibc 2.1 */\n"
7136 " size = n+1; /* precisely what is needed */\n"
7137 " else /* glibc 2.0 */\n"
7138 " size *= 2; /* twice the old size */\n"
7142 #: build/C/man3/printf.3:1073
7145 " if ((np = realloc (p, size)) == NULL) {\n"
7156 #: build/C/man3/printf.3:1083
7158 "B<printf>(1), B<asprintf>(3), B<dprintf>(3), B<scanf>(3), B<setlocale>(3), "
7159 "B<wcrtomb>(3), B<wprintf>(3), B<locale>(5)"
7163 #: build/C/man3/puts.3:24
7169 #: build/C/man3/puts.3:27
7170 msgid "fputc, fputs, putc, putchar, puts - output of characters and strings"
7174 #: build/C/man3/puts.3:32
7176 msgid "B<int fputc(int >I<c>B<, FILE *>I<stream>B<);>\n"
7180 #: build/C/man3/puts.3:34
7182 msgid "B<int fputs(const char *>I<s>B<, FILE *>I<stream>B<);>\n"
7186 #: build/C/man3/puts.3:36
7188 msgid "B<int putc(int >I<c>B<, FILE *>I<stream>B<);>\n"
7192 #: build/C/man3/puts.3:38
7194 msgid "B<int putchar(int >I<c>B<);>\n"
7198 #: build/C/man3/puts.3:40
7200 msgid "B<int puts(const char *>I<s>B<);>\n"
7204 #: build/C/man3/puts.3:49
7206 "B<fputc>() writes the character I<c>, cast to an I<unsigned char>, to "
7211 #: build/C/man3/puts.3:56
7213 "B<fputs>() writes the string I<s> to I<stream>, without its terminating "
7214 "null byte (\\(aq\\e0\\(aq)."
7218 #: build/C/man3/puts.3:63
7220 "B<putc>() is equivalent to B<fputc>() except that it may be implemented as "
7221 "a macro which evaluates I<stream> more than once."
7225 #: build/C/man3/puts.3:67
7226 msgid "B<putchar(>I<c>B<);> is equivalent to B<putc(>I<c>B<,>I<stdout>B<).>"
7230 #: build/C/man3/puts.3:74
7231 msgid "B<puts>() writes the string I<s> and a trailing newline to I<stdout>."
7235 #: build/C/man3/puts.3:79
7237 "Calls to the functions described here can be mixed with each other and with "
7238 "calls to other output functions from the I<stdio> library for the same "
7243 #: build/C/man3/puts.3:94
7245 "B<fputc>(), B<putc>() and B<putchar>() return the character written as an "
7246 "I<unsigned char> cast to an I<int> or B<EOF> on error."
7250 #: build/C/man3/puts.3:101
7252 "B<puts>() and B<fputs>() return a nonnegative number on success, or B<EOF> "
7257 #: build/C/man3/puts.3:110
7259 "It is not advisable to mix calls to output functions from the I<stdio> "
7260 "library with low-level calls to B<write>(2) for the file descriptor "
7261 "associated with the same output stream; the results will be undefined and "
7262 "very probably not what you want."
7266 #: build/C/man3/puts.3:122
7268 "B<write>(2), B<ferror>(3), B<fopen>(3), B<fputwc>(3), B<fputws>(3), "
7269 "B<fseek>(3), B<fwrite>(3), B<gets>(3), B<putwchar>(3), B<scanf>(3), "
7270 "B<unlocked_stdio>(3)"
7274 #: build/C/man2/read.2:35
7280 #: build/C/man2/read.2:38
7281 msgid "read - read from a file descriptor"
7285 #: build/C/man2/read.2:43
7287 msgid "B<ssize_t read(int >I<fd>B<, void *>I<buf>B<, size_t >I<count>B<);>\n"
7291 #: build/C/man2/read.2:52
7293 "B<read>() attempts to read up to I<count> bytes from file descriptor I<fd> "
7294 "into the buffer starting at I<buf>."
7298 #: build/C/man2/read.2:63
7300 "If I<count> is zero, B<read>() returns zero and has no other results. If "
7301 "I<count> is greater than B<SSIZE_MAX>, the result is unspecified."
7305 #: build/C/man2/read.2:77
7307 "On success, the number of bytes read is returned (zero indicates end of "
7308 "file), and the file position is advanced by this number. It is not an error "
7309 "if this number is smaller than the number of bytes requested; this may "
7310 "happen for example because fewer bytes are actually available right now "
7311 "(maybe because we were close to end-of-file, or because we are reading from "
7312 "a pipe, or from a terminal), or because B<read>() was interrupted by a "
7313 "signal. On error, -1 is returned, and I<errno> is set appropriately. In "
7314 "this case it is left unspecified whether the file position (if any) changes."
7318 #: build/C/man2/read.2:78 build/C/man3/scanf.3:546 build/C/man2/write.2:108
7324 #: build/C/man2/read.2:85
7326 "The file descriptor I<fd> refers to a file other than a socket and has been "
7327 "marked nonblocking (B<O_NONBLOCK>), and the read would block."
7331 #: build/C/man2/read.2:85 build/C/man2/write.2:115
7333 msgid "B<EAGAIN> or B<EWOULDBLOCK>"
7336 #. Actually EAGAIN on Linux
7338 #: build/C/man2/read.2:96
7340 "The file descriptor I<fd> refers to a socket and has been marked nonblocking "
7341 "(B<O_NONBLOCK>), and the read would block. POSIX.1-2001 allows either error "
7342 "to be returned for this case, and does not require these constants to have "
7343 "the same value, so a portable application should check for both "
7348 #: build/C/man2/read.2:100
7349 msgid "I<fd> is not a valid file descriptor or is not open for reading."
7353 #: build/C/man2/read.2:104 build/C/man2/write.2:139
7354 msgid "I<buf> is outside your accessible address space."
7358 #: build/C/man2/read.2:108
7360 "The call was interrupted by a signal before any data was read; see "
7365 #: build/C/man2/read.2:119
7367 "I<fd> is attached to an object which is unsuitable for reading; or the file "
7368 "was opened with the B<O_DIRECT> flag, and either the address specified in "
7369 "I<buf>, the value specified in I<count>, or the current file offset is not "
7374 #: build/C/man2/read.2:129
7376 "I<fd> was created via a call to B<timerfd_create>(2) and the wrong size "
7377 "buffer was given to B<read>(); see B<timerfd_create>(2) for further "
7382 #: build/C/man2/read.2:140
7384 "I/O error. This will happen for example when the process is in a background "
7385 "process group, tries to read from its controlling tty, and either it is "
7386 "ignoring or blocking B<SIGTTIN> or its process group is orphaned. It may "
7387 "also occur when there is a low-level I/O error while reading from a disk or "
7392 #: build/C/man2/read.2:144
7393 msgid "I<fd> refers to a directory."
7397 #: build/C/man2/read.2:155
7399 "Other errors may occur, depending on the object connected to I<fd>. POSIX "
7400 "allows a B<read>() that is interrupted after reading some data to return -1 "
7401 "(with I<errno> set to B<EINTR>) or to return the number of bytes already "
7406 #: build/C/man2/read.2:169
7408 "On NFS file systems, reading small amounts of data will only update the "
7409 "timestamp the first time, subsequent calls may not do so. This is caused by "
7410 "client side attribute caching, because most if not all NFS clients leave "
7411 "st_atime (last file access time) updates to the server and client side "
7412 "reads satisfied from the client's cache will not cause st_atime updates on "
7413 "the server as there are no server side reads. UNIX semantics can be "
7414 "obtained by disabling client side attribute caching, but in most situations "
7415 "this will substantially increase server load and decrease performance."
7419 #: build/C/man2/read.2:178
7421 "Many file systems and disks were considered to be fast enough that the "
7422 "implementation of B<O_NONBLOCK> was deemed unnecessary. So, B<O_NONBLOCK> "
7423 "may not be available on files and/or disks."
7427 #: build/C/man2/read.2:191
7429 "B<close>(2), B<fcntl>(2), B<ioctl>(2), B<lseek>(2), B<open>(2), B<pread>(2), "
7430 "B<readdir>(2), B<readlink>(2), B<readv>(2), B<select>(2), B<write>(2), "
7435 #: build/C/man2/readlink.2:41
7441 #: build/C/man2/readlink.2:41
7447 #: build/C/man2/readlink.2:44
7448 msgid "readlink - read value of a symbolic link"
7452 #: build/C/man2/readlink.2:48
7454 "B<ssize_t readlink(const char *>I<path>B<, char *>I<buf>B<, size_t "
7459 #: build/C/man2/readlink.2:56
7460 msgid "B<readlink>():"
7464 #: build/C/man2/readlink.2:59 build/C/man2/symlink.2:50
7466 "_BSD_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ "
7467 "_XOPEN_SOURCE_EXTENDED || _POSIX_C_SOURCE\\ E<gt>=\\ 200112L"
7471 #: build/C/man2/readlink.2:75
7473 "B<readlink>() places the contents of the symbolic link I<path> in the "
7474 "buffer I<buf>, which has size I<bufsiz>. B<readlink>() does not append a "
7475 "null byte to I<buf>. It will truncate the contents (to a length of "
7476 "I<bufsiz> characters), in case the buffer is too small to hold all of the "
7481 #: build/C/man2/readlink.2:83
7483 "On success, B<readlink>() returns the number of bytes placed in I<buf>. On "
7484 "error, -1 is returned and I<errno> is set to indicate the error."
7488 #: build/C/man2/readlink.2:89
7490 "Search permission is denied for a component of the path prefix. (See also "
7491 "B<path_resolution>(7).)"
7495 #: build/C/man2/readlink.2:93
7496 msgid "I<buf> extends outside the process's allocated address space."
7499 #. At the glibc level, bufsiz is unsigned, so this error can only occur
7500 #. if bufsiz==0. However, the in the kernel syscall, bufsiz is signed,
7501 #. and this error can also occur if bufsiz < 0.
7502 #. See: http://thread.gmane.org/gmane.linux.man/380
7503 #. Subject: [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall?
7505 #: build/C/man2/readlink.2:102
7506 msgid "I<bufsiz> is not positive."
7510 #: build/C/man2/readlink.2:105
7511 msgid "The named file is not a symbolic link."
7515 #: build/C/man2/readlink.2:108
7516 msgid "An I/O error occurred while reading from the file system."
7520 #: build/C/man2/readlink.2:111
7521 msgid "Too many symbolic links were encountered in translating the pathname."
7525 #: build/C/man2/readlink.2:114
7526 msgid "A pathname, or a component of a pathname, was too long."
7530 #: build/C/man2/readlink.2:117
7531 msgid "The named file does not exist."
7535 #: build/C/man2/readlink.2:123
7536 msgid "A component of the path prefix is not a directory."
7540 #: build/C/man2/readlink.2:128
7541 msgid "4.4BSD (B<readlink>() first appeared in 4.2BSD), POSIX.1-2001."
7545 #: build/C/man2/readlink.2:136
7547 "In versions of glibc up to and including glibc 2.4, the return type of "
7548 "B<readlink>() was declared as I<int>. Nowadays, the return type is "
7549 "declared as I<ssize_t>, as (newly) required in POSIX.1-2001."
7553 #: build/C/man2/readlink.2:155
7555 "Using a statically sized buffer might not provide enough room for the "
7556 "symbolic link contents. The required size for the buffer can be obtained "
7557 "from the I<stat.st_size> value returned by a call to B<lstat>(2) on the "
7558 "link. However, the number of bytes written by B<readlink>() should be "
7559 "checked to make sure that the size of the symbolic link did not increase "
7560 "between the calls. Dynamically allocating the buffer for B<readlink>() "
7561 "also addresses a common portability problem when using I<PATH_MAX> for the "
7562 "buffer size, as this constant is not guaranteed to be defined per POSIX if "
7563 "the system does not have such limit."
7567 #: build/C/man2/readlink.2:161
7569 "The following program allocates the buffer needed by B<readlink>() "
7570 "dynamically from the information provided by B<lstat>(), making sure there's "
7571 "no race condition between the calls."
7575 #: build/C/man2/readlink.2:168
7578 "#include E<lt>sys/types.hE<gt>\n"
7579 "#include E<lt>sys/stat.hE<gt>\n"
7580 "#include E<lt>stdio.hE<gt>\n"
7581 "#include E<lt>stdlib.hE<gt>\n"
7582 "#include E<lt>unistd.hE<gt>\n"
7586 #: build/C/man2/readlink.2:175
7590 "main(int argc, char *argv[])\n"
7592 " struct stat sb;\n"
7593 " char *linkname;\n"
7598 #: build/C/man2/readlink.2:180
7601 " if (argc != 2) {\n"
7602 " fprintf(stderr, \"Usage: %s E<lt>pathnameE<gt>\\en\", argv[0]);\n"
7603 " exit(EXIT_FAILURE);\n"
7608 #: build/C/man2/readlink.2:185
7611 " if (lstat(argv[1], &sb) == -1) {\n"
7612 " perror(\"lstat\");\n"
7613 " exit(EXIT_FAILURE);\n"
7618 #: build/C/man2/readlink.2:191
7621 " linkname = malloc(sb.st_size + 1);\n"
7622 " if (linkname == NULL) {\n"
7623 " fprintf(stderr, \"insufficient memory\\en\");\n"
7624 " exit(EXIT_FAILURE);\n"
7629 #: build/C/man2/readlink.2:193
7631 msgid " r = readlink(argv[1], linkname, sb.st_size + 1);\n"
7635 #: build/C/man2/readlink.2:198
7638 " if (r E<lt> 0) {\n"
7639 " perror(\"lstat\");\n"
7640 " exit(EXIT_FAILURE);\n"
7645 #: build/C/man2/readlink.2:204
7648 " if (r E<gt> sb.st_size) {\n"
7649 " fprintf(stderr, \"symlink increased in size \"\n"
7650 " \"between lstat() and readlink()\\en\");\n"
7651 " exit(EXIT_FAILURE);\n"
7656 #: build/C/man2/readlink.2:206
7658 msgid " linkname[sb.st_size] = \\(aq\\e0\\(aq;\n"
7662 #: build/C/man2/readlink.2:208
7665 " printf(\"\\(aq%s\\(aq points to \\(aq%s\\(aq\\en\", argv[1], "
7670 #: build/C/man2/readlink.2:220
7672 "B<readlink>(1), B<lstat>(2), B<readlinkat>(2), B<stat>(2), B<symlink>(2), "
7673 "B<path_resolution>(7), B<symlink>(7)"
7677 #: build/C/man2/readv.2:30
7683 #: build/C/man2/readv.2:30
7689 #: build/C/man2/readv.2:33
7690 msgid "readv, writev, preadv, pwritev - read or write data into multiple buffers"
7694 #: build/C/man2/readv.2:36
7696 msgid "B<#include E<lt>sys/uio.hE<gt>>\n"
7700 #: build/C/man2/readv.2:38
7703 "B<ssize_t readv(int >I<fd>B<, const struct iovec *>I<iov>B<, int "
7708 #: build/C/man2/readv.2:40
7711 "B<ssize_t writev(int >I<fd>B<, const struct iovec *>I<iov>B<, int "
7716 #: build/C/man2/readv.2:43
7719 "B<ssize_t preadv(int >I<fd>B<, const struct iovec *>I<iov>B<, int "
7721 "B< off_t >I<offset>B<);>\n"
7725 #: build/C/man2/readv.2:46
7728 "B<ssize_t pwritev(int >I<fd>B<, const struct iovec *>I<iov>B<, int "
7730 "B< off_t >I<offset>B<);>\n"
7734 #: build/C/man2/readv.2:56
7735 msgid "B<preadv>(), B<pwritev>(): _BSD_SOURCE"
7739 #: build/C/man2/readv.2:66
7741 "The B<readv>() system call reads I<iovcnt> buffers from the file associated "
7742 "with the file descriptor I<fd> into the buffers described by I<iov> "
7743 "(\"scatter input\")."
7747 #: build/C/man2/readv.2:76
7749 "The B<writev>() system call writes I<iovcnt> buffers of data described by "
7750 "I<iov> to the file associated with the file descriptor I<fd> (\"gather "
7755 #: build/C/man2/readv.2:85
7757 "The pointer I<iov> points to an array of I<iovec> structures, defined in "
7758 "I<E<lt>sys/uio.hE<gt>> as:"
7762 #: build/C/man2/readv.2:93
7766 " void *iov_base; /* Starting address */\n"
7767 " size_t iov_len; /* Number of bytes to transfer */\n"
7772 #: build/C/man2/readv.2:101
7774 "The B<readv>() system call works just like B<read>(2) except that multiple "
7775 "buffers are filled."
7779 #: build/C/man2/readv.2:107
7781 "The B<writev>() system call works just like B<write>(2) except that "
7782 "multiple buffers are written out."
7786 #: build/C/man2/readv.2:126
7788 "Buffers are processed in array order. This means that B<readv>() "
7789 "completely fills I<iov>[0] before proceeding to I<iov>[1], and so on. (If "
7790 "there is insufficient data, then not all buffers pointed to by I<iov> may be "
7791 "filled.) Similarly, B<writev>() writes out the entire contents of "
7792 "I<iov>[0] before proceeding to I<iov>[1], and so on."
7796 #: build/C/man2/readv.2:144
7798 "The data transfers performed by B<readv>() and B<writev>() are atomic: the "
7799 "data written by B<writev>() is written as a single block that is not "
7800 "intermingled with output from writes in other processes (but see B<pipe>(7) "
7801 "for an exception); analogously, B<readv>() is guaranteed to read a "
7802 "contiguous block of data from the file, regardless of read operations "
7803 "performed in other threads or processes that have file descriptors referring "
7804 "to the same open file description (see B<open>(2))."
7808 #: build/C/man2/readv.2:144
7810 msgid "preadv() and pwritev()"
7814 #: build/C/man2/readv.2:157
7816 "The B<preadv>() system call combines the functionality of B<readv>() and "
7817 "B<pread>(2). It performs the same task as B<readv>(), but adds a fourth "
7818 "argument, I<offset>, which specifies the file offset at which the input "
7819 "operation is to be performed."
7823 #: build/C/man2/readv.2:170
7825 "The B<pwritev>() system call combines the functionality of B<writev>() and "
7826 "B<pwrite>(2). It performs the same task as B<writev>(), but adds a fourth "
7827 "argument, I<offset>, which specifies the file offset at which the output "
7828 "operation is to be performed."
7832 #: build/C/man2/readv.2:175
7834 "The file offset is not changed by these system calls. The file referred to "
7835 "by I<fd> must be capable of seeking."
7839 #: build/C/man2/readv.2:186
7841 "On success, B<readv>() and B<preadv>() return the number of bytes read; "
7842 "B<writev>() and B<pwritev>() return the number of bytes written. On "
7843 "error, -1 is returned, and I<errno> is set appropriately."
7847 #: build/C/man2/readv.2:198
7849 "The errors are as given for B<read>(2) and B<write>(2). Furthermore, "
7850 "B<preadv>() and B<pwritev>() can also fail for the same reasons as "
7851 "B<lseek>(2). Additionally, the following error is defined:"
7855 #: build/C/man2/readv.2:207
7857 "The sum of the I<iov_len> values overflows an I<ssize_t> value. Or, the "
7858 "vector count I<iovcnt> is less than zero or greater than the permitted "
7863 #: build/C/man2/readv.2:212
7865 "B<preadv>() and B<pwritev>() first appeared in Linux 2.6.30; library "
7866 "support was added in glibc 2.10."
7869 #. The readv/writev system calls were buggy before Linux 1.3.40.
7870 #. (Says release.libc.)
7872 #: build/C/man2/readv.2:220
7874 "B<readv>(), B<writev>(): 4.4BSD (these system calls first appeared in "
7875 "4.2BSD), POSIX.1-2001. Linux libc5 used I<size_t> as the type of the "
7876 "I<iovcnt> argument, and I<int> as the return type."
7880 #: build/C/man2/readv.2:224
7881 msgid "B<preadv>(), B<pwritev>(): nonstandard, but present also on the modern BSDs."
7885 #: build/C/man2/readv.2:225
7891 #: build/C/man2/readv.2:256
7893 "POSIX.1-2001 allows an implementation to place a limit on the number of "
7894 "items that can be passed in I<iov>. An implementation can advertise its "
7895 "limit by defining B<IOV_MAX> in I<E<lt>limits.hE<gt>> or at run time via the "
7896 "return value from I<sysconf(_SC_IOV_MAX)>. On Linux, the limit advertised "
7897 "by these mechanisms is 1024, which is the true kernel limit. However, the "
7898 "glibc wrapper functions do some extra work if they detect that the "
7899 "underlying kernel system call failed because this limit was exceeded. In "
7900 "the case of B<readv>() the wrapper function allocates a temporary buffer "
7901 "large enough for all of the items specified by I<iov>, passes that buffer in "
7902 "a call to B<read>(2), copies data from the buffer to the locations specified "
7903 "by the I<iov_base> fields of the elements of I<iov>, and then frees the "
7904 "buffer. The wrapper function for B<writev>() performs the analogous task "
7905 "using a temporary buffer and a call to B<write>(2)."
7909 #: build/C/man2/readv.2:263
7911 "It is not advisable to mix calls to B<readv>() or B<writev>(), which "
7912 "operate on file descriptors, with the functions from the stdio library; the "
7913 "results will be undefined and probably not what you want."
7917 #: build/C/man2/readv.2:266
7918 msgid "The following code sample demonstrates the use of B<writev>():"
7922 #: build/C/man2/readv.2:273
7925 "char *str0 = \"hello \";\n"
7926 "char *str1 = \"world\\en\";\n"
7927 "struct iovec iov[2];\n"
7928 "ssize_t nwritten;\n"
7932 #: build/C/man2/readv.2:278
7935 "iov[0].iov_base = str0;\n"
7936 "iov[0].iov_len = strlen(str0);\n"
7937 "iov[1].iov_base = str1;\n"
7938 "iov[1].iov_len = strlen(str1);\n"
7942 #: build/C/man2/readv.2:280
7944 msgid "nwritten = writev(STDOUT_FILENO, iov, 2);\n"
7948 #: build/C/man2/readv.2:286
7949 msgid "B<pread>(2), B<read>(2), B<write>(2)"
7953 #: build/C/man3/remove.3:31
7959 #: build/C/man3/remove.3:31
7965 #: build/C/man3/remove.3:34
7966 msgid "remove - remove a file or directory"
7970 #: build/C/man3/remove.3:38
7971 msgid "B<int remove(const char *>I<pathname>B<);>"
7975 #: build/C/man3/remove.3:46
7977 "B<remove>() deletes a name from the file system. It calls B<unlink>(2) "
7978 "for files, and B<rmdir>(2) for directories."
7982 #: build/C/man3/remove.3:50
7984 "If the removed name was the last link to a file and no processes have the "
7985 "file open, the file is deleted and the space it was using is made available "
7990 #: build/C/man3/remove.3:55
7992 "If the name was the last link to a file, but any processes still have the "
7993 "file open, the file will remain in existence until the last file descriptor "
7994 "referring to it is closed."
7998 #: build/C/man3/remove.3:57
7999 msgid "If the name referred to a symbolic link, the link is removed."
8003 #: build/C/man3/remove.3:60
8005 "If the name referred to a socket, FIFO, or device, the name is removed, but "
8006 "processes which have the object open may continue to use it."
8010 #: build/C/man3/remove.3:70
8011 msgid "The errors that occur are those for B<unlink>(2) and B<rmdir>(2)."
8015 #: build/C/man3/remove.3:72
8016 msgid "C89, C99, 4.3BSD, POSIX.1-2001."
8020 #: build/C/man3/remove.3:78
8022 "Under libc4 and libc5, B<remove>() was an alias for B<unlink>(2) (and "
8023 "hence would not remove directories)."
8027 #: build/C/man3/remove.3:81 build/C/man2/unlink.2:148
8029 "Infelicities in the protocol underlying NFS can cause the unexpected "
8030 "disappearance of files which are still being used."
8034 #: build/C/man3/remove.3:92
8036 "B<rm>(1), B<unlink>(1), B<link>(2), B<mknod>(2), B<open>(2), B<rename>(2), "
8037 "B<rmdir>(2), B<unlink>(2), B<mkfifo>(3), B<symlink>(7)"
8041 #: build/C/man2/rename.2:32
8047 #: build/C/man2/rename.2:32
8053 #: build/C/man2/rename.2:35
8054 msgid "rename - change the name or location of a file"
8058 #: build/C/man2/rename.2:39
8059 msgid "B<int rename(const char *>I<oldpath>B<, const char *>I<newpath>B<);>"
8063 #: build/C/man2/rename.2:48
8065 "B<rename>() renames a file, moving it between directories if required. Any "
8066 "other hard links to the file (as created using B<link>(2)) are unaffected. "
8067 "Open file descriptors for I<oldpath> are also unaffected."
8071 #: build/C/man2/rename.2:56
8073 "If I<newpath> already exists it will be atomically replaced (subject to a "
8074 "few conditions; see ERRORS below), so that there is no point at which "
8075 "another process attempting to access I<newpath> will find it missing."
8079 #: build/C/man2/rename.2:64
8081 "If I<oldpath> and I<newpath> are existing hard links referring to the same "
8082 "file, then B<rename>() does nothing, and returns a success status."
8086 #: build/C/man2/rename.2:72
8088 "If I<newpath> exists but the operation fails for some reason B<rename>() "
8089 "guarantees to leave an instance of I<newpath> in place."
8093 #: build/C/man2/rename.2:78
8095 "I<oldpath> can specify a directory. In this case, I<newpath> must either "
8096 "not exist, or it must specify an empty directory."
8100 #: build/C/man2/rename.2:85
8102 "However, when overwriting there will probably be a window in which both "
8103 "I<oldpath> and I<newpath> refer to the file being renamed."
8107 #: build/C/man2/rename.2:91
8109 "If I<oldpath> refers to a symbolic link the link is renamed; if I<newpath> "
8110 "refers to a symbolic link the link will be overwritten."
8114 #: build/C/man2/rename.2:116
8116 "Write permission is denied for the directory containing I<oldpath> or "
8117 "I<newpath>, or, search permission is denied for one of the directories in "
8118 "the path prefix of I<oldpath> or I<newpath>, or I<oldpath> is a directory "
8119 "and does not allow write permission (needed to update the I<..> entry). "
8120 "(See also B<path_resolution>(7).)"
8124 #: build/C/man2/rename.2:116 build/C/man2/rmdir.2:55 build/C/man2/unlink.2:71
8130 #: build/C/man2/rename.2:133
8132 "The rename fails because I<oldpath> or I<newpath> is a directory that is in "
8133 "use by some process (perhaps as current working directory, or as root "
8134 "directory, or because it was open for reading) or is in use by the system "
8135 "(for example as mount point), while the system considers this an error. "
8136 "(Note that there is no requirement to return B<EBUSY> in such "
8137 "cases\\(emthere is nothing wrong with doing the rename anyway\\(embut it is "
8138 "allowed to return B<EBUSY> if the system cannot otherwise handle such "
8143 #: build/C/man2/rename.2:140
8145 "The new pathname contained a path prefix of the old, or, more generally, an "
8146 "attempt was made to make a directory a subdirectory of itself."
8150 #: build/C/man2/rename.2:146
8151 msgid "I<newpath> is an existing directory, but I<oldpath> is not a directory."
8155 #: build/C/man2/rename.2:157
8157 "I<oldpath> already has the maximum number of links to it, or it was a "
8158 "directory and the directory containing I<newpath> has the maximum number of "
8163 #: build/C/man2/rename.2:173
8165 "The link named by I<oldpath> does not exist; or, a directory component in "
8166 "I<newpath> does not exist; or, I<oldpath> or I<newpath> is an empty string."
8170 #: build/C/man2/rename.2:190
8172 "A component used as a directory in I<oldpath> or I<newpath> is not, in fact, "
8173 "a directory. Or, I<oldpath> is a directory, and I<newpath> exists but is "
8178 #: build/C/man2/rename.2:190
8180 msgid "B<ENOTEMPTY> or B<EEXIST>"
8184 #: build/C/man2/rename.2:194
8186 "I<newpath> is a nonempty directory, that is, contains entries other than "
8191 #: build/C/man2/rename.2:194 build/C/man2/unlink.2:126
8193 msgid "B<EPERM> or B<EACCES>"
8197 #: build/C/man2/rename.2:218
8199 "The directory containing I<oldpath> has the sticky bit (B<S_ISVTX>) set and "
8200 "the process's effective user ID is neither the user ID of the file to be "
8201 "deleted nor that of the directory containing it, and the process is not "
8202 "privileged (Linux: does not have the B<CAP_FOWNER> capability); or "
8203 "I<newpath> is an existing file and the directory containing it has the "
8204 "sticky bit set and the process's effective user ID is neither the user ID of "
8205 "the file to be replaced nor that of the directory containing it, and the "
8206 "process is not privileged (Linux: does not have the B<CAP_FOWNER> "
8207 "capability); or the file system containing I<pathname> does not support "
8208 "renaming of the type requested."
8212 #: build/C/man2/rename.2:229
8214 "I<oldpath> and I<newpath> are not on the same mounted file system. (Linux "
8215 "permits a file system to be mounted at multiple points, but B<rename>() "
8216 "does not work across different mount points, even if the same file system is "
8221 #: build/C/man2/rename.2:231
8222 msgid "4.3BSD, C89, C99, POSIX.1-2001."
8226 #: build/C/man2/rename.2:242
8228 "On NFS file systems, you can not assume that if the operation failed the "
8229 "file was not renamed. If the server does the rename operation and then "
8230 "crashes, the retransmitted RPC which will be processed when the server is up "
8231 "again causes a failure. The application is expected to deal with this. See "
8232 "B<link>(2) for a similar problem."
8236 #: build/C/man2/rename.2:251
8238 "B<mv>(1), B<chmod>(2), B<link>(2), B<renameat>(2), B<symlink>(2), "
8239 "B<unlink>(2), B<path_resolution>(7), B<symlink>(7)"
8243 #: build/C/man2/rmdir.2:30
8249 #: build/C/man2/rmdir.2:30
8255 #: build/C/man2/rmdir.2:33
8256 msgid "rmdir - delete a directory"
8260 #: build/C/man2/rmdir.2:37
8261 msgid "B<int rmdir(const char *>I<pathname>B<);>"
8265 #: build/C/man2/rmdir.2:40
8266 msgid "B<rmdir>() deletes a directory, which must be empty."
8270 #: build/C/man2/rmdir.2:55
8272 "Write access to the directory containing I<pathname> was not allowed, or one "
8273 "of the directories in the path prefix of I<pathname> did not allow search "
8274 "permission. (See also B<path_resolution>(7)."
8278 #: build/C/man2/rmdir.2:64
8280 "I<pathname> is currently in use by the system or some process that prevents "
8281 "its removal. On Linux this means I<pathname> is currently used as a mount "
8282 "point or is the root directory of the calling process."
8286 #: build/C/man2/rmdir.2:73
8287 msgid "I<pathname> has I<.> as last component."
8291 #: build/C/man2/rmdir.2:77
8292 msgid "Too many symbolic links were encountered in resolving I<pathname>."
8296 #: build/C/man2/rmdir.2:85
8298 "A directory component in I<pathname> does not exist or is a dangling "
8303 #: build/C/man2/rmdir.2:94
8305 "I<pathname>, or a component used as a directory in I<pathname>, is not, in "
8306 "fact, a directory."
8310 #: build/C/man2/rmdir.2:94
8312 msgid "B<ENOTEMPTY>"
8316 #: build/C/man2/rmdir.2:107
8318 "I<pathname> contains entries other than I<.> and I<..> ; or, I<pathname> has "
8319 "I<..> as its final component. POSIX.1-2001 also allows B<EEXIST> for this "
8324 #: build/C/man2/rmdir.2:118
8326 "The directory containing I<pathname> has the sticky bit (B<S_ISVTX>) set "
8327 "and the process's effective user ID is neither the user ID of the file to be "
8328 "deleted nor that of the directory containing it, and the process is not "
8329 "privileged (Linux: does not have the B<CAP_FOWNER> capability)."
8333 #: build/C/man2/rmdir.2:123
8335 "The file system containing I<pathname> does not support the removal of "
8340 #: build/C/man2/rmdir.2:127
8341 msgid "I<pathname> refers to a directory on a read-only file system."
8345 #: build/C/man2/rmdir.2:132
8347 "Infelicities in the protocol underlying NFS can cause the unexpected "
8348 "disappearance of directories which are still being used."
8352 #: build/C/man2/rmdir.2:141
8354 "B<rm>(1), B<rmdir>(1), B<chdir>(2), B<chmod>(2), B<mkdir>(2), B<rename>(2), "
8355 "B<unlink>(2), B<unlinkat>(2)"
8359 #: build/C/man3/scanf.3:50
8365 #: build/C/man3/scanf.3:53
8366 msgid "scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf - input format conversion"
8370 #: build/C/man3/scanf.3:60
8373 "B<int scanf(const char *>I<format>B<, ...);>\n"
8374 "B<int fscanf(FILE *>I<stream>B<, const char *>I<format>B<, ...);>\n"
8375 "B<int sscanf(const char *>I<str>B<, const char *>I<format>B<, ...);>\n"
8379 #: build/C/man3/scanf.3:62
8381 msgid "B<#include E<lt>stdarg.hE<gt>>\n"
8385 #: build/C/man3/scanf.3:66
8388 "B<int vscanf(const char *>I<format>B<, va_list >I<ap>B<);>\n"
8389 "B<int vsscanf(const char *>I<str>B<, const char *>I<format>B<, va_list "
8391 "B<int vfscanf(FILE *>I<stream>B<, const char *>I<format>B<, va_list "
8396 #: build/C/man3/scanf.3:77
8397 msgid "B<vscanf>(), B<vsscanf>(), B<vfscanf>():"
8401 #: build/C/man3/scanf.3:80
8403 "_XOPEN_SOURCE\\ E<gt>=\\ 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE\\ E<gt>=\\ "
8408 #: build/C/man3/scanf.3:102
8410 "The B<scanf>() family of functions scans input according to I<format> as "
8411 "described below. This format may contain I<conversion specifications>; the "
8412 "results from such conversions, if any, are stored in the locations pointed "
8413 "to by the I<pointer> arguments that follow I<format>. Each I<pointer> "
8414 "argument must be of a type that is appropriate for the value returned by the "
8415 "corresponding conversion specification."
8419 #: build/C/man3/scanf.3:113
8421 "If the number of conversion specifications in I<format> exceeds the number "
8422 "of I<pointer> arguments, the results are undefined. If the number of "
8423 "I<pointer> arguments exceeds the number of conversion specifications, then "
8424 "the excess I<pointer> arguments are evaluated, but are otherwise ignored."
8428 #: build/C/man3/scanf.3:125
8430 "The B<scanf>() function reads input from the standard input stream "
8431 "I<stdin>, B<fscanf>() reads input from the stream pointer I<stream>, and "
8432 "B<sscanf>() reads its input from the character string pointed to by I<str>."
8436 #: build/C/man3/scanf.3:143
8438 "The B<vfscanf>() function is analogous to B<vfprintf>(3) and reads input "
8439 "from the stream pointer I<stream> using a variable argument list of pointers "
8440 "(see B<stdarg>(3). The B<vscanf>() function scans a variable argument list "
8441 "from the standard input and the B<vsscanf>() function scans it from a "
8442 "string; these are analogous to the B<vprintf>(3) and B<vsprintf>(3) "
8443 "functions respectively."
8447 #: build/C/man3/scanf.3:157
8449 "The I<format> string consists of a sequence of I<directives> which describe "
8450 "how to process the sequence of input characters. If processing of a "
8451 "directive fails, no further input is read, and B<scanf>() returns. A "
8452 "\"failure\" can be either of the following: I<input failure>, meaning that "
8453 "input characters were unavailable, or I<matching failure>, meaning that the "
8454 "input was inappropriate (see below)."
8458 #: build/C/man3/scanf.3:159
8459 msgid "A directive is one of the following:"
8463 #: build/C/man3/scanf.3:159 build/C/man3/scanf.3:165 build/C/man3/scanf.3:169 build/C/man3/scanf.3:188 build/C/man3/scanf.3:199 build/C/man3/scanf.3:217 build/C/man3/scanf.3:229 build/C/man3/scanf.3:243
8469 #: build/C/man3/scanf.3:165
8471 "A sequence of white-space characters (space, tab, newline, etc.; see "
8472 "B<isspace>(3)). This directive matches any amount of white space, including "
8473 "none, in the input."
8477 #: build/C/man3/scanf.3:169
8479 "An ordinary character (i.e., one other than white space or \\(aq%\\(aq). "
8480 "This character must exactly match the next character of input."
8484 #: build/C/man3/scanf.3:180
8486 "A conversion specification, which commences with a \\(aq%\\(aq (percent) "
8487 "character. A sequence of characters from the input is converted according "
8488 "to this specification, and the result is placed in the corresponding "
8489 "I<pointer> argument. If the next item of input does not match the "
8490 "conversion specification, the conversion fails\\(emthis is a I<matching "
8495 #: build/C/man3/scanf.3:188
8497 "Each I<conversion specification> in I<format> begins with either the "
8498 "character \\(aq%\\(aq or the character sequence \"B<%>I<n>B<$>\" (see below "
8499 "for the distinction) followed by:"
8503 #: build/C/man3/scanf.3:199
8505 "An optional \\(aq*\\(aq assignment-suppression character: B<scanf>() reads "
8506 "input as directed by the conversion specification, but discards the input. "
8507 "No corresponding I<pointer> argument is required, and this specification is "
8508 "not included in the count of successful assignments returned by B<scanf>()."
8512 #: build/C/man3/scanf.3:217
8514 "An optional \\(aqa\\(aq character. This is used with string conversions, "
8515 "and relieves the caller of the need to allocate a corresponding buffer to "
8516 "hold the input: instead, B<scanf>() allocates a buffer of sufficient size, "
8517 "and assigns the address of this buffer to the corresponding I<pointer> "
8518 "argument, which should be a pointer to a I<char *> variable (this variable "
8519 "does not need to be initialized before the call). The caller should "
8520 "subsequently B<free>(3) this buffer when it is no longer required. This is "
8521 "a GNU extension; C99 employs the \\(aqa\\(aq character as a conversion "
8522 "specifier (and it can also be used as such in the GNU implementation)."
8526 #: build/C/man3/scanf.3:229
8528 "An optional decimal integer which specifies the I<maximum field width>. "
8529 "Reading of characters stops either when this maximum is reached or when a "
8530 "nonmatching character is found, whichever happens first. Most conversions "
8531 "discard initial white space characters (the exceptions are noted below), and "
8532 "these discarded characters don't count toward the maximum field width. "
8533 "String input conversions store a terminating null byte (\\(aq\\e0\\(aq) to "
8534 "mark the end of the input; the maximum field width does not include this "
8539 #: build/C/man3/scanf.3:243
8541 "An optional I<type modifier character>. For example, the B<l> type modifier "
8542 "is used with integer conversions such as B<%d> to specify that the "
8543 "corresponding I<pointer> argument refers to a I<long int> rather than a "
8544 "pointer to an I<int>."
8548 #: build/C/man3/scanf.3:248
8550 "A I<conversion specifier> that specifies the type of input conversion to be "
8555 #: build/C/man3/scanf.3:277
8557 "The conversion specifications in I<format> are of two forms, either "
8558 "beginning with \\(aq%\\(aq or beginning with \"B<%>I<n>B<$>\". The two "
8559 "forms should not be mixed in the same I<format> string, except that a string "
8560 "containing \"B<%>I<n>B<$>\" specifications can include B<%%> and B<%*>. If "
8561 "I<format> contains \\(aq%\\(aq specifications then these correspond in order "
8562 "with successive I<pointer> arguments. In the \"B<%>I<n>B<$>\" form (which "
8563 "is specified in POSIX.1-2001, but not C99), I<n> is a decimal integer that "
8564 "specifies that the converted input should be placed in the location referred "
8565 "to by the I<n>-th I<pointer> argument following I<format>."
8569 #: build/C/man3/scanf.3:277
8575 #: build/C/man3/scanf.3:281
8577 "The following I<type modifier characters> can appear in a conversion "
8582 #: build/C/man3/scanf.3:291
8584 "Indicates that the conversion will be one of B<d>, B<i>, B<o>, B<u>, B<x>, "
8585 "B<X>, or B<n> and the next pointer is a pointer to a I<short int> or "
8586 "I<unsigned short int> (rather than I<int>)."
8590 #: build/C/man3/scanf.3:299
8592 "As for B<h>, but the next pointer is a pointer to a I<signed char> or "
8597 #: build/C/man3/scanf.3:308
8599 "As for B<h>, but the next pointer is a pointer to an I<intmax_t> or a "
8600 "I<uintmax_t>. This modifier was introduced in C99."
8603 #. This use of l was introduced in Amendment 1 to ISO C90.
8605 #: build/C/man3/scanf.3:335
8607 "Indicates either that the conversion will be one of B<d>, B<i>, B<o>, B<u>, "
8608 "B<x>, B<X>, or B<n> and the next pointer is a pointer to a I<long int> or "
8609 "I<unsigned long int> (rather than I<int>), or that the conversion will be "
8610 "one of B<e>, B<f>, or B<g> and the next pointer is a pointer to I<double> "
8611 "(rather than I<float>). Specifying two B<l> characters is equivalent to "
8612 "B<L>. If used with B<%c> or B<%s> the corresponding parameter is considered "
8613 "as a pointer to a wide character or wide-character string respectively."
8616 #. MTK, Jul 05: The following is no longer true for modern
8617 #. ANSI C (i.e., C99):
8618 #. (Note that long long is not an
8620 #. type. Any program using this will not be portable to all
8623 #: build/C/man3/scanf.3:351
8625 "Indicates that the conversion will be either B<e>, B<f>, or B<g> and the "
8626 "next pointer is a pointer to I<long double> or the conversion will be B<d>, "
8627 "B<i>, B<o>, B<u>, or B<x> and the next pointer is a pointer to I<long long>."
8631 #: build/C/man3/scanf.3:356
8632 msgid "equivalent to B<L>. This specifier does not exist in ANSI C."
8636 #: build/C/man3/scanf.3:363
8638 "As for B<h>, but the next pointer is a pointer to a I<ptrdiff_t>. This "
8639 "modifier was introduced in C99."
8643 #: build/C/man3/scanf.3:370
8645 "As for B<h>, but the next pointer is a pointer to a I<size_t>. This "
8646 "modifier was introduced in C99."
8650 #: build/C/man3/scanf.3:374
8651 msgid "The following I<conversion specifiers> are available:"
8655 #: build/C/man3/scanf.3:383
8657 "Matches a literal \\(aq%\\(aq. That is, B<%\\&%> in the format string "
8658 "matches a single input \\(aq%\\(aq character. No conversion is done (but "
8659 "initial white space characters are discarded), and assignment does not "
8664 #: build/C/man3/scanf.3:383
8670 #: build/C/man3/scanf.3:388
8672 "Matches an optionally signed decimal integer; the next pointer must be a "
8673 "pointer to I<int>."
8677 #: build/C/man3/scanf.3:388
8683 #: build/C/man3/scanf.3:397
8685 "Equivalent to I<ld>; this exists only for backward compatibility. (Note: "
8686 "thus only in libc4. In libc5 and glibc the B<%D> is silently ignored, "
8687 "causing old programs to fail mysteriously.)"
8691 #: build/C/man3/scanf.3:397
8697 #: build/C/man3/scanf.3:409
8699 "Matches an optionally signed integer; the next pointer must be a pointer to "
8700 "I<int>. The integer is read in base 16 if it begins with I<0x> or I<0X>, in "
8701 "base 8 if it begins with I<0>, and in base 10 otherwise. Only characters "
8702 "that correspond to the base are used."
8706 #: build/C/man3/scanf.3:409
8712 #: build/C/man3/scanf.3:413
8714 "Matches an unsigned octal integer; the next pointer must be a pointer to "
8719 #: build/C/man3/scanf.3:413
8725 #: build/C/man3/scanf.3:418
8727 "Matches an unsigned decimal integer; the next pointer must be a pointer to "
8732 #: build/C/man3/scanf.3:423
8734 "Matches an unsigned hexadecimal integer; the next pointer must be a pointer "
8735 "to I<unsigned int>."
8739 #: build/C/man3/scanf.3:423
8745 #: build/C/man3/scanf.3:427
8746 msgid "Equivalent to B<x>."
8750 #: build/C/man3/scanf.3:427
8756 #: build/C/man3/scanf.3:432
8758 "Matches an optionally signed floating-point number; the next pointer must be "
8759 "a pointer to I<float>."
8763 #: build/C/man3/scanf.3:432
8769 #: build/C/man3/scanf.3:436 build/C/man3/scanf.3:440 build/C/man3/scanf.3:444
8770 msgid "Equivalent to B<f>."
8774 #: build/C/man3/scanf.3:436
8780 #: build/C/man3/scanf.3:440
8786 #: build/C/man3/scanf.3:448
8787 msgid "(C99) Equivalent to B<f>."
8791 #: build/C/man3/scanf.3:456
8793 "Matches a sequence of non-white-space characters; the next pointer must be a "
8794 "pointer to character array that is long enough to hold the input sequence "
8795 "and the terminating null byte (\\(aq\\e0\\(aq), which is added "
8796 "automatically. The input string stops at white space or at the maximum "
8797 "field width, whichever occurs first."
8801 #: build/C/man3/scanf.3:467
8803 "Matches a sequence of characters whose length is specified by the I<maximum "
8804 "field width> (default 1); the next pointer must be a pointer to I<char>, and "
8805 "there must be enough room for all the characters (no terminating null byte "
8806 "is added). The usual skip of leading white space is suppressed. To skip "
8807 "white space first, use an explicit space in the format."
8811 #: build/C/man3/scanf.3:467
8817 #: build/C/man3/scanf.3:500
8819 "Matches a nonempty sequence of characters from the specified set of accepted "
8820 "characters; the next pointer must be a pointer to I<char>, and there must be "
8821 "enough room for all the characters in the string, plus a terminating null "
8822 "byte. The usual skip of leading white space is suppressed. The string is "
8823 "to be made up of characters in (or not in) a particular set; the set is "
8824 "defined by the characters between the open bracket B<[> character and a "
8825 "close bracket B<]> character. The set I<excludes> those characters if the "
8826 "first character after the open bracket is a circumflex (B<^>). To include a "
8827 "close bracket in the set, make it the first character after the open bracket "
8828 "or the circumflex; any other position will end the set. The hyphen "
8829 "character B<-> is also special; when placed between two other characters, it "
8830 "adds all intervening characters to the set. To include a hyphen, make it "
8831 "the last character before the final close bracket. For instance, "
8832 "B<[^]0-9-]> means the set \"everything except close bracket, zero through "
8833 "nine, and hyphen\". The string ends with the appearance of a character not "
8834 "in the (or, with a circumflex, in) set or when the field width runs out."
8838 #: build/C/man3/scanf.3:508
8840 "Matches a pointer value (as printed by B<%p> in B<printf>(3); the next "
8841 "pointer must be a pointer to a pointer to I<void>."
8845 #: build/C/man3/scanf.3:528
8847 "Nothing is expected; instead, the number of characters consumed thus far "
8848 "from the input is stored through the next pointer, which must be a pointer "
8849 "to I<int>. This is I<not> a conversion, although it can be suppressed with "
8850 "the B<*> assignment-suppression character. The C standard says: \"Execution "
8851 "of a B<%n> directive does not increment the assignment count returned at the "
8852 "completion of execution\" but the Corrigendum seems to contradict this. "
8853 "Probably it is wise not to make any assumptions on the effect of B<%n> "
8854 "conversions on the return value."
8858 #: build/C/man3/scanf.3:533
8860 "These functions return the number of input items successfully matched and "
8861 "assigned, which can be fewer than provided for, or even zero in the event of "
8862 "an early matching failure."
8866 #: build/C/man3/scanf.3:545
8868 "The value B<EOF> is returned if the end of input is reached before either "
8869 "the first successful conversion or a matching failure occurs. B<EOF> is "
8870 "also returned if a read error occurs, in which case the error indicator for "
8871 "the stream (see B<ferror>(3)) is set, and I<errno> is set indicate the "
8876 #: build/C/man3/scanf.3:551
8878 "The file descriptor underlying I<stream> is marked nonblocking, and the read "
8879 "operation would block."
8883 #: build/C/man3/scanf.3:556
8885 "The file descriptor underlying I<stream> is invalid, or not open for "
8890 #: build/C/man3/scanf.3:559
8891 msgid "Input byte sequence does not form a valid character."
8895 #: build/C/man3/scanf.3:563
8896 msgid "The read operation was interrupted by a signal; see B<signal>(7)."
8900 #: build/C/man3/scanf.3:568
8901 msgid "Not enough arguments; or I<format> is NULL."
8905 #: build/C/man3/scanf.3:571
8906 msgid "Out of memory."
8910 #: build/C/man3/scanf.3:571
8916 #: build/C/man3/scanf.3:575
8918 "The result of an integer conversion would exceed the size that can be stored "
8919 "in the corresponding integer type."
8923 #: build/C/man3/scanf.3:585
8925 "The functions B<fscanf>(), B<scanf>(), and B<sscanf>() conform to C89 and "
8926 "C99 and POSIX.1-2001. These standards do not specify the B<ERANGE> error."
8930 #: build/C/man3/scanf.3:595
8932 "The B<q> specifier is the 4.4BSD notation for I<long long>, while B<ll> or "
8933 "the usage of B<L> in integer conversions is the GNU notation."
8937 #: build/C/man3/scanf.3:606
8939 "The Linux version of these functions is based on the I<GNU> I<libio> "
8940 "library. Take a look at the I<info> documentation of I<GNU> I<libc "
8941 "(glibc-1.08)> for a more concise description."
8944 #. This feature seems to be present at least as far back as glibc 2.0.
8946 #: build/C/man3/scanf.3:624
8948 "The GNU C library supports a nonstandard extension that causes the library "
8949 "to dynamically allocate a string of sufficient size for input strings for "
8950 "the B<%s> and B<%a[>I<range>B<]> conversion specifiers. To make use of this "
8951 "feature, specify B<a> as a length modifier (thus B<%as> or "
8952 "B<%a[>I<range>B<]>). The caller must B<free>(3) the returned string, as in "
8953 "the following example:"
8957 #: build/C/man3/scanf.3:629
8965 #: build/C/man3/scanf.3:640
8969 "n = scanf(\"%a[a-z]\", &p);\n"
8971 " printf(\"read: %s\\en\", p);\n"
8973 "} else if (errno != 0) {\n"
8974 " perror(\"scanf\");\n"
8976 " fprintf(stderr, \"No matching characters\\en\");\n"
8981 #: build/C/man3/scanf.3:648
8983 "As shown in the above example, it is only necessary to call B<free>(3) if "
8984 "the B<scanf>() call successfully read a string."
8988 #: build/C/man3/scanf.3:660
8990 "The B<a> modifier is not available if the program is compiled with I<gcc "
8991 "-std=c99> or I<gcc -D_ISOC99_SOURCE> (unless B<_GNU_SOURCE> is also "
8992 "specified), in which case the B<a> is interpreted as a specifier for "
8993 "floating-point numbers (see above)."
8997 #: build/C/man3/scanf.3:669
8999 "Since version 2.7, glibc also provides the B<m> modifier for the same "
9000 "purpose as the B<a> modifier. The B<m> modifier has the following "
9005 #: build/C/man3/scanf.3:674
9006 msgid "It may also be applied to B<%c> conversion specifiers (e.g., B<%3mc>)."
9010 #: build/C/man3/scanf.3:680
9012 "It avoids ambiguity with respect to the B<%a> floating-point conversion "
9013 "specifier (and is unaffected by I<gcc -std=c99> etc.)"
9017 #: build/C/man3/scanf.3:682
9018 msgid "It is specified in the upcoming revision of the POSIX.1 standard."
9022 #: build/C/man3/scanf.3:695
9024 "All functions are fully C89 conformant, but provide the additional "
9025 "specifiers B<q> and B<a> as well as an additional behavior of the B<L> and "
9026 "B<l> specifiers. The latter may be considered to be a bug, as it changes "
9027 "the behavior of specifiers defined in C89."
9031 #: build/C/man3/scanf.3:711
9033 "Some combinations of the type modifiers and conversion specifiers defined by "
9034 "ANSI C do not make sense (e.g. B<%Ld>). While they may have a well-defined "
9035 "behavior on Linux, this need not to be so on other architectures. Therefore "
9036 "it usually is better to use modifiers that are not defined by ANSI C at all, "
9037 "that is, use B<q> instead of B<L> in combination with B<d>, B<i>, B<o>, "
9038 "B<u>, B<x>, and B<X> conversions or B<ll>."
9042 #: build/C/man3/scanf.3:717
9044 "The usage of B<q> is not the same as on 4.4BSD, as it may be used in float "
9045 "conversions equivalently to B<L>."
9049 #: build/C/man3/scanf.3:724
9051 "B<getc>(3), B<printf>(3), B<setlocale>(3), B<strtod>(3), B<strtol>(3), "
9056 #: build/C/man3/setbuf.3:46
9062 #: build/C/man3/setbuf.3:46
9068 #: build/C/man3/setbuf.3:49
9069 msgid "setbuf, setbuffer, setlinebuf, setvbuf - stream buffering operations"
9073 #: build/C/man3/setbuf.3:54
9075 msgid "B<void setbuf(FILE *>I<stream>B<, char *>I<buf>B<);>\n"
9079 #: build/C/man3/setbuf.3:56
9081 msgid "B<void setbuffer(FILE *>I<stream>B<, char *>I<buf>B<, size_t >I<size>B<);>\n"
9085 #: build/C/man3/setbuf.3:58
9087 msgid "B<void setlinebuf(FILE *>I<stream>B<);>\n"
9091 #: build/C/man3/setbuf.3:61
9094 "B<int setvbuf(FILE *>I<stream>B<, char *>I<buf>B<, int >I<mode>B<, size_t "
9099 #: build/C/man3/setbuf.3:71
9100 msgid "B<setbuffer>(), B<setlinebuf>(): _BSD_SOURCE"
9104 #: build/C/man3/setbuf.3:94
9106 "The three types of buffering available are unbuffered, block buffered, and "
9107 "line buffered. When an output stream is unbuffered, information appears on "
9108 "the destination file or terminal as soon as written; when it is block "
9109 "buffered many characters are saved up and written as a block; when it is "
9110 "line buffered characters are saved up until a newline is output or input is "
9111 "read from any stream attached to a terminal device (typically I<stdin>). "
9112 "The function B<fflush>(3) may be used to force the block out early. (See "
9113 "B<fclose>(3).) Normally all files are block buffered. When the first I/O "
9114 "operation occurs on a file, B<malloc>(3) is called, and a buffer is "
9115 "obtained. If a stream refers to a terminal (as I<stdout> normally does) it "
9116 "is line buffered. The standard error stream I<stderr> is always unbuffered "
9121 #: build/C/man3/setbuf.3:101
9123 "The B<setvbuf>() function may be used on any open stream to change its "
9124 "buffer. The I<mode> argument must be one of the following three macros:"
9128 #: build/C/man3/setbuf.3:102
9134 #: build/C/man3/setbuf.3:105
9139 #: build/C/man3/setbuf.3:105
9145 #: build/C/man3/setbuf.3:108
9146 msgid "line buffered"
9150 #: build/C/man3/setbuf.3:108
9156 #: build/C/man3/setbuf.3:111
9157 msgid "fully buffered"
9161 #: build/C/man3/setbuf.3:127
9163 "Except for unbuffered files, the I<buf> argument should point to a buffer at "
9164 "least I<size> bytes long; this buffer will be used instead of the current "
9165 "buffer. If the argument I<buf> is NULL, only the mode is affected; a new "
9166 "buffer will be allocated on the next read or write operation. The "
9167 "B<setvbuf>() function may only be used after opening a stream and before "
9168 "any other operations have been performed on it."
9172 #: build/C/man3/setbuf.3:133
9174 "The other three calls are, in effect, simply aliases for calls to "
9175 "B<setvbuf>(). The B<setbuf>() function is exactly equivalent to the call"
9179 #: build/C/man3/setbuf.3:136
9180 msgid "setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);"
9184 #: build/C/man3/setbuf.3:146
9186 "The B<setbuffer>() function is the same, except that the size of the buffer "
9187 "is up to the caller, rather than being determined by the default B<BUFSIZ>. "
9188 "The B<setlinebuf>() function is exactly equivalent to the call:"
9192 #: build/C/man3/setbuf.3:149
9193 msgid "setvbuf(stream, (char *) NULL, _IOLBF, 0);"
9197 #: build/C/man3/setbuf.3:160
9199 "The function B<setvbuf>() returns 0 on success. It returns nonzero on "
9200 "failure (I<mode> is invalid or the request cannot be honored). It may set "
9201 "I<errno> on failure."
9205 #: build/C/man3/setbuf.3:162
9206 msgid "The other functions do not return a value."
9210 #: build/C/man3/setbuf.3:168
9211 msgid "The B<setbuf>() and B<setvbuf>() functions conform to C89 and C99."
9215 #: build/C/man3/setbuf.3:178
9217 "The B<setbuffer>() and B<setlinebuf>() functions are not portable to "
9218 "versions of BSD before 4.2BSD, and are available under Linux since libc "
9219 "4.5.21. On 4.2BSD and 4.3BSD systems, B<setbuf>() always uses a suboptimal "
9220 "buffer size and should be avoided."
9224 #: build/C/man3/setbuf.3:185
9226 "You must make sure that the space that I<buf> points to still exists by the "
9227 "time I<stream> is closed, which also happens at program termination. For "
9228 "example, the following is invalid:"
9232 #: build/C/man3/setbuf.3:188
9234 msgid "#include E<lt>stdio.hE<gt>\n"
9238 #: build/C/man3/setbuf.3:197
9244 " char buf[BUFSIZ];\n"
9245 " setbuf(stdin, buf);\n"
9246 " printf(\"Hello, world!\\en\");\n"
9252 #: build/C/man3/setbuf.3:206
9254 "B<fclose>(3), B<fflush>(3), B<fopen>(3), B<fread>(3), B<malloc>(3), "
9255 "B<printf>(3), B<puts>(3)"
9259 #: build/C/man3/stdin.3:9
9265 #: build/C/man3/stdin.3:9 build/C/man3/tmpfile.3:29
9271 #: build/C/man3/stdin.3:12
9272 msgid "stdin, stdout, stderr - standard I/O streams"
9276 #: build/C/man3/stdin.3:19
9279 "B<extern FILE *>I<stdin>B<;>\n"
9280 "B<extern FILE *>I<stdout>B<;>\n"
9281 "B<extern FILE *>I<stderr>B<;>\n"
9285 #: build/C/man3/stdin.3:31
9287 "Under normal circumstances every UNIX program has three streams opened for "
9288 "it when it starts up, one for input, one for output, and one for printing "
9289 "diagnostic or error messages. These are typically attached to the user's "
9290 "terminal (see B<tty>(4) but might instead refer to files or other devices, "
9291 "depending on what the parent process chose to set up. (See also the "
9292 "\"Redirection\" section of B<sh>(1).)"
9296 #: build/C/man3/stdin.3:41
9298 "The input stream is referred to as \"standard input\"; the output stream is "
9299 "referred to as \"standard output\"; and the error stream is referred to as "
9300 "\"standard error\". These terms are abbreviated to form the symbols used to "
9301 "refer to these files, namely I<stdin>, I<stdout>, and I<stderr>."
9305 #: build/C/man3/stdin.3:50
9307 "Each of these symbols is a B<stdio>(3) macro of type pointer to I<FILE>, "
9308 "and can be used with functions like B<fprintf>(3) or B<fread>(3)."
9312 #: build/C/man3/stdin.3:59
9314 "Since I<FILE>s are a buffering wrapper around UNIX file descriptors, the "
9315 "same underlying files may also be accessed using the raw UNIX file "
9316 "interface, that is, the functions like B<read>(2) and B<lseek>(2)."
9320 #: build/C/man3/stdin.3:78
9322 "On program startup, the integer file descriptors associated with the streams "
9323 "I<stdin>, I<stdout>, and I<stderr> are 0, 1, and 2, respectively. The "
9324 "preprocessor symbols B<STDIN_FILENO>, B<STDOUT_FILENO>, and B<STDERR_FILENO> "
9325 "are defined with these values in I<E<lt>unistd.hE<gt>>. (Applying "
9326 "B<freopen>(3) to one of these streams can change the file descriptor number "
9327 "associated with the stream.)"
9331 #: build/C/man3/stdin.3:91
9333 "Note that mixing use of I<FILE>s and raw file descriptors can produce "
9334 "unexpected results and should generally be avoided. (For the masochistic "
9335 "among you: POSIX.1, section 8.2.3, describes in detail how this interaction "
9336 "is supposed to work.) A general rule is that file descriptors are handled "
9337 "in the kernel, while stdio is just a library. This means for example, that "
9338 "after an B<exec>(3), the child inherits all open file descriptors, but all "
9339 "old streams have become inaccessible."
9343 #: build/C/man3/stdin.3:109
9345 "Since the symbols I<stdin>, I<stdout>, and I<stderr> are specified to be "
9346 "macros, assigning to them is nonportable. The standard streams can be made "
9347 "to refer to different files with help of the library function B<freopen>(3), "
9348 "specially introduced to make it possible to reassign I<stdin>, I<stdout>, "
9349 "and I<stderr>. The standard streams are closed by a call to B<exit>(3) and "
9350 "by normal program termination."
9354 #: build/C/man3/stdin.3:118
9356 "The I<stdin>, I<stdout>, and I<stderr> macros conform to C89 and this "
9357 "standard also stipulates that these three streams shall be open at program "
9362 #: build/C/man3/stdin.3:150
9364 "The stream I<stderr> is unbuffered. The stream I<stdout> is line-buffered "
9365 "when it points to a terminal. Partial lines will not appear until "
9366 "B<fflush>(3) or B<exit>(3) is called, or a newline is printed. This can "
9367 "produce unexpected results, especially with debugging output. The buffering "
9368 "mode of the standard streams (or any other stream) can be changed using the "
9369 "B<setbuf>(3) or B<setvbuf>(3) call. Note that in case I<stdin> is "
9370 "associated with a terminal, there may also be input buffering in the "
9371 "terminal driver, entirely unrelated to stdio buffering. (Indeed, normally "
9372 "terminal input is line buffered in the kernel.) This kernel input handling "
9373 "can be modified using calls like B<tcsetattr>(3); see also B<stty>(1), and "
9378 #: build/C/man3/stdin.3:156
9379 msgid "B<csh>(1), B<sh>(1), B<open>(2), B<fopen>(3), B<stdio>(3)"
9383 #: build/C/man3/stdio.3:37
9389 #: build/C/man3/stdio.3:37
9395 #: build/C/man3/stdio.3:40
9396 msgid "stdio - standard input/output library functions"
9400 #: build/C/man3/stdio.3:44
9401 msgid "B<FILE *>I<stdin>B<;>"
9405 #: build/C/man3/stdio.3:46
9406 msgid "B<FILE *>I<stdout>B<;>"
9410 #: build/C/man3/stdio.3:48
9411 msgid "B<FILE *>I<stderr>B<;>"
9415 #: build/C/man3/stdio.3:55
9417 "The standard I/O library provides a simple and efficient buffered stream I/O "
9418 "interface. Input and output is mapped into logical data streams and the "
9419 "physical I/O characteristics are concealed. The functions and macros are "
9420 "listed below; more information is available from the individual man pages."
9424 #: build/C/man3/stdio.3:78
9426 "A stream is associated with an external file (which may be a physical "
9427 "device) by I<opening> a file, which may involve creating a new file. "
9428 "Creating an existing file causes its former contents to be discarded. If a "
9429 "file can support positioning requests (such as a disk file, as opposed to a "
9430 "terminal) then a I<file position indicator> associated with the stream is "
9431 "positioned at the start of the file (byte zero), unless the file is opened "
9432 "with append mode. If append mode is used, it is unspecified whether the "
9433 "position indicator will be placed at the start or the end of the file. The "
9434 "position indicator is maintained by subsequent reads, writes and positioning "
9435 "requests. All input occurs as if the characters were read by successive "
9436 "calls to the B<fgetc>(3) function; all output takes place as if all "
9437 "characters were written by successive calls to the B<fputc>(3) function."
9441 #: build/C/man3/stdio.3:88
9443 "A file is disassociated from a stream by I<closing> the file. Output "
9444 "streams are flushed (any unwritten buffer contents are transferred to the "
9445 "host environment) before the stream is disassociated from the file. The "
9446 "value of a pointer to a I<FILE> object is indeterminate after a file is "
9451 #: build/C/man3/stdio.3:101
9453 "A file may be subsequently reopened, by the same or another program "
9454 "execution, and its contents reclaimed or modified (if it can be repositioned "
9455 "at the start). If the main function returns to its original caller, or the "
9456 "B<exit>(3) function is called, all open files are closed (hence all output "
9457 "streams are flushed) before program termination. Other methods of program "
9458 "termination, such as B<abort>(3) do not bother about closing files "
9463 #: build/C/man3/stdio.3:117
9465 "At program startup, three text streams are predefined and need not be opened "
9466 "explicitly: I<standard input> (for reading conventional input), I<standard "
9467 "output> (for writing conventional input), and I<standard error> (for writing "
9468 "diagnostic output). These streams are abbreviated I<stdin>,I<stdout> and "
9469 "I<stderr>. When opened, the standard error stream is not fully buffered; "
9470 "the standard input and output streams are fully buffered if and only if the "
9471 "streams do not to refer to an interactive device."
9475 #: build/C/man3/stdio.3:127
9477 "Output streams that refer to terminal devices are always line buffered by "
9478 "default; pending output to such streams is written automatically whenever an "
9479 "input stream that refers to a terminal device is read. In cases where a "
9480 "large amount of computation is done after printing part of a line on an "
9481 "output terminal, it is necessary to B<fflush>(3) the standard output before "
9482 "going off and computing so that the output will appear."
9486 #: build/C/man3/stdio.3:141
9488 "The I<stdio> library is a part of the library B<libc> and routines are "
9489 "automatically loaded as needed by the compilers B<cc>(1) and B<pc>(1). The "
9490 "SYNOPSIS sections of the following manual pages indicate which include files "
9491 "are to be used, what the compiler declaration for the function looks like "
9492 "and which external variables are of interest."
9495 #. Not on Linux: .BR fropen ,
9496 #. Not on Linux: .BR fwopen ,
9498 #: build/C/man3/stdio.3:181
9500 "The following are defined as macros; these names may not be reused without "
9501 "first removing their current definitions with B<#undef>: B<BUFSIZ>, B<EOF>, "
9502 "B<FILENAME_MAX>, B<FOPEN_MAX>, B<L_cuserid>, B<L_ctermid>, B<L_tmpnam>, "
9503 "B<NULL>, B<SEEK_END>, B<SEEK_SET>, B<SEEK_CUR>, B<TMP_MAX>, B<clearerr>, "
9504 "B<feof>, B<ferror>, B<fileno>, B<getc>, B<getchar>, B<putc>, B<putchar>, "
9505 "B<stderr>, B<stdin>, B<stdout>. Function versions of the macro functions "
9506 "B<feof>, B<ferror>, B<clearerr>, B<fileno>, B<getc>, B<getchar>, B<putc>, "
9507 "and B<putchar> exist and will be used if the macros definitions are "
9508 "explicitly removed."
9512 #: build/C/man3/stdio.3:181
9514 msgid "List of Functions"
9518 #: build/C/man3/stdio.3:186
9520 msgid "Function\tDescription\n"
9524 #: build/C/man3/stdio.3:187
9530 #: build/C/man3/stdio.3:188
9532 msgid "clearerr\tcheck and reset stream status\n"
9536 #: build/C/man3/stdio.3:189
9538 msgid "fclose\tclose a stream\n"
9542 #: build/C/man3/stdio.3:190
9544 msgid "fdopen\tstream open functions\n"
9548 #: build/C/man3/stdio.3:191
9550 msgid "feof\tcheck and reset stream status\n"
9554 #: build/C/man3/stdio.3:192
9556 msgid "ferror\tcheck and reset stream status\n"
9560 #: build/C/man3/stdio.3:193
9562 msgid "fflush\tflush a stream\n"
9566 #: build/C/man3/stdio.3:194
9568 msgid "fgetc\tget next character or word from input stream\n"
9572 #: build/C/man3/stdio.3:195
9574 msgid "fgetpos\treposition a stream\n"
9578 #: build/C/man3/stdio.3:196
9580 msgid "fgets\tget a line from a stream\n"
9584 #: build/C/man3/stdio.3:197
9586 msgid "fileno\treturn the integer descriptor of the argument stream\n"
9590 #: build/C/man3/stdio.3:198
9592 msgid "fopen\tstream open functions\n"
9596 #: build/C/man3/stdio.3:199
9598 msgid "fprintf\tformatted output conversion\n"
9602 #: build/C/man3/stdio.3:200
9604 msgid "fpurge\tflush a stream\n"
9608 #: build/C/man3/stdio.3:201
9610 msgid "fputc\toutput a character or word to a stream\n"
9614 #: build/C/man3/stdio.3:202
9616 msgid "fputs\toutput a line to a stream\n"
9620 #: build/C/man3/stdio.3:203
9622 msgid "fread\tbinary stream input/output\n"
9626 #: build/C/man3/stdio.3:204
9628 msgid "freopen\tstream open functions\n"
9632 #: build/C/man3/stdio.3:205
9634 msgid "fscanf\tinput format conversion\n"
9638 #: build/C/man3/stdio.3:206
9640 msgid "fseek\treposition a stream\n"
9644 #: build/C/man3/stdio.3:207
9646 msgid "fsetpos\treposition a stream\n"
9650 #: build/C/man3/stdio.3:208
9652 msgid "ftell\treposition a stream\n"
9656 #: build/C/man3/stdio.3:209
9658 msgid "fwrite\tbinary stream input/output\n"
9662 #: build/C/man3/stdio.3:210
9664 msgid "getc\tget next character or word from input stream\n"
9668 #: build/C/man3/stdio.3:211
9670 msgid "getchar\tget next character or word from input stream\n"
9674 #: build/C/man3/stdio.3:212
9676 msgid "gets\tget a line from a stream\n"
9680 #: build/C/man3/stdio.3:213
9682 msgid "getw\tget next character or word from input stream\n"
9686 #: build/C/man3/stdio.3:214
9688 msgid "mktemp\tmake temporary filename (unique)\n"
9692 #: build/C/man3/stdio.3:215
9694 msgid "perror\tsystem error messages\n"
9698 #: build/C/man3/stdio.3:216
9700 msgid "printf\tformatted output conversion\n"
9704 #: build/C/man3/stdio.3:217
9706 msgid "putc\toutput a character or word to a stream\n"
9710 #: build/C/man3/stdio.3:218
9712 msgid "putchar\toutput a character or word to a stream\n"
9716 #: build/C/man3/stdio.3:219
9718 msgid "puts\toutput a line to a stream\n"
9722 #: build/C/man3/stdio.3:220
9724 msgid "putw\toutput a character or word to a stream\n"
9728 #: build/C/man3/stdio.3:221
9730 msgid "remove\tremove directory entry\n"
9734 #: build/C/man3/stdio.3:222
9736 msgid "rewind\treposition a stream\n"
9740 #: build/C/man3/stdio.3:223
9742 msgid "scanf\tinput format conversion\n"
9746 #: build/C/man3/stdio.3:224
9748 msgid "setbuf\tstream buffering operations\n"
9752 #: build/C/man3/stdio.3:225
9754 msgid "setbuffer\tstream buffering operations\n"
9758 #: build/C/man3/stdio.3:226
9760 msgid "setlinebuf\tstream buffering operations\n"
9764 #: build/C/man3/stdio.3:227
9766 msgid "setvbuf\tstream buffering operations\n"
9770 #: build/C/man3/stdio.3:228
9772 msgid "sprintf\tformatted output conversion\n"
9776 #: build/C/man3/stdio.3:229
9778 msgid "sscanf\tinput format conversion\n"
9782 #: build/C/man3/stdio.3:230
9784 msgid "strerror\tsystem error messages\n"
9788 #: build/C/man3/stdio.3:231
9790 msgid "sys_errlist\tsystem error messages\n"
9794 #: build/C/man3/stdio.3:232
9796 msgid "sys_nerr\tsystem error messages\n"
9800 #: build/C/man3/stdio.3:233
9802 msgid "tempnam\ttemporary file routines\n"
9806 #: build/C/man3/stdio.3:234
9808 msgid "tmpfile\ttemporary file routines\n"
9812 #: build/C/man3/stdio.3:235
9814 msgid "tmpnam\ttemporary file routines\n"
9818 #: build/C/man3/stdio.3:236
9820 msgid "ungetc\tun-get character from input stream\n"
9824 #: build/C/man3/stdio.3:237
9826 msgid "vfprintf\tformatted output conversion\n"
9830 #: build/C/man3/stdio.3:238
9832 msgid "vfscanf\tinput format conversion\n"
9836 #: build/C/man3/stdio.3:239
9838 msgid "vprintf\tformatted output conversion\n"
9842 #: build/C/man3/stdio.3:240
9844 msgid "vscanf\tinput format conversion\n"
9848 #: build/C/man3/stdio.3:241
9850 msgid "vsprintf\tformatted output conversion\n"
9854 #: build/C/man3/stdio.3:242
9856 msgid "vsscanf\tinput format conversion\n"
9860 #: build/C/man3/stdio.3:248
9861 msgid "The I<stdio> library conforms to C89."
9865 #: build/C/man3/stdio.3:255
9867 "B<close>(2), B<open>(2), B<read>(2), B<write>(2), B<stdout>(3), "
9868 "B<unlocked_stdio>(3)"
9872 #: build/C/man3/stdio_ext.3:23
9878 #: build/C/man3/stdio_ext.3:23
9884 #: build/C/man3/stdio_ext.3:28
9886 "__fbufsize, __flbf, __fpending, __fpurge, __freadable, __freading, "
9887 "__fsetlocking, __fwritable, __fwriting, _flushlbf - interfaces to stdio FILE "
9892 #: build/C/man3/stdio_ext.3:32
9893 msgid "B<#include E<lt>stdio_ext.hE<gt>>"
9897 #: build/C/man3/stdio_ext.3:34
9898 msgid "B<size_t __fbufsize(FILE *>I<stream>B<);>"
9902 #: build/C/man3/stdio_ext.3:36
9903 msgid "B<size_t __fpending(FILE *>I<stream>B<);>"
9907 #: build/C/man3/stdio_ext.3:38
9908 msgid "B<int __flbf(FILE *>I<stream>B<);>"
9912 #: build/C/man3/stdio_ext.3:40
9913 msgid "B<int __freadable(FILE *>I<stream>B<);>"
9917 #: build/C/man3/stdio_ext.3:42
9918 msgid "B<int __fwritable(FILE *>I<stream>B<);>"
9922 #: build/C/man3/stdio_ext.3:44
9923 msgid "B<int __freading(FILE *>I<stream>B<);>"
9927 #: build/C/man3/stdio_ext.3:46
9928 msgid "B<int __fwriting(FILE *>I<stream>B<);>"
9932 #: build/C/man3/stdio_ext.3:48
9933 msgid "B<int __fsetlocking(FILE *>I<stream>B<, int >I<type>B<);>"
9937 #: build/C/man3/stdio_ext.3:50
9938 msgid "B<void _flushlbf(void);>"
9942 #: build/C/man3/stdio_ext.3:52
9943 msgid "B<void __fpurge(FILE *>I<stream>B<);>"
9947 #: build/C/man3/stdio_ext.3:57
9949 "Solaris introduced routines to allow portable access to the internals of the "
9950 "I<FILE> structure, and glibc also implemented these."
9954 #: build/C/man3/stdio_ext.3:62
9956 "The B<__fbufsize>() function returns the size of the buffer currently used "
9957 "by the given stream."
9961 #: build/C/man3/stdio_ext.3:69
9963 "The B<__fpending>() function returns the number of bytes in the output "
9964 "buffer. For wide-oriented streams the unit is wide characters. This "
9965 "function is undefined on buffers in reading mode, or opened read-only."
9969 #: build/C/man3/stdio_ext.3:74
9971 "The B<__flbf>() function returns a nonzero value if the stream is "
9972 "line-buffered, and zero otherwise."
9976 #: build/C/man3/stdio_ext.3:79
9978 "The B<__freadable>() function returns a nonzero value if the stream allows "
9979 "reading, and zero otherwise."
9983 #: build/C/man3/stdio_ext.3:84
9985 "The B<__fwritable>() function returns a nonzero value if the stream allows "
9986 "writing, and zero otherwise."
9990 #: build/C/man3/stdio_ext.3:90
9992 "The B<__freading>() function returns a nonzero value if the stream is "
9993 "read-only, or if the last operation on the stream was a read operation, and "
9998 #: build/C/man3/stdio_ext.3:96
10000 "The B<__fwriting>() function returns a nonzero value if the stream is "
10001 "write-only (or append-only), or if the last operation on the stream was a "
10002 "write operation, and zero otherwise."
10005 #. type: Plain text
10006 #: build/C/man3/stdio_ext.3:104
10008 "The B<__fsetlocking>() function can be used to select the desired type of "
10009 "locking on the stream. It returns the current type. The I<type> argument "
10010 "can take the following three values:"
10014 #: build/C/man3/stdio_ext.3:104
10016 msgid "B<FSETLOCKING_INTERNAL>"
10019 #. type: Plain text
10020 #: build/C/man3/stdio_ext.3:109
10022 "Perform implicit locking around every operation on the given stream (except "
10023 "for the *_unlocked ones). This is the default."
10027 #: build/C/man3/stdio_ext.3:109
10029 msgid "B<FSETLOCKING_BYCALLER>"
10032 #. type: Plain text
10033 #: build/C/man3/stdio_ext.3:116
10035 "The caller will take care of the locking (possibly using B<flockfile>(3) in "
10036 "case there is more than one thread), and the stdio routines will not do "
10037 "locking until the state is reset to B<FSETLOCKING_INTERNAL>."
10041 #: build/C/man3/stdio_ext.3:116
10043 msgid "B<FSETLOCKING_QUERY>"
10046 #. type: Plain text
10047 #: build/C/man3/stdio_ext.3:120
10048 msgid "Don't change the type of locking. (Only return it.)"
10051 #. type: Plain text
10052 #: build/C/man3/stdio_ext.3:126
10054 "The B<_flushlbf>() function flushes all line-buffered streams. (Presumably "
10055 "so that output to a terminal is forced out, say before reading keyboard "
10059 #. type: Plain text
10060 #: build/C/man3/stdio_ext.3:130
10061 msgid "The B<__fpurge>() function discards the contents of the stream's buffer."
10064 #. type: Plain text
10065 #: build/C/man3/stdio_ext.3:133
10066 msgid "B<flockfile>(3), B<fpurge>(3)"
10070 #: build/C/man2/symlink.2:32 build/C/man7/symlink.7:35
10076 #: build/C/man2/symlink.2:32
10081 #. type: Plain text
10082 #: build/C/man2/symlink.2:35
10083 msgid "symlink - make a new name for a file"
10086 #. type: Plain text
10087 #: build/C/man2/symlink.2:39
10088 msgid "B<int symlink(const char *>I<oldpath>B<, const char *>I<newpath>B<);>"
10091 #. type: Plain text
10092 #: build/C/man2/symlink.2:47
10093 msgid "B<symlink>():"
10096 #. type: Plain text
10097 #: build/C/man2/symlink.2:58
10099 "B<symlink>() creates a symbolic link named I<newpath> which contains the "
10100 "string I<oldpath>."
10103 #. type: Plain text
10104 #: build/C/man2/symlink.2:62
10106 "Symbolic links are interpreted at run time as if the contents of the link "
10107 "had been substituted into the path being followed to find a file or "
10111 #. type: Plain text
10112 #: build/C/man2/symlink.2:67
10114 "Symbolic links may contain I<..> path components, which (if used at the "
10115 "start of the link) refer to the parent directories of that in which the link "
10119 #. type: Plain text
10120 #: build/C/man2/symlink.2:71
10122 "A symbolic link (also known as a soft link) may point to an existing file or "
10123 "to a nonexistent one; the latter case is known as a dangling link."
10126 #. type: Plain text
10127 #: build/C/man2/symlink.2:78
10129 "The permissions of a symbolic link are irrelevant; the ownership is ignored "
10130 "when following the link, but is checked when removal or renaming of the link "
10131 "is requested and the link is in a directory with the sticky bit (B<S_ISVTX>) "
10135 #. type: Plain text
10136 #: build/C/man2/symlink.2:99
10138 "Write access to the directory containing I<newpath> is denied, or one of the "
10139 "directories in the path prefix of I<newpath> did not allow search "
10140 "permission. (See also B<path_resolution>(7).)"
10143 #. type: Plain text
10144 #: build/C/man2/symlink.2:113
10145 msgid "Too many symbolic links were encountered in resolving I<newpath>."
10148 #. type: Plain text
10149 #: build/C/man2/symlink.2:123
10151 "A directory component in I<newpath> does not exist or is a dangling symbolic "
10152 "link, or I<oldpath> is the empty string."
10155 #. type: Plain text
10156 #: build/C/man2/symlink.2:135
10157 msgid "A component used as a directory in I<newpath> is not, in fact, a directory."
10160 #. type: Plain text
10161 #: build/C/man2/symlink.2:140
10163 "The file system containing I<newpath> does not support the creation of "
10167 #. type: Plain text
10168 #: build/C/man2/symlink.2:144
10169 msgid "I<newpath> is on a read-only file system."
10172 #. type: Plain text
10173 #: build/C/man2/symlink.2:154
10174 msgid "No checking of I<oldpath> is done."
10177 #. type: Plain text
10178 #: build/C/man2/symlink.2:159
10180 "Deleting the name referred to by a symlink will actually delete the file "
10181 "(unless it also has other hard links). If this behavior is not desired, use "
10185 #. type: Plain text
10186 #: build/C/man2/symlink.2:171
10188 "B<ln>(1), B<lchown>(2), B<link>(2), B<lstat>(2), B<open>(2), B<readlink>(2), "
10189 "B<rename>(2), B<symlinkat>(2), B<unlink>(2), B<path_resolution>(7), "
10194 #: build/C/man7/symlink.7:35
10199 #. type: Plain text
10200 #: build/C/man7/symlink.7:38
10201 msgid "symlink - symbolic link handling"
10205 #: build/C/man7/symlink.7:38
10207 msgid "SYMBOLIC LINK HANDLING"
10210 #. type: Plain text
10211 #: build/C/man7/symlink.7:42
10213 "Symbolic links are files that act as pointers to other files. To understand "
10214 "their behavior, you must first understand how hard links work."
10217 #. type: Plain text
10218 #: build/C/man7/symlink.7:58
10220 "A hard link to a file is indistinguishable from the original file because it "
10221 "is a reference to the object underlying the original filename. (To be "
10222 "precise: each of the hard links to a file is a reference to the same "
10223 "I<i-node number>, where an i-node number is an index into the i-node table, "
10224 "which contains metadata about all files on a file system. See B<stat>(2).) "
10225 "Changes to a file are independent of the name used to reference the file. "
10226 "Hard links may not refer to directories (to prevent the possibility of loops "
10227 "within the file system tree, which would confuse many programs) and may not "
10228 "refer to files on different file systems (because i-node numbers are not "
10229 "unique across file systems)."
10232 #. type: Plain text
10233 #: build/C/man7/symlink.7:65
10235 "A symbolic link is a special type of file whose contents are a string that "
10236 "is the pathname another file, the file to which the link refers. In other "
10237 "words, a symbolic link is a pointer to another name, and not to an "
10238 "underlying object. For this reason, symbolic links may refer to directories "
10239 "and may cross file system boundaries."
10242 #. type: Plain text
10243 #: build/C/man7/symlink.7:71
10245 "There is no requirement that the pathname referred to by a symbolic link "
10246 "should exist. A symbolic link that refers to a pathname that does not exist "
10247 "is said to be a I<dangling link>."
10250 #. type: Plain text
10251 #: build/C/man7/symlink.7:83
10253 "Because a symbolic link and its referenced object coexist in the file system "
10254 "name space, confusion can arise in distinguishing between the link itself "
10255 "and the referenced object. On historical systems, commands and system calls "
10256 "adopted their own link-following conventions in a somewhat ad-hoc fashion. "
10257 "Rules for a more uniform approach, as they are implemented on Linux and "
10258 "other systems, are outlined here. It is important that site-local "
10259 "applications also conform to these rules, so that the user interface can be "
10260 "as consistent as possible."
10264 #: build/C/man7/symlink.7:83
10266 msgid "Symbolic link ownership, permissions, and timestamps"
10269 #. type: Plain text
10270 #: build/C/man7/symlink.7:91
10272 "The owner and group of an existing symbolic link can be changed using "
10273 "B<lchown>(2). The only time that the ownership of a symbolic link matters "
10274 "is when the link is being removed or renamed in a directory that has the "
10275 "sticky bit set (see B<stat>(2))."
10278 #. type: Plain text
10279 #: build/C/man7/symlink.7:97
10281 "The last access and last modification timestamps of a symbolic link can be "
10282 "changed using B<utimensat>(2) or B<lutimes>(3)."
10285 #. Linux does not currently implement an lchmod(2).
10289 #. system differs from historical
10291 #. systems in that the system call
10293 #. has been changed to follow symbolic links.
10296 #. system call was added later when the limitations of the new
10298 #. became apparent.
10299 #. type: Plain text
10300 #: build/C/man7/symlink.7:116
10302 "On Linux, the permissions of a symbolic link are not used in any operations; "
10303 "the permissions are always 0777 (read, write, and execute for all user "
10304 "categories), and can't be changed."
10308 #: build/C/man7/symlink.7:116
10310 msgid "Handling of symbolic links by system calls and commands"
10313 #. type: Plain text
10314 #: build/C/man7/symlink.7:131
10316 "Symbolic links are handled either by operating on the link itself, or by "
10317 "operating on the object referred to by the link. In the latter case, an "
10318 "application or system call is said to I<follow> the link. Symbolic links "
10319 "may refer to other symbolic links, in which case the links are dereferenced "
10320 "until an object that is not a symbolic link is found, a symbolic link that "
10321 "refers to a file which does not exist is found, or a loop is detected. "
10322 "(Loop detection is done by placing an upper limit on the number of links "
10323 "that may be followed, and an error results if this limit is exceeded.)"
10326 #. type: Plain text
10327 #: build/C/man7/symlink.7:134
10329 "There are three separate areas that need to be discussed. They are as "
10334 #: build/C/man7/symlink.7:134
10339 #. type: Plain text
10340 #: build/C/man7/symlink.7:136
10341 msgid "Symbolic links used as filename arguments for system calls."
10345 #: build/C/man7/symlink.7:136
10350 #. type: Plain text
10351 #: build/C/man7/symlink.7:139
10353 "Symbolic links specified as command-line arguments to utilities that are not "
10354 "traversing a file tree."
10358 #: build/C/man7/symlink.7:139
10363 #. type: Plain text
10364 #: build/C/man7/symlink.7:143
10366 "Symbolic links encountered by utilities that are traversing a file tree "
10367 "(either specified on the command line or encountered as part of the file "
10372 #: build/C/man7/symlink.7:143
10374 msgid "System calls"
10377 #. type: Plain text
10378 #: build/C/man7/symlink.7:146
10380 "The first area is symbolic links used as filename arguments for system "
10384 #. type: Plain text
10385 #: build/C/man7/symlink.7:156
10387 "Except as noted below, all system calls follow symbolic links. For example, "
10388 "if there were a symbolic link I<slink> which pointed to a file named "
10389 "I<afile>, the system call I<open(\"slink\" ...\\&)> would return a file "
10390 "descriptor referring to the file I<afile>."
10393 #. Maybe one day: .BR fchownat (2)
10394 #. type: Plain text
10395 #: build/C/man7/symlink.7:206
10397 "Various system calls do not follow links, and operate on the symbolic link "
10398 "itself. They are: B<lchown>(2), B<lgetxattr>(2), B<llistxattr>(2), "
10399 "B<lremovexattr>(2), B<lsetxattr>(2), B<lstat>(2), B<readlink>(2), "
10400 "B<rename>(2), B<rmdir>(2), and B<unlink>(2). Certain other system calls "
10401 "optionally follow symbolic links. They are: B<faccessat>(2), "
10402 "B<fchownat>(2), B<fstatat>(2), B<linkat>(2), B<open>(2), B<openat>(2), and "
10403 "B<utimensat>(2); see their manual pages for details. Because B<remove>(3) "
10404 "is an alias for B<unlink>(2), that library function also does not follow "
10405 "symbolic links. When B<rmdir>(2) is applied to a symbolic link, it fails "
10406 "with the error B<ENOTDIR>. The B<link>(2) warrants special discussion. "
10407 "POSIX.1-2001 specifies that B<link>(2) should dereference I<oldpath> if it "
10408 "is a symbolic link. However, Linux does not do this. (By default Solaris "
10409 "is the same, but the POSIX.1-2001 specified behavior can be obtained with "
10410 "suitable compiler options.) The upcoming POSIX.1 revision changes the "
10411 "specification to allow either behavior in an implementation."
10415 #: build/C/man7/symlink.7:206
10417 msgid "Commands not traversing a file tree"
10420 #. type: Plain text
10421 #: build/C/man7/symlink.7:209
10423 "The second area is symbolic links, specified as command-line filename "
10424 "arguments, to commands which are not traversing a file tree."
10427 #. type: Plain text
10428 #: build/C/man7/symlink.7:220
10430 "Except as noted below, commands follow symbolic links named as command-line "
10431 "arguments. For example, if there were a symbolic link I<slink> which "
10432 "pointed to a file named I<afile>, the command I<cat slink> would display the "
10433 "contents of the file I<afile>."
10436 #. type: Plain text
10437 #: build/C/man7/symlink.7:228
10439 "It is important to realize that this rule includes commands which may "
10440 "optionally traverse file trees, e.g., the command I<chown file> is included "
10441 "in this rule, while the command I<chown\\ -R file>, which performs a tree "
10442 "traversal, is not. (The latter is described in the third area, below.)"
10445 #. type: Plain text
10446 #: build/C/man7/symlink.7:246
10448 "If it is explicitly intended that the command operate on the symbolic link "
10449 "instead of following the symbolic link, e.g., it is desired that I<chown "
10450 "slink> change the ownership of the file that I<slink> is, whether it is a "
10451 "symbolic link or not, the I<-h> option should be used. In the above "
10452 "example, I<chown root slink> would change the ownership of the file referred "
10453 "to by I<slink>, while I<chown\\ -h root slink> would change the ownership of "
10457 #. type: Plain text
10458 #: build/C/man7/symlink.7:248
10459 msgid "There are some exceptions to this rule:"
10462 #. type: Plain text
10463 #: build/C/man7/symlink.7:258
10465 "The B<mv>(1) and B<rm>(1) commands do not follow symbolic links named as "
10466 "arguments, but respectively attempt to rename and delete them. (Note, if "
10467 "the symbolic link references a file via a relative path, moving it to "
10468 "another directory may very well cause it to stop working, since the path may "
10469 "no longer be correct.)"
10472 #. type: Plain text
10473 #: build/C/man7/symlink.7:288
10475 "The B<ls>(1) command is also an exception to this rule. For compatibility "
10476 "with historic systems (when B<ls>(1) is not doing a tree walk, i.e., the "
10477 "I<-R> option is not specified), the B<ls>(1) command follows symbolic links "
10478 "named as arguments if the I<-H> or I<-L> option is specified, or if the "
10479 "I<-F>, I<-d>, or I<-l> options are not specified. (The B<ls>(1) command is "
10480 "the only command where the I<-H> and I<-L> options affect its behavior even "
10481 "though it is not doing a walk of a file tree.)"
10485 #. The 4.4BSD system differs from historical 4BSD systems in that the
10489 #. commands follow symbolic links specified on the command line.
10490 #. type: Plain text
10491 #: build/C/man7/symlink.7:306
10493 "The B<file>(1) command is also an exception to this rule. The B<file>(1) "
10494 "command does not follow symbolic links named as argument by default. The "
10495 "B<file>(1) command does follow symbolic links named as argument if the "
10496 "I<-L> option is specified."
10500 #: build/C/man7/symlink.7:306
10502 msgid "Commands traversing a file tree"
10505 #. type: Plain text
10506 #: build/C/man7/symlink.7:319
10508 "The following commands either optionally or always traverse file trees: "
10509 "B<chgrp>(1), B<chmod>(1), B<chown>(1), B<cp>(1), B<du>(1), B<find>(1), "
10510 "B<ls>(1), B<pax>(1), B<rm>(1), and B<tar>(1)."
10513 #. type: Plain text
10514 #: build/C/man7/symlink.7:323
10516 "It is important to realize that the following rules apply equally to "
10517 "symbolic links encountered during the file tree traversal and symbolic links "
10518 "listed as command-line arguments."
10521 #. type: Plain text
10522 #: build/C/man7/symlink.7:328
10524 "The I<first rule> applies to symbolic links that reference files other than "
10525 "directories. Operations that apply to symbolic links are performed on the "
10526 "links themselves, but otherwise the links are ignored."
10529 #. type: Plain text
10530 #: build/C/man7/symlink.7:340
10532 "The command I<rm\\ -r slink directory> will remove I<slink>, as well as any "
10533 "symbolic links encountered in the tree traversal of I<directory>, because "
10534 "symbolic links may be removed. In no case will B<rm>(1) affect the file "
10535 "referred to by I<slink>."
10538 #. type: Plain text
10539 #: build/C/man7/symlink.7:345
10541 "The I<second rule> applies to symbolic links that refer to directories. "
10542 "Symbolic links that refer to directories are never followed by default. "
10543 "This is often referred to as a \"physical\" walk, as opposed to a "
10544 "\"logical\" walk (where symbolic links the refer to directories are "
10548 #. type: Plain text
10549 #: build/C/man7/symlink.7:348
10551 "Certain conventions are (should be) followed as consistently as possible by "
10552 "commands that perform file tree walks:"
10555 #. type: Plain text
10556 #: build/C/man7/symlink.7:361
10558 "A command can be made to follow any symbolic links named on the command "
10559 "line, regardless of the type of file they reference, by specifying the I<-H> "
10560 "(for \"half-logical\") flag. This flag is intended to make the command-line "
10561 "name space look like the logical name space. (Note, for commands that do "
10562 "not always do file tree traversals, the I<-H> flag will be ignored if the "
10563 "I<-R> flag is not also specified.)"
10566 #. type: Plain text
10567 #: build/C/man7/symlink.7:377
10569 "For example, the command I<chown\\ -HR user slink> will traverse the file "
10570 "hierarchy rooted in the file pointed to by I<slink>. Note, the I<-H> is not "
10571 "the same as the previously discussed I<-h> flag. The I<-H> flag causes "
10572 "symbolic links specified on the command line to be dereferenced for the "
10573 "purposes of both the action to be performed and the tree walk, and it is as "
10574 "if the user had specified the name of the file to which the symbolic link "
10578 #. type: Plain text
10579 #: build/C/man7/symlink.7:391
10581 "A command can be made to follow any symbolic links named on the command "
10582 "line, as well as any symbolic links encountered during the traversal, "
10583 "regardless of the type of file they reference, by specifying the I<-L> (for "
10584 "\"logical\") flag. This flag is intended to make the entire name space look "
10585 "like the logical name space. (Note, for commands that do not always do file "
10586 "tree traversals, the I<-L> flag will be ignored if the I<-R> flag is not "
10590 #. type: Plain text
10591 #: build/C/man7/symlink.7:406
10593 "For example, the command I<chown\\ -LR user slink> will change the owner of "
10594 "the file referred to by I<slink>. If I<slink> refers to a directory, "
10595 "B<chown> will traverse the file hierarchy rooted in the directory that it "
10596 "references. In addition, if any symbolic links are encountered in any file "
10597 "tree that B<chown> traverses, they will be treated in the same fashion as "
10601 #. type: Plain text
10602 #: build/C/man7/symlink.7:413
10604 "A command can be made to provide the default behavior by specifying the "
10605 "I<-P> (for \"physical\") flag. This flag is intended to make the entire "
10606 "name space look like the physical name space."
10609 #. type: Plain text
10610 #: build/C/man7/symlink.7:431
10612 "For commands that do not by default do file tree traversals, the I<-H>, "
10613 "I<-L>, and I<-P> flags are ignored if the I<-R> flag is not also specified. "
10614 "In addition, you may specify the I<-H>, I<-L>, and I<-P> options more than "
10615 "once; the last one specified determines the command's behavior. This is "
10616 "intended to permit you to alias commands to behave one way or the other, and "
10617 "then override that behavior on the command line."
10620 #. type: Plain text
10621 #: build/C/man7/symlink.7:437
10622 msgid "The B<ls>(1) and B<rm>(1) commands have exceptions to these rules:"
10625 #. type: Plain text
10626 #: build/C/man7/symlink.7:450
10628 "The B<rm>(1) command operates on the symbolic link, and not the file it "
10629 "references, and therefore never follows a symbolic link. The B<rm>(1) "
10630 "command does not support the I<-H>, I<-L>, or I<-P> options."
10633 #. type: Plain text
10634 #: build/C/man7/symlink.7:470
10636 "To maintain compatibility with historic systems, the B<ls>(1) command acts "
10637 "a little differently. If you do not specify the I<-F>, I<-d> or I<-l> "
10638 "options, B<ls>(1) will follow symbolic links specified on the command "
10639 "line. If the I<-L> flag is specified, B<ls>(1) follows all symbolic links, "
10640 "regardless of their type, whether specified on the command line or "
10641 "encountered in the tree walk."
10644 #. type: Plain text
10645 #: build/C/man7/symlink.7:488
10647 "B<chgrp>(1), B<chmod>(1), B<find>(1), B<ln>(1), B<ls>(1), B<mv>(1), "
10648 "B<rm>(1), B<lchown>(2), B<link>(2), B<lstat>(2), B<readlink>(2), "
10649 "B<rename>(2), B<symlink>(2), B<unlink>(2), B<utimensat>(2), B<lutimes>(3), "
10650 "B<path_resolution>(7)"
10654 #: build/C/man3/tempnam.3:23
10660 #: build/C/man3/tempnam.3:23
10665 #. type: Plain text
10666 #: build/C/man3/tempnam.3:26
10667 msgid "tempnam - create a name for a temporary file"
10670 #. type: Plain text
10671 #: build/C/man3/tempnam.3:31
10673 msgid "B<char *tempnam(const char *>I<dir>B<, const char *>I<pfx>B<);>\n"
10676 #. type: Plain text
10677 #: build/C/man3/tempnam.3:40
10678 msgid "B<tempnam>(): _BSD_SOURCE || _SVID_SOURCE"
10681 #. type: Plain text
10682 #: build/C/man3/tempnam.3:54
10684 "The B<tempnam>() function returns a pointer to a string that is a valid "
10685 "filename, and such that a file with this name did not exist when "
10686 "B<tempnam>() checked. The filename suffix of the pathname generated will "
10687 "start with I<pfx> in case I<pfx> is a non-NULL string of at most five "
10688 "bytes. The directory prefix part of the pathname generated is required to "
10689 "be \"appropriate\" (often that at least implies writable)."
10692 #. type: Plain text
10693 #: build/C/man3/tempnam.3:57
10694 msgid "Attempts to find an appropriate directory go through the following steps:"
10698 #: build/C/man3/tempnam.3:57
10703 #. type: Plain text
10704 #: build/C/man3/tempnam.3:63
10706 "In case the environment variable B<TMPDIR> exists and contains the name of "
10707 "an appropriate directory, that is used."
10711 #: build/C/man3/tempnam.3:63
10716 #. type: Plain text
10717 #: build/C/man3/tempnam.3:68
10718 msgid "Otherwise, if the I<dir> argument is non-NULL and appropriate, it is used."
10722 #: build/C/man3/tempnam.3:68
10727 #. type: Plain text
10728 #: build/C/man3/tempnam.3:75
10730 "Otherwise, I<P_tmpdir> (as defined in I<E<lt>stdio.hE<gt>>) is used when "
10735 #: build/C/man3/tempnam.3:75
10740 #. type: Plain text
10741 #: build/C/man3/tempnam.3:78
10742 msgid "Finally an implementation-defined directory may be used."
10745 #. type: Plain text
10746 #: build/C/man3/tempnam.3:85
10748 "The string returned by B<tempnam>() is allocated using B<malloc>(3) and "
10749 "hence should be freed by B<free>(3)."
10752 #. type: Plain text
10753 #: build/C/man3/tempnam.3:90
10755 "The B<tempnam>() function returns a pointer to a unique temporary filename, "
10756 "or NULL if a unique name cannot be generated."
10759 #. type: Plain text
10760 #: build/C/man3/tempnam.3:94
10761 msgid "Allocation of storage failed."
10764 #. type: Plain text
10765 #: build/C/man3/tempnam.3:99
10766 msgid "SVr4, 4.3BSD, POSIX.1-2001. POSIX.1-2008 marks B<tempnam>() as obsolete."
10769 #. type: Plain text
10770 #: build/C/man3/tempnam.3:118
10772 "Although B<tempnam>() generates names that are difficult to guess, it is "
10773 "nevertheless possible that between the time that B<tempnam>() returns a "
10774 "pathname, and the time that the program opens it, another program might "
10775 "create that pathname using B<open>(2), or create it as a symbolic link. "
10776 "This can lead to security holes. To avoid such possibilities, use the "
10777 "B<open>(2) B<O_EXCL> flag to open the pathname. Or better yet, use "
10778 "B<mkstemp>(3) or B<tmpfile>(3)."
10781 #. type: Plain text
10782 #: build/C/man3/tempnam.3:126
10784 "SUSv2 does not mention the use of B<TMPDIR>; glibc will use it only when the "
10785 "program is not set-user-ID. On SVr4, the directory used under B<d)> is "
10786 "I</tmp> (and this is what glibc does)."
10789 #. type: Plain text
10790 #: build/C/man3/tempnam.3:131
10792 "Because it dynamically allocates memory used to return the pathname, "
10793 "B<tempnam>() is reentrant, and thus thread safe, unlike B<tmpnam>(3)."
10796 #. type: Plain text
10797 #: build/C/man3/tempnam.3:144
10799 "The B<tempnam>() function generates a different string each time it is "
10800 "called, up to B<TMP_MAX> (defined in I<E<lt>stdio.hE<gt>>) times. If it is "
10801 "called more than B<TMP_MAX> times, the behavior is implementation defined."
10804 #. type: Plain text
10805 #: build/C/man3/tempnam.3:148
10806 msgid "B<tempnam>() uses at most the first five bytes from I<pfx>."
10809 #. type: Plain text
10810 #: build/C/man3/tempnam.3:154
10812 "The glibc implementation of B<tempnam>() will fail with the error B<EEXIST> "
10813 "upon failure to find a unique name."
10816 #. type: Plain text
10817 #: build/C/man3/tempnam.3:157
10819 "The precise meaning of \"appropriate\" is undefined; it is unspecified how "
10820 "accessibility of a directory is determined."
10823 #. type: Plain text
10824 #: build/C/man3/tempnam.3:164 build/C/man3/tmpnam.3:151
10825 msgid "Never use this function. Use B<mkstemp>(3) or B<tmpfile>(3) instead."
10828 #. type: Plain text
10829 #: build/C/man3/tempnam.3:169
10830 msgid "B<mkstemp>(3), B<mktemp>(3), B<tmpfile>(3), B<tmpnam>(3)"
10834 #: build/C/man3/tmpfile.3:29
10839 #. type: Plain text
10840 #: build/C/man3/tmpfile.3:32
10841 msgid "tmpfile - create a temporary file"
10844 #. type: Plain text
10845 #: build/C/man3/tmpfile.3:37
10847 msgid "B<FILE *tmpfile(void);>\n"
10850 #. type: Plain text
10851 #: build/C/man3/tmpfile.3:45
10853 "The B<tmpfile>() function opens a unique temporary file in binary "
10854 "read/write (w+b) mode. The file will be automatically deleted when it is "
10855 "closed or the program terminates."
10858 #. type: Plain text
10859 #: build/C/man3/tmpfile.3:52
10861 "The B<tmpfile>() function returns a stream descriptor, or NULL if a unique "
10862 "filename cannot be generated or the unique file cannot be opened. In the "
10863 "latter case, I<errno> is set to indicate the error."
10866 #. type: Plain text
10867 #: build/C/man3/tmpfile.3:56
10868 msgid "Search permission denied for directory in file's path prefix."
10871 #. type: Plain text
10872 #: build/C/man3/tmpfile.3:59
10873 msgid "Unable to generate a unique filename."
10876 #. type: Plain text
10877 #: build/C/man3/tmpfile.3:62
10878 msgid "The call was interrupted by a signal."
10881 #. type: Plain text
10882 #: build/C/man3/tmpfile.3:65
10883 msgid "Too many file descriptors in use by the process."
10886 #. type: Plain text
10887 #: build/C/man3/tmpfile.3:68
10888 msgid "Too many files open in the system."
10891 #. type: Plain text
10892 #: build/C/man3/tmpfile.3:71
10893 msgid "There was no room in the directory to add the new filename."
10896 #. type: Plain text
10897 #: build/C/man3/tmpfile.3:74
10898 msgid "Read-only file system."
10901 #. type: Plain text
10902 #: build/C/man3/tmpfile.3:76
10903 msgid "SVr4, 4.3BSD, C89, C99, SUSv2, POSIX.1-2001."
10906 #. type: Plain text
10907 #: build/C/man3/tmpfile.3:80
10909 "POSIX.1-2001 specifies: an error message may be written to I<stdout> if the "
10910 "stream cannot be opened."
10913 #. type: Plain text
10914 #: build/C/man3/tmpfile.3:86
10916 "The standard does not specify the directory that B<tmpfile>() will use. "
10917 "Glibc will try the path prefix I<P_tmpdir> defined in I<E<lt>stdio.hE<gt>>, "
10918 "and if that fails the directory I</tmp>."
10921 #. type: Plain text
10922 #: build/C/man3/tmpfile.3:92
10923 msgid "B<exit>(3), B<mkstemp>(3), B<mktemp>(3), B<tempnam>(3), B<tmpnam>(3)"
10927 #: build/C/man3/tmpnam.3:25
10933 #: build/C/man3/tmpnam.3:25
10938 #. type: Plain text
10939 #: build/C/man3/tmpnam.3:28
10940 msgid "tmpnam, tmpnam_r - create a name for a temporary file"
10943 #. type: Plain text
10944 #: build/C/man3/tmpnam.3:33
10946 msgid "B<char *tmpnam(char *>I<s>B<);>\n"
10949 #. type: Plain text
10950 #: build/C/man3/tmpnam.3:56
10952 "The B<tmpnam>() function returns a pointer to a string that is a valid "
10953 "filename, and such that a file with this name did not exist at some point in "
10954 "time, so that naive programmers may think it a suitable name for a temporary "
10955 "file. If the argument I<s> is NULL this name is generated in an internal "
10956 "static buffer and may be overwritten by the next call to B<tmpnam>(). If "
10957 "I<s> is not NULL, the name is copied to the character array (of length at "
10958 "least I<L_tmpnam>) pointed to by I<s> and the value I<s> is returned in "
10962 #. type: Plain text
10963 #: build/C/man3/tmpnam.3:68
10965 "The pathname that is created, has a directory prefix I<P_tmpdir>. (Both "
10966 "I<L_tmpnam> and I<P_tmpdir> are defined in I<E<lt>stdio.hE<gt>>, just like "
10967 "the B<TMP_MAX> mentioned below.)"
10970 #. type: Plain text
10971 #: build/C/man3/tmpnam.3:73
10973 "The B<tmpnam>() function returns a pointer to a unique temporary filename, "
10974 "or NULL if a unique name cannot be generated."
10977 #. type: Plain text
10978 #: build/C/man3/tmpnam.3:75
10979 msgid "No errors are defined."
10982 #. type: Plain text
10983 #: build/C/man3/tmpnam.3:80
10985 "SVr4, 4.3BSD, C89, C99, POSIX.1-2001. POSIX.1-2008 marks B<tmpnam>() as "
10989 #. type: Plain text
10990 #: build/C/man3/tmpnam.3:91
10992 "The B<tmpnam>() function generates a different string each time it is "
10993 "called, up to B<TMP_MAX> times. If it is called more than B<TMP_MAX> times, "
10994 "the behavior is implementation defined."
10997 #. type: Plain text
10998 #: build/C/man3/tmpnam.3:110
11000 "Although B<tmpnam>() generates names that are difficult to guess, it is "
11001 "nevertheless possible that between the time that B<tmpnam>() returns a "
11002 "pathname, and the time that the program opens it, another program might "
11003 "create that pathname using B<open>(2), or create it as a symbolic link. "
11004 "This can lead to security holes. To avoid such possibilities, use the "
11005 "B<open>(2) B<O_EXCL> flag to open the pathname. Or better yet, use "
11006 "B<mkstemp>(3) or B<tmpfile>(3)."
11009 #. type: Plain text
11010 #: build/C/man3/tmpnam.3:118
11012 "Portable applications that use threads cannot call B<tmpnam>() with a NULL "
11013 "argument if either B<_POSIX_THREADS> or B<_POSIX_THREAD_SAFE_FUNCTIONS> is "
11017 #. type: Plain text
11018 #: build/C/man3/tmpnam.3:122
11019 msgid "A POSIX draft proposed to use a function B<tmpnam_r>() defined by"
11022 #. type: Plain text
11023 #: build/C/man3/tmpnam.3:130
11027 "tmpnam_r(char *s)\n"
11029 " return s ? tmpnam(s) : NULL;\n"
11033 #. type: Plain text
11034 #: build/C/man3/tmpnam.3:144
11036 "apparently as a warning not to use NULL. A few systems implement it. To "
11037 "get a glibc prototype for this function from I<E<lt>stdio.hE<gt>>, define "
11038 "B<_SVID_SOURCE> or B<_BSD_SOURCE> (before including I<any> header file)."
11041 #. type: Plain text
11042 #: build/C/man3/tmpnam.3:156
11043 msgid "B<mkstemp>(3), B<mktemp>(3), B<tempnam>(3), B<tmpfile>(3)"
11047 #: build/C/man2/unlink.2:32
11053 #: build/C/man2/unlink.2:32
11058 #. type: Plain text
11059 #: build/C/man2/unlink.2:35
11060 msgid "unlink - delete a name and possibly the file it refers to"
11063 #. type: Plain text
11064 #: build/C/man2/unlink.2:39
11065 msgid "B<int unlink(const char *>I<pathname>B<);>"
11068 #. type: Plain text
11069 #: build/C/man2/unlink.2:45
11071 "B<unlink>() deletes a name from the file system. If that name was the last "
11072 "link to a file and no processes have the file open the file is deleted and "
11073 "the space it was using is made available for reuse."
11076 #. type: Plain text
11077 #: build/C/man2/unlink.2:49
11079 "If the name was the last link to a file but any processes still have the "
11080 "file open the file will remain in existence until the last file descriptor "
11081 "referring to it is closed."
11084 #. type: Plain text
11085 #: build/C/man2/unlink.2:51
11086 msgid "If the name referred to a symbolic link the link is removed."
11089 #. type: Plain text
11090 #: build/C/man2/unlink.2:55
11092 "If the name referred to a socket, fifo or device the name for it is removed "
11093 "but processes which have the object open may continue to use it."
11096 #. type: Plain text
11097 #: build/C/man2/unlink.2:71
11099 "Write access to the directory containing I<pathname> is not allowed for the "
11100 "process's effective UID, or one of the directories in I<pathname> did not "
11101 "allow search permission. (See also B<path_resolution>(7).)"
11104 #. type: Plain text
11105 #: build/C/man2/unlink.2:80
11107 "The file I<pathname> cannot be unlinked because it is being used by the "
11108 "system or another process; for example, it is a mount point or the NFS "
11109 "client software created it to represent an active but otherwise nameless "
11110 "inode (\"NFS silly renamed\")."
11113 #. type: Plain text
11114 #: build/C/man2/unlink.2:92
11116 "I<pathname> refers to a directory. (This is the non-POSIX value returned by "
11117 "Linux since 2.1.132.)"
11120 #. type: Plain text
11121 #: build/C/man2/unlink.2:96
11122 msgid "Too many symbolic links were encountered in translating I<pathname>."
11125 #. type: Plain text
11126 #: build/C/man2/unlink.2:106
11128 "A component in I<pathname> does not exist or is a dangling symbolic link, or "
11129 "I<pathname> is empty."
11132 #. type: Plain text
11133 #: build/C/man2/unlink.2:114
11134 msgid "A component used as a directory in I<pathname> is not, in fact, a directory."
11137 #. type: Plain text
11138 #: build/C/man2/unlink.2:123
11140 "The system does not allow unlinking of directories, or unlinking of "
11141 "directories requires privileges that the calling process doesn't have. "
11142 "(This is the POSIX prescribed error return; as noted above, Linux returns "
11143 "B<EISDIR> for this case.)"
11147 #: build/C/man2/unlink.2:123
11149 msgid "B<EPERM> (Linux only)"
11152 #. type: Plain text
11153 #: build/C/man2/unlink.2:126
11154 msgid "The file system does not allow unlinking of files."
11157 #. type: Plain text
11158 #: build/C/man2/unlink.2:137
11160 "The directory containing I<pathname> has the sticky bit (B<S_ISVTX>) set "
11161 "and the process's effective UID is neither the UID of the file to be deleted "
11162 "nor that of the directory containing it, and the process is not privileged "
11163 "(Linux: does not have the B<CAP_FOWNER> capability)."
11166 #. type: Plain text
11167 #: build/C/man2/unlink.2:141
11168 msgid "I<pathname> refers to a file on a read-only file system."
11171 #. type: Plain text
11172 #: build/C/man2/unlink.2:161
11174 "B<rm>(1), B<chmod>(2), B<link>(2), B<mknod>(2), B<open>(2), B<rename>(2), "
11175 "B<rmdir>(2), B<unlinkat>(2), B<mkfifo>(3), B<remove>(3), "
11176 "B<path_resolution>(7), B<symlink>(7)"
11180 #: build/C/man3/unlocked_stdio.3:23
11182 msgid "UNLOCKED_STDIO"
11185 #. type: Plain text
11186 #: build/C/man3/unlocked_stdio.3:27
11188 "getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - "
11189 "nonlocking stdio functions"
11192 #. type: Plain text
11193 #: build/C/man3/unlocked_stdio.3:35
11196 "B<int getc_unlocked(FILE *>I<stream>B<);>\n"
11197 "B<int getchar_unlocked(void);>\n"
11198 "B<int putc_unlocked(int >I<c>B<, FILE *>I<stream>B<);>\n"
11199 "B<int putchar_unlocked(int >I<c>B<);>\n"
11202 #. type: Plain text
11203 #: build/C/man3/unlocked_stdio.3:47
11206 "B<void clearerr_unlocked(FILE *>I<stream>B<);>\n"
11207 "B<int feof_unlocked(FILE *>I<stream>B<);>\n"
11208 "B<int ferror_unlocked(FILE *>I<stream>B<);>\n"
11209 "B<int fileno_unlocked(FILE *>I<stream>B<);>\n"
11210 "B<int fflush_unlocked(FILE *>I<stream>B<);>\n"
11211 "B<int fgetc_unlocked(FILE *>I<stream>B<);>\n"
11212 "B<int fputc_unlocked(int >I<c>B<, FILE *>I<stream>B<);>\n"
11213 "B<size_t fread_unlocked(void *>I<ptr>B<, size_t >I<size>B<, size_t "
11215 "B< FILE *>I<stream>B<);>\n"
11216 "B<size_t fwrite_unlocked(const void *>I<ptr>B<, size_t >I<size>B<, size_t "
11218 "B< FILE *>I<stream>B<);>\n"
11221 #. type: Plain text
11222 #: build/C/man3/unlocked_stdio.3:50
11225 "B<char *fgets_unlocked(char *>I<s>B<, int >I<n>B<, FILE *>I<stream>B<);>\n"
11226 "B<int fputs_unlocked(const char *>I<s>B<, FILE *>I<stream>B<);>\n"
11229 #. type: Plain text
11230 #: build/C/man3/unlocked_stdio.3:61
11233 "B<wint_t getwc_unlocked(FILE *>I<stream>B<);>\n"
11234 "B<wint_t getwchar_unlocked(void);>\n"
11235 "B<wint_t fgetwc_unlocked(FILE *>I<stream>B<);>\n"
11236 "B<wint_t fputwc_unlocked(wchar_t >I<wc>B<, FILE *>I<stream>B<);>\n"
11237 "B<wint_t putwc_unlocked(wchar_t >I<wc>B<, FILE *>I<stream>B<);>\n"
11238 "B<wint_t putwchar_unlocked(wchar_t >I<wc>B<);>\n"
11239 "B<wchar_t *fgetws_unlocked(wchar_t *>I<ws>B<, int >I<n>B<, FILE "
11240 "*>I<stream>B<);>\n"
11241 "B<int fputws_unlocked(const wchar_t *>I<ws>B<, FILE *>I<stream>B<);>\n"
11244 #. type: Plain text
11245 #: build/C/man3/unlocked_stdio.3:73
11247 "B<getc_unlocked>(), B<getchar_unlocked>(), B<putc_unlocked>(), "
11248 "B<putchar_unlocked>():"
11251 #. type: Plain text
11252 #: build/C/man3/unlocked_stdio.3:76
11254 "_POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE || "
11255 "_BSD_SOURCE || _SVID_SOURCE"
11258 #. type: Plain text
11259 #: build/C/man3/unlocked_stdio.3:87
11261 "B<clearerr_unlocked>(), B<feof_unlocked>(), B<ferror_unlocked>(), "
11262 "B<fileno_unlocked>(), B<fflush_unlocked>(), B<fgetc_unlocked>(), "
11263 "B<fputc_unlocked>(), B<fread_unlocked>(), B<fwrite_unlocked>():"
11266 #. type: Plain text
11267 #: build/C/man3/unlocked_stdio.3:89
11268 msgid "_BSD_SOURCE || _SVID_SOURCE"
11271 #. type: Plain text
11272 #: build/C/man3/unlocked_stdio.3:100
11274 "B<fgets_unlocked>(), B<fputs_unlocked>(), B<getwc_unlocked>(), "
11275 "B<getwchar_unlocked>(), B<fgetwc_unlocked>(), B<fputwc_unlocked>(), "
11276 "B<putwchar_unlocked>(), B<fgetws_unlocked>(), B<fputws_unlocked>():"
11279 #. type: Plain text
11280 #: build/C/man3/unlocked_stdio.3:111
11282 "Each of these functions has the same behavior as its counterpart without the "
11283 "\"_unlocked\" suffix, except that they do not use locking (they do not set "
11284 "locks themselves, and do not test for the presence of locks set by others) "
11285 "and hence are thread-unsafe. See B<flockfile>(3)."
11288 #. type: Plain text
11289 #: build/C/man3/unlocked_stdio.3:118
11291 "The four functions B<getc_unlocked>(), B<getchar_unlocked>(), "
11292 "B<putc_unlocked>(), B<putchar_unlocked>() are in POSIX.1-2001."
11295 #. E.g., in HP-UX 10.0. In HP-UX 10.30 they are called obsolescent, and
11296 #. moved to a compatibility library.
11297 #. Available in HP-UX 10.0: clearerr_unlocked, fclose_unlocked,
11298 #. feof_unlocked, ferror_unlocked, fflush_unlocked, fgets_unlocked,
11299 #. fgetwc_unlocked, fgetws_unlocked, fileno_unlocked, fputs_unlocked,
11300 #. fputwc_unlocked, fputws_unlocked, fread_unlocked, fseek_unlocked,
11301 #. ftell_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked,
11302 #. getw_unlocked, getwc_unlocked, getwchar_unlocked, putc_unlocked,
11303 #. putchar_unlocked, puts_unlocked, putws_unlocked, putw_unlocked,
11304 #. putwc_unlocked, putwchar_unlocked, rewind_unlocked, setvbuf_unlocked,
11305 #. ungetc_unlocked, ungetwc_unlocked.
11306 #. type: Plain text
11307 #: build/C/man3/unlocked_stdio.3:134
11309 "The nonstandard B<*_unlocked>() variants occur on a few UNIX systems, and "
11310 "are available in recent glibc. They should probably not be used."
11313 #. type: Plain text
11314 #: build/C/man3/unlocked_stdio.3:137
11315 msgid "B<flockfile>(3), B<stdio>(3)"
11319 #: build/C/man3/wprintf.3:14
11325 #: build/C/man3/wprintf.3:14
11330 #. type: Plain text
11331 #: build/C/man3/wprintf.3:18
11333 "wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf - formatted "
11334 "wide-character output conversion"
11337 #. type: Plain text
11338 #: build/C/man3/wprintf.3:22
11341 "B<#include E<lt>stdio.hE<gt>>\n"
11342 "B<#include E<lt>wchar.hE<gt>>\n"
11345 #. type: Plain text
11346 #: build/C/man3/wprintf.3:27
11349 "B<int wprintf(const wchar_t *>I<format>B<, ...);>\n"
11350 "B<int fwprintf(FILE *>I<stream>B<, const wchar_t *>I<format>B<, ...);>\n"
11351 "B<int swprintf(wchar_t *>I<wcs>B<, size_t >I<maxlen>B<,>\n"
11352 "B< const wchar_t *>I<format>B<, ...);>\n"
11355 #. type: Plain text
11356 #: build/C/man3/wprintf.3:32
11359 "B<int vwprintf(const wchar_t *>I<format>B<, va_list >I<args>B<);>\n"
11360 "B<int vfwprintf(FILE *>I<stream>B<, const wchar_t *>I<format>B<, va_list "
11362 "B<int vswprintf(wchar_t *>I<wcs>B<, size_t >I<maxlen>B<,>\n"
11363 "B< const wchar_t *>I<format>B<, va_list >I<args>B<);>\n"
11367 #. .BR fwprintf (),
11368 #. .BR swprintf (),
11369 #. .BR vwprintf (),
11370 #. .BR vfwprintf (),
11371 #. .BR vswprintf ():
11372 #. type: Plain text
11373 #: build/C/man3/wprintf.3:49
11374 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 500 || _ISOC99_SOURCE ||"
11377 #. type: Plain text
11378 #: build/C/man3/wprintf.3:51
11379 msgid "_ISOC95_SOURCE /* Since glibc 2.12 */ ||"
11382 #. type: Plain text
11383 #: build/C/man3/wprintf.3:53
11384 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 200112L;"
11387 #. type: Plain text
11388 #: build/C/man3/wprintf.3:56
11389 msgid "or I<cc\\ -std=c99>"
11392 #. type: Plain text
11393 #: build/C/man3/wprintf.3:67
11395 "The B<wprintf>() family of functions is the wide-character equivalent of "
11396 "the B<printf>(3) family of functions. It performs formatted output of wide "
11400 #. type: Plain text
11401 #: build/C/man3/wprintf.3:77
11403 "The B<wprintf>() and B<vwprintf>() functions perform wide-character output "
11404 "to I<stdout>. I<stdout> must not be byte oriented; see B<fwide>(3) for "
11405 "more information."
11408 #. type: Plain text
11409 #: build/C/man3/wprintf.3:87
11411 "The B<fwprintf>() and B<vfwprintf>() functions perform wide-character "
11412 "output to I<stream>. I<stream> must not be byte oriented; see B<fwide>(3) "
11413 "for more information."
11416 #. type: Plain text
11417 #: build/C/man3/wprintf.3:98
11419 "The B<swprintf>() and B<vswprintf>() functions perform wide-character "
11420 "output to an array of wide characters. The programmer must ensure that "
11421 "there is room for at least I<maxlen> wide characters at I<wcs>."
11424 #. type: Plain text
11425 #: build/C/man3/wprintf.3:109
11427 "These functions are like the B<printf>(3), B<vprintf>(3), B<fprintf>(3), "
11428 "B<vfprintf>(3), B<sprintf>(3), B<vsprintf>(3) functions except for the "
11429 "following differences:"
11433 #: build/C/man3/wprintf.3:109 build/C/man3/wprintf.3:112 build/C/man3/wprintf.3:115
11438 #. type: Plain text
11439 #: build/C/man3/wprintf.3:112
11440 msgid "The I<format> string is a wide-character string."
11443 #. type: Plain text
11444 #: build/C/man3/wprintf.3:115
11445 msgid "The output consists of wide characters, not bytes."
11448 #. type: Plain text
11449 #: build/C/man3/wprintf.3:130
11451 "B<swprintf>() and B<vswprintf>() take a I<maxlen> argument, B<sprintf>(3) "
11452 "and B<vsprintf>(3) do not. (B<snprintf>(3) and B<vsnprintf>(3) take a "
11453 "I<maxlen> argument, but these functions do not return -1 upon buffer "
11454 "overflow on Linux.)"
11457 #. type: Plain text
11458 #: build/C/man3/wprintf.3:132
11459 msgid "The treatment of the conversion characters B<c> and B<s> is different:"
11462 #. type: Plain text
11463 #: build/C/man3/wprintf.3:146
11465 "If no B<l> modifier is present, the I<int> argument is converted to a wide "
11466 "character by a call to the B<btowc>(3) function, and the resulting wide "
11467 "character is written. If an B<l> modifier is present, the I<wint_t> (wide "
11468 "character) argument is written."
11471 #. type: Plain text
11472 #: build/C/man3/wprintf.3:185
11474 "If no B<l> modifier is present: The I<const\\ char\\ *> argument is expected "
11475 "to be a pointer to an array of character type (pointer to a string) "
11476 "containing a multibyte character sequence beginning in the initial shift "
11477 "state. Characters from the array are converted to wide characters (each by "
11478 "a call to the B<mbrtowc>(3) function with a conversion state starting in "
11479 "the initial state before the first byte). The resulting wide characters are "
11480 "written up to (but not including) the terminating null wide character. If a "
11481 "precision is specified, no more wide characters than the number specified "
11482 "are written. Note that the precision determines the number of I<wide "
11483 "characters> written, not the number of I<bytes> or I<screen positions>. The "
11484 "array must contain a terminating null byte, unless a precision is given and "
11485 "it is so small that the number of converted wide characters reaches it "
11486 "before the end of the array is reached. If an B<l> modifier is present: The "
11487 "I<const\\ wchar_t\\ *> argument is expected to be a pointer to an array of "
11488 "wide characters. Wide characters from the array are written up to (but not "
11489 "including) a terminating null wide character. If a precision is specified, "
11490 "no more than the number specified are written. The array must contain a "
11491 "terminating null wide character, unless a precision is given and it is "
11492 "smaller than or equal to the number of wide characters in the array."
11495 #. type: Plain text
11496 #: build/C/man3/wprintf.3:193
11498 "The functions return the number of wide characters written, excluding the "
11499 "terminating null wide character in case of the functions B<swprintf>() and "
11500 "B<vswprintf>(). They return -1 when an error occurs."
11503 #. type: Plain text
11504 #: build/C/man3/wprintf.3:195
11508 #. type: Plain text
11509 #: build/C/man3/wprintf.3:203
11511 "The behavior of B<wprintf>() et al. depends on the B<LC_CTYPE> category of "
11512 "the current locale."
11515 #. type: Plain text
11516 #: build/C/man3/wprintf.3:229
11518 "If the I<format> string contains non-ASCII wide characters, the program will "
11519 "only work correctly if the B<LC_CTYPE> category of the current locale at run "
11520 "time is the same as the B<LC_CTYPE> category of the current locale at "
11521 "compile time. This is because the I<wchar_t> representation is platform- "
11522 "and locale-dependent. (The glibc represents wide characters using their "
11523 "Unicode (ISO-10646) code point, but other platforms don't do this. Also, "
11524 "the use of C99 universal character names of the form \\eunnnn does not solve "
11525 "this problem.) Therefore, in internationalized programs, the I<format> "
11526 "string should consist of ASCII wide characters only, or should be "
11527 "constructed at run time in an internationalized way (e.g., using "
11528 "B<gettext>(3) or B<iconv>(3), followed by B<mbstowcs>(3))."
11532 #. type: Plain text
11533 #: build/C/man3/wprintf.3:236
11534 msgid "B<fprintf>(3), B<fputwc>(3), B<fwide>(3), B<printf>(3), B<snprintf>(3)"
11538 #: build/C/man2/write.2:39
11544 #: build/C/man2/write.2:39
11549 #. type: Plain text
11550 #: build/C/man2/write.2:42
11551 msgid "write - write to a file descriptor"
11554 #. type: Plain text
11555 #: build/C/man2/write.2:46
11556 msgid "B<ssize_t write(int >I<fd>B<, const void *>I<buf>B<, size_t >I<count>B<);>"
11559 #. type: Plain text
11560 #: build/C/man2/write.2:54
11562 "B<write>() writes up to I<count> bytes from the buffer pointed I<buf> to "
11563 "the file referred to by the file descriptor I<fd>."
11566 #. type: Plain text
11567 #: build/C/man2/write.2:68
11569 "The number of bytes written may be less than I<count> if, for example, there "
11570 "is insufficient space on the underlying physical medium, or the "
11571 "B<RLIMIT_FSIZE> resource limit is encountered (see B<setrlimit>(2)), or the "
11572 "call was interrupted by a signal handler after having written less than "
11573 "I<count> bytes. (See also B<pipe>(7).)"
11576 #. type: Plain text
11577 #: build/C/man2/write.2:82
11579 "For a seekable file (i.e., one to which B<lseek>(2) may be applied, for "
11580 "example, a regular file) writing takes place at the current file offset, "
11581 "and the file offset is incremented by the number of bytes actually written. "
11582 "If the file was B<open>(2)ed with B<O_APPEND>, the file offset is first set "
11583 "to the end of the file before writing. The adjustment of the file offset "
11584 "and the write operation are performed as an atomic step."
11587 #. type: Plain text
11588 #: build/C/man2/write.2:89
11590 "POSIX requires that a B<read>(2) which can be proved to occur after a "
11591 "B<write>() has returned returns the new data. Note that not all file "
11592 "systems are POSIX conforming."
11595 #. type: Plain text
11596 #: build/C/man2/write.2:94
11598 "On success, the number of bytes written is returned (zero indicates nothing "
11599 "was written). On error, -1 is returned, and I<errno> is set appropriately."
11602 #. type: Plain text
11603 #: build/C/man2/write.2:107
11605 "If I<count> is zero and I<fd> refers to a regular file, then B<write>() may "
11606 "return a failure status if one of the errors below is detected. If no "
11607 "errors are detected, 0 will be returned without causing any other effect. "
11608 "If I<count> is zero and I<fd> refers to a file other than a regular file, "
11609 "the results are not specified."
11612 #. type: Plain text
11613 #: build/C/man2/write.2:115
11615 "The file descriptor I<fd> refers to a file other than a socket and has been "
11616 "marked nonblocking (B<O_NONBLOCK>), and the write would block."
11619 #. Actually EAGAIN on Linux
11620 #. type: Plain text
11621 #: build/C/man2/write.2:126
11623 "The file descriptor I<fd> refers to a socket and has been marked nonblocking "
11624 "(B<O_NONBLOCK>), and the write would block. POSIX.1-2001 allows either "
11625 "error to be returned for this case, and does not require these constants to "
11626 "have the same value, so a portable application should check for both "
11630 #. type: Plain text
11631 #: build/C/man2/write.2:130
11632 msgid "I<fd> is not a valid file descriptor or is not open for writing."
11636 #: build/C/man2/write.2:130
11638 msgid "B<EDESTADDRREQ>"
11641 #. type: Plain text
11642 #: build/C/man2/write.2:135
11644 "I<fd> refers to a datagram socket for which a peer address has not been set "
11645 "using B<connect>(2)."
11648 #. type: Plain text
11649 #: build/C/man2/write.2:144
11651 "An attempt was made to write a file that exceeds the implementation-defined "
11652 "maximum file size or the process's file size limit, or to write at a "
11653 "position past the maximum allowed offset."
11656 #. type: Plain text
11657 #: build/C/man2/write.2:148
11659 "The call was interrupted by a signal before any data was written; see "
11663 #. type: Plain text
11664 #: build/C/man2/write.2:159
11666 "I<fd> is attached to an object which is unsuitable for writing; or the file "
11667 "was opened with the B<O_DIRECT> flag, and either the address specified in "
11668 "I<buf>, the value specified in I<count>, or the current file offset is not "
11669 "suitably aligned."
11672 #. type: Plain text
11673 #: build/C/man2/write.2:162
11674 msgid "A low-level I/O error occurred while modifying the inode."
11677 #. type: Plain text
11678 #: build/C/man2/write.2:167
11680 "The device containing the file referred to by I<fd> has no room for the "
11685 #: build/C/man2/write.2:167
11690 #. type: Plain text
11691 #: build/C/man2/write.2:176
11693 "I<fd> is connected to a pipe or socket whose reading end is closed. When "
11694 "this happens the writing process will also receive a B<SIGPIPE> signal. "
11695 "(Thus, the write return value is seen only if the program catches, blocks or "
11696 "ignores this signal.)"
11699 #. type: Plain text
11700 #: build/C/man2/write.2:179
11701 msgid "Other errors may occur, depending on the object connected to I<fd>."
11704 #. type: Plain text
11705 #: build/C/man2/write.2:188
11707 "Under SVr4 a write may be interrupted and return B<EINTR> at any point, not "
11708 "just before any data is written."
11711 #. type: Plain text
11712 #: build/C/man2/write.2:197
11714 "A successful return from B<write>() does not make any guarantee that data "
11715 "has been committed to disk. In fact, on some buggy implementations, it does "
11716 "not even guarantee that space has successfully been reserved for the data. "
11717 "The only way to be sure is to call B<fsync>(2) after you are done writing "
11721 #. type: Plain text
11722 #: build/C/man2/write.2:205
11724 "If a B<write>() is interrupted by a signal handler before any bytes are "
11725 "written, then the call fails with the error B<EINTR>; if it is interrupted "
11726 "after at least one byte has been written, the call succeeds, and returns the "
11727 "number of bytes written."
11730 #. type: Plain text
11731 #: build/C/man2/write.2:217
11733 "B<close>(2), B<fcntl>(2), B<fsync>(2), B<ioctl>(2), B<lseek>(2), B<open>(2), "
11734 "B<pwrite>(2), B<read>(2), B<select>(2), B<writev>(2), B<fwrite>(3)"