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: 2013-09-28 04:06+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:27
26 #: build/C/man3/asprintf.3:27 build/C/man3/fcloseall.3:25 build/C/man3/ferror.3:44 build/C/man3/fmtmsg.3:13 build/C/man3/stdio_ext.3:25 build/C/man3/tmpnam.3:27
32 #: build/C/man3/asprintf.3:27 build/C/man3/ctermid.3:26 build/C/man3/dprintf.3:26 build/C/man3/fclose.3:44 build/C/man3/fcloseall.3:25 build/C/man3/fflush.3:45 build/C/man3/fgetwc.3:18 build/C/man3/fmemopen.3:10 build/C/man3/fopen.3:44 build/C/man3/fputwc.3:16 build/C/man3/fread.3:45 build/C/man3/fseek.3:42 build/C/man3/getline.3:26 build/C/man3/gets.3:27 build/C/man3/getw.3:25 build/C/man3/popen.3:40 build/C/man3/printf.3:34 build/C/man3/puts.3:26 build/C/man3/remove.3:31 build/C/man3/scanf.3:52 build/C/man3/wprintf.3:16
38 #: build/C/man3/asprintf.3:27 build/C/man3/ctermid.3:26 build/C/man3/dprintf.3:26 build/C/man3/fclose.3:44 build/C/man3/fcloseall.3:25 build/C/man3/ferror.3:44 build/C/man3/fflush.3:45 build/C/man3/fgetwc.3:18 build/C/man3/flockfile.3:25 build/C/man3/fmemopen.3:10 build/C/man3/fmtmsg.3:13 build/C/man3/fopen.3:44 build/C/man3/fopencookie.3:26 build/C/man3/fpurge.3:25 build/C/man3/fputwc.3:16 build/C/man3/fread.3:45 build/C/man3/fseek.3:42 build/C/man3/fseeko.3:25 build/C/man3/getline.3:26 build/C/man3/gets.3:27 build/C/man3/getw.3:25 build/C/man2/link.2:31 build/C/man2/llseek.2:28 build/C/man2/lseek.2:47 build/C/man3/lseek64.3:25 build/C/man2/open.2:51 build/C/man3/perror.3:31 build/C/man2/pipe.2:36 build/C/man3/popen.3:40 build/C/man3/printf.3:34 build/C/man3/puts.3:26 build/C/man2/read.2:35 build/C/man2/readlink.2:43 build/C/man2/readv.2:32 build/C/man3/remove.3:31 build/C/man2/rename.2:32 build/C/man2/rmdir.2:30 build/C/man3/scanf.3:52 build/C/man3/setbuf.3:48 build/C/man3/stdin.3:13 build/C/man3/stdio.3:39 build/C/man3/stdio_ext.3:25 build/C/man2/symlink.2:32 build/C/man7/symlink.7:36 build/C/man3/tempnam.3:25 build/C/man3/tmpfile.3:31 build/C/man3/tmpnam.3:27 build/C/man2/unlink.2:32 build/C/man3/unlocked_stdio.3:25 build/C/man3/wprintf.3:16 build/C/man2/write.2:39
40 msgid "Linux Programmer's Manual"
44 #: build/C/man3/asprintf.3:28 build/C/man3/ctermid.3:27 build/C/man3/dprintf.3:27 build/C/man3/fclose.3:45 build/C/man3/fcloseall.3:26 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:11 build/C/man3/fmtmsg.3:14 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:32 build/C/man2/llseek.2:29 build/C/man2/lseek.2:48 build/C/man3/lseek64.3:26 build/C/man2/open.2:52 build/C/man3/perror.3:32 build/C/man2/pipe.2:37 build/C/man3/popen.3:41 build/C/man3/printf.3:35 build/C/man3/puts.3:27 build/C/man2/read.2:36 build/C/man2/readlink.2:44 build/C/man2/readv.2:33 build/C/man3/remove.3:32 build/C/man2/rename.2:33 build/C/man2/rmdir.2:31 build/C/man3/scanf.3:53 build/C/man3/setbuf.3:49 build/C/man3/stdin.3:14 build/C/man3/stdio.3:40 build/C/man3/stdio_ext.3:26 build/C/man2/symlink.2:33 build/C/man7/symlink.7:37 build/C/man3/tempnam.3:26 build/C/man3/tmpfile.3:32 build/C/man3/tmpnam.3:28 build/C/man2/unlink.2:33 build/C/man3/unlocked_stdio.3:26 build/C/man3/wprintf.3:17 build/C/man2/write.2:40
50 #: build/C/man3/asprintf.3:30
51 msgid "asprintf, vasprintf - print to allocated string"
55 #: build/C/man3/asprintf.3:30 build/C/man3/ctermid.3:29 build/C/man3/dprintf.3:29 build/C/man3/fclose.3:47 build/C/man3/fcloseall.3:28 build/C/man3/ferror.3:47 build/C/man3/fflush.3:48 build/C/man3/fgetwc.3:21 build/C/man3/flockfile.3:28 build/C/man3/fmemopen.3:13 build/C/man3/fmtmsg.3:16 build/C/man3/fopen.3:47 build/C/man3/fopencookie.3:29 build/C/man3/fpurge.3:28 build/C/man3/fputwc.3:19 build/C/man3/fread.3:48 build/C/man3/fseek.3:45 build/C/man3/fseeko.3:28 build/C/man3/getline.3:29 build/C/man3/gets.3:30 build/C/man3/getw.3:28 build/C/man2/link.2:34 build/C/man2/llseek.2:31 build/C/man2/lseek.2:50 build/C/man3/lseek64.3:28 build/C/man2/open.2:54 build/C/man3/perror.3:34 build/C/man2/pipe.2:39 build/C/man3/popen.3:43 build/C/man3/printf.3:38 build/C/man3/puts.3:29 build/C/man2/read.2:38 build/C/man2/readlink.2:46 build/C/man2/readv.2:35 build/C/man3/remove.3:34 build/C/man2/rename.2:35 build/C/man2/rmdir.2:33 build/C/man3/scanf.3:55 build/C/man3/setbuf.3:51 build/C/man3/stdin.3:16 build/C/man3/stdio.3:42 build/C/man3/stdio_ext.3:30 build/C/man2/symlink.2:35 build/C/man3/tempnam.3:28 build/C/man3/tmpfile.3:34 build/C/man3/tmpnam.3:30 build/C/man2/unlink.2:35 build/C/man3/unlocked_stdio.3:29 build/C/man3/wprintf.3:20 build/C/man2/write.2:42
61 #: build/C/man3/asprintf.3:32
62 msgid "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */"
66 #: build/C/man3/asprintf.3:34 build/C/man3/dprintf.3:31 build/C/man3/fclose.3:49 build/C/man3/ferror.3:49 build/C/man3/fflush.3:50 build/C/man3/fseek.3:47 build/C/man3/perror.3:36 build/C/man3/printf.3:40 build/C/man3/remove.3:36 build/C/man2/rename.2:37 build/C/man3/stdio.3:44 build/C/man3/stdio_ext.3:32
67 msgid "B<#include E<lt>stdio.hE<gt>>"
71 #: build/C/man3/asprintf.3:36
72 msgid "B<int asprintf(char **>I<strp>B<, const char *>I<fmt>B<, ...);>"
76 #: build/C/man3/asprintf.3:38
78 "B<int vasprintf(char **>I<strp>B<, const char *>I<fmt>B<, va_list "
83 #: build/C/man3/asprintf.3:38 build/C/man3/ctermid.3:46 build/C/man3/dprintf.3:55 build/C/man3/fclose.3:51 build/C/man3/fcloseall.3:35 build/C/man3/ferror.3:65 build/C/man3/fflush.3:52 build/C/man3/fgetwc.3:30 build/C/man3/flockfile.3:51 build/C/man3/fmemopen.3:46 build/C/man3/fmtmsg.3:26 build/C/man3/fopen.3:65 build/C/man3/fopencookie.3:37 build/C/man3/fpurge.3:42 build/C/man3/fputwc.3:28 build/C/man3/fread.3:58 build/C/man3/fseek.3:57 build/C/man3/fseeko.3:37 build/C/man3/getline.3:58 build/C/man3/gets.3:46 build/C/man3/getw.3:59 build/C/man2/link.2:38 build/C/man2/llseek.2:43 build/C/man2/lseek.2:56 build/C/man3/lseek64.3:36 build/C/man2/open.2:65 build/C/man3/perror.3:55 build/C/man2/pipe.2:51 build/C/man3/popen.3:64 build/C/man3/printf.3:76 build/C/man3/puts.3:43 build/C/man2/read.2:44 build/C/man2/readlink.2:63 build/C/man2/readv.2:58 build/C/man3/remove.3:38 build/C/man2/rename.2:39 build/C/man2/rmdir.2:37 build/C/man3/scanf.3:87 build/C/man3/setbuf.3:73 build/C/man3/stdin.3:24 build/C/man3/stdio.3:50 build/C/man3/stdio_ext.3:54 build/C/man2/symlink.2:52 build/C/man3/tempnam.3:42 build/C/man3/tmpfile.3:40 build/C/man3/tmpnam.3:36 build/C/man2/unlink.2:39 build/C/man3/unlocked_stdio.3:106 build/C/man3/wprintf.3:60 build/C/man2/write.2:46
89 #: build/C/man3/asprintf.3:53
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 "
94 "(\\(aq\\e0\\(aq), and return a pointer to it via the first argument. This "
95 "pointer should be passed to B<free>(3) to release the allocated storage "
96 "when it is no longer needed."
100 #: build/C/man3/asprintf.3:53 build/C/man3/ctermid.3:59 build/C/man3/fclose.3:59 build/C/man3/fcloseall.3:50 build/C/man3/fflush.3:74 build/C/man3/fgetwc.3:55 build/C/man3/flockfile.3:120 build/C/man3/fmemopen.3:176 build/C/man3/fmtmsg.3:152 build/C/man3/fopen.3:189 build/C/man3/fopencookie.3:238 build/C/man3/fpurge.3:58 build/C/man3/fputwc.3:54 build/C/man3/fread.3:83 build/C/man3/fseek.3:121 build/C/man3/fseeko.3:75 build/C/man3/getline.3:110 build/C/man3/gets.3:111 build/C/man3/getw.3:73 build/C/man2/link.2:52 build/C/man2/llseek.2:62 build/C/man2/lseek.2:162 build/C/man2/open.2:568 build/C/man2/pipe.2:92 build/C/man3/popen.3:123 build/C/man3/puts.3:84 build/C/man2/read.2:81 build/C/man2/readlink.2:77 build/C/man2/readv.2:177 build/C/man3/remove.3:60 build/C/man2/rename.2:91 build/C/man2/rmdir.2:40 build/C/man3/scanf.3:530 build/C/man3/setbuf.3:152 build/C/man2/symlink.2:84 build/C/man3/tempnam.3:87 build/C/man3/tmpfile.3:47 build/C/man3/tmpnam.3:70 build/C/man2/unlink.2:55 build/C/man3/wprintf.3:205 build/C/man2/write.2:89
106 #: build/C/man3/asprintf.3:61
108 "When successful, these functions return the number of bytes printed, just "
109 "like B<sprintf>(3). If memory allocation wasn't possible, or some other "
110 "error occurs, these functions will return -1, and the contents of I<strp> is "
115 #: build/C/man3/asprintf.3:61 build/C/man3/ctermid.3:67 build/C/man3/dprintf.3:69 build/C/man3/fclose.3:90 build/C/man3/fcloseall.3:60 build/C/man3/ferror.3:115 build/C/man3/fflush.3:98 build/C/man3/fgetwc.3:70 build/C/man3/flockfile.3:135 build/C/man3/fmemopen.3:195 build/C/man3/fmtmsg.3:237 build/C/man3/fopen.3:246 build/C/man3/fopencookie.3:245 build/C/man3/fpurge.3:70 build/C/man3/fputwc.3:68 build/C/man3/fread.3:103 build/C/man3/fseek.3:168 build/C/man3/fseeko.3:87 build/C/man3/getline.3:137 build/C/man3/gets.3:138 build/C/man3/getw.3:80 build/C/man2/link.2:138 build/C/man2/llseek.2:81 build/C/man2/lseek.2:200 build/C/man2/open.2:727 build/C/man3/perror.3:111 build/C/man2/pipe.2:118 build/C/man3/popen.3:172 build/C/man3/printf.3:807 build/C/man3/puts.3:103 build/C/man2/read.2:173 build/C/man2/readlink.2:125 build/C/man2/readv.2:214 build/C/man3/remove.3:70 build/C/man2/rename.2:232 build/C/man2/rmdir.2:127 build/C/man3/scanf.3:577 build/C/man3/setbuf.3:164 build/C/man3/stdin.3:113 build/C/man3/stdio.3:246 build/C/man2/symlink.2:149 build/C/man3/tempnam.3:98 build/C/man3/tmpfile.3:78 build/C/man3/tmpnam.3:87 build/C/man2/unlink.2:141 build/C/man3/unlocked_stdio.3:113 build/C/man3/wprintf.3:213 build/C/man2/write.2:185
117 msgid "CONFORMING TO"
121 #: build/C/man3/asprintf.3:67
123 "These functions are GNU extensions, not in C or POSIX. They are also "
124 "available under *BSD. The FreeBSD implementation sets I<strp> to NULL on "
129 #: build/C/man3/asprintf.3:67 build/C/man3/ctermid.3:77 build/C/man3/dprintf.3:95 build/C/man3/fclose.3:102 build/C/man3/fcloseall.3:62 build/C/man3/ferror.3:122 build/C/man3/fflush.3:113 build/C/man3/fgetwc.3:87 build/C/man3/flockfile.3:143 build/C/man3/fmemopen.3:341 build/C/man3/fmtmsg.3:309 build/C/man3/fopen.3:348 build/C/man3/fopencookie.3:437 build/C/man3/fpurge.3:80 build/C/man3/fputwc.3:85 build/C/man3/fread.3:105 build/C/man3/fseek.3:170 build/C/man3/fseeko.3:93 build/C/man3/getline.3:171 build/C/man3/gets.3:173 build/C/man3/getw.3:86 build/C/man2/link.2:187 build/C/man2/llseek.2:87 build/C/man2/lseek.2:245 build/C/man3/lseek64.3:164 build/C/man2/open.2:1000 build/C/man3/perror.3:139 build/C/man2/pipe.2:190 build/C/man3/popen.3:201 build/C/man3/printf.3:1081 build/C/man3/puts.3:112 build/C/man2/read.2:187 build/C/man2/readlink.2:214 build/C/man2/readv.2:284 build/C/man3/remove.3:81 build/C/man2/rename.2:245 build/C/man2/rmdir.2:132 build/C/man3/scanf.3:715 build/C/man3/setbuf.3:200 build/C/man3/stdin.3:154 build/C/man3/stdio.3:250 build/C/man3/stdio_ext.3:151 build/C/man2/symlink.2:164 build/C/man7/symlink.7:471 build/C/man3/tempnam.3:168 build/C/man3/tmpfile.3:97 build/C/man3/tmpnam.3:163 build/C/man2/unlink.2:148 build/C/man3/unlocked_stdio.3:136 build/C/man3/wprintf.3:253 build/C/man2/write.2:211
135 #: build/C/man3/asprintf.3:71
136 msgid "B<free>(3), B<malloc>(3), B<printf>(3)"
140 #: build/C/man3/asprintf.3:71 build/C/man3/ctermid.3:79 build/C/man3/dprintf.3:97 build/C/man3/fclose.3:108 build/C/man3/fcloseall.3:68 build/C/man3/ferror.3:127 build/C/man3/fflush.3:121 build/C/man3/fgetwc.3:92 build/C/man3/flockfile.3:145 build/C/man3/fmemopen.3:344 build/C/man3/fmtmsg.3:312 build/C/man3/fopen.3:354 build/C/man3/fopencookie.3:442 build/C/man3/fpurge.3:85 build/C/man3/fputwc.3:89 build/C/man3/fread.3:111 build/C/man3/fseek.3:173 build/C/man3/fseeko.3:95 build/C/man3/getline.3:178 build/C/man3/gets.3:189 build/C/man3/getw.3:92 build/C/man2/link.2:197 build/C/man2/llseek.2:90 build/C/man2/lseek.2:252 build/C/man3/lseek64.3:167 build/C/man2/open.2:1022 build/C/man3/perror.3:144 build/C/man2/pipe.2:197 build/C/man3/popen.3:211 build/C/man3/printf.3:1090 build/C/man3/puts.3:124 build/C/man2/read.2:200 build/C/man2/readlink.2:222 build/C/man2/readv.2:288 build/C/man3/remove.3:92 build/C/man2/rename.2:254 build/C/man2/rmdir.2:141 build/C/man3/scanf.3:722 build/C/man3/setbuf.3:208 build/C/man3/stdin.3:160 build/C/man3/stdio.3:257 build/C/man3/stdio_ext.3:154 build/C/man2/symlink.2:176 build/C/man7/symlink.7:489 build/C/man3/tempnam.3:173 build/C/man3/tmpfile.3:103 build/C/man3/tmpnam.3:168 build/C/man2/unlink.2:161 build/C/man3/unlocked_stdio.3:139 build/C/man3/wprintf.3:260 build/C/man2/write.2:223
146 #: build/C/man3/asprintf.3:78 build/C/man3/ctermid.3:86 build/C/man3/dprintf.3:104 build/C/man3/fclose.3:115 build/C/man3/fcloseall.3:75 build/C/man3/ferror.3:134 build/C/man3/fflush.3:128 build/C/man3/fgetwc.3:99 build/C/man3/flockfile.3:152 build/C/man3/fmemopen.3:351 build/C/man3/fmtmsg.3:319 build/C/man3/fopen.3:361 build/C/man3/fopencookie.3:449 build/C/man3/fpurge.3:92 build/C/man3/fputwc.3:96 build/C/man3/fread.3:118 build/C/man3/fseek.3:180 build/C/man3/fseeko.3:102 build/C/man3/getline.3:185 build/C/man3/gets.3:196 build/C/man3/getw.3:99 build/C/man2/link.2:204 build/C/man2/llseek.2:97 build/C/man2/lseek.2:259 build/C/man3/lseek64.3:174 build/C/man2/open.2:1029 build/C/man3/perror.3:151 build/C/man2/pipe.2:204 build/C/man3/popen.3:218 build/C/man3/printf.3:1097 build/C/man3/puts.3:131 build/C/man2/read.2:207 build/C/man2/readlink.2:229 build/C/man2/readv.2:295 build/C/man3/remove.3:99 build/C/man2/rename.2:261 build/C/man2/rmdir.2:148 build/C/man3/scanf.3:729 build/C/man3/setbuf.3:215 build/C/man3/stdin.3:167 build/C/man3/stdio.3:264 build/C/man3/stdio_ext.3:161 build/C/man2/symlink.2:183 build/C/man7/symlink.7:496 build/C/man3/tempnam.3:180 build/C/man3/tmpfile.3:110 build/C/man3/tmpnam.3:175 build/C/man2/unlink.2:168 build/C/man3/unlocked_stdio.3:146 build/C/man3/wprintf.3:267 build/C/man2/write.2:230
148 "This page is part of release 3.54 of the Linux I<man-pages> project. A "
149 "description of the project, and information about reporting bugs, can be "
150 "found at \\%http://www.kernel.org/doc/man-pages/."
154 #: build/C/man3/ctermid.3:26
160 #: build/C/man3/ctermid.3:26
166 #: build/C/man3/ctermid.3:29
167 msgid "ctermid - get controlling terminal name"
171 #: build/C/man3/ctermid.3:34 build/C/man3/fgetwc.3:24 build/C/man3/flockfile.3:31 build/C/man3/fmemopen.3:16 build/C/man3/fopen.3:50 build/C/man3/fputwc.3:22 build/C/man3/fread.3:51 build/C/man3/fseeko.3:31 build/C/man3/getline.3:32 build/C/man3/gets.3:33 build/C/man3/getw.3:31 build/C/man3/popen.3:46 build/C/man3/puts.3:32 build/C/man3/scanf.3:58 build/C/man3/setbuf.3:54 build/C/man3/stdin.3:19 build/C/man3/tempnam.3:31 build/C/man3/tmpfile.3:37 build/C/man3/tmpnam.3:33 build/C/man3/unlocked_stdio.3:32
173 msgid "B<#include E<lt>stdio.hE<gt>>\n"
177 #: build/C/man3/ctermid.3:36
179 msgid "B<char *ctermid(char *>I<s>B<);>\n"
183 #: build/C/man3/ctermid.3:41 build/C/man3/dprintf.3:39 build/C/man3/ferror.3:61 build/C/man3/flockfile.3:42 build/C/man3/fmemopen.3:29 build/C/man3/fopen.3:61 build/C/man3/getline.3:42 build/C/man3/getw.3:40 build/C/man3/perror.3:50 build/C/man3/popen.3:55 build/C/man3/printf.3:63 build/C/man2/readlink.2:54 build/C/man2/readv.2:53 build/C/man3/scanf.3:73 build/C/man3/setbuf.3:68 build/C/man2/symlink.2:43 build/C/man3/tempnam.3:38 build/C/man3/unlocked_stdio.3:68 build/C/man3/wprintf.3:39
184 msgid "Feature Test Macro Requirements for glibc (see B<feature_test_macros>(7)):"
187 #. From <unistd.h>: _XOPEN_SOURCE
189 #: build/C/man3/ctermid.3:46
190 msgid "B<ctermid>(): _POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE"
194 #: build/C/man3/ctermid.3:59
196 "B<ctermid>() returns a string which is the pathname for the current "
197 "controlling terminal for this process. If I<s> is NULL, a static buffer is "
198 "used, otherwise I<s> points to a buffer used to hold the terminal pathname. "
199 "The symbolic constant B<L_ctermid> is the maximum number of characters in "
200 "the returned pathname."
204 #: build/C/man3/ctermid.3:61
205 msgid "The pointer to the pathname."
209 #: build/C/man3/ctermid.3:61 build/C/man3/fcloseall.3:55 build/C/man3/ferror.3:106 build/C/man3/fflush.3:93 build/C/man3/flockfile.3:127 build/C/man3/fmtmsg.3:225 build/C/man3/lseek64.3:159 build/C/man3/stdio_ext.3:132 build/C/man3/tmpnam.3:77
215 #: build/C/man3/ctermid.3:62 build/C/man3/fcloseall.3:56 build/C/man3/ferror.3:107 build/C/man3/fflush.3:94 build/C/man3/flockfile.3:128 build/C/man3/fmtmsg.3:226 build/C/man3/lseek64.3:160 build/C/man3/stdio_ext.3:133 build/C/man3/tmpnam.3:78
217 msgid "Multithreading (see pthreads(7))"
221 #: build/C/man3/ctermid.3:67
223 "The B<ctermid>() function is thread-safe with exceptions. It is not "
224 "thread-safe if called with a NULL parameter."
228 #: build/C/man3/ctermid.3:69
229 msgid "Svr4, POSIX.1-2001."
233 #: build/C/man3/ctermid.3:69 build/C/man3/fmemopen.3:213 build/C/man3/fopen.3:331 build/C/man3/gets.3:152 build/C/man3/getw.3:82 build/C/man2/link.2:181 build/C/man2/open.2:989 build/C/man3/popen.3:178 build/C/man3/printf.3:930 build/C/man3/puts.3:105 build/C/man2/readv.2:258 build/C/man3/remove.3:78 build/C/man2/rename.2:234 build/C/man2/rmdir.2:129 build/C/man3/scanf.3:646 build/C/man3/setbuf.3:170 build/C/man3/tempnam.3:158 build/C/man3/tmpnam.3:156 build/C/man2/unlink.2:145
239 #: build/C/man3/ctermid.3:73
241 "The path returned may not uniquely identify the controlling terminal; it "
242 "may, for example, be I</dev/tty>."
245 #. in glibc 2.3.x, x >= 4, the glibc headers threw an error
246 #. if ctermid() was given an argument; fixed in 2.4.
248 #: build/C/man3/ctermid.3:77
249 msgid "It is not assured that the program can open the terminal."
253 #: build/C/man3/ctermid.3:79
254 msgid "B<ttyname>(3)"
258 #: build/C/man3/dprintf.3:26
264 #: build/C/man3/dprintf.3:26
270 #: build/C/man3/dprintf.3:29
271 msgid "dprintf, vdprintf - print to a file descriptor"
275 #: build/C/man3/dprintf.3:33
276 msgid "B<int dprintf(int >I<fd>B<, const char *>I<format>B<, ...);>"
280 #: build/C/man3/dprintf.3:35
281 msgid "B<int vdprintf(int >I<fd>B<, const char *>I<format>B<, va_list >I<ap>B<);>"
285 #: build/C/man3/dprintf.3:43
286 msgid "B<dprintf>(), B<vdprintf>():"
290 #: build/C/man3/dprintf.3:46 build/C/man3/fmemopen.3:37 build/C/man3/getline.3:49
292 msgid "Since glibc 2.10:"
296 #: build/C/man3/dprintf.3:49 build/C/man3/fmemopen.3:40
297 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 700 || _POSIX_C_SOURCE\\ E<gt>=\\ 200809L"
301 #: build/C/man3/dprintf.3:49 build/C/man3/fmemopen.3:40 build/C/man3/getline.3:52
303 msgid "Before glibc 2.10:"
307 #: build/C/man3/dprintf.3:52 build/C/man3/fmemopen.3:43 build/C/man3/getline.3:55 build/C/man3/unlocked_stdio.3:104
312 #: build/C/man3/dprintf.3:69
314 "The functions B<dprintf>() and B<vdprintf>() (as found in the glibc2 "
315 "library) are exact analogs of B<fprintf>(3) and B<vfprintf>(3), except that "
316 "they output to a file descriptor I<fd> instead of to a I<stdio> stream."
320 #. These functions are GNU extensions, not in C or POSIX.
321 #. Clearly, the names were badly chosen.
322 #. Many systems (like MacOS) have incompatible functions called
324 #. usually some debugging version of
326 #. perhaps with a prototype like
328 #. .BI "void dprintf(int level, const char *" format ", ...);"
330 #. where the first argument is a debugging level (and output is to
336 #. is also a popular macro name for a debugging printf.
337 #. So, probably, it is better to avoid this function in programs
338 #. intended to be portable.
340 #. A better name would have been
343 #: build/C/man3/dprintf.3:95
345 "These functions are GNU extensions that are nowadays specified in "
350 #: build/C/man3/dprintf.3:97
355 #: build/C/man3/fclose.3:44
361 #: build/C/man3/fclose.3:44
367 #: build/C/man3/fclose.3:47
368 msgid "fclose - close a stream"
372 #: build/C/man3/fclose.3:51
373 msgid "B<int fclose(FILE *>I<fp>B<);>"
377 #: build/C/man3/fclose.3:59
379 "The B<fclose>() function flushes the stream pointed to by I<fp> (writing "
380 "any buffered output data using B<fflush>(3)) and closes the underlying file "
385 #: build/C/man3/fclose.3:70
387 "Upon successful completion 0 is returned. Otherwise, B<EOF> is returned and "
388 "I<errno> is set to indicate the error. In either case any further access "
389 "(including another call to B<fclose>()) to the stream results in undefined "
394 #: build/C/man3/fclose.3:70 build/C/man3/ferror.3:96 build/C/man3/fflush.3:81 build/C/man3/fgetwc.3:64 build/C/man3/flockfile.3:125 build/C/man3/fopen.3:201 build/C/man3/fpurge.3:65 build/C/man3/fputwc.3:63 build/C/man3/fseek.3:136 build/C/man3/fseeko.3:84 build/C/man3/getline.3:125 build/C/man2/link.2:57 build/C/man2/llseek.2:69 build/C/man2/lseek.2:170 build/C/man2/open.2:576 build/C/man2/pipe.2:97 build/C/man3/popen.3:146 build/C/man2/read.2:95 build/C/man2/readlink.2:85 build/C/man2/readv.2:188 build/C/man3/remove.3:65 build/C/man2/rename.2:96 build/C/man2/rmdir.2:45 build/C/man3/scanf.3:547 build/C/man2/symlink.2:89 build/C/man3/tempnam.3:94 build/C/man3/tmpfile.3:56 build/C/man3/tmpnam.3:75 build/C/man2/unlink.2:60 build/C/man2/write.2:107
400 #: build/C/man3/fclose.3:71 build/C/man3/fflush.3:82 build/C/man3/fpurge.3:66 build/C/man3/fseek.3:137 build/C/man2/llseek.2:70 build/C/man2/lseek.2:171 build/C/man2/read.2:114 build/C/man3/scanf.3:553 build/C/man2/write.2:126
405 #. This error cannot occur unless you are mixing ANSI C stdio operations and
406 #. low-level file operations on the same stream. If you do get this error,
407 #. you must have closed the stream's low-level file descriptor using
408 #. something like close(fileno(fp)).
410 #: build/C/man3/fclose.3:80
411 msgid "The file descriptor underlying I<fp> is not valid."
415 #: build/C/man3/fclose.3:90
417 "The B<fclose>() function may also fail and set I<errno> for any of the "
418 "errors specified for the routines B<close>(2), B<write>(2) or B<fflush>(3)."
422 #: build/C/man3/fclose.3:92 build/C/man3/fseek.3:170 build/C/man3/puts.3:105
427 #: build/C/man3/fclose.3:92 build/C/man3/fflush.3:104 build/C/man3/fgetwc.3:72 build/C/man3/fmemopen.3:207 build/C/man3/fmtmsg.3:252 build/C/man3/fopen.3:255 build/C/man3/fpurge.3:78 build/C/man3/fputwc.3:70 build/C/man3/fseeko.3:89 build/C/man2/link.2:143 build/C/man2/llseek.2:84 build/C/man2/lseek.2:210 build/C/man2/open.2:754 build/C/man3/perror.3:124 build/C/man3/printf.3:868 build/C/man2/read.2:175 build/C/man2/readlink.2:130 build/C/man2/readv.2:226 build/C/man3/remove.3:72 build/C/man3/scanf.3:608 build/C/man3/stdin.3:122 build/C/man2/symlink.2:155 build/C/man3/tempnam.3:103 build/C/man3/tmpfile.3:80 build/C/man3/tmpnam.3:92 build/C/man3/wprintf.3:215 build/C/man2/write.2:194
433 #: build/C/man3/fclose.3:102
435 "Note that B<fclose>() only flushes the user-space buffers provided by the C "
436 "library. To ensure that the data is physically stored on disk the kernel "
437 "buffers must be flushed too, for example, with B<sync>(2) or B<fsync>(2)."
441 #: build/C/man3/fclose.3:108
442 msgid "B<close>(2), B<fcloseall>(3), B<fflush>(3), B<fopen>(3), B<setbuf>(3)"
446 #: build/C/man3/fcloseall.3:25
452 #: build/C/man3/fcloseall.3:28
453 msgid "fcloseall - close all open streams"
457 #: build/C/man3/fcloseall.3:32 build/C/man3/fopencookie.3:33
460 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
461 "B<#include E<lt>stdio.hE<gt>>\n"
465 #: build/C/man3/fcloseall.3:34
467 msgid "B<int fcloseall(void);>\n"
471 #: build/C/man3/fcloseall.3:43
473 "The B<fcloseall>() function closes all of the calling process's open "
474 "streams. Buffered output for each stream is written before it is closed (as "
475 "for B<fflush>(3)); buffered input is discarded."
479 #: build/C/man3/fcloseall.3:50
480 msgid "The standard streams, I<stdin>, I<stdout>, and I<stderr> are also closed."
484 #: build/C/man3/fcloseall.3:55
486 "This function returns 0 if all files were successfully closed; on error, "
487 "B<EOF> is returned."
491 #: build/C/man3/fcloseall.3:60
493 "The B<fcloseall>() function does not lock the streams, so it is not "
498 #: build/C/man3/fcloseall.3:62
499 msgid "This function is a GNU extension."
503 #: build/C/man3/fcloseall.3:68
504 msgid "B<close>(2), B<fclose>(3), B<fflush>(3), B<fopen>(3), B<setbuf>(3)"
508 #: build/C/man3/ferror.3:44
514 #: build/C/man3/ferror.3:47
515 msgid "clearerr, feof, ferror, fileno - check and reset stream status"
519 #: build/C/man3/ferror.3:51
520 msgid "B<void clearerr(FILE *>I<stream>B<);>"
524 #: build/C/man3/ferror.3:53
525 msgid "B<int feof(FILE *>I<stream>B<);>"
529 #: build/C/man3/ferror.3:55
530 msgid "B<int ferror(FILE *>I<stream>B<);>"
534 #: build/C/man3/ferror.3:57
535 msgid "B<int fileno(FILE *>I<stream>B<);>"
539 #: build/C/man3/ferror.3:65
540 msgid "B<fileno>(): _POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE"
544 #: build/C/man3/ferror.3:70
546 "The function B<clearerr>() clears the end-of-file and error indicators for "
547 "the stream pointed to by I<stream>."
551 #: build/C/man3/ferror.3:78
553 "The function B<feof>() tests the end-of-file indicator for the stream "
554 "pointed to by I<stream>, returning nonzero if it is set. The end-of-file "
555 "indicator can be cleared only by the function B<clearerr>()."
559 #: build/C/man3/ferror.3:87
561 "The function B<ferror>() tests the error indicator for the stream pointed "
562 "to by I<stream>, returning nonzero if it is set. The error indicator can be "
563 "reset only by the B<clearerr>() function."
567 #: build/C/man3/ferror.3:93
569 "The function B<fileno>() examines the argument I<stream> and returns its "
570 "integer descriptor."
574 #: build/C/man3/ferror.3:96 build/C/man3/fgetwc.3:55 build/C/man3/fputwc.3:54 build/C/man3/fread.3:83 build/C/man3/gets.3:111 build/C/man3/puts.3:84
575 msgid "For nonlocking counterparts, see B<unlocked_stdio>(3)."
579 #: build/C/man3/ferror.3:106
581 "These functions should not fail and do not set the external variable "
582 "I<errno>. (However, in case B<fileno>() detects that its argument is not a "
583 "valid stream, it must return -1 and set I<errno> to B<EBADF>.)"
587 #: build/C/man3/ferror.3:115
589 "The B<clearerr>(), B<feof>(), B<ferror>(), and B<fileno>() functions are "
594 #: build/C/man3/ferror.3:122
596 "The functions B<clearerr>(), B<feof>(), and B<ferror>() conform to C89 and "
601 #: build/C/man3/ferror.3:127
602 msgid "B<open>(2), B<fdopen>(3), B<stdio>(3), B<unlocked_stdio>(3)"
606 #: build/C/man3/fflush.3:45
612 #: build/C/man3/fflush.3:45
618 #: build/C/man3/fflush.3:48
619 msgid "fflush - flush a stream"
623 #: build/C/man3/fflush.3:52
624 msgid "B<int fflush(FILE *>I<stream>B<);>"
628 #: build/C/man3/fflush.3:63
630 "For output streams, B<fflush>() forces a write of all user-space buffered "
631 "data for the given output or update I<stream> via the stream's underlying "
632 "write function. For input streams, B<fflush>() discards any buffered data "
633 "that has been fetched from the underlying file, but has not been consumed by "
634 "the application. The open status of the stream is unaffected."
638 #: build/C/man3/fflush.3:71
640 "If the I<stream> argument is NULL, B<fflush>() flushes I<all> open output "
645 #: build/C/man3/fflush.3:74
646 msgid "For a nonlocking counterpart, see B<unlocked_stdio>(3)."
650 #: build/C/man3/fflush.3:81
652 "Upon successful completion 0 is returned. Otherwise, B<EOF> is returned and "
653 "I<errno> is set to indicate the error."
657 #: build/C/man3/fflush.3:86
658 msgid "I<Stream> is not an open stream, or is not open for writing."
662 #: build/C/man3/fflush.3:93
664 "The function B<fflush>() may also fail and set I<errno> for any of the "
665 "errors specified for B<write>(2)."
669 #: build/C/man3/fflush.3:98
670 msgid "The B<fflush>() function is thread-safe."
674 #: build/C/man3/fflush.3:100
675 msgid "C89, C99, POSIX.1-2001, POSIX.1-2008."
678 #. Verified on: Solaris 8.
680 #: build/C/man3/fflush.3:104
682 "The standards do not specify the behavior for input streams. Most other "
683 "implementations behave the same as Linux."
687 #: build/C/man3/fflush.3:113
689 "Note that B<fflush>() only flushes the user-space buffers provided by the C "
690 "library. To ensure that the data is physically stored on disk the kernel "
691 "buffers must be flushed too, for example, with B<sync>(2) or B<fsync>(2)."
695 #: build/C/man3/fflush.3:121
697 "B<fsync>(2), B<sync>(2), B<write>(2), B<fclose>(3), B<fopen>(3), "
698 "B<setbuf>(3), B<unlocked_stdio>(3)"
702 #: build/C/man3/fgetwc.3:18
708 #: build/C/man3/fgetwc.3:18 build/C/man3/fputwc.3:16 build/C/man3/getline.3:26 build/C/man3/popen.3:40 build/C/man3/tempnam.3:25
714 #: build/C/man3/fgetwc.3:21
715 msgid "fgetwc, getwc - read a wide character from a FILE stream"
719 #: build/C/man3/fgetwc.3:26 build/C/man3/fmemopen.3:22 build/C/man3/fputwc.3:24 build/C/man3/unlocked_stdio.3:54
721 msgid "B<#include E<lt>wchar.hE<gt>>\n"
725 #: build/C/man3/fgetwc.3:29
728 "B<wint_t fgetwc(FILE *>I<stream>B<);>\n"
729 "B<wint_t getwc(FILE *>I<stream>B<);>\n"
733 #: build/C/man3/fgetwc.3:44
735 "The B<fgetwc>() function is the wide-character equivalent of the "
736 "B<fgetc>(3) function. It reads a wide character from I<stream> and returns "
737 "it. If the end of stream is reached, or if I<ferror(stream)> becomes true, "
738 "it returns B<WEOF>. If a wide-character conversion error occurs, it sets "
739 "I<errno> to B<EILSEQ> and returns B<WEOF>."
743 #: build/C/man3/fgetwc.3:52
745 "The B<getwc>() function or macro functions identically to B<fgetwc>(). It "
746 "may be implemented as a macro, and may evaluate its argument more than "
747 "once. There is no reason ever to use it."
751 #: build/C/man3/fgetwc.3:64
753 "The B<fgetwc>() function returns the next wide-character from the stream, "
754 "or B<WEOF>. In the event of an error, I<errno> is set to indicate the "
759 #: build/C/man3/fgetwc.3:66 build/C/man3/fputwc.3:65
760 msgid "Apart from the usual ones, there is"
764 #: build/C/man3/fgetwc.3:66 build/C/man3/fputwc.3:65 build/C/man3/scanf.3:558
770 #: build/C/man3/fgetwc.3:70
771 msgid "The data obtained from the input stream does not form a valid character."
775 #: build/C/man3/fgetwc.3:72 build/C/man3/fputwc.3:70
776 msgid "C99, POSIX.1-2001."
780 #: build/C/man3/fgetwc.3:79
782 "The behavior of B<fgetwc>() depends on the B<LC_CTYPE> category of the "
787 #: build/C/man3/fgetwc.3:87
789 "In the absence of additional information passed to the B<fopen>(3) call, it "
790 "is reasonable to expect that B<fgetwc>() will actually read a multibyte "
791 "sequence from the stream and then convert it to a wide character."
795 #: build/C/man3/fgetwc.3:92
796 msgid "B<fgetws>(3), B<fputwc>(3), B<ungetwc>(3), B<unlocked_stdio>(3)"
800 #: build/C/man3/flockfile.3:25
806 #: build/C/man3/flockfile.3:25
812 #: build/C/man3/flockfile.3:28
813 msgid "flockfile, ftrylockfile, funlockfile - lock FILE for stdio"
817 #: build/C/man3/flockfile.3:33
819 msgid "B<void flockfile(FILE *>I<filehandle>B<);>\n"
823 #: build/C/man3/flockfile.3:35
825 msgid "B<int ftrylockfile(FILE *>I<filehandle>B<);>\n"
829 #: build/C/man3/flockfile.3:37
831 msgid "B<void funlockfile(FILE *>I<filehandle>B<);>\n"
835 #: build/C/man3/flockfile.3:46 build/C/man3/wprintf.3:43
836 msgid "All functions shown above:"
840 #: build/C/man3/flockfile.3:49
842 "_POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE "
847 #: build/C/man3/flockfile.3:63
849 "The stdio functions are thread-safe. This is achieved by assigning to each "
850 "I<FILE> object a lockcount and (if the lockcount is nonzero) an owning "
851 "thread. For each library call, these functions wait until the I<FILE> "
852 "object is no longer locked by a different thread, then lock it, do the "
853 "requested I/O, and unlock the object again."
857 #: build/C/man3/flockfile.3:69
859 "(Note: this locking has nothing to do with the file locking done by "
860 "functions like B<flock>(2) and B<lockf>(3).)"
864 #: build/C/man3/flockfile.3:77
866 "All this is invisible to the C-programmer, but there may be two reasons to "
867 "wish for more detailed control. On the one hand, maybe a series of I/O "
868 "actions by one thread belongs together, and should not be interrupted by the "
869 "I/O of some other thread. On the other hand, maybe the locking overhead "
870 "should be avoided for greater efficiency."
874 #: build/C/man3/flockfile.3:94
876 "To this end, a thread can explicitly lock the I<FILE> object, then do its "
877 "series of I/O actions, then unlock. This prevents other threads from coming "
878 "in between. If the reason for doing this was to achieve greater efficiency, "
879 "one does the I/O with the nonlocking versions of the stdio functions: with "
880 "B<getc_unlocked>(3) and B<putc_unlocked>(3) instead of B<getc>(3) and "
885 #: build/C/man3/flockfile.3:105
887 "The B<flockfile>() function waits for I<*filehandle> to be no longer locked "
888 "by a different thread, then makes the current thread owner of "
889 "I<*filehandle>, and increments the lockcount."
893 #: build/C/man3/flockfile.3:109
894 msgid "The B<funlockfile>() function decrements the lock count."
898 #: build/C/man3/flockfile.3:120
900 "The B<ftrylockfile>() function is a nonblocking version of B<flockfile>(). "
901 "It does nothing in case some other thread owns I<*filehandle>, and it "
902 "obtains ownership and increments the lockcount otherwise."
906 #: build/C/man3/flockfile.3:125
908 "The B<ftrylockfile>() function returns zero for success (the lock was "
909 "obtained), and nonzero for failure."
913 #: build/C/man3/flockfile.3:127
918 #: build/C/man3/flockfile.3:135
920 "The B<flockfile>(), B<ftrylockfile>(), and B<funlockfile>() functions are "
925 #: build/C/man3/flockfile.3:137 build/C/man3/popen.3:174
926 msgid "POSIX.1-2001."
930 #: build/C/man3/flockfile.3:137
936 #: build/C/man3/flockfile.3:143
938 "These functions are available when B<_POSIX_THREAD_SAFE_FUNCTIONS> is "
939 "defined. They are in libc since libc 5.1.1 and in glibc since glibc 2.0."
943 #: build/C/man3/flockfile.3:145
944 msgid "B<unlocked_stdio>(3)"
948 #: build/C/man3/fmemopen.3:10
954 #: build/C/man3/fmemopen.3:10
960 #: build/C/man3/fmemopen.3:13
961 msgid "fmemopen, open_memstream, open_wmemstream - open memory as stream"
965 #: build/C/man3/fmemopen.3:18
968 "B<FILE *fmemopen(void *>I<buf>B<, size_t >I<size>B<, const char "
973 #: build/C/man3/fmemopen.3:20
975 msgid "B<FILE *open_memstream(char **>I<ptr>B<, size_t *>I<sizeloc>B<);>\n"
979 #: build/C/man3/fmemopen.3:24
981 msgid "B<FILE *open_wmemstream(wchar_t **>I<ptr>B<, size_t *>I<sizeloc>B<);>\n"
985 #: build/C/man3/fmemopen.3:34
986 msgid "B<fmemopen>(), B<open_memstream>(), B<open_wmemstream>():"
990 #: build/C/man3/fmemopen.3:57
992 "The B<fmemopen>() function opens a stream that permits the access specified "
993 "by I<mode>. The stream allows I/O to be performed on the string or memory "
994 "buffer pointed to by I<buf>. This buffer must be at least I<size> bytes "
999 #: build/C/man3/fmemopen.3:77
1001 "The argument I<mode> is the same as for B<fopen>(3). If I<mode> specifies "
1002 "an append mode, then the initial file position is set to the location of the "
1003 "first null byte (\\(aq\\e0\\(aq) in the buffer; otherwise the initial file "
1004 "position is set to the start of the buffer. Since glibc 2.9, the letter "
1005 "\\(aqb\\(aq may be specified as the second character in I<mode>. This "
1006 "provides \"binary\" mode: writes don't implicitly add a terminating null "
1007 "byte, and B<fseek>(3) B<SEEK_END> is relative to the end of the buffer "
1008 "(i.e., the value specified by the I<size> argument), rather than the current "
1013 #: build/C/man3/fmemopen.3:89
1015 "When a stream that has been opened for writing is flushed (B<fflush>(3)) or "
1016 "closed (B<fclose>(3)), a null byte is written at the end of the buffer if "
1017 "there is space. The caller should ensure that an extra byte is available in "
1018 "the buffer (and that I<size> counts that byte) to allow for this."
1021 #. See http://sourceware.org/bugzilla/show_bug.cgi?id=1995
1023 #. http://sources.redhat.com/ml/libc-alpha/2006-04/msg00064.html
1025 #: build/C/man3/fmemopen.3:107
1027 "Attempts to write more than I<size> bytes to the buffer result in an error. "
1028 "(By default, such errors will be visible only when the I<stdio> buffer is "
1029 "flushed. Disabling buffering with I<setbuf(fp,\\ NULL)> may be useful to "
1030 "detect errors at the time of an output operation. Alternatively, the caller "
1031 "can explicitly set I<buf> as the stdio stream buffer, at the same time "
1032 "informing stdio of the buffer's size, using I<setbuffer(fp, buf, size)>.)"
1036 #: build/C/man3/fmemopen.3:115
1038 "In a stream opened for reading, null bytes (\\(aq\\e0\\(aq) in the buffer do "
1039 "not cause read operations to return an end-of-file indication. A read from "
1040 "the buffer will only indicate end-of-file when the file pointer advances "
1041 "I<size> bytes past the start of the buffer."
1045 #: build/C/man3/fmemopen.3:130
1047 "If I<buf> is specified as NULL, then B<fmemopen>() dynamically allocates a "
1048 "buffer I<size> bytes long. This is useful for an application that wants to "
1049 "write data to a temporary buffer and then read it back again. The buffer is "
1050 "automatically freed when the stream is closed. Note that the caller has no "
1051 "way to obtain a pointer to the temporary buffer allocated by this call (but "
1052 "see B<open_memstream>() below)."
1056 #: build/C/man3/fmemopen.3:141
1058 "The B<open_memstream>() function opens a stream for writing to a buffer. "
1059 "The buffer is dynamically allocated (as with B<malloc>(3)), and "
1060 "automatically grows as required. After closing the stream, the caller "
1061 "should B<free>(3) this buffer."
1065 #: build/C/man3/fmemopen.3:156
1067 "When the stream is closed (B<fclose>(3)) or flushed (B<fflush>(3)), the "
1068 "locations pointed to by I<ptr> and I<sizeloc> are updated to contain, "
1069 "respectively, a pointer to the buffer and the current size of the buffer. "
1070 "These values remain valid only as long as the caller performs no further "
1071 "output on the stream. If further output is performed, then the stream must "
1072 "again be flushed before trying to access these variables."
1076 #: build/C/man3/fmemopen.3:162
1078 "A null byte is maintained at the end of the buffer. This byte is I<not> "
1079 "included in the size value stored at I<sizeloc>."
1083 #: build/C/man3/fmemopen.3:170
1085 "The stream's file position can be changed with B<fseek>(3) or "
1086 "B<fseeko>(3). Moving the file position past the end of the data already "
1087 "written fills the intervening space with zeros."
1091 #: build/C/man3/fmemopen.3:176
1093 "The B<open_wmemstream>() is similar to B<open_memstream>(), but operates on "
1094 "wide characters instead of bytes."
1098 #: build/C/man3/fmemopen.3:188
1100 "Upon successful completion B<fmemopen>(), B<open_memstream>() and "
1101 "B<open_wmemstream>() return a I<FILE> pointer. Otherwise, NULL is returned "
1102 "and I<errno> is set to indicate the error."
1106 #: build/C/man3/fmemopen.3:188 build/C/man3/fmtmsg.3:222 build/C/man3/getline.3:135 build/C/man2/pipe.2:113 build/C/man2/readv.2:209
1112 #: build/C/man3/fmemopen.3:195
1114 "B<fmemopen>() and B<open_memstream>() were already available in glibc "
1115 "1.0.x. B<open_wmemstream>() is available since glibc 2.4."
1119 #: build/C/man3/fmemopen.3:199
1121 "POSIX.1-2008. These functions are not specified in POSIX.1-2001, and are "
1122 "not widely available on other systems."
1125 #. http://austingroupbugs.net/view.php?id=396
1127 #: build/C/man3/fmemopen.3:207
1129 "POSIX.1-2008 specifies that \\(aqb\\(aq in I<mode> shall be ignored. "
1130 "However, Technical Corrigendum 1 adjusts the standard to allow "
1131 "implementation-specific treatment for this case, thus permitting the glibc "
1132 "treatment of \\(aqb\\(aq."
1136 #: build/C/man3/fmemopen.3:213
1138 "There is no file descriptor associated with the file stream returned by "
1139 "these functions (i.e., B<fileno>(3) will return an error if called on the "
1143 #. http://sourceware.org/bugzilla/show_bug.cgi?id=1996
1145 #: build/C/man3/fmemopen.3:220
1147 "In glibc before version 2.7, seeking past the end of a stream created by "
1148 "B<open_memstream>() does not enlarge the buffer; instead the B<fseek>(3) "
1149 "call fails, returning -1."
1152 #. FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=11216
1154 #: build/C/man3/fmemopen.3:231
1156 "If I<size> is specified as zero, B<fmemopen>() fails with the error "
1157 "B<EINVAL>. It would be more consistent if this case successfully created a "
1158 "stream that then returned end of file on the first attempt at reading. "
1159 "Furthermore, POSIX.1-2008 does not specify a failure for this case."
1162 #. FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=13152
1164 #: build/C/man3/fmemopen.3:239
1166 "Specifying append mode (\"a\" or \"a+\") for B<fmemopen>() sets the initial "
1167 "file position to the first null byte, but (if the file offset is reset to a "
1168 "location other than the end of the stream) does not force subsequent writes "
1169 "to append at the end of the stream."
1172 #. FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=13151
1174 #: build/C/man3/fmemopen.3:255
1176 "If the I<mode> argument to B<fmemopen>() specifies append (\"a\" or "
1177 "\"a+\"), and the I<size> argument does not cover a null byte in I<buf> then, "
1178 "according to POSIX.1-2008, the initial file position should be set to the "
1179 "next byte after the end of the buffer. However, in this case the glibc "
1180 "B<fmemopen>() sets the file position to -1."
1183 #. FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=12836
1185 #: build/C/man3/fmemopen.3:268
1187 "To specify binary mode for B<fmemopen>() the \\(aqb\\(aq must be the "
1188 "I<second> character in I<mode>. Thus, for example, \"wb+\" has the desired "
1189 "effect, but \"w+b\" does not. This is inconsistent with the treatment of "
1190 "I<mode> by B<fopen>(3)."
1193 #. http://sourceware.org/bugzilla/show_bug.cgi?id=6544
1195 #: build/C/man3/fmemopen.3:276
1197 "The glibc 2.9 addition of \"binary\" mode for B<fmemopen>() silently "
1198 "changed the ABI: previously, B<fmemopen>() ignored \\(aqb\\(aq in I<mode>."
1202 #: build/C/man3/fmemopen.3:276 build/C/man3/fmtmsg.3:256 build/C/man3/fopencookie.3:247 build/C/man3/getline.3:144 build/C/man2/pipe.2:124 build/C/man3/printf.3:974 build/C/man2/readlink.2:157 build/C/man2/readv.2:265 build/C/man3/scanf.3:681
1208 #: build/C/man3/fmemopen.3:286
1210 "The program below uses B<fmemopen>() to open an input buffer, and "
1211 "B<open_memstream>() to open a dynamically sized output buffer. The program "
1212 "scans its input string (taken from the program's first command-line "
1213 "argument) reading integers, and writes the squares of these integers to the "
1214 "output buffer. An example of the output produced by this program is the "
1219 #: build/C/man3/fmemopen.3:291
1222 "$B< ./a.out \\(aq1 23 43\\(aq>\n"
1223 "size=11; ptr=1 529 1849\n"
1227 #: build/C/man3/fmemopen.3:293 build/C/man3/fopencookie.3:271
1229 msgid "Program source"
1233 #: build/C/man3/fmemopen.3:300
1236 "#define _GNU_SOURCE\n"
1237 "#include E<lt>string.hE<gt>\n"
1238 "#include E<lt>stdio.hE<gt>\n"
1239 "#include E<lt>stdlib.hE<gt>\n"
1243 #: build/C/man3/fmemopen.3:303
1246 "#define handle_error(msg) \\e\n"
1247 " do { perror(msg); exit(EXIT_FAILURE); } while (0)\n"
1251 #: build/C/man3/fmemopen.3:311
1255 "main(int argc, char *argv[])\n"
1257 " FILE *out, *in;\n"
1264 #: build/C/man3/fmemopen.3:316
1267 " if (argc != 2) {\n"
1268 "\tfprintf(stderr, \"Usage: %s E<lt>fileE<gt>\\en\", argv[0]);\n"
1269 "\texit(EXIT_FAILURE);\n"
1274 #: build/C/man3/fmemopen.3:320
1277 " in = fmemopen(argv[1], strlen(argv[1]), \"r\");\n"
1278 " if (in == NULL)\n"
1279 " handle_error(\"fmemopen\");\n"
1283 #: build/C/man3/fmemopen.3:324
1286 " out = open_memstream(&ptr, &size);\n"
1287 " if (out == NULL)\n"
1288 " handle_error(\"open_memstream\");\n"
1292 #: build/C/man3/fmemopen.3:329
1296 " s = fscanf(in, \"%d\", &v);\n"
1297 " if (s E<lt>= 0)\n"
1302 #: build/C/man3/fmemopen.3:340
1305 " s = fprintf(out, \"%d \", v * v);\n"
1307 " handle_error(\"fprintf\");\n"
1311 " printf(\"size=%ld; ptr=%s\\en\", (long) size, ptr);\n"
1313 " exit(EXIT_SUCCESS);\n"
1318 #: build/C/man3/fmemopen.3:344
1319 msgid "B<fopen>(3), B<fopencookie>(3)"
1323 #: build/C/man3/fmtmsg.3:13
1329 #: build/C/man3/fmtmsg.3:16
1330 msgid "fmtmsg - print formatted error messages"
1334 #: build/C/man3/fmtmsg.3:19
1336 msgid "B<#include E<lt>fmtmsg.hE<gt>>\n"
1340 #: build/C/man3/fmtmsg.3:21
1342 msgid "B<int fmtmsg(long >I<classification>B<, const char *>I<label>B<,>\n"
1346 #: build/C/man3/fmtmsg.3:23
1348 msgid "B< int >I<severity>B<, const char *>I<text>B<,>\n"
1352 #: build/C/man3/fmtmsg.3:25
1354 msgid "B< const char *>I<action>B<, const char *>I<tag>B<);>\n"
1358 #: build/C/man3/fmtmsg.3:36
1360 "This function displays a message described by its arguments on the device(s) "
1361 "specified in the I<classification> argument. For messages written to "
1362 "I<stderr>, the format depends on the B<MSGVERB> environment variable."
1366 #: build/C/man3/fmtmsg.3:43
1368 "The I<label> argument identifies the source of the message. The string must "
1369 "consist of two colon separated parts where the first part has not more than "
1370 "10 and the second part not more than 14 characters."
1374 #: build/C/man3/fmtmsg.3:47
1375 msgid "The I<text> argument describes the condition of the error."
1379 #: build/C/man3/fmtmsg.3:52
1381 "The I<action> argument describes possible steps to recover from the error. "
1382 "If it is printed, it is prefixed by \"TO FIX: \"."
1386 #: build/C/man3/fmtmsg.3:60
1388 "The I<tag> argument is a reference to the online documentation where more "
1389 "information can be found. It should contain the I<label> value and a unique "
1390 "identification number."
1394 #: build/C/man3/fmtmsg.3:60
1396 msgid "Dummy arguments"
1400 #: build/C/man3/fmtmsg.3:79
1402 "Each of the arguments can have a dummy value. The dummy classification "
1403 "value B<MM_NULLMC> (0L) does not specify any output, so nothing is printed. "
1404 "The dummy severity value B<NO_SEV> (0) says that no severity is supplied. "
1405 "The values B<MM_NULLLBL>, B<MM_NULLTXT>, B<MM_NULLACT>, B<MM_NULLTAG> are "
1406 "synonyms for I<((char\\ *)\\ 0)>, the empty string, and B<MM_NULLSEV> is a "
1407 "synonym for B<NO_SEV>."
1411 #: build/C/man3/fmtmsg.3:79
1413 msgid "The classification argument"
1417 #: build/C/man3/fmtmsg.3:83
1419 "The I<classification> argument is the sum of values describing 4 types of "
1424 #: build/C/man3/fmtmsg.3:86
1425 msgid "The first value defines the output channel."
1429 #: build/C/man3/fmtmsg.3:86
1435 #: build/C/man3/fmtmsg.3:90
1436 msgid "Output to I<stderr>."
1440 #: build/C/man3/fmtmsg.3:90
1442 msgid "B<MM_CONSOLE>"
1446 #: build/C/man3/fmtmsg.3:93
1447 msgid "Output to the system console."
1451 #: build/C/man3/fmtmsg.3:93
1453 msgid "B<MM_PRINT | MM_CONSOLE>"
1457 #: build/C/man3/fmtmsg.3:96
1458 msgid "Output to both."
1462 #: build/C/man3/fmtmsg.3:98
1463 msgid "The second value is the source of the error:"
1467 #: build/C/man3/fmtmsg.3:98
1473 #: build/C/man3/fmtmsg.3:101
1474 msgid "A hardware error occurred."
1478 #: build/C/man3/fmtmsg.3:101
1484 #: build/C/man3/fmtmsg.3:104
1485 msgid "A firmware error occurred."
1489 #: build/C/man3/fmtmsg.3:104
1495 #: build/C/man3/fmtmsg.3:107
1496 msgid "A software error occurred."
1500 #: build/C/man3/fmtmsg.3:109
1501 msgid "The third value encodes the detector of the problem:"
1505 #: build/C/man3/fmtmsg.3:109
1511 #: build/C/man3/fmtmsg.3:112
1512 msgid "It is detected by an application."
1516 #: build/C/man3/fmtmsg.3:112
1522 #: build/C/man3/fmtmsg.3:115
1523 msgid "It is detected by a utility."
1527 #: build/C/man3/fmtmsg.3:115
1533 #: build/C/man3/fmtmsg.3:118
1534 msgid "It is detected by the operating system."
1538 #: build/C/man3/fmtmsg.3:120
1539 msgid "The fourth value shows the severity of the incident:"
1543 #: build/C/man3/fmtmsg.3:120
1545 msgid "B<MM_RECOVER>"
1549 #: build/C/man3/fmtmsg.3:123
1550 msgid "It is a recoverable error."
1554 #: build/C/man3/fmtmsg.3:123
1556 msgid "B<MM_NRECOV>"
1560 #: build/C/man3/fmtmsg.3:126
1561 msgid "It is a nonrecoverable error."
1565 #: build/C/man3/fmtmsg.3:126
1567 msgid "The severity argument"
1571 #: build/C/man3/fmtmsg.3:130
1572 msgid "The I<severity> argument can take one of the following values:"
1576 #: build/C/man3/fmtmsg.3:130
1582 #: build/C/man3/fmtmsg.3:133
1583 msgid "No severity is printed."
1587 #: build/C/man3/fmtmsg.3:133
1593 #: build/C/man3/fmtmsg.3:136
1594 msgid "This value is printed as HALT."
1598 #: build/C/man3/fmtmsg.3:136
1604 #: build/C/man3/fmtmsg.3:139
1605 msgid "This value is printed as ERROR."
1609 #: build/C/man3/fmtmsg.3:139
1611 msgid "B<MM_WARNING>"
1615 #: build/C/man3/fmtmsg.3:142
1616 msgid "This value is printed as WARNING."
1620 #: build/C/man3/fmtmsg.3:142
1626 #: build/C/man3/fmtmsg.3:145
1627 msgid "This value is printed as INFO."
1631 #: build/C/man3/fmtmsg.3:152
1633 "The numeric values are between 0 and 4. Using B<addseverity>(3) or the "
1634 "environment variable B<SEV_LEVEL> you can add more levels and strings to "
1639 #: build/C/man3/fmtmsg.3:154
1640 msgid "The function can return 4 values:"
1644 #: build/C/man3/fmtmsg.3:154
1650 #: build/C/man3/fmtmsg.3:157
1651 msgid "Everything went smooth."
1655 #: build/C/man3/fmtmsg.3:157
1661 #: build/C/man3/fmtmsg.3:160
1662 msgid "Complete failure."
1666 #: build/C/man3/fmtmsg.3:160
1672 #: build/C/man3/fmtmsg.3:164
1673 msgid "Error writing to I<stderr>."
1677 #: build/C/man3/fmtmsg.3:164
1683 #: build/C/man3/fmtmsg.3:167
1684 msgid "Error writing to the console."
1688 #: build/C/man3/fmtmsg.3:167
1694 #: build/C/man3/fmtmsg.3:178
1696 "The environment variable B<MSGVERB> (\"message verbosity\") can be used to "
1697 "suppress parts of the output to I<stderr>. (It does not influence output to "
1698 "the console.) When this variable is defined, is non-NULL, and is a "
1699 "colon-separated list of valid keywords, then only the parts of the message "
1700 "corresponding to these keywords is printed. Valid keywords are \"label\", "
1701 "\"severity\", \"text\", \"action\" and \"tag\"."
1705 #: build/C/man3/fmtmsg.3:190
1707 "The environment variable B<SEV_LEVEL> can be used to introduce new severity "
1708 "levels. By default, only the five severity levels described above are "
1709 "available. Any other numeric value would make B<fmtmsg>() print nothing. "
1710 "If the user puts B<SEV_LEVEL> with a format like"
1714 #: build/C/man3/fmtmsg.3:193
1715 msgid "SEV_LEVEL=[description[:description[:...]]]"
1719 #: build/C/man3/fmtmsg.3:198
1721 "in the environment of the process before the first call to B<fmtmsg>(), "
1722 "where each description is of the form"
1726 #: build/C/man3/fmtmsg.3:201
1727 msgid "severity-keyword,level,printstring"
1731 #: build/C/man3/fmtmsg.3:208
1733 "then B<fmtmsg>() will also accept the indicated values for the level (in "
1734 "addition to the standard levels 0-4), and use the indicated printstring when "
1735 "such a level occurs."
1739 #: build/C/man3/fmtmsg.3:222
1741 "The severity-keyword part is not used by B<fmtmsg>() but it has to be "
1742 "present. The level part is a string representation of a number. The "
1743 "numeric value must be a number greater than 4. This value must be used in "
1744 "the severity argument of B<fmtmsg>() to select this class. It is not "
1745 "possible to overwrite any of the predefined classes. The printstring is the "
1746 "string printed when a message of this class is processed by B<fmtmsg>()."
1750 #: build/C/man3/fmtmsg.3:225
1751 msgid "B<fmtmsg>() is provided in glibc since version 2.1."
1755 #: build/C/man3/fmtmsg.3:231
1757 "Before glibc 2.16, the B<fmtmsg>() function uses a static variable that is "
1758 "not protected, so it is not thread-safe."
1761 #. Modified in commit 7724defcf8873116fe4efab256596861eef21a94
1763 #: build/C/man3/fmtmsg.3:237
1765 "Since glibc 2.16, the B<fmtmsg>() function uses a lock to protect the "
1766 "static variable, so it is thread-safe."
1770 #: build/C/man3/fmtmsg.3:252
1772 "The functions B<fmtmsg>() and B<addseverity>(3), and environment variables "
1773 "B<MSGVERB> and B<SEV_LEVEL> come from System V. The function B<fmtmsg>() "
1774 "and the environment variable B<MSGVERB> are described in POSIX.1-2001."
1778 #: build/C/man3/fmtmsg.3:256
1780 "System V and UnixWare man pages tell us that these functions have been "
1781 "replaced by \"pfmt() and addsev()\" or by \"pfmt(), vpfmt(), lfmt(), and "
1782 "vlfmt()\", and will be removed later."
1786 #: build/C/man3/fmtmsg.3:261
1789 "#include E<lt>stdio.hE<gt>\n"
1790 "#include E<lt>stdlib.hE<gt>\n"
1791 "#include E<lt>fmtmsg.hE<gt>\n"
1795 #: build/C/man3/fmtmsg.3:267
1801 " long class = MM_PRINT | MM_SOFT | MM_OPSYS | MM_RECOVER;\n"
1806 #: build/C/man3/fmtmsg.3:288
1809 " err = fmtmsg(class, \"util-linux:mount\", MM_ERROR,\n"
1810 " \"unknown mount option\", \"See mount(8).\",\n"
1811 " \"util-linux:mount:017\");\n"
1816 " printf(\"Nothing printed\\en\");\n"
1819 " printf(\"Nothing printed to stderr\\en\");\n"
1822 " printf(\"No console output\\en\");\n"
1825 " printf(\"Unknown error from fmtmsg()\\en\");\n"
1827 " exit(EXIT_SUCCESS);\n"
1832 #: build/C/man3/fmtmsg.3:291
1833 msgid "The output should be:"
1837 #: build/C/man3/fmtmsg.3:295
1840 " util-linux:mount: ERROR: unknown mount option\n"
1841 " TO FIX: See mount(8). util-linux:mount:017\n"
1845 #: build/C/man3/fmtmsg.3:298
1850 #: build/C/man3/fmtmsg.3:301
1852 msgid " MSGVERB=text:action; export MSGVERB\n"
1856 #: build/C/man3/fmtmsg.3:304
1857 msgid "the output becomes:"
1861 #: build/C/man3/fmtmsg.3:308
1864 " unknown mount option\n"
1865 " TO FIX: See mount(8).\n"
1869 #: build/C/man3/fmtmsg.3:312
1870 msgid "B<addseverity>(3), B<perror>(3)"
1874 #: build/C/man3/fopen.3:44
1880 #: build/C/man3/fopen.3:44
1886 #: build/C/man3/fopen.3:47
1887 msgid "fopen, fdopen, freopen - stream open functions"
1891 #: build/C/man3/fopen.3:52
1893 msgid "B<FILE *fopen(const char *>I<path>B<, const char *>I<mode>B<);>\n"
1897 #: build/C/man3/fopen.3:54
1899 msgid "B<FILE *fdopen(int >I<fd>B<, const char *>I<mode>B<);>\n"
1903 #: build/C/man3/fopen.3:56
1906 "B<FILE *freopen(const char *>I<path>B<, const char *>I<mode>B<, FILE "
1907 "*>I<stream>B<);>\n"
1911 #: build/C/man3/fopen.3:65
1912 msgid "B<fdopen>(): _POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE"
1916 #: build/C/man3/fopen.3:71
1918 "The B<fopen>() function opens the file whose name is the string pointed to "
1919 "by I<path> and associates a stream with it."
1923 #: build/C/man3/fopen.3:76
1925 "The argument I<mode> points to a string beginning with one of the following "
1926 "sequences (possibly followed by additional characters, as described below):"
1930 #: build/C/man3/fopen.3:76
1936 #: build/C/man3/fopen.3:80
1938 "Open text file for reading. The stream is positioned at the beginning of "
1943 #: build/C/man3/fopen.3:80
1949 #: build/C/man3/fopen.3:84
1951 "Open for reading and writing. The stream is positioned at the beginning of "
1956 #: build/C/man3/fopen.3:84
1962 #: build/C/man3/fopen.3:88
1964 "Truncate file to zero length or create text file for writing. The stream is "
1965 "positioned at the beginning of the file."
1969 #: build/C/man3/fopen.3:88
1975 #: build/C/man3/fopen.3:94
1977 "Open for reading and writing. The file is created if it does not exist, "
1978 "otherwise it is truncated. The stream is positioned at the beginning of the "
1983 #: build/C/man3/fopen.3:94 build/C/man3/scanf.3:447
1989 #: build/C/man3/fopen.3:99
1991 "Open for appending (writing at end of file). The file is created if it does "
1992 "not exist. The stream is positioned at the end of the file."
1996 #: build/C/man3/fopen.3:99
2002 #: build/C/man3/fopen.3:105
2004 "Open for reading and appending (writing at end of file). The file is "
2005 "created if it does not exist. The initial file position for reading is at "
2006 "the beginning of the file, but output is always appended to the end of the "
2011 #: build/C/man3/fopen.3:118
2013 "The I<mode> string can also include the letter \\(aqb\\(aq either as a last "
2014 "character or as a character between the characters in any of the "
2015 "two-character strings described above. This is strictly for compatibility "
2016 "with C89 and has no effect; the \\(aqb\\(aq is ignored on all POSIX "
2017 "conforming systems, including Linux. (Other systems may treat text files "
2018 "and binary files differently, and adding the \\(aqb\\(aq may be a good idea "
2019 "if you do I/O to a binary file and expect that your program may be ported to "
2020 "non-UNIX environments.)"
2024 #: build/C/man3/fopen.3:121
2025 msgid "See NOTES below for details of glibc extensions for I<mode>."
2029 #: build/C/man3/fopen.3:126
2031 "Any created files will have mode B<S_IRUSR> | B<S_IWUSR> | B<S_IRGRP> | "
2032 "B<S_IWGRP> | B<S_IROTH> | B<S_IWOTH> (0666), as modified by the process's "
2033 "umask value (see B<umask>(2))."
2037 #: build/C/man3/fopen.3:141
2039 "Reads and writes may be intermixed on read/write streams in any order. Note "
2040 "that ANSI C requires that a file positioning function intervene between "
2041 "output and input, unless an input operation encounters end-of-file. (If "
2042 "this condition is not met, then a read is allowed to return the result of "
2043 "writes other than the most recent.) Therefore it is good practice (and "
2044 "indeed sometimes necessary under Linux) to put an B<fseek>(3) or "
2045 "B<fgetpos>(3) operation between write and read operations on such a "
2046 "stream. This operation may be an apparent no-op (as in I<fseek(..., 0L, "
2047 "SEEK_CUR)> called for its synchronizing side effect."
2051 #: build/C/man3/fopen.3:146
2053 "Opening a file in append mode (B<a> as the first character of I<mode>) "
2054 "causes all subsequent write operations to this stream to occur at "
2055 "end-of-file, as if preceded the call:"
2059 #: build/C/man3/fopen.3:149
2061 msgid " fseek(stream, 0, SEEK_END);\n"
2065 #: build/C/man3/fopen.3:171
2067 "The B<fdopen>() function associates a stream with the existing file "
2068 "descriptor, I<fd>. The I<mode> of the stream (one of the values \"r\", "
2069 "\"r+\", \"w\", \"w+\", \"a\", \"a+\") must be compatible with the mode of "
2070 "the file descriptor. The file position indicator of the new stream is set "
2071 "to that belonging to I<fd>, and the error and end-of-file indicators are "
2072 "cleared. Modes \"w\" or \"w+\" do not cause truncation of the file. The "
2073 "file descriptor is not dup'ed, and will be closed when the stream created by "
2074 "B<fdopen>() is closed. The result of applying B<fdopen>() to a shared "
2075 "memory object is undefined."
2079 #: build/C/man3/fopen.3:189
2081 "The B<freopen>() function opens the file whose name is the string pointed "
2082 "to by I<path> and associates the stream pointed to by I<stream> with it. "
2083 "The original stream (if it exists) is closed. The I<mode> argument is used "
2084 "just as in the B<fopen>() function. The primary use of the B<freopen>() "
2085 "function is to change the file associated with a standard text stream "
2086 "(I<stderr>, I<stdin>, or I<stdout>)."
2090 #: build/C/man3/fopen.3:201
2092 "Upon successful completion B<fopen>(), B<fdopen>() and B<freopen>() return "
2093 "a I<FILE> pointer. Otherwise, NULL is returned and I<errno> is set to "
2094 "indicate the error."
2098 #: build/C/man3/fopen.3:202 build/C/man3/fseek.3:142 build/C/man3/getline.3:126 build/C/man2/llseek.2:77 build/C/man2/lseek.2:175 build/C/man2/open.2:613 build/C/man2/pipe.2:102 build/C/man2/read.2:126 build/C/man2/read.2:137 build/C/man2/readlink.2:95 build/C/man2/readlink.2:104 build/C/man2/readv.2:200 build/C/man2/rename.2:139 build/C/man2/rmdir.2:67 build/C/man3/scanf.3:565 build/C/man2/write.2:154
2104 #: build/C/man3/fopen.3:212
2106 "The I<mode> provided to B<fopen>(), B<fdopen>(), or B<freopen>() was "
2111 #: build/C/man3/fopen.3:222
2113 "The B<fopen>(), B<fdopen>() and B<freopen>() functions may also fail and "
2114 "set I<errno> for any of the errors specified for the routine B<malloc>(3)."
2118 #: build/C/man3/fopen.3:229
2120 "The B<fopen>() function may also fail and set I<errno> for any of the "
2121 "errors specified for the routine B<open>(2)."
2125 #: build/C/man3/fopen.3:236
2127 "The B<fdopen>() function may also fail and set I<errno> for any of the "
2128 "errors specified for the routine B<fcntl>(2)."
2132 #: build/C/man3/fopen.3:246
2134 "The B<freopen>() function may also fail and set I<errno> for any of the "
2135 "errors specified for the routines B<open>(2), B<fclose>(3) and "
2140 #: build/C/man3/fopen.3:255
2142 "The B<fopen>() and B<freopen>() functions conform to C89. The B<fdopen>() "
2143 "function conforms to POSIX.1-1990."
2147 #: build/C/man3/fopen.3:256
2153 #: build/C/man3/fopen.3:259
2155 "The GNU C library allows the following extensions for the string specified "
2160 #: build/C/man3/fopen.3:259
2162 msgid "B<c> (since glibc 2.3.3)"
2166 #: build/C/man3/fopen.3:266
2168 "Do not make the open operation, or subsequent read and write operations, "
2169 "thread cancellation points. This flag is ignored for B<fdopen>()."
2173 #: build/C/man3/fopen.3:266
2175 msgid "B<e> (since glibc 2.7)"
2179 #: build/C/man3/fopen.3:276
2181 "Open the file with the B<O_CLOEXEC> flag. See B<open>(2) for more "
2182 "information. This flag is ignored for B<fdopen>()."
2186 #: build/C/man3/fopen.3:276
2188 msgid "B<m> (since glibc 2.3)"
2193 #: build/C/man3/fopen.3:288
2195 "Attempt to access the file using B<mmap>(2), rather than I/O system calls "
2196 "(B<read>(2), B<write>(2)). Currently, use of B<mmap>(2) is attempted only "
2197 "for a file opened for reading."
2201 #: build/C/man3/fopen.3:288 build/C/man3/scanf.3:421
2207 #. FIXME C11 specifies this flag
2209 #: build/C/man3/fopen.3:305
2211 "Open the file exclusively (like the B<O_EXCL> flag of B<open>(2)). If the "
2212 "file already exists, B<fopen>() fails, and sets I<errno> to B<EEXIST>. "
2213 "This flag is ignored for B<fdopen>()."
2217 #: build/C/man3/fopen.3:313
2219 "In addition to the above characters, B<fopen>() and B<freopen>() support "
2220 "the following syntax in I<mode>:"
2224 #: build/C/man3/fopen.3:315
2225 msgid "B< ,ccs=>I<string>"
2229 #: build/C/man3/fopen.3:331
2231 "The given I<string> is taken as the name of a coded character set and the "
2232 "stream is marked as wide-oriented. Thereafter, internal conversion "
2233 "functions convert I/O to and from the character set I<string>. If the "
2234 "B<,ccs=>I<string> syntax is not specified, then the wide-orientation of the "
2235 "stream is determined by the first file operation. If that operation is a "
2236 "wide-character operation, the stream is marked wide-oriented, and functions "
2237 "to convert to the coded character set are loaded."
2240 #. FIXME http://sourceware.org/bugzilla/show_bug.cgi?id=12685
2242 #: build/C/man3/fopen.3:348
2244 "When parsing for individual flag characters in I<mode> (i.e., the characters "
2245 "preceding the \"ccs\" specification), the glibc implementation of B<fopen>() "
2246 "and B<freopen>() limits the number of characters examined in I<mode> to 7 "
2247 "(or, in glibc versions before 2.14, to 6, which was not enough to include "
2248 "possible specifications such as \"rb+cmxe\"). The current implementation of "
2249 "B<fdopen>() parses at most 5 characters in I<mode>."
2253 #: build/C/man3/fopen.3:354
2254 msgid "B<open>(2), B<fclose>(3), B<fileno>(3), B<fmemopen>(3), B<fopencookie>(3)"
2258 #: build/C/man3/fopencookie.3:26
2264 #: build/C/man3/fopencookie.3:26
2270 #: build/C/man3/fopencookie.3:26 build/C/man2/link.2:31 build/C/man2/llseek.2:28 build/C/man2/lseek.2:47 build/C/man3/lseek64.3:25 build/C/man2/open.2:51 build/C/man2/pipe.2:36 build/C/man2/read.2:35 build/C/man2/readlink.2:43 build/C/man2/readv.2:32 build/C/man2/rename.2:32 build/C/man2/rmdir.2:30 build/C/man3/setbuf.3:48 build/C/man3/stdin.3:13 build/C/man2/symlink.2:32 build/C/man7/symlink.7:36 build/C/man2/unlink.2:32 build/C/man2/write.2:39
2276 #: build/C/man3/fopencookie.3:29
2277 msgid "fopencookie - opening a custom stream"
2281 #: build/C/man3/fopencookie.3:36
2284 "B<FILE *fopencookie(void *>I<cookie>B<, const char *>I<mode>B<,>\n"
2285 "B< cookie_io_functions_t >I<io_funcs>B<);>\n"
2289 #: build/C/man3/fopencookie.3:49
2291 "The B<fopencookie>() function allows the programmer to create a custom "
2292 "implementation for a standard I/O stream. This implementation can store the "
2293 "stream's data at a location of its own choosing; for example, "
2294 "B<fopencookie>() is used to implement B<fmemopen>(3), which provides a "
2295 "stream interface to data that is stored in a buffer in memory."
2299 #: build/C/man3/fopencookie.3:51
2300 msgid "In order to create a custom stream the programmer must:"
2304 #: build/C/man3/fopencookie.3:51 build/C/man3/fopencookie.3:54 build/C/man3/fopencookie.3:65 build/C/man2/open.2:470 build/C/man2/open.2:478 build/C/man2/open.2:484 build/C/man2/open.2:490 build/C/man2/open.2:497 build/C/man2/open.2:503 build/C/man3/scanf.3:633 build/C/man3/scanf.3:638 build/C/man3/scanf.3:644 build/C/man7/symlink.7:249 build/C/man7/symlink.7:259 build/C/man7/symlink.7:289 build/C/man7/symlink.7:349 build/C/man7/symlink.7:378 build/C/man7/symlink.7:407 build/C/man7/symlink.7:438 build/C/man7/symlink.7:451
2310 #: build/C/man3/fopencookie.3:54
2312 "Implement four \"hook\" functions that are used internally by the standard "
2313 "I/O library when performing I/O on the stream."
2317 #: build/C/man3/fopencookie.3:65
2319 "Define a \"cookie\" data type, a structure that provides bookkeeping "
2320 "information (e.g., where to store data) used by the aforementioned hook "
2321 "functions. The standard I/O package knows nothing about the contents of "
2322 "this cookie (thus it is typed as I<void\\ *> when passed to "
2323 "B<fopencookie>()), but automatically supplies the cookie as the first "
2324 "argument when calling the hook functions."
2328 #: build/C/man3/fopencookie.3:70
2330 "Call B<fopencookie>() to open a new stream and associate the cookie and "
2331 "hook functions with that stream."
2335 #: build/C/man3/fopencookie.3:78
2337 "The B<fopencookie>() function serves a purpose similar to B<fopen>(3): it "
2338 "opens a new stream and returns a pointer to a I<FILE> object that is used to "
2339 "operate on that stream."
2343 #: build/C/man3/fopencookie.3:85
2345 "The I<cookie> argument is a pointer to the caller's cookie structure that is "
2346 "to be associated with the new stream. This pointer is supplied as the first "
2347 "argument when the standard I/O library invokes any of the hook functions "
2352 #: build/C/man3/fopencookie.3:101
2354 "The I<mode> argument serves the same purpose as for B<fopen>(3). The "
2355 "following modes are supported: I<r>, I<w>, I<a>, I<r+>, I<w+>, and I<a+>. "
2356 "See B<fopen>(3) for details."
2360 #: build/C/man3/fopencookie.3:107
2362 "The I<io_funcs> argument is a structure that contains four fields pointing "
2363 "to the programmer-defined hook functions that are used to implement this "
2364 "stream. The structure is defined as follows"
2368 #: build/C/man3/fopencookie.3:116
2371 "typedef struct {\n"
2372 " cookie_read_function_t *read;\n"
2373 " cookie_write_function_t *write;\n"
2374 " cookie_seek_function_t *seek;\n"
2375 " cookie_close_function_t *close;\n"
2376 "} cookie_io_functions_t;\n"
2380 #: build/C/man3/fopencookie.3:120
2381 msgid "The four fields are as follows:"
2385 #: build/C/man3/fopencookie.3:120
2387 msgid "I<cookie_read_function_t *read>"
2391 #: build/C/man3/fopencookie.3:124
2393 "This function implements read operations for the stream. When called, it "
2394 "receives three arguments:"
2398 #: build/C/man3/fopencookie.3:126
2400 msgid " ssize_t read(void *cookie, char *buf, size_t size);\n"
2404 #: build/C/man3/fopencookie.3:141
2406 "The I<buf> and I<size> arguments are, respectively, a buffer into which "
2407 "input data can be placed and the size of that buffer. As its function "
2408 "result, the I<read> function should return the number of bytes copied into "
2409 "I<buf>, 0 on end of file, or -1 on error. The I<read> function should "
2410 "update the stream offset appropriately."
2414 #: build/C/man3/fopencookie.3:146
2416 "If I<*read> is a NULL pointer, then reads from the custom stream always "
2417 "return end of file."
2421 #: build/C/man3/fopencookie.3:146
2423 msgid "I<cookie_write_function_t *write>"
2427 #: build/C/man3/fopencookie.3:150
2429 "This function implements write operations for the stream. When called, it "
2430 "receives three arguments:"
2434 #: build/C/man3/fopencookie.3:152
2436 msgid " ssize_t write(void *cookie, const char *buf, size_t size);\n"
2440 #: build/C/man3/fopencookie.3:168
2442 "The I<buf> and I<size> arguments are, respectively, a buffer of data to be "
2443 "output to the stream and the size of that buffer. As its function result, "
2444 "the I<write> function should return the number of bytes copied from I<buf>, "
2445 "or 0 on error. (The function must not return a negative value.) The "
2446 "I<write> function should update the stream offset appropriately."
2450 #: build/C/man3/fopencookie.3:173
2451 msgid "If I<*write> is a NULL pointer, then output to the stream is discarded."
2455 #: build/C/man3/fopencookie.3:173
2457 msgid "I<cookie_seek_function_t *seek>"
2461 #: build/C/man3/fopencookie.3:177
2463 "This function implements seek operations on the stream. When called, it "
2464 "receives three arguments:"
2468 #: build/C/man3/fopencookie.3:179
2470 msgid " int seek(void *cookie, off64_t *offset, int whence);\n"
2474 #: build/C/man3/fopencookie.3:185
2476 "The I<*offset> argument specifies the new file offset depending on which of "
2477 "the following three values is supplied in I<whence>:"
2481 #: build/C/man3/fopencookie.3:186 build/C/man2/lseek.2:67
2487 #: build/C/man3/fopencookie.3:191
2489 "The stream offset should be set I<*offset> bytes from the start of the "
2494 #: build/C/man3/fopencookie.3:191 build/C/man2/lseek.2:72
2500 #: build/C/man3/fopencookie.3:195
2501 msgid "I<*offset> should be added to the current stream offset."
2505 #: build/C/man3/fopencookie.3:195 build/C/man2/lseek.2:77
2511 #: build/C/man3/fopencookie.3:199
2512 msgid "The stream offset should be set to the size of the stream plus I<*offset>."
2516 #: build/C/man3/fopencookie.3:206
2518 "Before returning, the I<seek> function should update I<*offset> to indicate "
2519 "the new stream offset."
2523 #: build/C/man3/fopencookie.3:210
2525 "As its function result, the I<seek> function should return 0 on success, and "
2530 #: build/C/man3/fopencookie.3:215
2532 "If I<*seek> is a NULL pointer, then it is not possible to perform seek "
2533 "operations on the stream."
2537 #: build/C/man3/fopencookie.3:215
2539 msgid "I<cookie_close_function_t *close>"
2543 #: build/C/man3/fopencookie.3:221
2545 "This function closes the stream. The hook function can do things such as "
2546 "freeing buffers allocated for the stream. When called, it receives one "
2551 #: build/C/man3/fopencookie.3:223
2553 msgid " int close(void *cookie);\n"
2557 #: build/C/man3/fopencookie.3:228
2559 "The I<cookie> argument is the cookie that the programmer supplied when "
2560 "calling B<fopencookie>()."
2564 #: build/C/man3/fopencookie.3:234
2566 "As its function result, the I<close> function should return 0 on success, "
2567 "and B<EOF> on error."
2571 #: build/C/man3/fopencookie.3:238
2573 "If I<*close> is NULL, then no special action is performed when the stream is "
2578 #. It's not clear if errno ever gets set...
2580 #: build/C/man3/fopencookie.3:245
2582 "On success B<fopencookie>() returns a pointer to the new stream. On error, "
2587 #: build/C/man3/fopencookie.3:247
2588 msgid "This function is a nonstandard GNU extension."
2592 #: build/C/man3/fopencookie.3:256
2594 "The program below implements a custom stream whose functionality is similar "
2595 "(but not identical) to that available via B<fmemopen>(3). It implements a "
2596 "stream whose data is stored in a memory buffer. The program writes its "
2597 "command-line arguments to the stream, and then seeks through the stream "
2598 "reading two out of every five characters and writing them to standard "
2599 "output. The following shell session demonstrates the use of the program:"
2603 #: build/C/man3/fopencookie.3:264
2606 "$B< ./a.out \\(aqhello world\\(aq>\n"
2610 "Reached end of file\n"
2614 #: build/C/man3/fopencookie.3:271
2616 "Note that a more general version of the program below could be improved to "
2617 "more robustly handle various error situations (e.g., opening a stream with a "
2618 "cookie that already has an open stream; closing a stream that has already "
2623 #: build/C/man3/fopencookie.3:280
2626 "#define _GNU_SOURCE\n"
2627 "#include E<lt>sys/types.hE<gt>\n"
2628 "#include E<lt>stdio.hE<gt>\n"
2629 "#include E<lt>stdlib.hE<gt>\n"
2630 "#include E<lt>unistd.hE<gt>\n"
2631 "#include E<lt>string.hE<gt>\n"
2635 #: build/C/man3/fopencookie.3:282
2637 msgid "#define INIT_BUF_SIZE 4\n"
2641 #: build/C/man3/fopencookie.3:289
2644 "struct memfile_cookie {\n"
2645 " char *buf; /* Dynamically sized buffer for data */\n"
2646 " size_t allocated; /* Size of buf */\n"
2647 " size_t endpos; /* Number of characters in buf */\n"
2648 " off_t offset; /* Current file offset in buf */\n"
2653 #: build/C/man3/fopencookie.3:295
2657 "memfile_write(void *c, const char *buf, size_t size)\n"
2659 " char *new_buff;\n"
2660 " struct memfile_cookie *cookie = c;\n"
2664 #: build/C/man3/fopencookie.3:297
2666 msgid " /* Buffer too small? Keep doubling size until big enough */\n"
2670 #: build/C/man3/fopencookie.3:307
2673 " while (size + cookie-E<gt>offset E<gt> cookie-E<gt>allocated) {\n"
2674 " new_buff = realloc(cookie-E<gt>buf, cookie-E<gt>allocated * 2);\n"
2675 " if (new_buff == NULL) {\n"
2678 " cookie-E<gt>allocated *= 2;\n"
2679 " cookie-E<gt>buf = new_buff;\n"
2685 #: build/C/man3/fopencookie.3:309
2687 msgid " memcpy(cookie-E<gt>buf + cookie-E<gt>offset, buf, size);\n"
2691 #: build/C/man3/fopencookie.3:313
2694 " cookie-E<gt>offset += size;\n"
2695 " if (cookie-E<gt>offset E<gt> cookie-E<gt>endpos)\n"
2696 " cookie-E<gt>endpos = cookie-E<gt>offset;\n"
2700 #: build/C/man3/fopencookie.3:316
2708 #: build/C/man3/fopencookie.3:322
2712 "memfile_read(void *c, char *buf, size_t size)\n"
2714 " ssize_t xbytes;\n"
2715 " struct memfile_cookie *cookie = c;\n"
2719 #: build/C/man3/fopencookie.3:324
2721 msgid " /* Fetch minimum of bytes requested and bytes available */\n"
2725 #: build/C/man3/fopencookie.3:330
2729 " if (cookie-E<gt>offset + size E<gt> cookie-E<gt>endpos)\n"
2730 " xbytes = cookie-E<gt>endpos - cookie-E<gt>offset;\n"
2731 " if (xbytes E<lt> 0) /* offset may be past endpos */\n"
2736 #: build/C/man3/fopencookie.3:332
2738 msgid " memcpy(buf, cookie-E<gt>buf + cookie-E<gt>offset, xbytes);\n"
2742 #: build/C/man3/fopencookie.3:336
2745 " cookie-E<gt>offset += xbytes;\n"
2751 #: build/C/man3/fopencookie.3:342
2755 "memfile_seek(void *c, off64_t *offset, int whence)\n"
2757 " off64_t new_offset;\n"
2758 " struct memfile_cookie *cookie = c;\n"
2762 #: build/C/man3/fopencookie.3:351
2765 " if (whence == SEEK_SET)\n"
2766 " new_offset = *offset;\n"
2767 " else if (whence == SEEK_END)\n"
2768 " new_offset = cookie-E<gt>endpos + *offset;\n"
2769 " else if (whence == SEEK_CUR)\n"
2770 " new_offset = cookie-E<gt>offset + *offset;\n"
2776 #: build/C/man3/fopencookie.3:354
2779 " if (new_offset E<lt> 0)\n"
2784 #: build/C/man3/fopencookie.3:359
2787 " cookie-E<gt>offset = new_offset;\n"
2788 " *offset = new_offset;\n"
2794 #: build/C/man3/fopencookie.3:364
2798 "memfile_close(void *c)\n"
2800 " struct memfile_cookie *cookie = c;\n"
2804 #: build/C/man3/fopencookie.3:368
2807 " free(cookie-E<gt>buf);\n"
2808 " cookie-E<gt>allocated = 0;\n"
2809 " cookie-E<gt>buf = NULL;\n"
2813 #: build/C/man3/fopencookie.3:371
2821 #: build/C/man3/fopencookie.3:387
2825 "main(int argc, char *argv[])\n"
2827 " cookie_io_functions_t memfile_func = {\n"
2828 " .read = memfile_read,\n"
2829 " .write = memfile_write,\n"
2830 " .seek = memfile_seek,\n"
2831 " .close = memfile_close\n"
2834 " struct memfile_cookie mycookie;\n"
2838 " char buf[1000];\n"
2842 #: build/C/man3/fopencookie.3:389
2844 msgid " /* Set up the cookie before calling fopencookie() */\n"
2848 #: build/C/man3/fopencookie.3:395
2851 " mycookie.buf = malloc(INIT_BUF_SIZE);\n"
2852 " if (mycookie.buf == NULL) {\n"
2853 " perror(\"malloc\");\n"
2854 " exit(EXIT_FAILURE);\n"
2859 #: build/C/man3/fopencookie.3:399
2862 " mycookie.allocated = INIT_BUF_SIZE;\n"
2863 " mycookie.offset = 0;\n"
2864 " mycookie.endpos = 0;\n"
2868 #: build/C/man3/fopencookie.3:405
2871 " fp = fopencookie(&mycookie,\"w+\", memfile_func);\n"
2872 " if (fp == NULL) {\n"
2873 " perror(\"fopencookie\");\n"
2874 " exit(EXIT_FAILURE);\n"
2879 #: build/C/man3/fopencookie.3:407
2881 msgid " /* Write command-line arguments to our file */\n"
2885 #: build/C/man3/fopencookie.3:413
2888 " for (j = 1; j E<lt> argc; j++)\n"
2889 " if (fputs(argv[j], fp) == EOF) {\n"
2890 " perror(\"fputs\");\n"
2891 " exit(EXIT_FAILURE);\n"
2896 #: build/C/man3/fopencookie.3:415
2898 msgid " /* Read two bytes out of every five, until EOF */\n"
2902 #: build/C/man3/fopencookie.3:430
2905 " for (p = 0; ; p += 5) {\n"
2906 " if (fseek(fp, p, SEEK_SET) == -1) {\n"
2907 " perror(\"fseek\");\n"
2908 " exit(EXIT_FAILURE);\n"
2910 " nread = fread(buf, 1, 2, fp);\n"
2911 " if (nread == -1) {\n"
2912 " perror(\"fread\");\n"
2913 " exit(EXIT_FAILURE);\n"
2915 " if (nread == 0) {\n"
2916 " printf(\"Reached end of file\\en\");\n"
2922 #: build/C/man3/fopencookie.3:433
2925 " printf(\"/%.*s/\\en\", nread, buf);\n"
2930 #: build/C/man3/fopencookie.3:436 build/C/man2/readlink.2:213
2933 " exit(EXIT_SUCCESS);\n"
2938 #: build/C/man3/fopencookie.3:442
2939 msgid "B<fclose>(3), B<fmemopen>(3), B<fopen>(3), B<fseek>(3)"
2943 #: build/C/man3/fpurge.3:25
2949 #: build/C/man3/fpurge.3:25
2955 #: build/C/man3/fpurge.3:28
2956 msgid "fpurge, __fpurge - purge a stream"
2960 #: build/C/man3/fpurge.3:32
2963 "/* unsupported */\n"
2964 "B<#include E<lt>stdio.hE<gt>>\n"
2968 #: build/C/man3/fpurge.3:34
2970 msgid "B<int fpurge(FILE *>I<stream>B<);>\n"
2974 #: build/C/man3/fpurge.3:37
2978 "B<#include E<lt>stdio.hE<gt>>\n"
2982 #: build/C/man3/fpurge.3:39
2984 msgid "B<#include E<lt>stdio_ext.hE<gt>>\n"
2988 #: build/C/man3/fpurge.3:41
2990 msgid "B<void __fpurge(FILE *>I<stream>B<);>\n"
2994 #: build/C/man3/fpurge.3:54
2996 "The function B<fpurge>() clears the buffers of the given stream. For "
2997 "output streams this discards any unwritten output. For input streams this "
2998 "discards any input read from the underlying object but not yet obtained via "
2999 "B<getc>(3); this includes any text pushed back via B<ungetc>(3). See also "
3004 #: build/C/man3/fpurge.3:58
3006 "The function B<__fpurge>() does precisely the same, but without returning a "
3011 #: build/C/man3/fpurge.3:65
3013 "Upon successful completion B<fpurge>() returns 0. On error, it returns -1 "
3014 "and sets I<errno> appropriately."
3018 #: build/C/man3/fpurge.3:70
3019 msgid "I<stream> is not an open stream."
3023 #: build/C/man3/fpurge.3:78
3025 "These functions are nonstandard and not portable. The function B<fpurge>() "
3026 "was introduced in 4.4BSD and is not available under Linux. The function "
3027 "B<__fpurge>() was introduced in Solaris, and is present in glibc 2.1.95 and "
3032 #: build/C/man3/fpurge.3:80
3033 msgid "Usually it is a mistake to want to discard input buffers."
3038 #: build/C/man3/fpurge.3:85
3039 msgid "B<fflush>(3), B<setbuf>(3), B<stdio_ext>(3)"
3043 #: build/C/man3/fputwc.3:16
3049 #: build/C/man3/fputwc.3:19
3050 msgid "fputwc, putwc - write a wide character to a FILE stream"
3054 #: build/C/man3/fputwc.3:27
3057 "B<wint_t fputwc(wchar_t >I<wc>B<, FILE *>I<stream>B<);>\n"
3058 "B<wint_t putwc(wchar_t >I<wc>B<, FILE *>I<stream>B<);>\n"
3062 #: build/C/man3/fputwc.3:43
3064 "The B<fputwc>() function is the wide-character equivalent of the "
3065 "B<fputc>(3) function. It writes the wide character I<wc> to I<stream>. If "
3066 "I<ferror(stream)> becomes true, it returns B<WEOF>. If a wide-character "
3067 "conversion error occurs, it sets I<errno> to B<EILSEQ> and returns B<WEOF>. "
3068 "Otherwise it returns I<wc>."
3072 #: build/C/man3/fputwc.3:51
3074 "The B<putwc>() function or macro functions identically to B<fputwc>(). It "
3075 "may be implemented as a macro, and may evaluate its argument more than "
3076 "once. There is no reason ever to use it."
3080 #: build/C/man3/fputwc.3:63
3082 "The B<fputwc>() function returns I<wc> if no error occurred, or B<WEOF> to "
3083 "indicate an error. In the event of an error, I<errno> is set to indicate "
3088 #: build/C/man3/fputwc.3:68
3089 msgid "Conversion of I<wc> to the stream's encoding fails."
3093 #: build/C/man3/fputwc.3:77
3095 "The behavior of B<fputwc>() depends on the B<LC_CTYPE> category of the "
3100 #: build/C/man3/fputwc.3:85
3102 "In the absence of additional information passed to the B<fopen>(3) call, it "
3103 "is reasonable to expect that B<fputwc>() will actually write the multibyte "
3104 "sequence corresponding to the wide character I<wc>."
3108 #: build/C/man3/fputwc.3:89
3109 msgid "B<fgetwc>(3), B<fputws>(3), B<unlocked_stdio>(3)"
3113 #: build/C/man3/fread.3:45
3119 #: build/C/man3/fread.3:45
3125 #: build/C/man3/fread.3:48
3126 msgid "fread, fwrite - binary stream input/output"
3130 #: build/C/man3/fread.3:54
3133 "B<size_t fread(void *>I<ptr>B<, size_t >I<size>B<, size_t >I<nmemb>B<, FILE "
3134 "*>I<stream>B<);>\n"
3138 #: build/C/man3/fread.3:57
3141 "B<size_t fwrite(const void *>I<ptr>B<, size_t >I<size>B<, size_t "
3143 "B< FILE *>I<stream>B<);>\n"
3147 #: build/C/man3/fread.3:69
3149 "The function B<fread>() reads I<nmemb> elements of data, each I<size> bytes "
3150 "long, from the stream pointed to by I<stream>, storing them at the location "
3155 #: build/C/man3/fread.3:80
3157 "The function B<fwrite>() writes I<nmemb> elements of data, each I<size> "
3158 "bytes long, to the stream pointed to by I<stream>, obtaining them from the "
3159 "location given by I<ptr>."
3163 #: build/C/man3/fread.3:96
3165 "On success, B<fread>() and B<fwrite>() return the number of I<items> read "
3166 "or written. This number equals the number of bytes transferred only when "
3167 "I<size> is 1. If an error occurs, or the end of the file is reached, the "
3168 "return value is a short item count (or zero)."
3172 #: build/C/man3/fread.3:103
3174 "B<fread>() does not distinguish between end-of-file and error, and callers "
3175 "must use B<feof>(3) and B<ferror>(3) to determine which occurred."
3179 #: build/C/man3/fread.3:105
3180 msgid "C89, POSIX.1-2001."
3184 #: build/C/man3/fread.3:111
3185 msgid "B<read>(2), B<write>(2), B<feof>(3), B<ferror>(3), B<unlocked_stdio>(3)"
3189 #: build/C/man3/fseek.3:42
3195 #: build/C/man3/fseek.3:42
3201 #: build/C/man3/fseek.3:45
3202 msgid "fgetpos, fseek, fsetpos, ftell, rewind - reposition a stream"
3206 #: build/C/man3/fseek.3:49
3207 msgid "B<int fseek(FILE *>I<stream>B<, long >I<offset>B<, int >I<whence>B<);>"
3211 #: build/C/man3/fseek.3:51
3212 msgid "B<long ftell(FILE *>I<stream>B<);>"
3216 #: build/C/man3/fseek.3:53
3217 msgid "B<void rewind(FILE *>I<stream>B<);>"
3221 #: build/C/man3/fseek.3:55
3222 msgid "B<int fgetpos(FILE *>I<stream>B<, fpos_t *>I<pos>B<);>"
3226 #: build/C/man3/fseek.3:57
3227 msgid "B<int fsetpos(FILE *>I<stream>B<, fpos_t *>I<pos>B<);>"
3231 #: build/C/man3/fseek.3:81
3233 "The B<fseek>() function sets the file position indicator for the stream "
3234 "pointed to by I<stream>. The new position, measured in bytes, is obtained "
3235 "by adding I<offset> bytes to the position specified by I<whence>. If "
3236 "I<whence> is set to B<SEEK_SET>, B<SEEK_CUR>, or B<SEEK_END>, the offset is "
3237 "relative to the start of the file, the current position indicator, or "
3238 "end-of-file, respectively. A successful call to the B<fseek>() function "
3239 "clears the end-of-file indicator for the stream and undoes any effects of "
3240 "the B<ungetc>(3) function on the same stream."
3244 #: build/C/man3/fseek.3:87
3246 "The B<ftell>() function obtains the current value of the file position "
3247 "indicator for the stream pointed to by I<stream>."
3251 #: build/C/man3/fseek.3:94
3253 "The B<rewind>() function sets the file position indicator for the stream "
3254 "pointed to by I<stream> to the beginning of the file. It is equivalent to:"
3258 #: build/C/man3/fseek.3:97
3259 msgid "(void) fseek(stream, 0L, SEEK_SET)"
3263 #: build/C/man3/fseek.3:101
3265 "except that the error indicator for the stream is also cleared (see "
3270 #: build/C/man3/fseek.3:121
3272 "The B<fgetpos>() and B<fsetpos>() functions are alternate interfaces "
3273 "equivalent to B<ftell>() and B<fseek>() (with I<whence> set to "
3274 "B<SEEK_SET>), setting and storing the current value of the file offset into "
3275 "or from the object referenced by I<pos>. On some non-UNIX systems, an "
3276 "I<fpos_t> object may be a complex object and these routines may be the only "
3277 "way to portably reposition a text stream."
3281 #: build/C/man3/fseek.3:136
3283 "The B<rewind>() function returns no value. Upon successful completion, "
3284 "B<fgetpos>(), B<fseek>(), B<fsetpos>() return 0, and B<ftell>() returns "
3285 "the current offset. Otherwise, -1 is returned and I<errno> is set to "
3286 "indicate the error."
3290 #: build/C/man3/fseek.3:142
3291 msgid "The I<stream> specified is not a seekable stream."
3295 #: build/C/man3/fseek.3:153
3297 "The I<whence> argument to B<fseek>() was not B<SEEK_SET>, B<SEEK_END>, or "
3302 #: build/C/man3/fseek.3:168
3304 "The functions B<fgetpos>(), B<fseek>(), B<fsetpos>(), and B<ftell>() may "
3305 "also fail and set I<errno> for any of the errors specified for the routines "
3306 "B<fflush>(3), B<fstat>(2), B<lseek>(2), and B<malloc>(3)."
3310 #: build/C/man3/fseek.3:173
3311 msgid "B<lseek>(2), B<fseeko>(3)"
3315 #: build/C/man3/fseeko.3:25
3321 #: build/C/man3/fseeko.3:25
3327 #: build/C/man3/fseeko.3:28
3328 msgid "fseeko, ftello - seek to or report file position"
3332 #: build/C/man3/fseeko.3:33
3334 msgid "B<int fseeko(FILE *>I<stream>B<, off_t >I<offset>B<, int >I<whence>B<);>\n"
3338 #: build/C/man3/fseeko.3:36
3341 "B<off_t ftello(FILE *>I<stream>B<);>\n"
3346 #: build/C/man3/fseeko.3:58
3348 "The B<fseeko>() and B<ftello>() functions are identical to B<fseek>(3) "
3349 "and B<ftell>(3) (see B<fseek>(3)), respectively, except that the I<offset> "
3350 "argument of B<fseeko>() and the return value of B<ftello>() is of type "
3351 "I<off_t> instead of I<long>."
3355 #: build/C/man3/fseeko.3:65
3357 "On many architectures both I<off_t> and I<long> are 32-bit types, but "
3362 #: build/C/man3/fseeko.3:69 build/C/man3/lseek64.3:81
3364 msgid "#define _FILE_OFFSET_BITS 64\n"
3368 #: build/C/man3/fseeko.3:75
3369 msgid "will turn I<off_t> into a 64-bit type."
3373 #: build/C/man3/fseeko.3:84
3375 "On successful completion, B<fseeko>() returns 0, while B<ftello>() returns "
3376 "the current offset. Otherwise, -1 is returned and I<errno> is set to "
3377 "indicate the error."
3381 #: build/C/man3/fseeko.3:87
3382 msgid "See the ERRORS in B<fseek>(3)."
3386 #: build/C/man3/fseeko.3:89
3387 msgid "SUSv2, POSIX.1-2001."
3391 #: build/C/man3/fseeko.3:93
3393 "These functions are found on System V-like systems. They are not present in "
3394 "libc4, libc5, glibc 2.0 but are available since glibc 2.1."
3398 #: build/C/man3/fseeko.3:95
3403 #: build/C/man3/getline.3:26
3409 #: build/C/man3/getline.3:29
3410 msgid "getline, getdelim - delimited string input"
3414 #: build/C/man3/getline.3:34
3417 "B<ssize_t getline(char **>I<lineptr>B<, size_t *>I<n>B<, FILE "
3418 "*>I<stream>B<);>\n"
3422 #: build/C/man3/getline.3:37
3425 "B<ssize_t getdelim(char **>I<lineptr>B<, size_t *>I<n>B<, int >I<delim>B<, "
3426 "FILE *>I<stream>B<);>\n"
3430 #: build/C/man3/getline.3:47
3431 msgid "B<getline>(), B<getdelim>():"
3435 #: build/C/man3/getline.3:52
3436 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 200809L || _XOPEN_SOURCE\\ E<gt>=\\ 700"
3440 #: build/C/man3/getline.3:65
3442 "B<getline>() reads an entire line from I<stream>, storing the address of "
3443 "the buffer containing the text into I<*lineptr>. The buffer is "
3444 "null-terminated and includes the newline character, if one was found."
3448 #: build/C/man3/getline.3:75
3450 "If I<*lineptr> is NULL, then B<getline>() will allocate a buffer for "
3451 "storing the line, which should be freed by the user program. (In this case, "
3452 "the value in I<*n> is ignored.)"
3456 #: build/C/man3/getline.3:93
3458 "Alternatively, before calling B<getline>(), I<*lineptr> can contain a "
3459 "pointer to a B<malloc>(3)-allocated buffer I<*n> bytes in size. If the "
3460 "buffer is not large enough to hold the line, B<getline>() resizes it with "
3461 "B<realloc>(3), updating I<*lineptr> and I<*n> as necessary."
3465 #: build/C/man3/getline.3:99
3467 "In either case, on a successful call, I<*lineptr> and I<*n> will be updated "
3468 "to reflect the buffer address and allocated size respectively."
3472 #: build/C/man3/getline.3:110
3474 "B<getdelim>() works like B<getline>(), except that a line delimiter other "
3475 "than newline can be specified as the I<delimiter> argument. As with "
3476 "B<getline>(), a delimiter character is not added if one was not present in "
3477 "the input before end of file was reached."
3481 #: build/C/man3/getline.3:119
3483 "On success, B<getline>() and B<getdelim>() return the number of characters "
3484 "read, including the delimiter character, but not including the terminating "
3485 "null byte (\\(aq\\e0\\(aq). This value can be used to handle embedded null "
3486 "bytes in the line read."
3490 #: build/C/man3/getline.3:125
3492 "Both functions return -1 on failure to read a line (including end-of-file "
3493 "condition). In the event of an error, I<errno> is set to indicate the "
3498 #: build/C/man3/getline.3:135
3499 msgid "Bad arguments (I<n> or I<lineptr> is NULL, or I<stream> is not valid)."
3503 #: build/C/man3/getline.3:137
3504 msgid "These functions are available since libc 4.6.27."
3508 #: build/C/man3/getline.3:144
3510 "Both B<getline>() and B<getdelim>() were originally GNU extensions. They "
3511 "were standardized in POSIX.1-2008."
3515 #: build/C/man3/getline.3:149
3518 "#define _GNU_SOURCE\n"
3519 "#include E<lt>stdio.hE<gt>\n"
3520 "#include E<lt>stdlib.hE<gt>\n"
3524 #: build/C/man3/getline.3:157
3531 " char *line = NULL;\n"
3532 " size_t len = 0;\n"
3537 #: build/C/man3/getline.3:161
3540 " fp = fopen(\"/etc/motd\", \"r\");\n"
3541 " if (fp == NULL)\n"
3542 " exit(EXIT_FAILURE);\n"
3546 #: build/C/man3/getline.3:166
3549 " while ((read = getline(&line, &len, fp)) != -1) {\n"
3550 " printf(\"Retrieved line of length %zu :\\en\", read);\n"
3551 " printf(\"%s\", line);\n"
3556 #: build/C/man3/getline.3:170
3560 " exit(EXIT_SUCCESS);\n"
3565 #: build/C/man3/getline.3:178
3566 msgid "B<read>(2), B<fgets>(3), B<fopen>(3), B<fread>(3), B<gets>(3), B<scanf>(3)"
3570 #: build/C/man3/gets.3:27
3576 #: build/C/man3/gets.3:27
3582 #: build/C/man3/gets.3:30
3583 msgid "fgetc, fgets, getc, getchar, gets, ungetc - input of characters and strings"
3587 #: build/C/man3/gets.3:35
3589 msgid "B<int fgetc(FILE *>I<stream>B<);>\n"
3593 #: build/C/man3/gets.3:37
3595 msgid "B<char *fgets(char *>I<s>B<, int >I<size>B<, FILE *>I<stream>B<);>\n"
3599 #: build/C/man3/gets.3:39
3601 msgid "B<int getc(FILE *>I<stream>B<);>\n"
3605 #: build/C/man3/gets.3:41
3607 msgid "B<int getchar(void);>\n"
3611 #: build/C/man3/gets.3:43
3613 msgid "B<char *gets(char *>I<s>B<);>\n"
3617 #: build/C/man3/gets.3:45
3619 msgid "B<int ungetc(int >I<c>B<, FILE *>I<stream>B<);>\n"
3623 #: build/C/man3/gets.3:57
3625 "B<fgetc>() reads the next character from I<stream> and returns it as an "
3626 "I<unsigned char> cast to an I<int>, or B<EOF> on end of file or error."
3630 #: build/C/man3/gets.3:64
3632 "B<getc>() is equivalent to B<fgetc>() except that it may be implemented as "
3633 "a macro which evaluates I<stream> more than once."
3637 #: build/C/man3/gets.3:68
3638 msgid "B<getchar>() is equivalent to B<getc(>I<stdin>B<)>."
3642 #: build/C/man3/gets.3:78
3644 "B<gets>() reads a line from I<stdin> into the buffer pointed to by I<s> "
3645 "until either a terminating newline or B<EOF>, which it replaces with a null "
3646 "byte (\\(aq\\e0\\(aq). No check for buffer overrun is performed (see BUGS "
3651 #: build/C/man3/gets.3:92
3653 "B<fgets>() reads in at most one less than I<size> characters from I<stream> "
3654 "and stores them into the buffer pointed to by I<s>. Reading stops after an "
3655 "B<EOF> or a newline. If a newline is read, it is stored into the buffer. A "
3656 "terminating null byte (\\(aq\\e0\\(aq) is stored after the last character "
3661 #: build/C/man3/gets.3:103
3663 "B<ungetc>() pushes I<c> back to I<stream>, cast to I<unsigned char>, where "
3664 "it is available for subsequent read operations. Pushed-back characters will "
3665 "be returned in reverse order; only one pushback is guaranteed."
3669 #: build/C/man3/gets.3:108
3671 "Calls to the functions described here can be mixed with each other and with "
3672 "calls to other input functions from the I<stdio> library for the same input "
3677 #: build/C/man3/gets.3:123
3679 "B<fgetc>(), B<getc>() and B<getchar>() return the character read as an "
3680 "I<unsigned char> cast to an I<int> or B<EOF> on end of file or error."
3684 #: build/C/man3/gets.3:131
3686 "B<gets>() and B<fgets>() return I<s> on success, and NULL on error or when "
3687 "end of file occurs while no characters have been read."
3691 #: build/C/man3/gets.3:138
3692 msgid "B<ungetc>() returns I<c> on success, or B<EOF> on error."
3696 #: build/C/man3/gets.3:140
3697 msgid "C89, C99, POSIX.1-2001."
3701 #: build/C/man3/gets.3:152
3703 "LSB deprecates B<gets>(). POSIX.1-2008 marks B<gets>() obsolescent. ISO "
3704 "C11 removes the specification of B<gets>() from the C language, and since "
3705 "version 2.16, glibc header files don't expose the function declaration if "
3706 "the B<_ISOC11_SOURCE> feature test macro is defined."
3710 #: build/C/man3/gets.3:166
3712 "Never use B<gets>(). Because it is impossible to tell without knowing the "
3713 "data in advance how many characters B<gets>() will read, and because "
3714 "B<gets>() will continue to store characters past the end of the buffer, it "
3715 "is extremely dangerous to use. It has been used to break computer "
3716 "security. Use B<fgets>() instead."
3720 #: build/C/man3/gets.3:173
3722 "It is not advisable to mix calls to input functions from the I<stdio> "
3723 "library with low-level calls to B<read>(2) for the file descriptor "
3724 "associated with the input stream; the results will be undefined and very "
3725 "probably not what you want."
3729 #: build/C/man3/gets.3:189
3731 "B<read>(2), B<write>(2), B<ferror>(3), B<fgetwc>(3), B<fgetws>(3), "
3732 "B<fopen>(3), B<fread>(3), B<fseek>(3), B<getline>(3), B<getwchar>(3), "
3733 "B<puts>(3), B<scanf>(3), B<ungetwc>(3), B<unlocked_stdio>(3), "
3734 "B<feature_test_macros>(7)"
3738 #: build/C/man3/getw.3:25
3744 #: build/C/man3/getw.3:25
3750 #: build/C/man3/getw.3:28
3751 msgid "getw, putw - input and output of words (ints)"
3755 #: build/C/man3/getw.3:33
3757 msgid "B<int getw(FILE *>I<stream>B<);>\n"
3761 #: build/C/man3/getw.3:35
3763 msgid "B<int putw(int >I<w>B<, FILE *>I<stream>B<);>\n"
3767 #: build/C/man3/getw.3:44
3768 msgid "B<getw>(), B<putw>():"
3772 #: build/C/man3/getw.3:47
3774 msgid "Since glibc 2.3.3:"
3778 #: build/C/man3/getw.3:50
3779 msgid "_SVID_SOURCE || _BSD_SOURCE ||"
3783 #: build/C/man3/getw.3:53
3786 "(_XOPEN_SOURCE &&\n"
3787 " !(_POSIX_C_SOURCE\\ E<gt>=\\ 200112L || _XOPEN_SOURCE\\ E<gt>=\\ 600))\n"
3791 #: build/C/man3/getw.3:53
3793 msgid "Before glibc 2.3.3:"
3797 #: build/C/man3/getw.3:56
3798 msgid "_SVID_SOURCE || _BSD_SOURCE || _XOPEN_SOURCE"
3802 #: build/C/man3/getw.3:66
3804 "B<getw>() reads a word (that is, an I<int>) from I<stream>. It's provided "
3805 "for compatibility with SVr4. We recommend you use B<fread>(3) instead."
3809 #: build/C/man3/getw.3:73
3811 "B<putw>() writes the word I<w> (that is, an I<int>) to I<stream>. It is "
3812 "provided for compatibility with SVr4, but we recommend you use B<fwrite>(3) "
3817 #: build/C/man3/getw.3:80
3819 "Normally, B<getw>() returns the word read, and B<putw>() returns 0. On "
3820 "error, they return B<EOF>."
3824 #: build/C/man3/getw.3:82
3825 msgid "SVr4, SUSv2. Not present in POSIX.1-2001."
3829 #: build/C/man3/getw.3:86
3831 "The value returned on error is also a legitimate data value. B<ferror>(3) "
3832 "can be used to distinguish between the two cases."
3836 #: build/C/man3/getw.3:92
3837 msgid "B<ferror>(3), B<fread>(3), B<fwrite>(3), B<getc>(3), B<putc>(3)"
3841 #: build/C/man2/link.2:31
3847 #: build/C/man2/link.2:31 build/C/man2/rename.2:32 build/C/man2/symlink.2:32 build/C/man2/write.2:39
3853 #: build/C/man2/link.2:34
3854 msgid "link - make a new name for a file"
3858 #: build/C/man2/link.2:36 build/C/man2/lseek.2:54 build/C/man3/lseek64.3:34 build/C/man2/readlink.2:48 build/C/man2/rmdir.2:35 build/C/man2/symlink.2:37 build/C/man2/unlink.2:37 build/C/man2/write.2:44
3859 msgid "B<#include E<lt>unistd.hE<gt>>"
3863 #: build/C/man2/link.2:38
3864 msgid "B<int link(const char *>I<oldpath>B<, const char *>I<newpath>B<);>"
3868 #: build/C/man2/link.2:41
3870 "B<link>() creates a new link (also known as a hard link) to an existing "
3875 #: build/C/man2/link.2:47 build/C/man2/symlink.2:84
3876 msgid "If I<newpath> exists it will I<not> be overwritten."
3880 #: build/C/man2/link.2:52
3882 "This new name may be used exactly as the old one for any operation; both "
3883 "names refer to the same file (and so have the same permissions and "
3884 "ownership) and it is impossible to tell which name was the \"original\"."
3888 #: 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
3890 "On success, zero is returned. On error, -1 is returned, and I<errno> is set "
3895 #: build/C/man2/link.2:58 build/C/man2/open.2:577 build/C/man2/readlink.2:86 build/C/man2/rename.2:97 build/C/man2/rmdir.2:46 build/C/man2/symlink.2:90 build/C/man3/tmpfile.3:57 build/C/man2/unlink.2:61
3901 #: build/C/man2/link.2:69
3903 "Write access to the directory containing I<newpath> is denied, or search "
3904 "permission is denied for one of the directories in the path prefix of "
3905 "I<oldpath> or I<newpath>. (See also B<path_resolution>(7).)"
3909 #: build/C/man2/link.2:69 build/C/man2/open.2:586 build/C/man2/rename.2:133 build/C/man2/symlink.2:99 build/C/man2/write.2:135
3915 #: build/C/man2/link.2:72 build/C/man2/rename.2:136
3916 msgid "The user's quota of disk blocks on the filesystem has been exhausted."
3920 #: build/C/man2/link.2:72 build/C/man2/open.2:592 build/C/man2/symlink.2:104 build/C/man3/tmpfile.3:60
3926 #: build/C/man2/link.2:76 build/C/man2/symlink.2:108
3927 msgid "I<newpath> already exists."
3931 #: build/C/man2/link.2:76 build/C/man2/llseek.2:74 build/C/man2/open.2:598 build/C/man2/pipe.2:98 build/C/man2/read.2:118 build/C/man2/readlink.2:91 build/C/man2/rename.2:136 build/C/man2/rmdir.2:64 build/C/man2/symlink.2:108 build/C/man2/unlink.2:80 build/C/man2/write.2:141
3937 #: build/C/man2/link.2:79 build/C/man2/rename.2:139 build/C/man2/symlink.2:111
3938 msgid "I<oldpath> or I<newpath> points outside your accessible address space."
3942 #: build/C/man2/link.2:79 build/C/man2/read.2:147 build/C/man2/readlink.2:107 build/C/man2/symlink.2:111 build/C/man2/unlink.2:84 build/C/man2/write.2:165
3948 #: build/C/man2/link.2:82 build/C/man2/symlink.2:114 build/C/man2/unlink.2:87
3949 msgid "An I/O error occurred."
3953 #: build/C/man2/link.2:82 build/C/man2/open.2:629 build/C/man2/readlink.2:110 build/C/man2/rename.2:149 build/C/man2/rmdir.2:73 build/C/man2/symlink.2:114 build/C/man2/unlink.2:92
3959 #: build/C/man2/link.2:86 build/C/man2/rename.2:153
3961 "Too many symbolic links were encountered in resolving I<oldpath> or "
3966 #: build/C/man2/link.2:86 build/C/man2/rename.2:153
3972 #: build/C/man2/link.2:91
3974 "The file referred to by I<oldpath> already has the maximum number of links "
3979 #: build/C/man2/link.2:91 build/C/man2/open.2:639 build/C/man2/readlink.2:113 build/C/man2/rename.2:160 build/C/man2/rmdir.2:77 build/C/man2/symlink.2:118 build/C/man2/unlink.2:96
3981 msgid "B<ENAMETOOLONG>"
3985 #: build/C/man2/link.2:94 build/C/man2/rename.2:163 build/C/man2/symlink.2:121
3986 msgid "I<oldpath> or I<newpath> was too long."
3990 #: build/C/man2/link.2:94 build/C/man2/open.2:653 build/C/man2/readlink.2:116 build/C/man2/rename.2:163 build/C/man2/rmdir.2:80 build/C/man2/symlink.2:121 build/C/man2/unlink.2:99
3996 #: build/C/man2/link.2:99
3998 "A directory component in I<oldpath> or I<newpath> does not exist or is a "
3999 "dangling symbolic link."
4003 #: build/C/man2/link.2:99 build/C/man2/open.2:660 build/C/man2/readlink.2:119 build/C/man2/rename.2:176 build/C/man2/rmdir.2:85 build/C/man3/scanf.3:570 build/C/man2/symlink.2:128 build/C/man3/tempnam.3:95 build/C/man2/unlink.2:106
4009 #: build/C/man2/link.2:102 build/C/man2/open.2:663 build/C/man2/readlink.2:122 build/C/man2/rename.2:179 build/C/man2/rmdir.2:88 build/C/man2/symlink.2:131 build/C/man2/unlink.2:109
4010 msgid "Insufficient kernel memory was available."
4014 #: build/C/man2/link.2:102 build/C/man2/open.2:663 build/C/man2/rename.2:179 build/C/man2/symlink.2:131 build/C/man3/tmpfile.3:72 build/C/man2/write.2:168
4020 #: build/C/man2/link.2:106 build/C/man2/rename.2:183 build/C/man2/symlink.2:135
4021 msgid "The device containing the file has no room for the new directory entry."
4025 #: build/C/man2/link.2:106 build/C/man2/open.2:669 build/C/man2/readlink.2:122 build/C/man2/rename.2:183 build/C/man2/rmdir.2:88 build/C/man2/symlink.2:135 build/C/man2/unlink.2:109
4031 #: build/C/man2/link.2:111
4033 "A component used as a directory in I<oldpath> or I<newpath> is not, in fact, "
4038 #: build/C/man2/link.2:111 build/C/man2/link.2:115 build/C/man2/open.2:702 build/C/man2/rmdir.2:107 build/C/man2/rmdir.2:118 build/C/man2/symlink.2:140 build/C/man2/unlink.2:114
4044 #: build/C/man2/link.2:115
4045 msgid "I<oldpath> is a directory."
4049 #: build/C/man2/link.2:120
4051 "The filesystem containing I<oldpath> and I<newpath> does not support the "
4052 "creation of hard links."
4056 #: build/C/man2/link.2:120
4058 msgid "B<EPERM> (since Linux 3.6)"
4062 #: build/C/man2/link.2:127
4064 "The caller does not have permission to create a hard link to this file (see "
4065 "the description of I</proc/sys/fs/protected_hardlink> in B<proc>(5))."
4069 #: build/C/man2/link.2:127 build/C/man2/open.2:710 build/C/man2/rename.2:221 build/C/man2/rmdir.2:123 build/C/man2/symlink.2:145 build/C/man3/tmpfile.3:75 build/C/man2/unlink.2:137
4075 #: build/C/man2/link.2:130 build/C/man2/rename.2:224
4076 msgid "The file is on a read-only filesystem."
4080 #: build/C/man2/link.2:130 build/C/man2/rename.2:224
4086 #: build/C/man2/link.2:138
4088 "I<oldpath> and I<newpath> are not on the same mounted filesystem. (Linux "
4089 "permits a filesystem to be mounted at multiple points, but B<link>() does "
4090 "not work across different mount points, even if the same filesystem is "
4094 #. SVr4 documents additional ENOLINK and
4095 #. EMULTIHOP error conditions; POSIX.1 does not document ELOOP.
4096 #. X/OPEN does not document EFAULT, ENOMEM or EIO.
4098 #: build/C/man2/link.2:143
4099 msgid "SVr4, 4.3BSD, POSIX.1-2001 (but see NOTES)."
4103 #: build/C/man2/link.2:150
4105 "Hard links, as created by B<link>(), cannot span filesystems. Use "
4106 "B<symlink>(2) if this is required."
4109 #. more precisely: since kernel 1.3.56
4110 #. For example, the default Solaris compilation environment
4111 #. behaves like Linux, and contributors to a March 2005
4112 #. thread in the Austin mailing list reported that some
4113 #. other (System V) implementations did/do the same -- MTK, Apr 05
4115 #: build/C/man2/link.2:181
4117 "POSIX.1-2001 says that B<link>() should dereference I<oldpath> if it is a "
4118 "symbolic link. However, since kernel 2.0, Linux does not do so: if "
4119 "I<oldpath> is a symbolic link, then I<newpath> is created as a (hard) link "
4120 "to the same symbolic link file (i.e., I<newpath> becomes a symbolic link to "
4121 "the same file that I<oldpath> refers to). Some other implementations behave "
4122 "in the same manner as Linux. POSIX.1-2008 changes the specification of "
4123 "B<link>(), making it implementation-dependent whether or not I<oldpath> is "
4124 "dereferenced if it is a symbolic link. For precise control over the "
4125 "treatment of symbolic links when creating a link, see B<linkat>(2)."
4129 #: build/C/man2/link.2:187
4131 "On NFS filesystems, the return code may be wrong in case the NFS server "
4132 "performs the link creation and dies before it can say so. Use B<stat>(2) "
4133 "to find out if the link got created."
4137 #: build/C/man2/link.2:197
4139 "B<ln>(1), B<linkat>(2), B<open>(2), B<rename>(2), B<stat>(2), B<symlink>(2), "
4140 "B<unlink>(2), B<path_resolution>(7), B<symlink>(7)"
4144 #: build/C/man2/llseek.2:28
4150 #: build/C/man2/llseek.2:28
4156 #: build/C/man2/llseek.2:31
4157 msgid "_llseek - reposition read/write file offset"
4161 #: build/C/man2/llseek.2:35
4164 "B<#include E<lt>sys/types.hE<gt>>\n"
4165 "B<#include E<lt>unistd.hE<gt>>\n"
4169 #: build/C/man2/llseek.2:39
4172 "B<int _llseek(unsigned int >I<fd>B<, unsigned long >I<offset_high>B<,>\n"
4173 "B< unsigned long >I<offset_low>B<, loff_t *>I<result>B<,>\n"
4174 "B< unsigned int >I<whence>B<);>\n"
4178 #: build/C/man2/llseek.2:43
4179 msgid "I<Note>: There is no glibc wrapper for this system call; see NOTES."
4183 #: build/C/man2/llseek.2:62
4185 "The B<_llseek>() function repositions the offset of the open file "
4186 "associated with the file descriptor I<fd> to I<(offset_highE<lt>E<lt>32) | "
4187 "offset_low> bytes relative to the beginning of the file, the current "
4188 "position in the file, or the end of the file, depending on whether I<whence> "
4189 "is B<SEEK_SET>, B<SEEK_CUR>, or B<SEEK_END>, respectively. It returns the "
4190 "resulting file position in the argument I<result>."
4194 #: build/C/man2/llseek.2:69
4196 "Upon successful completion, B<_llseek>() returns 0. Otherwise, a value of "
4197 "-1 is returned and I<errno> is set to indicate the error."
4201 #: build/C/man2/llseek.2:74 build/C/man2/lseek.2:175
4202 msgid "I<fd> is not an open file descriptor."
4206 #: build/C/man2/llseek.2:77
4207 msgid "Problem with copying results to user space."
4211 #: build/C/man2/llseek.2:81
4212 msgid "I<whence> is invalid."
4216 #: build/C/man2/llseek.2:84
4218 "This function is Linux-specific, and should not be used in programs intended "
4223 #: build/C/man2/llseek.2:87
4225 "Glibc does not provide a wrapper for this system call; call it using "
4230 #: build/C/man2/llseek.2:90
4231 msgid "B<lseek>(2), B<lseek64>(3)"
4235 #: build/C/man2/lseek.2:47
4241 #: build/C/man2/lseek.2:47
4247 #: build/C/man2/lseek.2:50
4248 msgid "lseek - reposition read/write file offset"
4252 #: build/C/man2/lseek.2:52 build/C/man3/lseek64.3:32
4253 msgid "B<#include E<lt>sys/types.hE<gt>>"
4257 #: build/C/man2/lseek.2:56
4258 msgid "B<off_t lseek(int >I<fd>B<, off_t >I<offset>B<, int >I<whence>B<);>"
4262 #: build/C/man2/lseek.2:67
4264 "The B<lseek>() function repositions the offset of the open file associated "
4265 "with the file descriptor I<fd> to the argument I<offset> according to the "
4266 "directive I<whence> as follows:"
4270 #: build/C/man2/lseek.2:72
4271 msgid "The offset is set to I<offset> bytes."
4275 #: build/C/man2/lseek.2:77
4276 msgid "The offset is set to its current location plus I<offset> bytes."
4280 #: build/C/man2/lseek.2:82
4281 msgid "The offset is set to the size of the file plus I<offset> bytes."
4285 #: build/C/man2/lseek.2:90
4287 "The B<lseek>() function allows the file offset to be set beyond the end of "
4288 "the file (but this does not change the size of the file). If data is later "
4289 "written at this point, subsequent reads of the data in the gap (a \"hole\") "
4290 "return null bytes (\\(aq\\e0\\(aq) until data is actually written into the "
4295 #: build/C/man2/lseek.2:90
4297 msgid "Seeking file data and holes"
4301 #: build/C/man2/lseek.2:93
4303 "Since version 3.1, Linux supports the following additional values for "
4308 #: build/C/man2/lseek.2:93
4310 msgid "B<SEEK_DATA>"
4314 #: build/C/man2/lseek.2:104
4316 "Adjust the file offset to the next location in the file greater than or "
4317 "equal to I<offset> containing data. If I<offset> points to data, then the "
4318 "file offset is set to I<offset>."
4322 #: build/C/man2/lseek.2:104
4324 msgid "B<SEEK_HOLE>"
4328 #: build/C/man2/lseek.2:118
4330 "Adjust the file offset to the next hole in the file greater than or equal to "
4331 "I<offset>. If I<offset> points into the middle of a hole, then the file "
4332 "offset is set to I<offset>. If there is no hole past I<offset>, then the "
4333 "file offset is adjusted to the end of the file (i.e., there is an implicit "
4334 "hole at the end of any file)."
4338 #: build/C/man2/lseek.2:124
4340 "In both of the above cases, B<lseek>() fails if I<offset> points past the "
4345 #: build/C/man2/lseek.2:130
4347 "These operations allow applications to map holes in a sparsely allocated "
4348 "file. This can be useful for applications such as file backup tools, which "
4349 "can save space when creating backups and preserve holes, if they have a "
4350 "mechanism for discovering holes."
4353 #. https://lkml.org/lkml/2011/4/22/79
4354 #. http://lwn.net/Articles/440255/
4355 #. http://blogs.oracle.com/bonwick/entry/seek_hole_and_seek_data
4357 #: build/C/man2/lseek.2:153
4359 "For the purposes of these operations, a hole is a sequence of zeros that "
4360 "(normally) has not been allocated in the underlying file storage. However, "
4361 "a filesystem is not obliged to report holes, so these operations are not a "
4362 "guaranteed mechanism for mapping the storage space actually allocated to a "
4363 "file. (Furthermore, a sequence of zeros that actually has been written to "
4364 "the underlying storage may not be reported as a hole.) In the simplest "
4365 "implementation, a filesystem can support the operations by making "
4366 "B<SEEK_HOLE> always return the offset of the end of the file, and making "
4367 "B<SEEK_DATA> always return I<offset> (i.e., even if the location referred to "
4368 "by I<offset> is a hole, it can be considered to consist of data that is a "
4369 "sequence of zeros)."
4373 #: build/C/man2/lseek.2:162
4375 "The B<_GNU_SOURCE> feature test macro must be defined in order to obtain the "
4376 "definitions of B<SEEK_DATA> and B<SEEK_HOLE> from I<E<lt>unistd.hE<gt>>."
4380 #: build/C/man2/lseek.2:170
4382 "Upon successful completion, B<lseek>() returns the resulting offset "
4383 "location as measured in bytes from the beginning of the file. On error, the "
4384 "value I<(off_t)\\ -1> is returned and I<errno> is set to indicate the error."
4387 #. Some systems may allow negative offsets for character devices
4388 #. and/or for remote filesystems.
4390 #: build/C/man2/lseek.2:183
4392 "I<whence> is not valid. Or: the resulting file offset would be negative, or "
4393 "beyond the end of a seekable device."
4397 #: build/C/man2/lseek.2:183 build/C/man2/open.2:682
4399 msgid "B<EOVERFLOW>"
4402 #. HP-UX 11 says EINVAL for this case (but POSIX.1 says EOVERFLOW)
4404 #: build/C/man2/lseek.2:188
4405 msgid "The resulting file offset cannot be represented in an I<off_t>."
4409 #: build/C/man2/lseek.2:188
4415 #: build/C/man2/lseek.2:192
4416 msgid "I<fd> is associated with a pipe, socket, or FIFO."
4420 #: build/C/man2/lseek.2:192 build/C/man2/open.2:676
4426 #: build/C/man2/lseek.2:200
4428 "I<whence> is B<SEEK_DATA> or B<SEEK_HOLE>, and the current file offset is "
4429 "beyond the end of the file."
4432 #. SVr4 documents additional error
4433 #. conditions EDEADLK, ENOLCK, ENOLNK, ENOSR, ENXIO, or ERANGE.
4435 #: build/C/man2/lseek.2:202 build/C/man2/read.2:175 build/C/man2/rmdir.2:129 build/C/man2/symlink.2:155 build/C/man2/unlink.2:145 build/C/man2/write.2:189
4436 msgid "SVr4, 4.3BSD, POSIX.1-2001."
4439 #. FIXME . Review http://austingroupbugs.net/view.php?id=415 in the future
4441 #: build/C/man2/lseek.2:210
4443 "B<SEEK_DATA> and B<SEEK_HOLE> are nonstandard extensions also present in "
4444 "Solaris, FreeBSD, and DragonFly BSD; they are proposed for inclusion in the "
4445 "next POSIX revision (Issue 8)."
4449 #: build/C/man2/lseek.2:214
4451 "Some devices are incapable of seeking and POSIX does not specify which "
4452 "devices must support B<lseek>()."
4455 #. Other systems return the number of written characters,
4456 #. using SEEK_SET to set the counter. (Of written characters.)
4458 #: build/C/man2/lseek.2:221
4459 msgid "On Linux, using B<lseek>() on a terminal device returns B<ESPIPE>."
4463 #: build/C/man2/lseek.2:224
4465 "When converting old code, substitute values for I<whence> with the following "
4470 #: build/C/man2/lseek.2:227
4476 #: build/C/man2/lseek.2:228
4478 msgid "0\tSEEK_SET\n"
4482 #: build/C/man2/lseek.2:229
4484 msgid "1\tSEEK_CUR\n"
4488 #: build/C/man2/lseek.2:230
4490 msgid "2\tSEEK_END\n"
4494 #: build/C/man2/lseek.2:231
4496 msgid "L_SET\tSEEK_SET\n"
4500 #: build/C/man2/lseek.2:232
4502 msgid "L_INCR\tSEEK_CUR\n"
4506 #: build/C/man2/lseek.2:233
4508 msgid "L_XTND\tSEEK_END\n"
4512 #: build/C/man2/lseek.2:245
4514 "Note that file descriptors created by B<dup>(2) or B<fork>(2) share the "
4515 "current file position pointer, so seeking on such files may be subject to "
4520 #: build/C/man2/lseek.2:252
4522 "B<dup>(2), B<fork>(2), B<open>(2), B<fseek>(3), B<lseek64>(3), "
4523 "B<posix_fallocate>(3)"
4527 #: build/C/man3/lseek64.3:25
4533 #: build/C/man3/lseek64.3:25
4539 #: build/C/man3/lseek64.3:28
4540 msgid "lseek64 - reposition 64-bit read/write file offset"
4544 #: build/C/man3/lseek64.3:30
4545 msgid "B<#define _LARGEFILE64_SOURCE> /* See feature_test_macros(7) */"
4549 #: build/C/man3/lseek64.3:36
4550 msgid "B<off64_t lseek64(int >I<fd>B<, off64_t >I<offset>B<, int >I<whence>B<);>"
4554 #: build/C/man3/lseek64.3:53
4556 "The B<lseek>(2) family of functions reposition the offset of the open file "
4557 "associated with the file descriptor I<fd> to I<offset> bytes relative to the "
4558 "start, current position, or end of the file, when I<whence> has the value "
4559 "B<SEEK_SET>, B<SEEK_CUR>, or B<SEEK_END>, respectively."
4563 #: build/C/man3/lseek64.3:56
4564 msgid "For more details, return value, and errors, see B<lseek>(2)."
4568 #: build/C/man3/lseek64.3:63
4570 "Four interfaces are available: B<lseek>(2), B<lseek64>(), B<llseek>(2), and "
4571 "the raw system call B<_llseek>(2)."
4575 #: build/C/man3/lseek64.3:63
4581 #: build/C/man3/lseek64.3:65 build/C/man3/lseek64.3:87 build/C/man3/lseek64.3:116
4586 #: build/C/man3/lseek64.3:69
4588 msgid "B<off_t lseek(int >I<fd>B<, off_t >I<offset>B<, int >I<whence>B<);>\n"
4592 #: build/C/man3/lseek64.3:77
4594 "B<lseek>(2) uses the type I<off_t>. This is a 32-bit signed type on 32-bit "
4595 "architectures, unless one compiles with"
4599 #: build/C/man3/lseek64.3:85
4600 msgid "in which case it is a 64-bit signed type."
4604 #: build/C/man3/lseek64.3:85
4610 #: build/C/man3/lseek64.3:91
4612 msgid "B<off64_t lseek64(int >I<fd>B<, off64_t >I<offset>B<, int >I<whence>B<);>\n"
4616 #: build/C/man3/lseek64.3:102
4618 "The library routine B<lseek64>() uses a 64-bit type even when I<off_t> is a "
4619 "32-bit type. Its prototype (and the type I<off64_t>) is available only "
4620 "when one compiles with"
4624 #: build/C/man3/lseek64.3:106
4626 msgid "#define _LARGEFILE64_SOURCE\n"
4629 #. in glibc 2.0.94, not in 2.0.6
4631 #: build/C/man3/lseek64.3:114
4633 "The function B<lseek64>() is available since glibc 2.1, and is defined to "
4634 "be an alias for B<llseek>()."
4638 #: build/C/man3/lseek64.3:114
4644 #: build/C/man3/lseek64.3:120
4646 msgid "B<loff_t llseek(int >I<fd>B<, loff_t >I<offset>B<, int >I<whence>B<);>\n"
4649 #. in libc 5.0.9, not in 4.7.6
4651 #: build/C/man3/lseek64.3:139
4653 "The type I<loff_t> is a 64-bit signed type. The library routine B<llseek>() "
4654 "is available in libc5 and glibc and works without special defines. Its "
4655 "prototype was given in I<E<lt>unistd.hE<gt>> with libc5, but glibc does not "
4656 "provide a prototype. This is bad, since a prototype is needed. Users "
4657 "should add the above prototype, or something equivalent, to their own "
4658 "source. When users complained about data loss caused by a miscompilation of "
4659 "B<e2fsck>(8), glibc 2.1.3 added the link-time warning"
4663 #: build/C/man3/lseek64.3:142
4664 msgid "the \\`llseek\\' function may be dangerous; use \\`lseek64\\' instead."
4668 #: build/C/man3/lseek64.3:146
4669 msgid "This makes this function unusable if one desires a warning-free compilation."
4673 #: build/C/man3/lseek64.3:146
4679 #: build/C/man3/lseek64.3:149
4681 "All the above functions are implemented in terms of this system call. The "
4686 #: build/C/man3/lseek64.3:154
4689 "B<int _llseek(int >I<fd>B<, off_t >I<offset_hi>B<, off_t >I<offset_lo>B<,>\n"
4690 "B< loff_t *>I<result>B<, int >I<whence>B<);>\n"
4694 #: build/C/man3/lseek64.3:159
4695 msgid "For more details, see B<llseek>(2)."
4699 #: build/C/man3/lseek64.3:164
4700 msgid "The B<lseek64>() function is thread-safe."
4704 #: build/C/man3/lseek64.3:167
4705 msgid "B<llseek>(2), B<lseek>(2)"
4709 #: build/C/man2/open.2:51
4715 #: build/C/man2/open.2:51
4721 #: build/C/man2/open.2:54
4722 msgid "open, creat - open and possibly create a file or device"
4726 #: build/C/man2/open.2:59
4729 "B<#include E<lt>sys/types.hE<gt>>\n"
4730 "B<#include E<lt>sys/stat.hE<gt>>\n"
4731 "B<#include E<lt>fcntl.hE<gt>>\n"
4735 #: build/C/man2/open.2:62
4738 "B<int open(const char *>I<pathname>B<, int >I<flags>B<);>\n"
4739 "B<int open(const char *>I<pathname>B<, int >I<flags>B<, mode_t "
4744 #: build/C/man2/open.2:64
4746 msgid "B<int creat(const char *>I<pathname>B<, mode_t >I<mode>B<);>\n"
4750 #: build/C/man2/open.2:75
4752 "Given a I<pathname> for a file, B<open>() returns a file descriptor, a "
4753 "small, nonnegative integer for use in subsequent system calls (B<read>(2), "
4754 "B<write>(2), B<lseek>(2), B<fcntl>(2), etc.). The file descriptor returned "
4755 "by a successful call will be the lowest-numbered file descriptor not "
4756 "currently open for the process."
4760 #: build/C/man2/open.2:87
4762 "By default, the new file descriptor is set to remain open across an "
4763 "B<execve>(2) (i.e., the B<FD_CLOEXEC> file descriptor flag described in "
4764 "B<fcntl>(2) is initially disabled; the B<O_CLOEXEC> flag, described below, "
4765 "can be used to change this default). The file offset is set to the "
4766 "beginning of the file (see B<lseek>(2))."
4770 #: build/C/man2/open.2:106
4772 "A call to B<open>() creates a new I<open file description>, an entry in the "
4773 "system-wide table of open files. This entry records the file offset and the "
4774 "file status flags (modifiable via the B<fcntl>(2) B<F_SETFL> operation). A "
4775 "file descriptor is a reference to one of these entries; this reference is "
4776 "unaffected if I<pathname> is subsequently removed or modified to refer to a "
4777 "different file. The new open file description is initially not shared with "
4778 "any other process, but sharing may arise via B<fork>(2)."
4782 #: build/C/man2/open.2:114
4784 "The argument I<flags> must include one of the following I<access modes>: "
4785 "B<O_RDONLY>, B<O_WRONLY>, or B<O_RDWR>. These request opening the file "
4786 "read-only, write-only, or read/write, respectively."
4789 #. SUSv4 divides the flags into:
4793 #. * Other (O_CLOEXEC, O_DIRECTORY, O_NOFOLLOW)
4794 #. though it's not clear what the difference between "other" and
4795 #. "File creation" flags is. I raised an Aardvark to see if this
4796 #. can be clarified in SUSv4; 10 Oct 2008.
4797 #. http://thread.gmane.org/gmane.comp.standards.posix.austin.general/64/focus=67
4798 #. TC1 (balloted in 2013), resolved this, so that those three constants
4799 #. are also categorized" as file status flags.
4801 #: build/C/man2/open.2:152
4803 "In addition, zero or more file creation flags and file status flags can be "
4804 "bitwise-I<or>'d in I<flags>. The I<file creation flags> are B<O_CLOEXEC>, "
4805 "B<O_CREAT>, B<O_DIRECTORY>, B<O_EXCL>, B<O_NOCTTY>, B<O_NOFOLLOW>, "
4806 "B<O_TRUNC>, and B<O_TTY_INIT>. The I<file status flags> are all of the "
4807 "remaining flags listed below. The distinction between these two groups of "
4808 "flags is that the file status flags can be retrieved and (in some cases) "
4809 "modified using B<fcntl>(2). The full list of file creation flags and file "
4810 "status flags is as follows:"
4814 #: build/C/man2/open.2:152
4819 #. For more background, see
4820 #. http://bugs.debian.org/cgi-bin/bugreport.cgi?bug=453946
4821 #. http://nfs.sourceforge.net/
4823 #: build/C/man2/open.2:169
4825 "The file is opened in append mode. Before each B<write>(2), the file offset "
4826 "is positioned at the end of the file, as if with B<lseek>(2). B<O_APPEND> "
4827 "may lead to corrupted files on NFS filesystems if more than one process "
4828 "appends data to a file at once. This is because NFS does not support "
4829 "appending to a file, so the client kernel has to simulate it, which can't be "
4830 "done without a race condition."
4834 #: build/C/man2/open.2:169
4840 #: build/C/man2/open.2:182
4842 "Enable signal-driven I/O: generate a signal (B<SIGIO> by default, but this "
4843 "can be changed via B<fcntl>(2)) when input or output becomes possible on "
4844 "this file descriptor. This feature is available only for terminals, "
4845 "pseudoterminals, sockets, and (since Linux 2.6) pipes and FIFOs. See "
4846 "B<fcntl>(2) for further details."
4850 #: build/C/man2/open.2:182
4852 msgid "B<O_CLOEXEC> (Since Linux 2.6.23)"
4855 #. This flag fixes only one form of the race condition;
4856 #. The race can also occur with, for example, descriptors
4857 #. returned by accept(), pipe(), etc.
4859 #: build/C/man2/open.2:207
4861 "Enable the close-on-exec flag for the new file descriptor. Specifying this "
4862 "flag permits a program to avoid additional B<fcntl>(2) B<F_SETFD> "
4863 "operations to set the B<FD_CLOEXEC> flag. Additionally, use of this flag is "
4864 "essential in some multithreaded programs since using a separate B<fcntl>(2) "
4865 "B<F_SETFD> operation to set the B<FD_CLOEXEC> flag does not suffice to avoid "
4866 "race conditions where one thread opens a file descriptor at the same time as "
4867 "another thread does a B<fork>(2) plus B<execve>(2)."
4871 #: build/C/man2/open.2:207
4876 #. As at 2.6.25, bsdgroups is supported by ext2, ext3, ext4, and
4877 #. XFS (since 2.6.14).
4879 #: build/C/man2/open.2:223
4881 "If the file does not exist it will be created. The owner (user ID) of the "
4882 "file is set to the effective user ID of the process. The group ownership "
4883 "(group ID) is set either to the effective group ID of the process or to the "
4884 "group ID of the parent directory (depending on filesystem type and mount "
4885 "options, and the mode of the parent directory, see the mount options "
4886 "I<bsdgroups> and I<sysvgroups> described in B<mount>(8))."
4890 #: build/C/man2/open.2:246
4892 "I<mode> specifies the permissions to use in case a new file is created. "
4893 "This argument must be supplied when B<O_CREAT> is specified in I<flags>; if "
4894 "B<O_CREAT> is not specified, then I<mode> is ignored. The effective "
4895 "permissions are modified by the process's I<umask> in the usual way: The "
4896 "permissions of the created file are I<(mode\\ &\\ ~umask)>. Note that this "
4897 "mode applies only to future accesses of the newly created file; the "
4898 "B<open>() call that creates a read-only file may well return a read/write "
4903 #: build/C/man2/open.2:249
4904 msgid "The following symbolic constants are provided for I<mode>:"
4908 #: build/C/man2/open.2:249
4914 #: build/C/man2/open.2:252
4915 msgid "00700 user (file owner) has read, write and execute permission"
4919 #: build/C/man2/open.2:252
4925 #: build/C/man2/open.2:255
4926 msgid "00400 user has read permission"
4930 #: build/C/man2/open.2:255
4936 #: build/C/man2/open.2:258
4937 msgid "00200 user has write permission"
4941 #: build/C/man2/open.2:258
4947 #: build/C/man2/open.2:261
4948 msgid "00100 user has execute permission"
4952 #: build/C/man2/open.2:261
4958 #: build/C/man2/open.2:264
4959 msgid "00070 group has read, write and execute permission"
4963 #: build/C/man2/open.2:264
4969 #: build/C/man2/open.2:267
4970 msgid "00040 group has read permission"
4974 #: build/C/man2/open.2:267
4980 #: build/C/man2/open.2:270
4981 msgid "00020 group has write permission"
4985 #: build/C/man2/open.2:270
4991 #: build/C/man2/open.2:273
4992 msgid "00010 group has execute permission"
4996 #: build/C/man2/open.2:273
5002 #: build/C/man2/open.2:276
5003 msgid "00007 others have read, write and execute permission"
5007 #: build/C/man2/open.2:276
5013 #: build/C/man2/open.2:279
5014 msgid "00004 others have read permission"
5018 #: build/C/man2/open.2:279
5024 #: build/C/man2/open.2:282
5025 msgid "00002 others have write permission"
5029 #: build/C/man2/open.2:282
5035 #: build/C/man2/open.2:285
5036 msgid "00001 others have execute permission"
5040 #: build/C/man2/open.2:286
5042 msgid "B<O_DIRECT> (Since Linux 2.4.10)"
5046 #: build/C/man2/open.2:303
5048 "Try to minimize cache effects of the I/O to and from this file. In general "
5049 "this will degrade performance, but it is useful in special situations, such "
5050 "as when applications do their own caching. File I/O is done directly "
5051 "to/from user-space buffers. The B<O_DIRECT> flag on its own makes an effort "
5052 "to transfer data synchronously, but does not give the guarantees of the "
5053 "B<O_SYNC> flag that data and necessary metadata are transferred. To "
5054 "guarantee synchronous I/O, B<O_SYNC> must be used in addition to "
5055 "B<O_DIRECT>. See NOTES below for further discussion."
5059 #: build/C/man2/open.2:307
5061 "A semantically similar (but deprecated) interface for block devices is "
5062 "described in B<raw>(8)."
5066 #: build/C/man2/open.2:307
5068 msgid "B<O_DIRECTORY>"
5071 #. But see the following and its replies:
5072 #. http://marc.theaimsgroup.com/?t=112748702800001&r=1&w=2
5073 #. [PATCH] open: O_DIRECTORY and O_CREAT together should fail
5074 #. O_DIRECTORY | O_CREAT causes O_DIRECTORY to be ignored.
5076 #: build/C/man2/open.2:319
5078 "If I<pathname> is not a directory, cause the open to fail. This flag is "
5079 "Linux-specific, and was added in kernel version 2.1.126, to avoid "
5080 "denial-of-service problems if B<opendir>(3) is called on a FIFO or tape "
5085 #: build/C/man2/open.2:319
5091 #: build/C/man2/open.2:329
5093 "Ensure that this call creates the file: if this flag is specified in "
5094 "conjunction with B<O_CREAT>, and I<pathname> already exists, then B<open>() "
5098 #. POSIX.1-2001 explicitly requires this behavior.
5100 #: build/C/man2/open.2:337
5102 "When these two flags are specified, symbolic links are not followed: if "
5103 "I<pathname> is a symbolic link, then B<open>() fails regardless of where "
5104 "the symbolic link points to."
5108 #: build/C/man2/open.2:353
5110 "In general, the behavior of B<O_EXCL> is undefined if it is used without "
5111 "B<O_CREAT>. There is one exception: on Linux 2.6 and later, B<O_EXCL> can "
5112 "be used without B<O_CREAT> if I<pathname> refers to a block device. If the "
5113 "block device is in use by the system (e.g., mounted), B<open>() fails with "
5114 "the error B<EBUSY>."
5118 #: build/C/man2/open.2:375
5120 "On NFS, B<O_EXCL> is supported only when using NFSv3 or later on kernel 2.6 "
5121 "or later. In NFS environments where B<O_EXCL> support is not provided, "
5122 "programs that rely on it for performing locking tasks will contain a race "
5123 "condition. Portable programs that want to perform atomic file locking using "
5124 "a lockfile, and need to avoid reliance on NFS support for B<O_EXCL>, can "
5125 "create a unique file on the same filesystem (e.g., incorporating hostname "
5126 "and PID), and use B<link>(2) to make a link to the lockfile. If B<link>(2) "
5127 "returns 0, the lock is successful. Otherwise, use B<stat>(2) on the unique "
5128 "file to check if its link count has increased to 2, in which case the lock "
5129 "is also successful."
5133 #: build/C/man2/open.2:375
5135 msgid "B<O_LARGEFILE>"
5139 #: build/C/man2/open.2:397
5141 "(LFS) Allow files whose sizes cannot be represented in an I<off_t> (but can "
5142 "be represented in an I<off64_t>) to be opened. The B<_LARGEFILE64_SOURCE> "
5143 "macro must be defined (before including I<any> header files) in order to "
5144 "obtain this definition. Setting the B<_FILE_OFFSET_BITS> feature test macro "
5145 "to 64 (rather than using B<O_LARGEFILE>) is the preferred method of "
5146 "accessing large files on 32-bit systems (see B<feature_test_macros>(7))."
5150 #: build/C/man2/open.2:397
5152 msgid "B<O_NOATIME> (Since Linux 2.6.8)"
5155 #. The O_NOATIME flag also affects the treatment of st_atime
5156 #. by mmap() and readdir(2), MTK, Dec 04.
5158 #: build/C/man2/open.2:410
5160 "Do not update the file last access time (I<st_atime> in the inode) when the "
5161 "file is B<read>(2). This flag is intended for use by indexing or backup "
5162 "programs, where its use can significantly reduce the amount of disk "
5163 "activity. This flag may not be effective on all filesystems. One example "
5164 "is NFS, where the server maintains the access time."
5168 #: build/C/man2/open.2:410
5174 #: build/C/man2/open.2:418
5176 "If I<pathname> refers to a terminal device\\(emsee B<tty>(4)\\(emit will not "
5177 "become the process's controlling terminal even if the process does not have "
5182 #: build/C/man2/open.2:418
5184 msgid "B<O_NOFOLLOW>"
5187 #. The headers from glibc 2.0.100 and later include a
5188 #. definition of this flag; \fIkernels before 2.1.126 will ignore it if
5191 #: build/C/man2/open.2:430
5193 "If I<pathname> is a symbolic link, then the open fails. This is a FreeBSD "
5194 "extension, which was added to Linux in version 2.1.126. Symbolic links in "
5195 "earlier components of the pathname will still be followed. See also "
5196 "B<O_NOPATH> below."
5200 #: build/C/man2/open.2:430
5202 msgid "B<O_NONBLOCK> or B<O_NDELAY>"
5206 #: build/C/man2/open.2:443
5208 "When possible, the file is opened in nonblocking mode. Neither the "
5209 "B<open>() nor any subsequent operations on the file descriptor which is "
5210 "returned will cause the calling process to wait. For the handling of FIFOs "
5211 "(named pipes), see also B<fifo>(7). For a discussion of the effect of "
5212 "B<O_NONBLOCK> in conjunction with mandatory file locks and with file leases, "
5217 #: build/C/man2/open.2:443
5219 msgid "B<O_PATH> (since Linux 2.6.39)"
5222 #. commit 1abf0c718f15a56a0a435588d1b104c7a37dc9bd
5223 #. commit 326be7b484843988afe57566b627fb7a70beac56
5224 #. commit 65cfc6722361570bfe255698d9cd4dccaf47570d
5226 #. http://thread.gmane.org/gmane.linux.man/2790/focus=3496
5227 #. Subject: Re: [PATCH] open(2): document O_PATH
5228 #. Newsgroups: gmane.linux.man, gmane.linux.kernel
5230 #: build/C/man2/open.2:465
5232 "Obtain a file descriptor that can be used for two purposes: to indicate a "
5233 "location in the filesystem tree and to perform operations that act purely at "
5234 "the file descriptor level. The file itself is not opened, and other file "
5235 "operations (e.g., B<read>(2), B<write>(2), B<fchmod>(2), B<fchown>(2), "
5236 "B<fgetxattr>(2), B<mmap>(2)) fail with the error B<EBADF>."
5240 #: build/C/man2/open.2:469
5242 "The following operations I<can> be performed on the resulting file "
5246 #. commit 332a2e1244bd08b9e3ecd378028513396a004a24
5247 #. fstat(): commit 55815f70147dcfa3ead5738fd56d3574e2e3c1c2
5249 #: build/C/man2/open.2:478
5251 "B<close>(2); B<fchdir>(2) (since Linux 3.5); B<fstat>(2) (since Linux "
5256 #: build/C/man2/open.2:484
5257 msgid "Duplicating the file descriptor (B<dup>(2), B<fcntl>(2) B<F_DUPFD>, etc.)."
5261 #: build/C/man2/open.2:490
5263 "Getting and setting file descriptor flags (B<fcntl>(2) B<F_GETFD> and "
5268 #: build/C/man2/open.2:496
5270 "Retrieving open file status flags using the B<fcntl>(2) B<F_GETFL> "
5271 "operation: the returned flags will include the bit B<O_PATH>."
5275 #: build/C/man2/open.2:503
5277 "Passing the file descriptor as the I<dirfd> argument of B<openat>(2) and "
5278 "the other \"*at()\" system calls."
5282 #: build/C/man2/open.2:509
5284 "Passing the file descriptor to another process via a UNIX domain socket (see "
5285 "B<SCM_RIGHTS> in B<unix>(7))."
5289 #: build/C/man2/open.2:520
5291 "When B<O_PATH> is specified in I<flags>, flag bits other than B<O_DIRECTORY> "
5292 "and B<O_NOFOLLOW> are ignored."
5296 #: build/C/man2/open.2:534
5298 "If the B<O_NOFOLLOW> flag is also specified, then the call returns a file "
5299 "descriptor referring to the symbolic link. This file descriptor can be used "
5300 "as the I<dirfd> argument in calls to B<fchownat>(2), B<fstatat>(2), "
5301 "B<linkat>(2), and B<readlinkat>(2) with an empty pathname to have the calls "
5302 "operate on the symbolic link."
5306 #: build/C/man2/open.2:534
5312 #: build/C/man2/open.2:542
5314 "The file is opened for synchronous I/O. Any B<write>(2)s on the resulting "
5315 "file descriptor will block the calling process until the data has been "
5316 "physically written to the underlying hardware. I<But see NOTES below>."
5320 #: build/C/man2/open.2:542
5326 #: build/C/man2/open.2:556
5328 "If the file already exists and is a regular file and the open mode allows "
5329 "writing (i.e., is B<O_RDWR> or B<O_WRONLY>) it will be truncated to length "
5330 "0. If the file is a FIFO or terminal device file, the B<O_TRUNC> flag is "
5331 "ignored. Otherwise the effect of B<O_TRUNC> is unspecified."
5335 #: build/C/man2/open.2:560
5337 "Some of these optional flags can be altered using B<fcntl>(2) after the "
5338 "file has been opened."
5342 #: build/C/man2/open.2:568
5344 "B<creat>() is equivalent to B<open>() with I<flags> equal to "
5345 "B<O_CREAT|O_WRONLY|O_TRUNC>."
5349 #: build/C/man2/open.2:576
5351 "B<open>() and B<creat>() return the new file descriptor, or -1 if an error "
5352 "occurred (in which case, I<errno> is set appropriately)."
5356 #: build/C/man2/open.2:586
5358 "The requested access to the file is not allowed, or search permission is "
5359 "denied for one of the directories in the path prefix of I<pathname>, or the "
5360 "file did not exist yet and write access to the parent directory is not "
5361 "allowed. (See also B<path_resolution>(7).)"
5365 #: build/C/man2/open.2:592
5367 "Where B<O_CREAT> is specified, the file does not exist, and the user's quota "
5368 "of disk blocks or inodes on the filesystem has been exhausted."
5372 #: build/C/man2/open.2:598
5373 msgid "I<pathname> already exists and B<O_CREAT> and B<O_EXCL> were used."
5377 #: build/C/man2/open.2:602 build/C/man2/rmdir.2:67 build/C/man2/unlink.2:84
5378 msgid "I<pathname> points outside your accessible address space."
5382 #: build/C/man2/open.2:602 build/C/man2/write.2:145
5388 #: build/C/man2/open.2:606
5389 msgid "See B<EOVERFLOW>."
5393 #: build/C/man2/open.2:606 build/C/man2/read.2:122 build/C/man3/scanf.3:561 build/C/man3/tmpfile.3:63 build/C/man2/write.2:150
5399 #: build/C/man2/open.2:613
5401 "While blocked waiting to complete an open of a slow device (e.g., a FIFO; "
5402 "see B<fifo>(7)), the call was interrupted by a signal handler; see "
5407 #: build/C/man2/open.2:620
5409 "The filesystem does not support the B<O_DIRECT> flag. See B<NOTES> for more "
5414 #: build/C/man2/open.2:620 build/C/man2/read.2:158 build/C/man2/rename.2:143 build/C/man2/unlink.2:87
5420 #: build/C/man2/open.2:629
5422 "I<pathname> refers to a directory and the access requested involved writing "
5423 "(that is, B<O_WRONLY> or B<O_RDWR> is set)."
5427 #: build/C/man2/open.2:636
5429 "Too many symbolic links were encountered in resolving I<pathname>, or "
5430 "B<O_NOFOLLOW> was specified but I<pathname> was a symbolic link."
5434 #: build/C/man2/open.2:636 build/C/man2/pipe.2:107 build/C/man3/tmpfile.3:66
5440 #: build/C/man2/open.2:639
5441 msgid "The process already has the maximum number of files open."
5445 #: build/C/man2/open.2:643 build/C/man2/rmdir.2:80 build/C/man2/unlink.2:99
5446 msgid "I<pathname> was too long."
5450 #: build/C/man2/open.2:643 build/C/man2/pipe.2:110 build/C/man3/tmpfile.3:69
5456 #: build/C/man2/open.2:646 build/C/man2/pipe.2:113
5457 msgid "The system limit on the total number of open files has been reached."
5461 #: build/C/man2/open.2:646
5467 #: build/C/man2/open.2:653
5469 "I<pathname> refers to a device special file and no corresponding device "
5470 "exists. (This is a Linux kernel bug; in this situation B<ENXIO> must be "
5475 #: build/C/man2/open.2:660
5477 "B<O_CREAT> is not set and the named file does not exist. Or, a directory "
5478 "component in I<pathname> does not exist or is a dangling symbolic link."
5482 #: build/C/man2/open.2:669
5484 "I<pathname> was to be created but the device containing I<pathname> has no "
5485 "room for the new file."
5489 #: build/C/man2/open.2:676
5491 "A component used as a directory in I<pathname> is not, in fact, a directory, "
5492 "or B<O_DIRECTORY> was specified and I<pathname> was not a directory."
5496 #: build/C/man2/open.2:682
5498 "B<O_NONBLOCK> | B<O_WRONLY> is set, the named file is a FIFO and no process "
5499 "has the file open for reading. Or, the file is a device special file and no "
5500 "corresponding device exists."
5503 #. See http://bugzilla.kernel.org/show_bug.cgi?id=7253
5504 #. "Open of a large file on 32-bit fails with EFBIG, should be EOVERFLOW"
5505 #. Reported 2006-10-03
5507 #: build/C/man2/open.2:702
5509 "I<pathname> refers to a regular file that is too large to be opened. The "
5510 "usual scenario here is that an application compiled on a 32-bit platform "
5511 "without I<-D_FILE_OFFSET_BITS=64> tried to open a file whose size exceeds "
5512 "I<(2E<lt>E<lt>31)-1> bits; see also B<O_LARGEFILE> above. This is the error "
5513 "specified by POSIX.1-2001; in kernels before 2.6.24, Linux gave the error "
5514 "B<EFBIG> for this case."
5517 #. Strictly speaking, it's the filesystem UID... (MTK)
5519 #: build/C/man2/open.2:710
5521 "The B<O_NOATIME> flag was specified, but the effective user ID of the caller "
5522 "did not match the owner of the file and the caller was not privileged "
5527 #: build/C/man2/open.2:715
5529 "I<pathname> refers to a file on a read-only filesystem and write access was "
5534 #: build/C/man2/open.2:715
5540 #: build/C/man2/open.2:720
5542 "I<pathname> refers to an executable image which is currently being executed "
5543 "and write access was requested."
5547 #: build/C/man2/open.2:720
5549 msgid "B<EWOULDBLOCK>"
5553 #: build/C/man2/open.2:727
5555 "The B<O_NONBLOCK> flag was specified, and an incompatible lease was held on "
5556 "the file (see B<fcntl>(2))."
5560 #: build/C/man2/open.2:741
5562 "SVr4, 4.3BSD, POSIX.1-2001. The B<O_DIRECTORY>, B<O_NOATIME>, "
5563 "B<O_NOFOLLOW>, and B<O_PATH> flags are Linux-specific, and one may need to "
5564 "define B<_GNU_SOURCE> (before including I<any> header files) to obtain "
5565 "their definitions."
5569 #: build/C/man2/open.2:746
5571 "The B<O_CLOEXEC> flag is not specified in POSIX.1-2001, but is specified in "
5576 #: build/C/man2/open.2:754
5578 "B<O_DIRECT> is not specified in POSIX; one has to define B<_GNU_SOURCE> "
5579 "(before including I<any> header files) to get its definition."
5583 #: build/C/man2/open.2:762
5585 "Under Linux, the B<O_NONBLOCK> flag indicates that one wants to open but "
5586 "does not necessarily have the intention to read or write. This is typically "
5587 "used to open devices in order to get a file descriptor for use with "
5591 #. See for example util-linux's disk-utils/setfdprm.c
5592 #. For some background on access mode 3, see
5593 #. http://thread.gmane.org/gmane.linux.kernel/653123
5594 #. "[RFC] correct flags to f_mode conversion in __dentry_open"
5595 #. LKML, 12 Mar 2008
5597 #: build/C/man2/open.2:791
5599 "Unlike the other values that can be specified in I<flags>, the I<access "
5600 "mode> values B<O_RDONLY>, B<O_WRONLY>, and B<O_RDWR>, do not specify "
5601 "individual bits. Rather, they define the low order two bits of I<flags>, "
5602 "and are defined respectively as 0, 1, and 2. In other words, the "
5603 "combination B<O_RDONLY | O_WRONLY> is a logical error, and certainly does "
5604 "not have the same meaning as B<O_RDWR>. Linux reserves the special, "
5605 "nonstandard access mode 3 (binary 11) in I<flags> to mean: check for read "
5606 "and write permission on the file and return a descriptor that can't be used "
5607 "for reading or writing. This nonstandard access mode is used by some Linux "
5608 "drivers to return a descriptor that is to be used only for device-specific "
5609 "B<ioctl>(2) operations."
5612 #. Linux 2.0, 2.5: truncate
5613 #. Solaris 5.7, 5.8: truncate
5614 #. Irix 6.5: truncate
5615 #. Tru64 5.1B: truncate
5616 #. HP-UX 11.22: truncate
5617 #. FreeBSD 4.7: truncate
5619 #: build/C/man2/open.2:802
5621 "The (undefined) effect of B<O_RDONLY | O_TRUNC> varies among "
5622 "implementations. On many systems the file is actually truncated."
5626 #: build/C/man2/open.2:806
5628 "There are many infelicities in the protocol underlying NFS, affecting "
5629 "amongst others B<O_SYNC> and B<O_NDELAY>."
5633 #: build/C/man2/open.2:828
5635 "POSIX provides for three different variants of synchronized I/O, "
5636 "corresponding to the flags B<O_SYNC>, B<O_DSYNC>, and B<O_RSYNC>. Currently "
5637 "(2.6.31), Linux implements only B<O_SYNC>, but glibc maps B<O_DSYNC> and "
5638 "B<O_RSYNC> to the same numerical value as B<O_SYNC>. Most Linux filesystems "
5639 "don't actually implement the POSIX B<O_SYNC> semantics, which require all "
5640 "metadata updates of a write to be on disk on returning to user space, but "
5641 "only the B<O_DSYNC> semantics, which require only actual file data and "
5642 "metadata necessary to retrieve it to be on disk by the time the system call "
5647 #: build/C/man2/open.2:836
5649 "Note that B<open>() can open device special files, but B<creat>() cannot "
5650 "create them; use B<mknod>(2) instead."
5654 #: build/C/man2/open.2:849
5656 "On NFS filesystems with UID mapping enabled, B<open>() may return a file "
5657 "descriptor but, for example, B<read>(2) requests are denied with "
5658 "B<EACCES>. This is because the client performs B<open>() by checking the "
5659 "permissions, but UID mapping is performed by the server upon read and write "
5664 #: build/C/man2/open.2:868
5666 "If the file is newly created, its I<st_atime>, I<st_ctime>, I<st_mtime> "
5667 "fields (respectively, time of last access, time of last status change, and "
5668 "time of last modification; see B<stat>(2)) are set to the current time, and "
5669 "so are the I<st_ctime> and I<st_mtime> fields of the parent directory. "
5670 "Otherwise, if the file is modified because of the B<O_TRUNC> flag, its "
5671 "st_ctime and st_mtime fields are set to the current time."
5675 #: build/C/man2/open.2:868
5681 #: build/C/man2/open.2:885
5683 "The B<O_DIRECT> flag may impose alignment restrictions on the length and "
5684 "address of user-space buffers and the file offset of I/Os. In Linux "
5685 "alignment restrictions vary by filesystem and kernel version and might be "
5686 "absent entirely. However there is currently no filesystem-independent "
5687 "interface for an application to discover these restrictions for a given file "
5688 "or filesystem. Some filesystems provide their own interfaces for doing so, "
5689 "for example the B<XFS_IOC_DIOINFO> operation in B<xfsctl>(3)."
5693 #: build/C/man2/open.2:890
5695 "Under Linux 2.4, transfer sizes, and the alignment of the user buffer and "
5696 "the file offset must all be multiples of the logical block size of the "
5697 "filesystem. Under Linux 2.6, alignment to 512-byte boundaries suffices."
5701 #: build/C/man2/open.2:924
5703 "B<O_DIRECT> I/Os should never be run concurrently with the B<fork>(2) "
5704 "system call, if the memory buffer is a private mapping (i.e., any mapping "
5705 "created with the B<mmap>(2) B<MAP_PRIVATE> flag; this includes memory "
5706 "allocated on the heap and statically allocated buffers). Any such I/Os, "
5707 "whether submitted via an asynchronous I/O interface or from another thread "
5708 "in the process, should be completed before B<fork>(2) is called. Failure "
5709 "to do so can result in data corruption and undefined behavior in parent and "
5710 "child processes. This restriction does not apply when the memory buffer for "
5711 "the B<O_DIRECT> I/Os was created using B<shmat>(2) or B<mmap>(2) with the "
5712 "B<MAP_SHARED> flag. Nor does this restriction apply when the memory buffer "
5713 "has been advised as B<MADV_DONTFORK> with B<madvise>(2), ensuring that it "
5714 "will not be available to the child after B<fork>(2)."
5718 #: build/C/man2/open.2:934
5720 "The B<O_DIRECT> flag was introduced in SGI IRIX, where it has alignment "
5721 "restrictions similar to those of Linux 2.4. IRIX has also a B<fcntl>(2) "
5722 "call to query appropriate alignments, and sizes. FreeBSD 4.x introduced a "
5723 "flag of the same name, but without alignment restrictions."
5727 #: build/C/man2/open.2:943
5729 "B<O_DIRECT> support was added under Linux in kernel version 2.4.10. Older "
5730 "Linux kernels simply ignore this flag. Some filesystems may not implement "
5731 "the flag and B<open>() will fail with B<EINVAL> if it is used."
5735 #: build/C/man2/open.2:954
5737 "Applications should avoid mixing B<O_DIRECT> and normal I/O to the same "
5738 "file, and especially to overlapping byte regions in the same file. Even "
5739 "when the filesystem correctly handles the coherency issues in this "
5740 "situation, overall I/O throughput is likely to be slower than using either "
5741 "mode alone. Likewise, applications should avoid mixing B<mmap>(2) of files "
5742 "with direct I/O to the same files."
5746 #: build/C/man2/open.2:976
5748 "The behaviour of B<O_DIRECT> with NFS will differ from local filesystems. "
5749 "Older kernels, or kernels configured in certain ways, may not support this "
5750 "combination. The NFS protocol does not support passing the flag to the "
5751 "server, so B<O_DIRECT> I/O will bypass the page cache only on the client; "
5752 "the server may still cache the I/O. The client asks the server to make the "
5753 "I/O synchronous to preserve the synchronous semantics of B<O_DIRECT>. Some "
5754 "servers will perform poorly under these circumstances, especially if the I/O "
5755 "size is small. Some servers may also be configured to lie to clients about "
5756 "the I/O having reached stable storage; this will avoid the performance "
5757 "penalty at some risk to data integrity in the event of server power "
5758 "failure. The Linux NFS client places no alignment restrictions on "
5763 #: build/C/man2/open.2:983
5765 "In summary, B<O_DIRECT> is a potentially powerful tool that should be used "
5766 "with caution. It is recommended that applications treat use of B<O_DIRECT> "
5767 "as a performance option which is disabled by default."
5771 #: build/C/man2/open.2:988
5773 "\"The thing that has always disturbed me about O_DIRECT is that the whole "
5774 "interface is just stupid, and was probably designed by a deranged monkey on "
5775 "some serious mind-controlling substances.\"\\(emLinus"
5778 #. FIXME . Check bugzilla report on open(O_ASYNC)
5779 #. See http://bugzilla.kernel.org/show_bug.cgi?id=5993
5781 #: build/C/man2/open.2:1000
5783 "Currently, it is not possible to enable signal-driven I/O by specifying "
5784 "B<O_ASYNC> when calling B<open>(); use B<fcntl>(2) to enable this flag."
5788 #: build/C/man2/open.2:1022
5790 "B<chmod>(2), B<chown>(2), B<close>(2), B<dup>(2), B<fcntl>(2), B<link>(2), "
5791 "B<lseek>(2), B<mknod>(2), B<mmap>(2), B<mount>(2), B<openat>(2), B<read>(2), "
5792 "B<socket>(2), B<stat>(2), B<umask>(2), B<unlink>(2), B<write>(2), "
5793 "B<fopen>(3), B<fifo>(7), B<path_resolution>(7), B<symlink>(7)"
5797 #: build/C/man3/perror.3:31
5803 #: build/C/man3/perror.3:31
5809 #: build/C/man3/perror.3:34
5810 msgid "perror - print a system error message"
5814 #: build/C/man3/perror.3:38
5815 msgid "B<void perror(const char *>I<s>B<);>"
5819 #: build/C/man3/perror.3:40
5820 msgid "B<#include E<lt>errno.hE<gt>>"
5824 #: build/C/man3/perror.3:42
5825 msgid "B<const char *>I<sys_errlist>B<[];>"
5829 #: build/C/man3/perror.3:44
5830 msgid "B<int >I<sys_nerr>B<;>"
5834 #: build/C/man3/perror.3:46
5835 msgid "B<int >I<errno>B<;>"
5839 #: build/C/man3/perror.3:55
5840 msgid "I<sys_errlist>, I<sys_nerr>: _BSD_SOURCE"
5844 #: build/C/man3/perror.3:68
5846 "The routine B<perror>() produces a message on the standard error output, "
5847 "describing the last error encountered during a call to a system or library "
5848 "function. First (if I<s> is not NULL and I<*s> is not a null byte "
5849 "(\\(aq\\e0\\(aq)) the argument string I<s> is printed, followed by a colon "
5850 "and a blank. Then the message and a new-line."
5854 #: build/C/man3/perror.3:76
5856 "To be of most use, the argument string should include the name of the "
5857 "function that incurred the error. The error number is taken from the "
5858 "external variable I<errno>, which is set when errors occur but not cleared "
5859 "when successful calls are made."
5863 #: build/C/man3/perror.3:90
5865 "The global error list I<sys_errlist>[] indexed by I<errno> can be used to "
5866 "obtain the error message without the newline. The largest message number "
5867 "provided in the table is I<sys_nerr>-1. Be careful when directly accessing "
5868 "this list because new error values may not have been added to "
5869 "I<sys_errlist>[]. The use of I<sys_errlist>[] is nowadays deprecated."
5873 #: build/C/man3/perror.3:111
5875 "When a system call fails, it usually returns -1 and sets the variable "
5876 "I<errno> to a value describing what went wrong. (These values can be found "
5877 "in I<E<lt>errno.hE<gt>>.) Many library functions do likewise. The function "
5878 "B<perror>() serves to translate this error code into human-readable form. "
5879 "Note that I<errno> is undefined after a successful library call: this call "
5880 "may well change this variable, even though it succeeds, for example because "
5881 "it internally used some other library function that failed. Thus, if a "
5882 "failing call is not immediately followed by a call to B<perror>(), the value "
5883 "of I<errno> should be saved."
5887 #: build/C/man3/perror.3:124
5889 "The function B<perror>() and the external I<errno> (see B<errno>(3)) "
5890 "conform to C89, C99, 4.3BSD, POSIX.1-2001. The externals I<sys_nerr> and "
5891 "I<sys_errlist> conform to BSD."
5894 #. and only when _BSD_SOURCE is defined.
5897 #. is defined, the symbols
5903 #: build/C/man3/perror.3:139
5905 "The externals I<sys_nerr> and I<sys_errlist> are defined by glibc, but in "
5906 "I<E<lt>stdio.hE<gt>>."
5910 #: build/C/man3/perror.3:144
5911 msgid "B<err>(3), B<errno>(3), B<error>(3), B<strerror>(3)"
5915 #: build/C/man2/pipe.2:36
5921 #: build/C/man2/pipe.2:36
5927 #: build/C/man2/pipe.2:39
5928 msgid "pipe, pipe2 - create pipe"
5932 #: build/C/man2/pipe.2:42 build/C/man2/read.2:41
5934 msgid "B<#include E<lt>unistd.hE<gt>>\n"
5938 #: build/C/man2/pipe.2:44
5940 msgid "B<int pipe(int >I<pipefd>B<[2]);>\n"
5944 #: build/C/man2/pipe.2:48
5947 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
5948 "B<#include E<lt>fcntl.hE<gt>> /* Obtain O_* constant "
5950 "B<#include E<lt>unistd.hE<gt>>\n"
5954 #: build/C/man2/pipe.2:50
5956 msgid "B<int pipe2(int >I<pipefd>B<[2], int >I<flags>B<);>\n"
5960 #: build/C/man2/pipe.2:66
5962 "B<pipe>() creates a pipe, a unidirectional data channel that can be used "
5963 "for interprocess communication. The array I<pipefd> is used to return two "
5964 "file descriptors referring to the ends of the pipe. I<pipefd[0]> refers to "
5965 "the read end of the pipe. I<pipefd[1]> refers to the write end of the "
5966 "pipe. Data written to the write end of the pipe is buffered by the kernel "
5967 "until it is read from the read end of the pipe. For further details, see "
5972 #: build/C/man2/pipe.2:76
5974 "If I<flags> is 0, then B<pipe2>() is the same as B<pipe>(). The following "
5975 "values can be bitwise ORed in I<flags> to obtain different behavior:"
5979 #: build/C/man2/pipe.2:76
5981 msgid "B<O_NONBLOCK>"
5985 #: build/C/man2/pipe.2:84
5987 "Set the B<O_NONBLOCK> file status flag on the two new open file "
5988 "descriptions. Using this flag saves extra calls to B<fcntl>(2) to achieve "
5993 #: build/C/man2/pipe.2:84
5995 msgid "B<O_CLOEXEC>"
5999 #: build/C/man2/pipe.2:92
6001 "Set the close-on-exec (B<FD_CLOEXEC>) flag on the two new file "
6002 "descriptors. See the description of the same flag in B<open>(2) for "
6003 "reasons why this may be useful."
6007 #: build/C/man2/pipe.2:102
6008 msgid "I<pipefd> is not valid."
6012 #: build/C/man2/pipe.2:107
6013 msgid "(B<pipe2>()) Invalid value in I<flags>."
6017 #: build/C/man2/pipe.2:110
6018 msgid "Too many file descriptors are in use by the process."
6022 #: build/C/man2/pipe.2:118
6024 "B<pipe2>() was added to Linux in version 2.6.27; glibc support is available "
6025 "starting with version 2.9."
6029 #: build/C/man2/pipe.2:121
6030 msgid "B<pipe>(): POSIX.1-2001."
6034 #: build/C/man2/pipe.2:124
6035 msgid "B<pipe2>() is Linux-specific."
6038 #. fork.2 refers to this example program.
6040 #: build/C/man2/pipe.2:140
6042 "The following program creates a pipe, and then B<fork>(2)s to create a child "
6043 "process; the child inherits a duplicate set of file descriptors that refer "
6044 "to the same pipe. After the B<fork>(2), each process closes the descriptors "
6045 "that it doesn't need for the pipe (see B<pipe>(7)). The parent then writes "
6046 "the string contained in the program's command-line argument to the pipe, and "
6047 "the child reads this string a byte at a time from the pipe and echoes it on "
6052 #: build/C/man2/pipe.2:147
6055 "#include E<lt>sys/wait.hE<gt>\n"
6056 "#include E<lt>stdio.hE<gt>\n"
6057 "#include E<lt>stdlib.hE<gt>\n"
6058 "#include E<lt>unistd.hE<gt>\n"
6059 "#include E<lt>string.hE<gt>\n"
6063 #: build/C/man2/pipe.2:154
6067 "main(int argc, char *argv[])\n"
6075 #: build/C/man2/pipe.2:159
6078 " if (argc != 2) {\n"
6079 "\tfprintf(stderr, \"Usage: %s E<lt>stringE<gt>\\en\", argv[0]);\n"
6080 "\texit(EXIT_FAILURE);\n"
6085 #: build/C/man2/pipe.2:164
6088 " if (pipe(pipefd) == -1) {\n"
6089 " perror(\"pipe\");\n"
6090 " exit(EXIT_FAILURE);\n"
6095 #: build/C/man2/pipe.2:170
6099 " if (cpid == -1) {\n"
6100 " perror(\"fork\");\n"
6101 " exit(EXIT_FAILURE);\n"
6106 #: build/C/man2/pipe.2:173
6109 " if (cpid == 0) { /* Child reads from pipe */\n"
6110 " close(pipefd[1]); /* Close unused write end */\n"
6114 #: build/C/man2/pipe.2:176
6117 " while (read(pipefd[0], &buf, 1) E<gt> 0)\n"
6118 " write(STDOUT_FILENO, &buf, 1);\n"
6122 #: build/C/man2/pipe.2:180
6125 " write(STDOUT_FILENO, \"\\en\", 1);\n"
6126 " close(pipefd[0]);\n"
6127 " _exit(EXIT_SUCCESS);\n"
6131 #: build/C/man2/pipe.2:189
6134 " } else { /* Parent writes argv[1] to pipe */\n"
6135 " close(pipefd[0]); /* Close unused read end */\n"
6136 " write(pipefd[1], argv[1], strlen(argv[1]));\n"
6137 " close(pipefd[1]); /* Reader will see EOF */\n"
6138 " wait(NULL); /* Wait for child */\n"
6139 " exit(EXIT_SUCCESS);\n"
6145 #: build/C/man2/pipe.2:197
6147 "B<fork>(2), B<read>(2), B<socketpair>(2), B<write>(2), B<popen>(3), "
6152 #: build/C/man3/popen.3:40
6158 #: build/C/man3/popen.3:43
6159 msgid "popen, pclose - pipe stream to or from a process"
6163 #: build/C/man3/popen.3:48
6165 msgid "B<FILE *popen(const char *>I<command>B<, const char *>I<type>B<);>\n"
6169 #: build/C/man3/popen.3:50
6171 msgid "B<int pclose(FILE *>I<stream>B<);>\n"
6175 #: build/C/man3/popen.3:60
6176 msgid "B<popen>(), B<pclose>():"
6180 #: build/C/man3/popen.3:62
6181 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 2 || _XOPEN_SOURCE || _BSD_SOURCE || _SVID_SOURCE"
6185 #: build/C/man3/popen.3:73
6187 "The B<popen>() function opens a process by creating a pipe, forking, and "
6188 "invoking the shell. Since a pipe is by definition unidirectional, the "
6189 "I<type> argument may specify only reading or writing, not both; the "
6190 "resulting stream is correspondingly read-only or write-only."
6194 #: build/C/man3/popen.3:97
6196 "The I<command> argument is a pointer to a null-terminated string containing "
6197 "a shell command line. This command is passed to I</bin/sh> using the B<-c> "
6198 "flag; interpretation, if any, is performed by the shell. The I<type> "
6199 "argument is a pointer to a null-terminated string which must contain either "
6200 "the letter \\(aqr\\(aq for reading or the letter \\(aqw\\(aq for writing. "
6201 "Since glibc 2.9, this argument can additionally include the letter "
6202 "\\(aqe\\(aq, which causes the close-on-exec flag (B<FD_CLOEXEC>) to be set "
6203 "on the underlying file descriptor; see the description of the B<O_CLOEXEC> "
6204 "flag in B<open>(2) for reasons why this may be useful."
6208 #: build/C/man3/popen.3:113
6210 "The return value from B<popen>() is a normal standard I/O stream in all "
6211 "respects save that it must be closed with B<pclose>() rather than "
6212 "B<fclose>(3). Writing to such a stream writes to the standard input of the "
6213 "command; the command's standard output is the same as that of the process "
6214 "that called B<popen>(), unless this is altered by the command itself. "
6215 "Conversely, reading from a \"popened\" stream reads the command's standard "
6216 "output, and the command's standard input is the same as that of the process "
6217 "that called B<popen>()."
6221 #: build/C/man3/popen.3:117
6222 msgid "Note that output B<popen>() streams are fully buffered by default."
6226 #: build/C/man3/popen.3:123
6228 "The B<pclose>() function waits for the associated process to terminate and "
6229 "returns the exit status of the command as returned by B<wait4>(2)."
6233 #: build/C/man3/popen.3:131
6235 "The B<popen>() function returns NULL if the B<fork>(2) or B<pipe>(2) "
6236 "calls fail, or if it cannot allocate memory."
6239 #. These conditions actually give undefined results, so I commented
6242 #. is not associated with a "popen()ed" command, if
6244 #. already "pclose()d", or if
6246 #: build/C/man3/popen.3:146
6248 "The B<pclose>() function returns -1 if B<wait4>(2) returns an error, or "
6249 "some other error is detected. In the event of an error, these functions set "
6250 "I<errno> to indicate the cause of the error."
6254 #: build/C/man3/popen.3:165
6256 "The B<popen>() function does not set I<errno> if memory allocation fails. "
6257 "If the underlying B<fork>(2) or B<pipe>(2) fails, I<errno> is set "
6258 "appropriately. If the I<type> argument is invalid, and this condition is "
6259 "detected, I<errno> is set to B<EINVAL>."
6263 #: build/C/man3/popen.3:172
6265 "If B<pclose>() cannot obtain the child status, I<errno> is set to "
6270 #: build/C/man3/popen.3:178
6271 msgid "The \\(aqe\\(aq value for I<type> is a Linux extension."
6275 #: build/C/man3/popen.3:191
6277 "Since the standard input of a command opened for reading shares its seek "
6278 "offset with the process that called B<popen>(), if the original process has "
6279 "done a buffered read, the command's input position may not be as expected. "
6280 "Similarly, the output from a command opened for writing may become "
6281 "intermingled with that of the original process. The latter can be avoided "
6282 "by calling B<fflush>(3) before B<popen>()."
6290 #. function appeared in Version 7 AT&T UNIX.
6292 #: build/C/man3/popen.3:201
6294 "Failure to execute the shell is indistinguishable from the shell's failure "
6295 "to execute command, or an immediate exit of the command. The only hint is "
6296 "an exit status of 127."
6300 #: build/C/man3/popen.3:211
6302 "B<sh>(1), B<fork>(2), B<pipe>(2), B<wait4>(2), B<fclose>(3), B<fflush>(3), "
6303 "B<fopen>(3), B<stdio>(3), B<system>(3)"
6307 #: build/C/man3/printf.3:34
6313 #: build/C/man3/printf.3:34
6319 #: build/C/man3/printf.3:38
6321 "printf, fprintf, sprintf, snprintf, vprintf, vfprintf, vsprintf, vsnprintf - "
6322 "formatted output conversion"
6326 #: build/C/man3/printf.3:42
6327 msgid "B<int printf(const char *>I<format>B<, ...);>"
6331 #: build/C/man3/printf.3:44
6332 msgid "B<int fprintf(FILE *>I<stream>B<, const char *>I<format>B<, ...);>"
6336 #: build/C/man3/printf.3:46
6337 msgid "B<int sprintf(char *>I<str>B<, const char *>I<format>B<, ...);>"
6341 #: build/C/man3/printf.3:48
6343 "B<int snprintf(char *>I<str>B<, size_t >I<size>B<, const char *>I<format>B<, "
6348 #: build/C/man3/printf.3:50
6349 msgid "B<#include E<lt>stdarg.hE<gt>>"
6353 #: build/C/man3/printf.3:52
6354 msgid "B<int vprintf(const char *>I<format>B<, va_list >I<ap>B<);>"
6358 #: build/C/man3/printf.3:54
6360 "B<int vfprintf(FILE *>I<stream>B<, const char *>I<format>B<, va_list "
6365 #: build/C/man3/printf.3:56
6367 "B<int vsprintf(char *>I<str>B<, const char *>I<format>B<, va_list "
6372 #: build/C/man3/printf.3:59
6374 "B<int vsnprintf(char *>I<str>B<, size_t >I<size>B<, const char "
6375 "*>I<format>B<, va_list >I<ap>B<);>"
6379 #: build/C/man3/printf.3:68
6380 msgid "B<snprintf>(), B<vsnprintf>():"
6384 #: build/C/man3/printf.3:71
6386 "_BSD_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _ISOC99_SOURCE || "
6387 "_POSIX_C_SOURCE\\ E<gt>=\\ 200112L;"
6391 #: build/C/man3/printf.3:74 build/C/man3/scanf.3:85
6392 msgid "or I<cc -std=c99>"
6396 #: build/C/man3/printf.3:101
6398 "The functions in the B<printf>() family produce output according to a "
6399 "I<format> as described below. The functions B<printf>() and B<vprintf>() "
6400 "write output to I<stdout>, the standard output stream; B<fprintf>() and "
6401 "B<vfprintf>() write output to the given output I<stream>; B<sprintf>(), "
6402 "B<snprintf>(), B<vsprintf>() and B<vsnprintf>() write to the character "
6407 #: build/C/man3/printf.3:110
6409 "The functions B<snprintf>() and B<vsnprintf>() write at most I<size> bytes "
6410 "(including the terminating null byte (\\(aq\\e0\\(aq)) to I<str>."
6414 #: build/C/man3/printf.3:134
6416 "The functions B<vprintf>(), B<vfprintf>(), B<vsprintf>(), B<vsnprintf>() "
6417 "are equivalent to the functions B<printf>(), B<fprintf>(), B<sprintf>(), "
6418 "B<snprintf>(), respectively, except that they are called with a I<va_list> "
6419 "instead of a variable number of arguments. These functions do not call the "
6420 "I<va_end> macro. Because they invoke the I<va_arg> macro, the value of "
6421 "I<ap> is undefined after the call. See B<stdarg>(3)."
6425 #: build/C/man3/printf.3:141
6427 "These eight functions write the output under the control of a I<format> "
6428 "string that specifies how subsequent arguments (or arguments accessed via "
6429 "the variable-length argument facilities of B<stdarg>(3)) are converted for "
6434 #: build/C/man3/printf.3:152
6436 "C99 and POSIX.1-2001 specify that the results are undefined if a call to "
6437 "B<sprintf>(), B<snprintf>(), B<vsprintf>(), or B<vsnprintf>() would cause "
6438 "copying to take place between objects that overlap (e.g., if the target "
6439 "string array and one of the supplied input arguments refer to the same "
6440 "buffer). See NOTES."
6444 #: build/C/man3/printf.3:152
6446 msgid "Return value"
6450 #: build/C/man3/printf.3:155
6452 "Upon successful return, these functions return the number of characters "
6453 "printed (excluding the null byte used to end output to strings)."
6457 #: build/C/man3/printf.3:171
6459 "The functions B<snprintf>() and B<vsnprintf>() do not write more than "
6460 "I<size> bytes (including the terminating null byte (\\(aq\\e0\\(aq)). If "
6461 "the output was truncated due to this limit then the return value is the "
6462 "number of characters (excluding the terminating null byte) which would have "
6463 "been written to the final string if enough space had been available. Thus, "
6464 "a return value of I<size> or more means that the output was truncated. (See "
6465 "also below under NOTES.)"
6469 #: build/C/man3/printf.3:173
6470 msgid "If an output error is encountered, a negative value is returned."
6474 #: build/C/man3/printf.3:173
6476 msgid "Format of the format string"
6480 #: build/C/man3/printf.3:195
6482 "The format string is a character string, beginning and ending in its initial "
6483 "shift state, if any. The format string is composed of zero or more "
6484 "directives: ordinary characters (not B<%>), which are copied unchanged to "
6485 "the output stream; and conversion specifications, each of which results in "
6486 "fetching zero or more subsequent arguments. Each conversion specification "
6487 "is introduced by the character B<%>, and ends with a I<conversion "
6488 "specifier>. In between there may be (in this order) zero or more I<flags>, "
6489 "an optional minimum I<field width>, an optional I<precision> and an optional "
6490 "I<length modifier>."
6494 #: build/C/man3/printf.3:208
6496 "The arguments must correspond properly (after type promotion) with the "
6497 "conversion specifier. By default, the arguments are used in the order "
6498 "given, where each \\(aq*\\(aq and each conversion specifier asks for the "
6499 "next argument (and it is an error if insufficiently many arguments are "
6500 "given). One can also specify explicitly which argument is taken, at each "
6501 "place where an argument is required, by writing \"%m$\" instead of "
6502 "\\(aq%\\(aq and \"*m$\" instead of \\(aq*\\(aq, where the decimal integer m "
6503 "denotes the position in the argument list of the desired argument, indexed "
6504 "starting from 1. Thus,"
6508 #: build/C/man3/printf.3:212
6510 msgid "printf(\"%*d\", width, num);\n"
6514 #: build/C/man3/printf.3:216
6519 #: build/C/man3/printf.3:220
6521 msgid "printf(\"%2$*1$d\", width, num);\n"
6525 #: build/C/man3/printf.3:236
6527 "are equivalent. The second style allows repeated references to the same "
6528 "argument. The C99 standard does not include the style using \\(aq$\\(aq, "
6529 "which comes from the Single UNIX Specification. If the style using "
6530 "\\(aq$\\(aq is used, it must be used throughout for all conversions taking "
6531 "an argument and all width and precision arguments, but it may be mixed with "
6532 "\"%%\" formats which do not consume an argument. There may be no gaps in "
6533 "the numbers of arguments specified using \\(aq$\\(aq; for example, if "
6534 "arguments 1 and 3 are specified, argument 2 must also be specified somewhere "
6535 "in the format string."
6539 #: build/C/man3/printf.3:246
6541 "For some numeric conversions a radix character (\"decimal point\") or "
6542 "thousands' grouping character is used. The actual character used depends on "
6543 "the B<LC_NUMERIC> part of the locale. The POSIX locale uses \\(aq.\\(aq as "
6544 "radix character, and does not have a grouping character. Thus,"
6548 #: build/C/man3/printf.3:250
6550 msgid " printf(\"%\\(aq.2f\", 1234567.89);\n"
6554 #: build/C/man3/printf.3:255
6556 "results in \"1234567.89\" in the POSIX locale, in \"1234567,89\" in the "
6557 "nl_NL locale, and in \"1.234.567,89\" in the da_DK locale."
6561 #: build/C/man3/printf.3:255
6563 msgid "The flag characters"
6567 #: build/C/man3/printf.3:257
6568 msgid "The character % is followed by zero or more of the following flags:"
6572 #: build/C/man3/printf.3:257
6578 #: build/C/man3/printf.3:291
6580 "The value should be converted to an \"alternate form\". For B<o> "
6581 "conversions, the first character of the output string is made zero (by "
6582 "prefixing a 0 if it was not zero already). For B<x> and B<X> conversions, a "
6583 "nonzero result has the string \"0x\" (or \"0X\" for B<X> conversions) "
6584 "prepended to it. For B<a>, B<A>, B<e>, B<E>, B<f>, B<F>, B<g>, and B<G> "
6585 "conversions, the result will always contain a decimal point, even if no "
6586 "digits follow it (normally, a decimal point appears in the results of those "
6587 "conversions only if a digit follows). For B<g> and B<G> conversions, "
6588 "trailing zeros are not removed from the result as they would otherwise be. "
6589 "For other conversions, the result is undefined."
6593 #: build/C/man3/printf.3:291
6599 #: build/C/man3/printf.3:331
6601 "The value should be zero padded. For B<d>, B<i>, B<o>, B<u>, B<x>, B<X>, "
6602 "B<a>, B<A>, B<e>, B<E>, B<f>, B<F>, B<g>, and B<G> conversions, the "
6603 "converted value is padded on the left with zeros rather than blanks. If the "
6604 "B<\\&0> and B<-> flags both appear, the B<\\&0> flag is ignored. If a "
6605 "precision is given with a numeric conversion (B<d>, B<i>, B<o>, B<u>, B<x>, "
6606 "and B<X>), the B<\\&0> flag is ignored. For other conversions, the behavior "
6611 #: build/C/man3/printf.3:331
6617 #: build/C/man3/printf.3:344
6619 "The converted value is to be left adjusted on the field boundary. (The "
6620 "default is right justification.) Except for B<n> conversions, the converted "
6621 "value is padded on the right with blanks, rather than on the left with "
6622 "blanks or zeros. A B<-> overrides a B<\\&0> if both are given."
6626 #: build/C/man3/printf.3:344
6628 msgid "B<\\(aq \\(aq>"
6632 #: build/C/man3/printf.3:348
6634 "(a space) A blank should be left before a positive number (or empty string) "
6635 "produced by a signed conversion."
6639 #: build/C/man3/printf.3:348
6645 #: build/C/man3/printf.3:356
6647 "A sign (+ or -) should always be placed before a number produced by a signed "
6648 "conversion. By default a sign is used only for negative numbers. A B<+> "
6649 "overrides a space if both are used."
6653 #: build/C/man3/printf.3:359
6655 "The five flag characters above are defined in the C standard. The SUSv2 "
6656 "specifies one further flag character."
6660 #: build/C/man3/printf.3:359
6666 #: build/C/man3/printf.3:376
6668 "For decimal conversion (B<i>, B<d>, B<u>, B<f>, B<F>, B<g>, B<G>) the "
6669 "output is to be grouped with thousands' grouping characters if the locale "
6670 "information indicates any. Note that many versions of B<gcc>(1) cannot "
6671 "parse this option and will issue a warning. SUSv2 does not include "
6676 #: build/C/man3/printf.3:378
6677 msgid "glibc 2.2 adds one further flag character."
6681 #: build/C/man3/printf.3:378
6686 #. outdigits keyword in locale file
6688 #: build/C/man3/printf.3:388
6690 "For decimal integer conversion (B<i>, B<d>, B<u>) the output uses the "
6691 "locale's alternative output digits, if any. For example, since glibc 2.2.3 "
6692 "this will give Arabic-Indic digits in the Persian (\"fa_IR\") locale."
6696 #: build/C/man3/printf.3:388
6698 msgid "The field width"
6702 #: build/C/man3/printf.3:404
6704 "An optional decimal digit string (with nonzero first digit) specifying a "
6705 "minimum field width. If the converted value has fewer characters than the "
6706 "field width, it will be padded with spaces on the left (or right, if the "
6707 "left-adjustment flag has been given). Instead of a decimal digit string one "
6708 "may write \"*\" or \"*m$\" (for some decimal integer I<m>) to specify that "
6709 "the field width is given in the next argument, or in the I<m>-th argument, "
6710 "respectively, which must be of type I<int>. A negative field width is taken "
6711 "as a \\(aq-\\(aq flag followed by a positive field width. In no case does a "
6712 "nonexistent or small field width cause truncation of a field; if the result "
6713 "of a conversion is wider than the field width, the field is expanded to "
6714 "contain the conversion result."
6718 #: build/C/man3/printf.3:404
6720 msgid "The precision"
6724 #: build/C/man3/printf.3:441
6726 "An optional precision, in the form of a period (\\(aq.\\(aq) followed by an "
6727 "optional decimal digit string. Instead of a decimal digit string one may "
6728 "write \"*\" or \"*m$\" (for some decimal integer m) to specify that the "
6729 "precision is given in the next argument, or in the m-th argument, "
6730 "respectively, which must be of type I<int>. If the precision is given as "
6731 "just \\(aq.\\(aq, the precision is taken to be zero. A negative precision "
6732 "is taken as if the precision were omitted. This gives the minimum number of "
6733 "digits to appear for B<d>, B<i>, B<o>, B<u>, B<x>, and B<X> conversions, the "
6734 "number of digits to appear after the radix character for B<a>, B<A>, B<e>, "
6735 "B<E>, B<f>, and B<F> conversions, the maximum number of significant digits "
6736 "for B<g> and B<G> conversions, or the maximum number of characters to be "
6737 "printed from a string for B<s> and B<S> conversions."
6741 #: build/C/man3/printf.3:441
6743 msgid "The length modifier"
6747 #: build/C/man3/printf.3:451
6749 "Here, \"integer conversion\" stands for B<d>, B<i>, B<o>, B<u>, B<x>, or "
6754 #: build/C/man3/printf.3:451 build/C/man3/scanf.3:294
6760 #: build/C/man3/printf.3:462
6762 "A following integer conversion corresponds to a I<signed char> or I<unsigned "
6763 "char> argument, or a following B<n> conversion corresponds to a pointer to a "
6764 "I<signed char> argument."
6768 #: build/C/man3/printf.3:462 build/C/man3/scanf.3:284
6774 #: build/C/man3/printf.3:473
6776 "A following integer conversion corresponds to a I<short int> or I<unsigned "
6777 "short int> argument, or a following B<n> conversion corresponds to a pointer "
6778 "to a I<short int> argument."
6782 #: build/C/man3/printf.3:473 build/C/man3/scanf.3:311
6788 #: build/C/man3/printf.3:492
6790 "(ell) A following integer conversion corresponds to a I<long int> or "
6791 "I<unsigned long int> argument, or a following B<n> conversion corresponds to "
6792 "a pointer to a I<long int> argument, or a following B<c> conversion "
6793 "corresponds to a I<wint_t> argument, or a following B<s> conversion "
6794 "corresponds to a pointer to I<wchar_t> argument."
6798 #: build/C/man3/printf.3:492
6804 #: build/C/man3/printf.3:504
6806 "(ell-ell). A following integer conversion corresponds to a I<long long int> "
6807 "or I<unsigned long long int> argument, or a following B<n> conversion "
6808 "corresponds to a pointer to a I<long long int> argument."
6812 #: build/C/man3/printf.3:504 build/C/man3/scanf.3:338
6818 #: build/C/man3/printf.3:520
6820 "A following B<a>, B<A>, B<e>, B<E>, B<f>, B<F>, B<g>, or B<G> conversion "
6821 "corresponds to a I<long double> argument. (C99 allows %LF, but SUSv2 does "
6826 #: build/C/man3/printf.3:520 build/C/man3/scanf.3:354
6832 #: build/C/man3/printf.3:526
6834 "(\"quad\". 4.4BSD and Linux libc5 only. Don't use.) This is a synonym for "
6839 #: build/C/man3/printf.3:526 build/C/man3/scanf.3:302
6845 #: build/C/man3/printf.3:533
6847 "A following integer conversion corresponds to an I<intmax_t> or I<uintmax_t> "
6852 #: build/C/man3/printf.3:533 build/C/man3/scanf.3:366
6858 #: build/C/man3/printf.3:544
6860 "A following integer conversion corresponds to a I<size_t> or I<ssize_t> "
6861 "argument. (Linux libc5 has B<Z> with this meaning. Don't use it.)"
6865 #: build/C/man3/printf.3:544 build/C/man3/scanf.3:359
6871 #: build/C/man3/printf.3:549
6872 msgid "A following integer conversion corresponds to a I<ptrdiff_t> argument."
6876 #: build/C/man3/printf.3:578
6878 "The SUSv2 knows about only the length modifiers B<h> (in B<hd>, B<hi>, "
6879 "B<ho>, B<hx>, B<hX>, B<hn>) and B<l> (in B<ld>, B<li>, B<lo>, B<lx>, B<lX>, "
6880 "B<ln>, B<lc>, B<ls>) and B<L> (in B<Le>, B<LE>, B<Lf>, B<Lg>, B<LG>)."
6884 #: build/C/man3/printf.3:578
6886 msgid "The conversion specifier"
6890 #: build/C/man3/printf.3:581
6892 "A character that specifies the type of conversion to be applied. The "
6893 "conversion specifiers and their meanings are:"
6897 #: build/C/man3/printf.3:581
6903 #: build/C/man3/printf.3:591
6905 "The I<int> argument is converted to signed decimal notation. The precision, "
6906 "if any, gives the minimum number of digits that must appear; if the "
6907 "converted value requires fewer digits, it is padded on the left with zeros. "
6908 "The default precision is 1. When 0 is printed with an explicit precision 0, "
6909 "the output is empty."
6913 #: build/C/man3/printf.3:591
6915 msgid "B<o>, B<u>, B<x>, B<X>"
6919 #: build/C/man3/printf.3:618
6921 "The I<unsigned int> argument is converted to unsigned octal (B<o>), unsigned "
6922 "decimal (B<u>), or unsigned hexadecimal (B<x> and B<X>) notation. The "
6923 "letters B<abcdef> are used for B<x> conversions; the letters B<ABCDEF> are "
6924 "used for B<X> conversions. The precision, if any, gives the minimum number "
6925 "of digits that must appear; if the converted value requires fewer digits, it "
6926 "is padded on the left with zeros. The default precision is 1. When 0 is "
6927 "printed with an explicit precision 0, the output is empty."
6931 #: build/C/man3/printf.3:618
6937 #: build/C/man3/printf.3:637
6939 "The I<double> argument is rounded and converted in the style "
6940 "[-]dB<\\&.>dddB<e>\\(+-dd where there is one digit before the decimal-point "
6941 "character and the number of digits after it is equal to the precision; if "
6942 "the precision is missing, it is taken as 6; if the precision is zero, no "
6943 "decimal-point character appears. An B<E> conversion uses the letter B<E> "
6944 "(rather than B<e>) to introduce the exponent. The exponent always contains "
6945 "at least two digits; if the value is zero, the exponent is 00."
6949 #: build/C/man3/printf.3:637
6955 #: build/C/man3/printf.3:648
6957 "The I<double> argument is rounded and converted to decimal notation in the "
6958 "style [-]dddB<\\&.>ddd, where the number of digits after the decimal-point "
6959 "character is equal to the precision specification. If the precision is "
6960 "missing, it is taken as 6; if the precision is explicitly zero, no "
6961 "decimal-point character appears. If a decimal point appears, at least one "
6962 "digit appears before it."
6966 #: build/C/man3/printf.3:659
6968 "(The SUSv2 does not know about B<F> and says that character string "
6969 "representations for infinity and NaN may be made available. The C99 "
6970 "standard specifies \"[-]inf\" or \"[-]infinity\" for infinity, and a string "
6971 "starting with \"nan\" for NaN, in the case of B<f> conversion, and "
6972 "\"[-]INF\" or \"[-]INFINITY\" or \"NAN*\" in the case of B<F> conversion.)"
6976 #: build/C/man3/printf.3:659
6982 #: build/C/man3/printf.3:684
6984 "The I<double> argument is converted in style B<f> or B<e> (or B<F> or B<E> "
6985 "for B<G> conversions). The precision specifies the number of significant "
6986 "digits. If the precision is missing, 6 digits are given; if the precision "
6987 "is zero, it is treated as 1. Style B<e> is used if the exponent from its "
6988 "conversion is less than -4 or greater than or equal to the precision. "
6989 "Trailing zeros are removed from the fractional part of the result; a decimal "
6990 "point appears only if it is followed by at least one digit."
6994 #: build/C/man3/printf.3:684
7000 #: build/C/man3/printf.3:708
7002 "(C99; not in SUSv2) For B<a> conversion, the I<double> argument is converted "
7003 "to hexadecimal notation (using the letters abcdef) in the style "
7004 "[-]B<0x>hB<\\&.>hhhhB<p>\\(+-; for B<A> conversion the prefix B<0X>, the "
7005 "letters ABCDEF, and the exponent separator B<P> is used. There is one "
7006 "hexadecimal digit before the decimal point, and the number of digits after "
7007 "it is equal to the precision. The default precision suffices for an exact "
7008 "representation of the value if an exact representation in base 2 exists and "
7009 "otherwise is sufficiently large to distinguish values of type I<double>. "
7010 "The digit before the decimal point is unspecified for nonnormalized numbers, "
7011 "and nonzero but otherwise unspecified for normalized numbers."
7015 #: build/C/man3/printf.3:708 build/C/man3/scanf.3:459 build/C/man3/wprintf.3:151
7021 #: build/C/man3/printf.3:726
7023 "If no B<l> modifier is present, the I<int> argument is converted to an "
7024 "I<unsigned char>, and the resulting character is written. If an B<l> "
7025 "modifier is present, the I<wint_t> (wide character) argument is converted to "
7026 "a multibyte sequence by a call to the B<wcrtomb>(3) function, with a "
7027 "conversion state starting in the initial state, and the resulting multibyte "
7028 "string is written."
7032 #: build/C/man3/printf.3:726 build/C/man3/scanf.3:451 build/C/man3/wprintf.3:165
7038 #: build/C/man3/printf.3:741
7040 "If no B<l> modifier is present: The I<const char\\ *> argument is expected "
7041 "to be a pointer to an array of character type (pointer to a string). "
7042 "Characters from the array are written up to (but not including) a "
7043 "terminating null byte (\\(aq\\e0\\(aq); if a precision is specified, no more "
7044 "than the number specified are written. If a precision is given, no null "
7045 "byte need be present; if the precision is not specified, or is greater than "
7046 "the size of the array, the array must contain a terminating null byte."
7050 #: build/C/man3/printf.3:768
7052 "If an B<l> modifier is present: The I<const wchar_t\\ *> argument is "
7053 "expected to be a pointer to an array of wide characters. Wide characters "
7054 "from the array are converted to multibyte characters (each by a call to the "
7055 "B<wcrtomb>(3) function, with a conversion state starting in the initial "
7056 "state before the first wide character), up to and including a terminating "
7057 "null wide character. The resulting multibyte characters are written up to "
7058 "(but not including) the terminating null byte. If a precision is specified, "
7059 "no more bytes than the number specified are written, but no partial "
7060 "multibyte characters are written. Note that the precision determines the "
7061 "number of I<bytes> written, not the number of I<wide characters> or I<screen "
7062 "positions>. The array must contain a terminating null wide character, "
7063 "unless a precision is given and it is so small that the number of bytes "
7064 "written exceeds it before the end of the array is reached."
7068 #: build/C/man3/printf.3:768
7074 #: build/C/man3/printf.3:774
7075 msgid "(Not in C99, but in SUSv2.) Synonym for B<lc>. Don't use."
7079 #: build/C/man3/printf.3:774
7085 #: build/C/man3/printf.3:780
7086 msgid "(Not in C99, but in SUSv2.) Synonym for B<ls>. Don't use."
7090 #: build/C/man3/printf.3:780 build/C/man3/scanf.3:502
7096 #: build/C/man3/printf.3:788
7098 "The I<void\\ *> pointer argument is printed in hexadecimal (as if by B<%#x> "
7103 #: build/C/man3/printf.3:788 build/C/man3/scanf.3:510
7109 #: build/C/man3/printf.3:795
7111 "The number of characters written so far is stored into the integer indicated "
7112 "by the I<int\\ *> (or variant) pointer argument. No argument is converted."
7116 #: build/C/man3/printf.3:795
7122 #: build/C/man3/printf.3:801
7124 "(Glibc extension.) Print output of I<strerror(errno)>. No argument is "
7129 #: build/C/man3/printf.3:801 build/C/man3/scanf.3:377
7135 #: build/C/man3/printf.3:807
7137 "A \\(aq%\\(aq is written. No argument is converted. The complete "
7138 "conversion specification is \\(aq%%\\(aq."
7142 #: build/C/man3/printf.3:822
7144 "The B<fprintf>(), B<printf>(), B<sprintf>(), B<vprintf>(), B<vfprintf>(), "
7145 "and B<vsprintf>() functions conform to C89 and C99. The B<snprintf>() and "
7146 "B<vsnprintf>() functions conform to C99."
7150 #: build/C/man3/printf.3:835
7152 "Concerning the return value of B<snprintf>(), SUSv2 and C99 contradict each "
7153 "other: when B<snprintf>() is called with I<size>=0 then SUSv2 stipulates an "
7154 "unspecified return value less than 1, while C99 allows I<str> to be NULL in "
7155 "this case, and gives the return value (as always) as the number of "
7156 "characters that would have been written in case the output string has been "
7161 #: build/C/man3/printf.3:849
7163 "Linux libc4 knows about the five C standard flags. It knows about the "
7164 "length modifiers B<h>, B<l>, B<L>, and the conversions B<c>, B<d>, B<e>, "
7165 "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 "
7166 "B<X>, where B<F> is a synonym for B<f>. Additionally, it accepts B<D>, "
7167 "B<O>, and B<U> as synonyms for B<ld>, B<lo>, and B<lu>. (This is bad, and "
7168 "caused serious bugs later, when support for B<%D> disappeared.) No "
7169 "locale-dependent radix character, no thousands' separator, no NaN or "
7170 "infinity, no \"%m$\" and \"*m$\"."
7174 #: build/C/man3/printf.3:860
7176 "Linux libc5 knows about the five C standard flags and the \\(aq flag, "
7177 "locale, \"%m$\" and \"*m$\". It knows about the length modifiers B<h>, "
7178 "B<l>, B<L>, B<Z>, and B<q>, but accepts B<L> and B<q> both for I<long "
7179 "double> and for I<long long int> (this is a bug). It no longer recognizes "
7180 "B<F>, B<D>, B<O>, and B<U>, but adds the conversion character B<m>, which "
7181 "outputs I<strerror(errno)>."
7185 #: build/C/man3/printf.3:862
7186 msgid "glibc 2.0 adds conversion characters B<C> and B<S>."
7190 #: build/C/man3/printf.3:865
7192 "glibc 2.1 adds length modifiers B<hh>, B<j>, B<t>, and B<z> and conversion "
7193 "characters B<a> and B<A>."
7197 #: build/C/man3/printf.3:868
7199 "glibc 2.2 adds the conversion character B<F> with C99 semantics, and the "
7200 "flag character B<I>."
7204 #: build/C/man3/printf.3:870
7205 msgid "Some programs imprudently rely on code such as the following"
7209 #: build/C/man3/printf.3:872
7211 msgid " sprintf(buf, \"%s some further text\", buf);\n"
7214 #. http://sourceware.org/bugzilla/show_bug.cgi?id=7075
7216 #: build/C/man3/printf.3:888
7218 "to append text to I<buf>. However, the standards explicitly note that the "
7219 "results are undefined if source and destination buffers overlap when calling "
7220 "B<sprintf>(), B<snprintf>(), B<vsprintf>(), and B<vsnprintf>(). Depending "
7221 "on the version of B<gcc>(1) used, and the compiler options employed, calls "
7222 "such as the above will B<not> produce the expected results."
7226 #. UNIX V7 defines the three routines
7230 #. and has the flag \-, the width or precision *, the length modifier l,
7231 #. and the conversions doxfegcsu, and also D,O,U,X as synonyms for ld,lo,lu,lx.
7232 #. This is still true for 2.9.1BSD, but 2.10BSD has the flags
7233 #. #, + and <space> and no longer mentions D,O,U,X.
7238 #. and warns not to use D,O,U,X.
7239 #. 4.3BSD Reno has the flag 0, the length modifiers h and L,
7240 #. and the conversions n, p, E, G, X (with current meaning)
7241 #. and deprecates D,O,U.
7242 #. 4.4BSD introduces the functions
7245 #. .BR vsnprintf (),
7246 #. and the length modifier q.
7247 #. FreeBSD also has functions
7250 #. .BR vasprintf (),
7251 #. that allocate a buffer large enough for
7253 #. In glibc there are functions
7257 #. that print to a file descriptor instead of a stream.
7259 #: build/C/man3/printf.3:930
7261 "The glibc implementation of the functions B<snprintf>() and B<vsnprintf>() "
7262 "conforms to the C99 standard, that is, behaves as described above, since "
7263 "glibc version 2.1. Until glibc 2.0.6 they would return -1 when the output "
7268 #: build/C/man3/printf.3:947
7270 "Because B<sprintf>() and B<vsprintf>() assume an arbitrarily long string, "
7271 "callers must be careful not to overflow the actual space; this is often "
7272 "impossible to assure. Note that the length of the strings produced is "
7273 "locale-dependent and difficult to predict. Use B<snprintf>() and "
7274 "B<vsnprintf>() instead (or B<asprintf>(3) and B<vasprintf>(3))."
7278 #: build/C/man3/printf.3:960
7280 "Linux libc4.[45] does not have a B<snprintf>(), but provides a libbsd that "
7281 "contains an B<snprintf>() equivalent to B<sprintf>(), that is, one that "
7282 "ignores the I<size> argument. Thus, the use of B<snprintf>() with early "
7283 "libc4 leads to serious security problems."
7287 #. Some floating-point conversions under early libc4
7288 #. caused memory leaks.
7290 #: build/C/man3/printf.3:974
7292 "Code such as B<printf(>I<foo>B<);> often indicates a bug, since I<foo> may "
7293 "contain a % character. If I<foo> comes from untrusted user input, it may "
7294 "contain B<%n>, causing the B<printf>() call to write to memory and creating "
7299 #: build/C/man3/printf.3:978
7300 msgid "To print I<Pi> to five decimal places:"
7304 #: build/C/man3/printf.3:984
7307 "#include E<lt>math.hE<gt>\n"
7308 "#include E<lt>stdio.hE<gt>\n"
7309 "fprintf(stdout, \"pi = %.5f\\en\", 4 * atan(1.0));\n"
7313 #: build/C/man3/printf.3:993
7315 "To print a date and time in the form \"Sunday, July 3, 10:02\", where "
7316 "I<weekday> and I<month> are pointers to strings:"
7320 #: build/C/man3/printf.3:999
7323 "#include E<lt>stdio.hE<gt>\n"
7324 "fprintf(stdout, \"%s, %s %d, %.2d:%.2d\\en\",\n"
7325 " weekday, month, day, hour, min);\n"
7329 #: build/C/man3/printf.3:1005
7331 "Many countries use the day-month-year order. Hence, an internationalized "
7332 "version must be able to print the arguments in an order specified by the "
7337 #: build/C/man3/printf.3:1011
7340 "#include E<lt>stdio.hE<gt>\n"
7341 "fprintf(stdout, format,\n"
7342 " weekday, month, day, hour, min);\n"
7346 #: build/C/man3/printf.3:1018
7348 "where I<format> depends on locale, and may permute the arguments. With the "
7353 #: build/C/man3/printf.3:1022
7355 msgid "\"%1$s, %3$d. %2$s, %4$d:%5$.2d\\en\"\n"
7359 #: build/C/man3/printf.3:1026
7360 msgid "one might obtain \"Sonntag, 3. Juli, 10:02\"."
7364 #: build/C/man3/printf.3:1029
7366 "To allocate a sufficiently large string and print into it (code correct for "
7367 "both glibc 2.0 and glibc 2.1):"
7371 #: build/C/man3/printf.3:1032
7373 "If truncation occurs in glibc versions prior to 2.0.6, this is treated as an "
7374 "error instead of being handled gracefully."
7378 #: build/C/man3/printf.3:1037
7381 "#include E<lt>stdio.hE<gt>\n"
7382 "#include E<lt>stdlib.hE<gt>\n"
7383 "#include E<lt>stdarg.hE<gt>\n"
7387 #: build/C/man3/printf.3:1045
7391 "make_message(const char *fmt, ...)\n"
7394 " int size = 100; /* Guess we need no more than 100 bytes */\n"
7400 #: build/C/man3/printf.3:1048
7403 " if ((p = malloc(size)) == NULL)\n"
7408 #: build/C/man3/printf.3:1050
7410 msgid " while (1) {\n"
7414 #: build/C/man3/printf.3:1052
7416 msgid " /* Try to print in the allocated space */\n"
7420 #: build/C/man3/printf.3:1056
7423 " va_start(ap, fmt);\n"
7424 " n = vsnprintf(p, size, fmt, ap);\n"
7429 #: build/C/man3/printf.3:1058
7431 msgid " /* Check error code */\n"
7435 #: build/C/man3/printf.3:1061
7443 #: build/C/man3/printf.3:1063
7445 msgid " /* If that worked, return the string */\n"
7449 #: build/C/man3/printf.3:1066
7452 " if (n E<lt> size)\n"
7457 #: build/C/man3/printf.3:1068
7459 msgid " /* Else try again with more space */\n"
7463 #: build/C/man3/printf.3:1070
7465 msgid " size = n + 1; /* Precisely what is needed */\n"
7469 #: build/C/man3/printf.3:1080
7472 " if ((np = realloc (p, size)) == NULL) {\n"
7483 #: build/C/man3/printf.3:1090
7485 "B<printf>(1), B<asprintf>(3), B<dprintf>(3), B<scanf>(3), B<setlocale>(3), "
7486 "B<wcrtomb>(3), B<wprintf>(3), B<locale>(5)"
7490 #: build/C/man3/puts.3:26
7496 #: build/C/man3/puts.3:26
7502 #: build/C/man3/puts.3:29
7503 msgid "fputc, fputs, putc, putchar, puts - output of characters and strings"
7507 #: build/C/man3/puts.3:34
7509 msgid "B<int fputc(int >I<c>B<, FILE *>I<stream>B<);>\n"
7513 #: build/C/man3/puts.3:36
7515 msgid "B<int fputs(const char *>I<s>B<, FILE *>I<stream>B<);>\n"
7519 #: build/C/man3/puts.3:38
7521 msgid "B<int putc(int >I<c>B<, FILE *>I<stream>B<);>\n"
7525 #: build/C/man3/puts.3:40
7527 msgid "B<int putchar(int >I<c>B<);>\n"
7531 #: build/C/man3/puts.3:42
7533 msgid "B<int puts(const char *>I<s>B<);>\n"
7537 #: build/C/man3/puts.3:51
7539 "B<fputc>() writes the character I<c>, cast to an I<unsigned char>, to "
7544 #: build/C/man3/puts.3:58
7546 "B<fputs>() writes the string I<s> to I<stream>, without its terminating "
7547 "null byte (\\(aq\\e0\\(aq)."
7551 #: build/C/man3/puts.3:65
7553 "B<putc>() is equivalent to B<fputc>() except that it may be implemented as "
7554 "a macro which evaluates I<stream> more than once."
7558 #: build/C/man3/puts.3:69
7559 msgid "B<putchar(>I<c>B<);> is equivalent to B<putc(>I<c>B<,>I<stdout>B<).>"
7563 #: build/C/man3/puts.3:76
7564 msgid "B<puts>() writes the string I<s> and a trailing newline to I<stdout>."
7568 #: build/C/man3/puts.3:81
7570 "Calls to the functions described here can be mixed with each other and with "
7571 "calls to other output functions from the I<stdio> library for the same "
7576 #: build/C/man3/puts.3:96
7578 "B<fputc>(), B<putc>() and B<putchar>() return the character written as an "
7579 "I<unsigned char> cast to an I<int> or B<EOF> on error."
7583 #: build/C/man3/puts.3:103
7585 "B<puts>() and B<fputs>() return a nonnegative number on success, or B<EOF> "
7590 #: build/C/man3/puts.3:112
7592 "It is not advisable to mix calls to output functions from the I<stdio> "
7593 "library with low-level calls to B<write>(2) for the file descriptor "
7594 "associated with the same output stream; the results will be undefined and "
7595 "very probably not what you want."
7599 #: build/C/man3/puts.3:124
7601 "B<write>(2), B<ferror>(3), B<fopen>(3), B<fputwc>(3), B<fputws>(3), "
7602 "B<fseek>(3), B<fwrite>(3), B<gets>(3), B<putwchar>(3), B<scanf>(3), "
7603 "B<unlocked_stdio>(3)"
7607 #: build/C/man2/read.2:35
7613 #: build/C/man2/read.2:35
7619 #: build/C/man2/read.2:38
7620 msgid "read - read from a file descriptor"
7624 #: build/C/man2/read.2:43
7626 msgid "B<ssize_t read(int >I<fd>B<, void *>I<buf>B<, size_t >I<count>B<);>\n"
7630 #: build/C/man2/read.2:52
7632 "B<read>() attempts to read up to I<count> bytes from file descriptor I<fd> "
7633 "into the buffer starting at I<buf>."
7637 #: build/C/man2/read.2:60
7639 "On files that support seeking, the read operation commences at the current "
7640 "file offset, and the file offset is incremented by the number of bytes "
7641 "read. If the current file offset is at or past the end of file, no bytes "
7642 "are read, and B<read>() returns zero."
7646 #: build/C/man2/read.2:75
7648 "If I<count> is zero, B<read>() I<may> detect the errors described below. "
7649 "In the absence of any errors, or if B<read>() does not check for errors, a "
7650 "B<read>() with a I<count> of 0 returns zero and has no other effects."
7654 #: build/C/man2/read.2:81
7655 msgid "If I<count> is greater than B<SSIZE_MAX>, the result is unspecified."
7659 #: build/C/man2/read.2:95
7661 "On success, the number of bytes read is returned (zero indicates end of "
7662 "file), and the file position is advanced by this number. It is not an error "
7663 "if this number is smaller than the number of bytes requested; this may "
7664 "happen for example because fewer bytes are actually available right now "
7665 "(maybe because we were close to end-of-file, or because we are reading from "
7666 "a pipe, or from a terminal), or because B<read>() was interrupted by a "
7667 "signal. On error, -1 is returned, and I<errno> is set appropriately. In "
7668 "this case it is left unspecified whether the file position (if any) changes."
7672 #: build/C/man2/read.2:96 build/C/man3/scanf.3:548 build/C/man2/write.2:108
7678 #: build/C/man2/read.2:103
7680 "The file descriptor I<fd> refers to a file other than a socket and has been "
7681 "marked nonblocking (B<O_NONBLOCK>), and the read would block."
7685 #: build/C/man2/read.2:103 build/C/man2/write.2:115
7687 msgid "B<EAGAIN> or B<EWOULDBLOCK>"
7690 #. Actually EAGAIN on Linux
7692 #: build/C/man2/read.2:114
7694 "The file descriptor I<fd> refers to a socket and has been marked nonblocking "
7695 "(B<O_NONBLOCK>), and the read would block. POSIX.1-2001 allows either error "
7696 "to be returned for this case, and does not require these constants to have "
7697 "the same value, so a portable application should check for both "
7702 #: build/C/man2/read.2:118
7703 msgid "I<fd> is not a valid file descriptor or is not open for reading."
7707 #: build/C/man2/read.2:122 build/C/man2/write.2:145
7708 msgid "I<buf> is outside your accessible address space."
7712 #: build/C/man2/read.2:126
7714 "The call was interrupted by a signal before any data was read; see "
7719 #: build/C/man2/read.2:137
7721 "I<fd> is attached to an object which is unsuitable for reading; or the file "
7722 "was opened with the B<O_DIRECT> flag, and either the address specified in "
7723 "I<buf>, the value specified in I<count>, or the current file offset is not "
7728 #: build/C/man2/read.2:147
7730 "I<fd> was created via a call to B<timerfd_create>(2) and the wrong size "
7731 "buffer was given to B<read>(); see B<timerfd_create>(2) for further "
7736 #: build/C/man2/read.2:158
7738 "I/O error. This will happen for example when the process is in a background "
7739 "process group, tries to read from its controlling terminal, and either it is "
7740 "ignoring or blocking B<SIGTTIN> or its process group is orphaned. It may "
7741 "also occur when there is a low-level I/O error while reading from a disk or "
7746 #: build/C/man2/read.2:162
7747 msgid "I<fd> refers to a directory."
7751 #: build/C/man2/read.2:173
7753 "Other errors may occur, depending on the object connected to I<fd>. POSIX "
7754 "allows a B<read>() that is interrupted after reading some data to return -1 "
7755 "(with I<errno> set to B<EINTR>) or to return the number of bytes already "
7760 #: build/C/man2/read.2:187
7762 "On NFS filesystems, reading small amounts of data will update the timestamp "
7763 "only the first time, subsequent calls may not do so. This is caused by "
7764 "client side attribute caching, because most if not all NFS clients leave "
7765 "st_atime (last file access time) updates to the server and client side "
7766 "reads satisfied from the client's cache will not cause st_atime updates on "
7767 "the server as there are no server side reads. UNIX semantics can be "
7768 "obtained by disabling client side attribute caching, but in most situations "
7769 "this will substantially increase server load and decrease performance."
7773 #: build/C/man2/read.2:200
7775 "B<close>(2), B<fcntl>(2), B<ioctl>(2), B<lseek>(2), B<open>(2), B<pread>(2), "
7776 "B<readdir>(2), B<readlink>(2), B<readv>(2), B<select>(2), B<write>(2), "
7781 #: build/C/man2/readlink.2:43
7787 #: build/C/man2/readlink.2:43
7793 #: build/C/man2/readlink.2:46
7794 msgid "readlink - read value of a symbolic link"
7798 #: build/C/man2/readlink.2:50
7800 "B<ssize_t readlink(const char *>I<path>B<, char *>I<buf>B<, size_t "
7805 #: build/C/man2/readlink.2:58
7806 msgid "B<readlink>():"
7810 #: build/C/man2/readlink.2:61 build/C/man2/symlink.2:50
7812 "_BSD_SOURCE || _XOPEN_SOURCE\\ E<gt>=\\ 500 || _XOPEN_SOURCE\\ &&\\ "
7813 "_XOPEN_SOURCE_EXTENDED || _POSIX_C_SOURCE\\ E<gt>=\\ 200112L"
7817 #: build/C/man2/readlink.2:77
7819 "B<readlink>() places the contents of the symbolic link I<path> in the "
7820 "buffer I<buf>, which has size I<bufsiz>. B<readlink>() does not append a "
7821 "null byte to I<buf>. It will truncate the contents (to a length of "
7822 "I<bufsiz> characters), in case the buffer is too small to hold all of the "
7827 #: build/C/man2/readlink.2:85
7829 "On success, B<readlink>() returns the number of bytes placed in I<buf>. On "
7830 "error, -1 is returned and I<errno> is set to indicate the error."
7834 #: build/C/man2/readlink.2:91
7836 "Search permission is denied for a component of the path prefix. (See also "
7837 "B<path_resolution>(7).)"
7841 #: build/C/man2/readlink.2:95
7842 msgid "I<buf> extends outside the process's allocated address space."
7845 #. At the glibc level, bufsiz is unsigned, so this error can only occur
7846 #. if bufsiz==0. However, the in the kernel syscall, bufsiz is signed,
7847 #. and this error can also occur if bufsiz < 0.
7848 #. See: http://thread.gmane.org/gmane.linux.man/380
7849 #. Subject: [patch 0/3] [RFC] kernel/glibc mismatch of "readlink" syscall?
7851 #: build/C/man2/readlink.2:104
7852 msgid "I<bufsiz> is not positive."
7856 #: build/C/man2/readlink.2:107
7857 msgid "The named file is not a symbolic link."
7861 #: build/C/man2/readlink.2:110
7862 msgid "An I/O error occurred while reading from the filesystem."
7866 #: build/C/man2/readlink.2:113
7867 msgid "Too many symbolic links were encountered in translating the pathname."
7871 #: build/C/man2/readlink.2:116
7872 msgid "A pathname, or a component of a pathname, was too long."
7876 #: build/C/man2/readlink.2:119
7877 msgid "The named file does not exist."
7881 #: build/C/man2/readlink.2:125
7882 msgid "A component of the path prefix is not a directory."
7886 #: build/C/man2/readlink.2:130
7887 msgid "4.4BSD (B<readlink>() first appeared in 4.2BSD), POSIX.1-2001."
7891 #: build/C/man2/readlink.2:138
7893 "In versions of glibc up to and including glibc 2.4, the return type of "
7894 "B<readlink>() was declared as I<int>. Nowadays, the return type is "
7895 "declared as I<ssize_t>, as (newly) required in POSIX.1-2001."
7899 #: build/C/man2/readlink.2:157
7901 "Using a statically sized buffer might not provide enough room for the "
7902 "symbolic link contents. The required size for the buffer can be obtained "
7903 "from the I<stat.st_size> value returned by a call to B<lstat>(2) on the "
7904 "link. However, the number of bytes written by B<readlink>() should be "
7905 "checked to make sure that the size of the symbolic link did not increase "
7906 "between the calls. Dynamically allocating the buffer for B<readlink>() "
7907 "also addresses a common portability problem when using I<PATH_MAX> for the "
7908 "buffer size, as this constant is not guaranteed to be defined per POSIX if "
7909 "the system does not have such limit."
7913 #: build/C/man2/readlink.2:163
7915 "The following program allocates the buffer needed by B<readlink>() "
7916 "dynamically from the information provided by B<lstat>(), making sure there's "
7917 "no race condition between the calls."
7921 #: build/C/man2/readlink.2:170
7924 "#include E<lt>sys/types.hE<gt>\n"
7925 "#include E<lt>sys/stat.hE<gt>\n"
7926 "#include E<lt>stdio.hE<gt>\n"
7927 "#include E<lt>stdlib.hE<gt>\n"
7928 "#include E<lt>unistd.hE<gt>\n"
7932 #: build/C/man2/readlink.2:177
7936 "main(int argc, char *argv[])\n"
7938 " struct stat sb;\n"
7939 " char *linkname;\n"
7944 #: build/C/man2/readlink.2:182
7947 " if (argc != 2) {\n"
7948 " fprintf(stderr, \"Usage: %s E<lt>pathnameE<gt>\\en\", argv[0]);\n"
7949 " exit(EXIT_FAILURE);\n"
7954 #: build/C/man2/readlink.2:187
7957 " if (lstat(argv[1], &sb) == -1) {\n"
7958 " perror(\"lstat\");\n"
7959 " exit(EXIT_FAILURE);\n"
7964 #: build/C/man2/readlink.2:193
7967 " linkname = malloc(sb.st_size + 1);\n"
7968 " if (linkname == NULL) {\n"
7969 " fprintf(stderr, \"insufficient memory\\en\");\n"
7970 " exit(EXIT_FAILURE);\n"
7975 #: build/C/man2/readlink.2:195
7977 msgid " r = readlink(argv[1], linkname, sb.st_size + 1);\n"
7981 #: build/C/man2/readlink.2:200
7985 " perror(\"lstat\");\n"
7986 " exit(EXIT_FAILURE);\n"
7991 #: build/C/man2/readlink.2:206
7994 " if (r E<gt> sb.st_size) {\n"
7995 " fprintf(stderr, \"symlink increased in size \"\n"
7996 " \"between lstat() and readlink()\\en\");\n"
7997 " exit(EXIT_FAILURE);\n"
8002 #: build/C/man2/readlink.2:208
8004 msgid " linkname[r] = \\(aq\\e0\\(aq;\n"
8008 #: build/C/man2/readlink.2:210
8011 " printf(\"\\(aq%s\\(aq points to \\(aq%s\\(aq\\en\", argv[1], "
8016 #: build/C/man2/readlink.2:222
8018 "B<readlink>(1), B<lstat>(2), B<readlinkat>(2), B<stat>(2), B<symlink>(2), "
8019 "B<path_resolution>(7), B<symlink>(7)"
8023 #: build/C/man2/readv.2:32
8029 #: build/C/man2/readv.2:32
8035 #: build/C/man2/readv.2:35
8036 msgid "readv, writev, preadv, pwritev - read or write data into multiple buffers"
8040 #: build/C/man2/readv.2:38
8042 msgid "B<#include E<lt>sys/uio.hE<gt>>\n"
8046 #: build/C/man2/readv.2:40
8049 "B<ssize_t readv(int >I<fd>B<, const struct iovec *>I<iov>B<, int "
8054 #: build/C/man2/readv.2:42
8057 "B<ssize_t writev(int >I<fd>B<, const struct iovec *>I<iov>B<, int "
8062 #: build/C/man2/readv.2:45
8065 "B<ssize_t preadv(int >I<fd>B<, const struct iovec *>I<iov>B<, int "
8067 "B< off_t >I<offset>B<);>\n"
8071 #: build/C/man2/readv.2:48
8074 "B<ssize_t pwritev(int >I<fd>B<, const struct iovec *>I<iov>B<, int "
8076 "B< off_t >I<offset>B<);>\n"
8080 #: build/C/man2/readv.2:58
8081 msgid "B<preadv>(), B<pwritev>(): _BSD_SOURCE"
8085 #: build/C/man2/readv.2:68
8087 "The B<readv>() system call reads I<iovcnt> buffers from the file associated "
8088 "with the file descriptor I<fd> into the buffers described by I<iov> "
8089 "(\"scatter input\")."
8093 #: build/C/man2/readv.2:78
8095 "The B<writev>() system call writes I<iovcnt> buffers of data described by "
8096 "I<iov> to the file associated with the file descriptor I<fd> (\"gather "
8101 #: build/C/man2/readv.2:87
8103 "The pointer I<iov> points to an array of I<iovec> structures, defined in "
8104 "I<E<lt>sys/uio.hE<gt>> as:"
8108 #: build/C/man2/readv.2:95
8112 " void *iov_base; /* Starting address */\n"
8113 " size_t iov_len; /* Number of bytes to transfer */\n"
8118 #: build/C/man2/readv.2:103
8120 "The B<readv>() system call works just like B<read>(2) except that multiple "
8121 "buffers are filled."
8125 #: build/C/man2/readv.2:109
8127 "The B<writev>() system call works just like B<write>(2) except that "
8128 "multiple buffers are written out."
8132 #: build/C/man2/readv.2:128
8134 "Buffers are processed in array order. This means that B<readv>() "
8135 "completely fills I<iov>[0] before proceeding to I<iov>[1], and so on. (If "
8136 "there is insufficient data, then not all buffers pointed to by I<iov> may be "
8137 "filled.) Similarly, B<writev>() writes out the entire contents of "
8138 "I<iov>[0] before proceeding to I<iov>[1], and so on."
8142 #: build/C/man2/readv.2:146
8144 "The data transfers performed by B<readv>() and B<writev>() are atomic: the "
8145 "data written by B<writev>() is written as a single block that is not "
8146 "intermingled with output from writes in other processes (but see B<pipe>(7) "
8147 "for an exception); analogously, B<readv>() is guaranteed to read a "
8148 "contiguous block of data from the file, regardless of read operations "
8149 "performed in other threads or processes that have file descriptors referring "
8150 "to the same open file description (see B<open>(2))."
8154 #: build/C/man2/readv.2:146
8156 msgid "preadv() and pwritev()"
8160 #: build/C/man2/readv.2:159
8162 "The B<preadv>() system call combines the functionality of B<readv>() and "
8163 "B<pread>(2). It performs the same task as B<readv>(), but adds a fourth "
8164 "argument, I<offset>, which specifies the file offset at which the input "
8165 "operation is to be performed."
8169 #: build/C/man2/readv.2:172
8171 "The B<pwritev>() system call combines the functionality of B<writev>() and "
8172 "B<pwrite>(2). It performs the same task as B<writev>(), but adds a fourth "
8173 "argument, I<offset>, which specifies the file offset at which the output "
8174 "operation is to be performed."
8178 #: build/C/man2/readv.2:177
8180 "The file offset is not changed by these system calls. The file referred to "
8181 "by I<fd> must be capable of seeking."
8185 #: build/C/man2/readv.2:188
8187 "On success, B<readv>() and B<preadv>() return the number of bytes read; "
8188 "B<writev>() and B<pwritev>() return the number of bytes written. On "
8189 "error, -1 is returned, and I<errno> is set appropriately."
8193 #: build/C/man2/readv.2:200
8195 "The errors are as given for B<read>(2) and B<write>(2). Furthermore, "
8196 "B<preadv>() and B<pwritev>() can also fail for the same reasons as "
8197 "B<lseek>(2). Additionally, the following error is defined:"
8201 #: build/C/man2/readv.2:209
8203 "The sum of the I<iov_len> values overflows an I<ssize_t> value. Or, the "
8204 "vector count I<iovcnt> is less than zero or greater than the permitted "
8209 #: build/C/man2/readv.2:214
8211 "B<preadv>() and B<pwritev>() first appeared in Linux 2.6.30; library "
8212 "support was added in glibc 2.10."
8215 #. The readv/writev system calls were buggy before Linux 1.3.40.
8216 #. (Says release.libc.)
8218 #: build/C/man2/readv.2:222
8220 "B<readv>(), B<writev>(): 4.4BSD (these system calls first appeared in "
8221 "4.2BSD), POSIX.1-2001. Linux libc5 used I<size_t> as the type of the "
8222 "I<iovcnt> argument, and I<int> as the return type."
8226 #: build/C/man2/readv.2:226
8227 msgid "B<preadv>(), B<pwritev>(): nonstandard, but present also on the modern BSDs."
8231 #: build/C/man2/readv.2:227
8237 #: build/C/man2/readv.2:258
8239 "POSIX.1-2001 allows an implementation to place a limit on the number of "
8240 "items that can be passed in I<iov>. An implementation can advertise its "
8241 "limit by defining B<IOV_MAX> in I<E<lt>limits.hE<gt>> or at run time via the "
8242 "return value from I<sysconf(_SC_IOV_MAX)>. On Linux, the limit advertised "
8243 "by these mechanisms is 1024, which is the true kernel limit. However, the "
8244 "glibc wrapper functions do some extra work if they detect that the "
8245 "underlying kernel system call failed because this limit was exceeded. In "
8246 "the case of B<readv>() the wrapper function allocates a temporary buffer "
8247 "large enough for all of the items specified by I<iov>, passes that buffer in "
8248 "a call to B<read>(2), copies data from the buffer to the locations specified "
8249 "by the I<iov_base> fields of the elements of I<iov>, and then frees the "
8250 "buffer. The wrapper function for B<writev>() performs the analogous task "
8251 "using a temporary buffer and a call to B<write>(2)."
8255 #: build/C/man2/readv.2:265
8257 "It is not advisable to mix calls to B<readv>() or B<writev>(), which "
8258 "operate on file descriptors, with the functions from the stdio library; the "
8259 "results will be undefined and probably not what you want."
8263 #: build/C/man2/readv.2:268
8264 msgid "The following code sample demonstrates the use of B<writev>():"
8268 #: build/C/man2/readv.2:275
8271 "char *str0 = \"hello \";\n"
8272 "char *str1 = \"world\\en\";\n"
8273 "struct iovec iov[2];\n"
8274 "ssize_t nwritten;\n"
8278 #: build/C/man2/readv.2:280
8281 "iov[0].iov_base = str0;\n"
8282 "iov[0].iov_len = strlen(str0);\n"
8283 "iov[1].iov_base = str1;\n"
8284 "iov[1].iov_len = strlen(str1);\n"
8288 #: build/C/man2/readv.2:282
8290 msgid "nwritten = writev(STDOUT_FILENO, iov, 2);\n"
8294 #: build/C/man2/readv.2:288
8295 msgid "B<pread>(2), B<read>(2), B<write>(2)"
8299 #: build/C/man3/remove.3:31
8305 #: build/C/man3/remove.3:31
8311 #: build/C/man3/remove.3:34
8312 msgid "remove - remove a file or directory"
8316 #: build/C/man3/remove.3:38
8317 msgid "B<int remove(const char *>I<pathname>B<);>"
8321 #: build/C/man3/remove.3:46
8323 "B<remove>() deletes a name from the filesystem. It calls B<unlink>(2) for "
8324 "files, and B<rmdir>(2) for directories."
8328 #: build/C/man3/remove.3:50
8330 "If the removed name was the last link to a file and no processes have the "
8331 "file open, the file is deleted and the space it was using is made available "
8336 #: build/C/man3/remove.3:55
8338 "If the name was the last link to a file, but any processes still have the "
8339 "file open, the file will remain in existence until the last file descriptor "
8340 "referring to it is closed."
8344 #: build/C/man3/remove.3:57
8345 msgid "If the name referred to a symbolic link, the link is removed."
8349 #: build/C/man3/remove.3:60
8351 "If the name referred to a socket, FIFO, or device, the name is removed, but "
8352 "processes which have the object open may continue to use it."
8356 #: build/C/man3/remove.3:70
8357 msgid "The errors that occur are those for B<unlink>(2) and B<rmdir>(2)."
8361 #: build/C/man3/remove.3:72
8362 msgid "C89, C99, 4.3BSD, POSIX.1-2001."
8366 #: build/C/man3/remove.3:78
8368 "Under libc4 and libc5, B<remove>() was an alias for B<unlink>(2) (and "
8369 "hence would not remove directories)."
8373 #: build/C/man3/remove.3:81 build/C/man2/unlink.2:148
8375 "Infelicities in the protocol underlying NFS can cause the unexpected "
8376 "disappearance of files which are still being used."
8380 #: build/C/man3/remove.3:92
8382 "B<rm>(1), B<unlink>(1), B<link>(2), B<mknod>(2), B<open>(2), B<rename>(2), "
8383 "B<rmdir>(2), B<unlink>(2), B<mkfifo>(3), B<symlink>(7)"
8387 #: build/C/man2/rename.2:32
8393 #: build/C/man2/rename.2:35
8394 msgid "rename - change the name or location of a file"
8398 #: build/C/man2/rename.2:39
8399 msgid "B<int rename(const char *>I<oldpath>B<, const char *>I<newpath>B<);>"
8403 #: build/C/man2/rename.2:48
8405 "B<rename>() renames a file, moving it between directories if required. Any "
8406 "other hard links to the file (as created using B<link>(2)) are unaffected. "
8407 "Open file descriptors for I<oldpath> are also unaffected."
8411 #: build/C/man2/rename.2:56
8413 "If I<newpath> already exists it will be atomically replaced (subject to a "
8414 "few conditions; see ERRORS below), so that there is no point at which "
8415 "another process attempting to access I<newpath> will find it missing."
8419 #: build/C/man2/rename.2:64
8421 "If I<oldpath> and I<newpath> are existing hard links referring to the same "
8422 "file, then B<rename>() does nothing, and returns a success status."
8426 #: build/C/man2/rename.2:72
8428 "If I<newpath> exists but the operation fails for some reason B<rename>() "
8429 "guarantees to leave an instance of I<newpath> in place."
8433 #: build/C/man2/rename.2:78
8435 "I<oldpath> can specify a directory. In this case, I<newpath> must either "
8436 "not exist, or it must specify an empty directory."
8440 #: build/C/man2/rename.2:85
8442 "However, when overwriting there will probably be a window in which both "
8443 "I<oldpath> and I<newpath> refer to the file being renamed."
8447 #: build/C/man2/rename.2:91
8449 "If I<oldpath> refers to a symbolic link the link is renamed; if I<newpath> "
8450 "refers to a symbolic link the link will be overwritten."
8454 #: build/C/man2/rename.2:116
8456 "Write permission is denied for the directory containing I<oldpath> or "
8457 "I<newpath>, or, search permission is denied for one of the directories in "
8458 "the path prefix of I<oldpath> or I<newpath>, or I<oldpath> is a directory "
8459 "and does not allow write permission (needed to update the I<..> entry). "
8460 "(See also B<path_resolution>(7).)"
8464 #: build/C/man2/rename.2:116 build/C/man2/rmdir.2:55 build/C/man2/unlink.2:71
8470 #: build/C/man2/rename.2:133
8472 "The rename fails because I<oldpath> or I<newpath> is a directory that is in "
8473 "use by some process (perhaps as current working directory, or as root "
8474 "directory, or because it was open for reading) or is in use by the system "
8475 "(for example as mount point), while the system considers this an error. "
8476 "(Note that there is no requirement to return B<EBUSY> in such "
8477 "cases\\(emthere is nothing wrong with doing the rename anyway\\(embut it is "
8478 "allowed to return B<EBUSY> if the system cannot otherwise handle such "
8483 #: build/C/man2/rename.2:143
8485 "The new pathname contained a path prefix of the old, or, more generally, an "
8486 "attempt was made to make a directory a subdirectory of itself."
8490 #: build/C/man2/rename.2:149
8491 msgid "I<newpath> is an existing directory, but I<oldpath> is not a directory."
8495 #: build/C/man2/rename.2:160
8497 "I<oldpath> already has the maximum number of links to it, or it was a "
8498 "directory and the directory containing I<newpath> has the maximum number of "
8503 #: build/C/man2/rename.2:176
8505 "The link named by I<oldpath> does not exist; or, a directory component in "
8506 "I<newpath> does not exist; or, I<oldpath> or I<newpath> is an empty string."
8510 #: build/C/man2/rename.2:193
8512 "A component used as a directory in I<oldpath> or I<newpath> is not, in fact, "
8513 "a directory. Or, I<oldpath> is a directory, and I<newpath> exists but is "
8518 #: build/C/man2/rename.2:193
8520 msgid "B<ENOTEMPTY> or B<EEXIST>"
8524 #: build/C/man2/rename.2:197
8526 "I<newpath> is a nonempty directory, that is, contains entries other than "
8531 #: build/C/man2/rename.2:197 build/C/man2/unlink.2:126
8533 msgid "B<EPERM> or B<EACCES>"
8537 #: build/C/man2/rename.2:221
8539 "The directory containing I<oldpath> has the sticky bit (B<S_ISVTX>) set and "
8540 "the process's effective user ID is neither the user ID of the file to be "
8541 "deleted nor that of the directory containing it, and the process is not "
8542 "privileged (Linux: does not have the B<CAP_FOWNER> capability); or "
8543 "I<newpath> is an existing file and the directory containing it has the "
8544 "sticky bit set and the process's effective user ID is neither the user ID of "
8545 "the file to be replaced nor that of the directory containing it, and the "
8546 "process is not privileged (Linux: does not have the B<CAP_FOWNER> "
8547 "capability); or the filesystem containing I<pathname> does not support "
8548 "renaming of the type requested."
8552 #: build/C/man2/rename.2:232
8554 "I<oldpath> and I<newpath> are not on the same mounted filesystem. (Linux "
8555 "permits a filesystem to be mounted at multiple points, but B<rename>() does "
8556 "not work across different mount points, even if the same filesystem is "
8561 #: build/C/man2/rename.2:234
8562 msgid "4.3BSD, C89, C99, POSIX.1-2001."
8566 #: build/C/man2/rename.2:245
8568 "On NFS filesystems, you can not assume that if the operation failed the file "
8569 "was not renamed. If the server does the rename operation and then crashes, "
8570 "the retransmitted RPC which will be processed when the server is up again "
8571 "causes a failure. The application is expected to deal with this. See "
8572 "B<link>(2) for a similar problem."
8576 #: build/C/man2/rename.2:254
8578 "B<mv>(1), B<chmod>(2), B<link>(2), B<renameat>(2), B<symlink>(2), "
8579 "B<unlink>(2), B<path_resolution>(7), B<symlink>(7)"
8583 #: build/C/man2/rmdir.2:30
8589 #: build/C/man2/rmdir.2:30
8595 #: build/C/man2/rmdir.2:33
8596 msgid "rmdir - delete a directory"
8600 #: build/C/man2/rmdir.2:37
8601 msgid "B<int rmdir(const char *>I<pathname>B<);>"
8605 #: build/C/man2/rmdir.2:40
8606 msgid "B<rmdir>() deletes a directory, which must be empty."
8610 #: build/C/man2/rmdir.2:55
8612 "Write access to the directory containing I<pathname> was not allowed, or one "
8613 "of the directories in the path prefix of I<pathname> did not allow search "
8614 "permission. (See also B<path_resolution>(7)."
8618 #: build/C/man2/rmdir.2:64
8620 "I<pathname> is currently in use by the system or some process that prevents "
8621 "its removal. On Linux this means I<pathname> is currently used as a mount "
8622 "point or is the root directory of the calling process."
8626 #: build/C/man2/rmdir.2:73
8627 msgid "I<pathname> has I<.> as last component."
8631 #: build/C/man2/rmdir.2:77
8632 msgid "Too many symbolic links were encountered in resolving I<pathname>."
8636 #: build/C/man2/rmdir.2:85
8638 "A directory component in I<pathname> does not exist or is a dangling "
8643 #: build/C/man2/rmdir.2:94
8645 "I<pathname>, or a component used as a directory in I<pathname>, is not, in "
8646 "fact, a directory."
8650 #: build/C/man2/rmdir.2:94
8652 msgid "B<ENOTEMPTY>"
8656 #: build/C/man2/rmdir.2:107
8658 "I<pathname> contains entries other than I<.> and I<..> ; or, I<pathname> has "
8659 "I<..> as its final component. POSIX.1-2001 also allows B<EEXIST> for this "
8664 #: build/C/man2/rmdir.2:118
8666 "The directory containing I<pathname> has the sticky bit (B<S_ISVTX>) set "
8667 "and the process's effective user ID is neither the user ID of the file to be "
8668 "deleted nor that of the directory containing it, and the process is not "
8669 "privileged (Linux: does not have the B<CAP_FOWNER> capability)."
8673 #: build/C/man2/rmdir.2:123
8675 "The filesystem containing I<pathname> does not support the removal of "
8680 #: build/C/man2/rmdir.2:127
8681 msgid "I<pathname> refers to a directory on a read-only filesystem."
8685 #: build/C/man2/rmdir.2:132
8687 "Infelicities in the protocol underlying NFS can cause the unexpected "
8688 "disappearance of directories which are still being used."
8692 #: build/C/man2/rmdir.2:141
8694 "B<rm>(1), B<rmdir>(1), B<chdir>(2), B<chmod>(2), B<mkdir>(2), B<rename>(2), "
8695 "B<unlink>(2), B<unlinkat>(2)"
8699 #: build/C/man3/scanf.3:52
8705 #: build/C/man3/scanf.3:52
8711 #: build/C/man3/scanf.3:55
8712 msgid "scanf, fscanf, sscanf, vscanf, vsscanf, vfscanf - input format conversion"
8716 #: build/C/man3/scanf.3:62
8719 "B<int scanf(const char *>I<format>B<, ...);>\n"
8720 "B<int fscanf(FILE *>I<stream>B<, const char *>I<format>B<, ...);>\n"
8721 "B<int sscanf(const char *>I<str>B<, const char *>I<format>B<, ...);>\n"
8725 #: build/C/man3/scanf.3:64
8727 msgid "B<#include E<lt>stdarg.hE<gt>>\n"
8731 #: build/C/man3/scanf.3:68
8734 "B<int vscanf(const char *>I<format>B<, va_list >I<ap>B<);>\n"
8735 "B<int vsscanf(const char *>I<str>B<, const char *>I<format>B<, va_list "
8737 "B<int vfscanf(FILE *>I<stream>B<, const char *>I<format>B<, va_list "
8742 #: build/C/man3/scanf.3:79
8743 msgid "B<vscanf>(), B<vsscanf>(), B<vfscanf>():"
8747 #: build/C/man3/scanf.3:82
8749 "_XOPEN_SOURCE\\ E<gt>=\\ 600 || _ISOC99_SOURCE || _POSIX_C_SOURCE\\ E<gt>=\\ "
8754 #: build/C/man3/scanf.3:104
8756 "The B<scanf>() family of functions scans input according to I<format> as "
8757 "described below. This format may contain I<conversion specifications>; the "
8758 "results from such conversions, if any, are stored in the locations pointed "
8759 "to by the I<pointer> arguments that follow I<format>. Each I<pointer> "
8760 "argument must be of a type that is appropriate for the value returned by the "
8761 "corresponding conversion specification."
8765 #: build/C/man3/scanf.3:115
8767 "If the number of conversion specifications in I<format> exceeds the number "
8768 "of I<pointer> arguments, the results are undefined. If the number of "
8769 "I<pointer> arguments exceeds the number of conversion specifications, then "
8770 "the excess I<pointer> arguments are evaluated, but are otherwise ignored."
8774 #: build/C/man3/scanf.3:127
8776 "The B<scanf>() function reads input from the standard input stream "
8777 "I<stdin>, B<fscanf>() reads input from the stream pointer I<stream>, and "
8778 "B<sscanf>() reads its input from the character string pointed to by I<str>."
8782 #: build/C/man3/scanf.3:145
8784 "The B<vfscanf>() function is analogous to B<vfprintf>(3) and reads input "
8785 "from the stream pointer I<stream> using a variable argument list of pointers "
8786 "(see B<stdarg>(3). The B<vscanf>() function scans a variable argument list "
8787 "from the standard input and the B<vsscanf>() function scans it from a "
8788 "string; these are analogous to the B<vprintf>(3) and B<vsprintf>(3) "
8789 "functions respectively."
8793 #: build/C/man3/scanf.3:159
8795 "The I<format> string consists of a sequence of I<directives> which describe "
8796 "how to process the sequence of input characters. If processing of a "
8797 "directive fails, no further input is read, and B<scanf>() returns. A "
8798 "\"failure\" can be either of the following: I<input failure>, meaning that "
8799 "input characters were unavailable, or I<matching failure>, meaning that the "
8800 "input was inappropriate (see below)."
8804 #: build/C/man3/scanf.3:161
8805 msgid "A directive is one of the following:"
8809 #: build/C/man3/scanf.3:161 build/C/man3/scanf.3:167 build/C/man3/scanf.3:171 build/C/man3/scanf.3:190 build/C/man3/scanf.3:201 build/C/man3/scanf.3:220 build/C/man3/scanf.3:232 build/C/man3/scanf.3:246
8815 #: build/C/man3/scanf.3:167
8817 "A sequence of white-space characters (space, tab, newline, etc.; see "
8818 "B<isspace>(3)). This directive matches any amount of white space, including "
8819 "none, in the input."
8823 #: build/C/man3/scanf.3:171
8825 "An ordinary character (i.e., one other than white space or \\(aq%\\(aq). "
8826 "This character must exactly match the next character of input."
8830 #: build/C/man3/scanf.3:182
8832 "A conversion specification, which commences with a \\(aq%\\(aq (percent) "
8833 "character. A sequence of characters from the input is converted according "
8834 "to this specification, and the result is placed in the corresponding "
8835 "I<pointer> argument. If the next item of input does not match the "
8836 "conversion specification, the conversion fails\\(emthis is a I<matching "
8841 #: build/C/man3/scanf.3:190
8843 "Each I<conversion specification> in I<format> begins with either the "
8844 "character \\(aq%\\(aq or the character sequence \"B<%>I<n>B<$>\" (see below "
8845 "for the distinction) followed by:"
8849 #: build/C/man3/scanf.3:201
8851 "An optional \\(aq*\\(aq assignment-suppression character: B<scanf>() reads "
8852 "input as directed by the conversion specification, but discards the input. "
8853 "No corresponding I<pointer> argument is required, and this specification is "
8854 "not included in the count of successful assignments returned by B<scanf>()."
8858 #: build/C/man3/scanf.3:220
8860 "An optional \\(aqm\\(aq character. This is used with string conversions "
8861 "(I<%s>, I<%c>, I<%[>), and relieves the caller of the need to allocate a "
8862 "corresponding buffer to hold the input: instead, B<scanf>() allocates a "
8863 "buffer of sufficient size, and assigns the address of this buffer to the "
8864 "corresponding I<pointer> argument, which should be a pointer to a I<char\\ "
8865 "*> variable (this variable does not need to be initialized before the "
8866 "call). The caller should subsequently B<free>(3) this buffer when it is no "
8871 #: build/C/man3/scanf.3:232
8873 "An optional decimal integer which specifies the I<maximum field width>. "
8874 "Reading of characters stops either when this maximum is reached or when a "
8875 "nonmatching character is found, whichever happens first. Most conversions "
8876 "discard initial white space characters (the exceptions are noted below), and "
8877 "these discarded characters don't count toward the maximum field width. "
8878 "String input conversions store a terminating null byte (\\(aq\\e0\\(aq) to "
8879 "mark the end of the input; the maximum field width does not include this "
8884 #: build/C/man3/scanf.3:246
8886 "An optional I<type modifier character>. For example, the B<l> type modifier "
8887 "is used with integer conversions such as B<%d> to specify that the "
8888 "corresponding I<pointer> argument refers to a I<long int> rather than a "
8889 "pointer to an I<int>."
8893 #: build/C/man3/scanf.3:251
8895 "A I<conversion specifier> that specifies the type of input conversion to be "
8900 #: build/C/man3/scanf.3:280
8902 "The conversion specifications in I<format> are of two forms, either "
8903 "beginning with \\(aq%\\(aq or beginning with \"B<%>I<n>B<$>\". The two "
8904 "forms should not be mixed in the same I<format> string, except that a string "
8905 "containing \"B<%>I<n>B<$>\" specifications can include B<%%> and B<%*>. If "
8906 "I<format> contains \\(aq%\\(aq specifications then these correspond in order "
8907 "with successive I<pointer> arguments. In the \"B<%>I<n>B<$>\" form (which "
8908 "is specified in POSIX.1-2001, but not C99), I<n> is a decimal integer that "
8909 "specifies that the converted input should be placed in the location referred "
8910 "to by the I<n>-th I<pointer> argument following I<format>."
8914 #: build/C/man3/scanf.3:280
8920 #: build/C/man3/scanf.3:284
8922 "The following I<type modifier characters> can appear in a conversion "
8927 #: build/C/man3/scanf.3:294
8929 "Indicates that the conversion will be one of B<d>, B<i>, B<o>, B<u>, B<x>, "
8930 "B<X>, or B<n> and the next pointer is a pointer to a I<short int> or "
8931 "I<unsigned short int> (rather than I<int>)."
8935 #: build/C/man3/scanf.3:302
8937 "As for B<h>, but the next pointer is a pointer to a I<signed char> or "
8942 #: build/C/man3/scanf.3:311
8944 "As for B<h>, but the next pointer is a pointer to an I<intmax_t> or a "
8945 "I<uintmax_t>. This modifier was introduced in C99."
8948 #. This use of l was introduced in Amendment 1 to ISO C90.
8950 #: build/C/man3/scanf.3:338
8952 "Indicates either that the conversion will be one of B<d>, B<i>, B<o>, B<u>, "
8953 "B<x>, B<X>, or B<n> and the next pointer is a pointer to a I<long int> or "
8954 "I<unsigned long int> (rather than I<int>), or that the conversion will be "
8955 "one of B<e>, B<f>, or B<g> and the next pointer is a pointer to I<double> "
8956 "(rather than I<float>). Specifying two B<l> characters is equivalent to "
8957 "B<L>. If used with B<%c> or B<%s> the corresponding parameter is considered "
8958 "as a pointer to a wide character or wide-character string respectively."
8961 #. MTK, Jul 05: The following is no longer true for modern
8962 #. ANSI C (i.e., C99):
8963 #. (Note that long long is not an
8965 #. type. Any program using this will not be portable to all
8968 #: build/C/man3/scanf.3:354
8970 "Indicates that the conversion will be either B<e>, B<f>, or B<g> and the "
8971 "next pointer is a pointer to I<long double> or the conversion will be B<d>, "
8972 "B<i>, B<o>, B<u>, or B<x> and the next pointer is a pointer to I<long long>."
8976 #: build/C/man3/scanf.3:359
8977 msgid "equivalent to B<L>. This specifier does not exist in ANSI C."
8981 #: build/C/man3/scanf.3:366
8983 "As for B<h>, but the next pointer is a pointer to a I<ptrdiff_t>. This "
8984 "modifier was introduced in C99."
8988 #: build/C/man3/scanf.3:373
8990 "As for B<h>, but the next pointer is a pointer to a I<size_t>. This "
8991 "modifier was introduced in C99."
8995 #: build/C/man3/scanf.3:377
8996 msgid "The following I<conversion specifiers> are available:"
9000 #: build/C/man3/scanf.3:386
9002 "Matches a literal \\(aq%\\(aq. That is, B<%\\&%> in the format string "
9003 "matches a single input \\(aq%\\(aq character. No conversion is done (but "
9004 "initial white space characters are discarded), and assignment does not "
9009 #: build/C/man3/scanf.3:386
9015 #: build/C/man3/scanf.3:391
9017 "Matches an optionally signed decimal integer; the next pointer must be a "
9018 "pointer to I<int>."
9022 #: build/C/man3/scanf.3:391
9028 #: build/C/man3/scanf.3:400
9030 "Equivalent to I<ld>; this exists only for backward compatibility. (Note: "
9031 "thus only in libc4. In libc5 and glibc the B<%D> is silently ignored, "
9032 "causing old programs to fail mysteriously.)"
9036 #: build/C/man3/scanf.3:400
9042 #: build/C/man3/scanf.3:412
9044 "Matches an optionally signed integer; the next pointer must be a pointer to "
9045 "I<int>. The integer is read in base 16 if it begins with I<0x> or I<0X>, in "
9046 "base 8 if it begins with I<0>, and in base 10 otherwise. Only characters "
9047 "that correspond to the base are used."
9051 #: build/C/man3/scanf.3:412
9057 #: build/C/man3/scanf.3:416
9059 "Matches an unsigned octal integer; the next pointer must be a pointer to "
9064 #: build/C/man3/scanf.3:416
9070 #: build/C/man3/scanf.3:421
9072 "Matches an unsigned decimal integer; the next pointer must be a pointer to "
9077 #: build/C/man3/scanf.3:426
9079 "Matches an unsigned hexadecimal integer; the next pointer must be a pointer "
9080 "to I<unsigned int>."
9084 #: build/C/man3/scanf.3:426
9090 #: build/C/man3/scanf.3:430
9091 msgid "Equivalent to B<x>."
9095 #: build/C/man3/scanf.3:430
9101 #: build/C/man3/scanf.3:435
9103 "Matches an optionally signed floating-point number; the next pointer must be "
9104 "a pointer to I<float>."
9108 #: build/C/man3/scanf.3:435
9114 #: build/C/man3/scanf.3:439 build/C/man3/scanf.3:443 build/C/man3/scanf.3:447
9115 msgid "Equivalent to B<f>."
9119 #: build/C/man3/scanf.3:439
9125 #: build/C/man3/scanf.3:443
9131 #: build/C/man3/scanf.3:451
9132 msgid "(C99) Equivalent to B<f>."
9136 #: build/C/man3/scanf.3:459
9138 "Matches a sequence of non-white-space characters; the next pointer must be a "
9139 "pointer to character array that is long enough to hold the input sequence "
9140 "and the terminating null byte (\\(aq\\e0\\(aq), which is added "
9141 "automatically. The input string stops at white space or at the maximum "
9142 "field width, whichever occurs first."
9146 #: build/C/man3/scanf.3:469
9148 "Matches a sequence of characters whose length is specified by the I<maximum "
9149 "field width> (default 1); the next pointer must be a pointer to I<char>, and "
9150 "there must be enough room for all the characters (no terminating null byte "
9151 "is added). The usual skip of leading white space is suppressed. To skip "
9152 "white space first, use an explicit space in the format."
9156 #: build/C/man3/scanf.3:469
9162 #: build/C/man3/scanf.3:502
9164 "Matches a nonempty sequence of characters from the specified set of accepted "
9165 "characters; the next pointer must be a pointer to I<char>, and there must be "
9166 "enough room for all the characters in the string, plus a terminating null "
9167 "byte. The usual skip of leading white space is suppressed. The string is "
9168 "to be made up of characters in (or not in) a particular set; the set is "
9169 "defined by the characters between the open bracket B<[> character and a "
9170 "close bracket B<]> character. The set I<excludes> those characters if the "
9171 "first character after the open bracket is a circumflex (B<^>). To include a "
9172 "close bracket in the set, make it the first character after the open bracket "
9173 "or the circumflex; any other position will end the set. The hyphen "
9174 "character B<-> is also special; when placed between two other characters, it "
9175 "adds all intervening characters to the set. To include a hyphen, make it "
9176 "the last character before the final close bracket. For instance, "
9177 "B<[^]0-9-]> means the set \"everything except close bracket, zero through "
9178 "nine, and hyphen\". The string ends with the appearance of a character not "
9179 "in the (or, with a circumflex, in) set or when the field width runs out."
9183 #: build/C/man3/scanf.3:510
9185 "Matches a pointer value (as printed by B<%p> in B<printf>(3); the next "
9186 "pointer must be a pointer to a pointer to I<void>."
9190 #: build/C/man3/scanf.3:530
9192 "Nothing is expected; instead, the number of characters consumed thus far "
9193 "from the input is stored through the next pointer, which must be a pointer "
9194 "to I<int>. This is I<not> a conversion, although it can be suppressed with "
9195 "the B<*> assignment-suppression character. The C standard says: \"Execution "
9196 "of a B<%n> directive does not increment the assignment count returned at the "
9197 "completion of execution\" but the Corrigendum seems to contradict this. "
9198 "Probably it is wise not to make any assumptions on the effect of B<%n> "
9199 "conversions on the return value."
9203 #: build/C/man3/scanf.3:535
9205 "These functions return the number of input items successfully matched and "
9206 "assigned, which can be fewer than provided for, or even zero in the event of "
9207 "an early matching failure."
9211 #: build/C/man3/scanf.3:547
9213 "The value B<EOF> is returned if the end of input is reached before either "
9214 "the first successful conversion or a matching failure occurs. B<EOF> is "
9215 "also returned if a read error occurs, in which case the error indicator for "
9216 "the stream (see B<ferror>(3)) is set, and I<errno> is set indicate the "
9221 #: build/C/man3/scanf.3:553
9223 "The file descriptor underlying I<stream> is marked nonblocking, and the read "
9224 "operation would block."
9228 #: build/C/man3/scanf.3:558
9230 "The file descriptor underlying I<stream> is invalid, or not open for "
9235 #: build/C/man3/scanf.3:561
9236 msgid "Input byte sequence does not form a valid character."
9240 #: build/C/man3/scanf.3:565
9241 msgid "The read operation was interrupted by a signal; see B<signal>(7)."
9245 #: build/C/man3/scanf.3:570
9246 msgid "Not enough arguments; or I<format> is NULL."
9250 #: build/C/man3/scanf.3:573
9251 msgid "Out of memory."
9255 #: build/C/man3/scanf.3:573
9261 #: build/C/man3/scanf.3:577
9263 "The result of an integer conversion would exceed the size that can be stored "
9264 "in the corresponding integer type."
9268 #: build/C/man3/scanf.3:587
9270 "The functions B<fscanf>(), B<scanf>(), and B<sscanf>() conform to C89 and "
9271 "C99 and POSIX.1-2001. These standards do not specify the B<ERANGE> error."
9275 #: build/C/man3/scanf.3:597
9277 "The B<q> specifier is the 4.4BSD notation for I<long long>, while B<ll> or "
9278 "the usage of B<L> in integer conversions is the GNU notation."
9282 #: build/C/man3/scanf.3:608
9284 "The Linux version of these functions is based on the I<GNU> I<libio> "
9285 "library. Take a look at the I<info> documentation of I<GNU> I<libc "
9286 "(glibc-1.08)> for a more concise description."
9290 #: build/C/man3/scanf.3:614
9292 "The GNU C library supported the dynamic allocation conversion specifier (as "
9293 "a nonstandard extension) via the B<a> character. This feature seems to be "
9294 "present at least as far back as glibc 2.0."
9298 #: build/C/man3/scanf.3:624
9300 "It is not available if the program is compiled with I<gcc -std=c99> or I<gcc "
9301 "-D_ISOC99_SOURCE> (unless B<_GNU_SOURCE> is also specified), in which case "
9302 "the B<a> is interpreted as a specifier for floating-point numbers (see "
9307 #: build/C/man3/scanf.3:633
9309 "Since version 2.7, glibc also provides the B<m> modifier for the same "
9310 "purpose as the B<a> modifier. The B<m> modifier has the following "
9315 #: build/C/man3/scanf.3:638
9316 msgid "It may also be applied to B<%c> conversion specifiers (e.g., B<%3mc>)."
9320 #: build/C/man3/scanf.3:644
9322 "It avoids ambiguity with respect to the B<%a> floating-point conversion "
9323 "specifier (and is unaffected by I<gcc -std=c99> etc.)"
9327 #: build/C/man3/scanf.3:646
9328 msgid "It is specified in the POSIX.1-2008 standard."
9332 #: build/C/man3/scanf.3:659
9334 "All functions are fully C89 conformant, but provide the additional "
9335 "specifiers B<q> and B<a> as well as an additional behavior of the B<L> and "
9336 "B<l> specifiers. The latter may be considered to be a bug, as it changes "
9337 "the behavior of specifiers defined in C89."
9341 #: build/C/man3/scanf.3:675
9343 "Some combinations of the type modifiers and conversion specifiers defined by "
9344 "ANSI C do not make sense (e.g., B<%Ld>). While they may have a well-defined "
9345 "behavior on Linux, this need not to be so on other architectures. Therefore "
9346 "it usually is better to use modifiers that are not defined by ANSI C at all, "
9347 "that is, use B<q> instead of B<L> in combination with B<d>, B<i>, B<o>, "
9348 "B<u>, B<x>, and B<X> conversions or B<ll>."
9352 #: build/C/man3/scanf.3:681
9354 "The usage of B<q> is not the same as on 4.4BSD, as it may be used in float "
9355 "conversions equivalently to B<L>."
9359 #: build/C/man3/scanf.3:691
9361 "To use the dynamic allocation conversion specifier, specify B<m> as a length "
9362 "modifier (thus B<%ms> or B<%m[>I<range>B<]>). The caller must B<free>(3) "
9363 "the returned string, as in the following example:"
9367 #: build/C/man3/scanf.3:696
9375 #: build/C/man3/scanf.3:707
9379 "n = scanf(\"%m[a-z]\", &p);\n"
9381 " printf(\"read: %s\\en\", p);\n"
9383 "} else if (errno != 0) {\n"
9384 " perror(\"scanf\");\n"
9386 " fprintf(stderr, \"No matching characters\\en\");\n"
9391 #: build/C/man3/scanf.3:715
9393 "As shown in the above example, it is necessary to call B<free>(3) only if "
9394 "the B<scanf>() call successfully read a string."
9398 #: build/C/man3/scanf.3:722
9400 "B<getc>(3), B<printf>(3), B<setlocale>(3), B<strtod>(3), B<strtol>(3), "
9405 #: build/C/man3/setbuf.3:48
9411 #: build/C/man3/setbuf.3:48
9417 #: build/C/man3/setbuf.3:51
9418 msgid "setbuf, setbuffer, setlinebuf, setvbuf - stream buffering operations"
9422 #: build/C/man3/setbuf.3:56
9424 msgid "B<void setbuf(FILE *>I<stream>B<, char *>I<buf>B<);>\n"
9428 #: build/C/man3/setbuf.3:58
9430 msgid "B<void setbuffer(FILE *>I<stream>B<, char *>I<buf>B<, size_t >I<size>B<);>\n"
9434 #: build/C/man3/setbuf.3:60
9436 msgid "B<void setlinebuf(FILE *>I<stream>B<);>\n"
9440 #: build/C/man3/setbuf.3:63
9443 "B<int setvbuf(FILE *>I<stream>B<, char *>I<buf>B<, int >I<mode>B<, size_t "
9448 #: build/C/man3/setbuf.3:73
9449 msgid "B<setbuffer>(), B<setlinebuf>(): _BSD_SOURCE"
9453 #: build/C/man3/setbuf.3:96
9455 "The three types of buffering available are unbuffered, block buffered, and "
9456 "line buffered. When an output stream is unbuffered, information appears on "
9457 "the destination file or terminal as soon as written; when it is block "
9458 "buffered many characters are saved up and written as a block; when it is "
9459 "line buffered characters are saved up until a newline is output or input is "
9460 "read from any stream attached to a terminal device (typically I<stdin>). "
9461 "The function B<fflush>(3) may be used to force the block out early. (See "
9462 "B<fclose>(3).) Normally all files are block buffered. When the first I/O "
9463 "operation occurs on a file, B<malloc>(3) is called, and a buffer is "
9464 "obtained. If a stream refers to a terminal (as I<stdout> normally does) it "
9465 "is line buffered. The standard error stream I<stderr> is always unbuffered "
9470 #: build/C/man3/setbuf.3:103
9472 "The B<setvbuf>() function may be used on any open stream to change its "
9473 "buffer. The I<mode> argument must be one of the following three macros:"
9477 #: build/C/man3/setbuf.3:104
9483 #: build/C/man3/setbuf.3:107
9488 #: build/C/man3/setbuf.3:107
9494 #: build/C/man3/setbuf.3:110
9495 msgid "line buffered"
9499 #: build/C/man3/setbuf.3:110
9505 #: build/C/man3/setbuf.3:113
9506 msgid "fully buffered"
9510 #: build/C/man3/setbuf.3:129
9512 "Except for unbuffered files, the I<buf> argument should point to a buffer at "
9513 "least I<size> bytes long; this buffer will be used instead of the current "
9514 "buffer. If the argument I<buf> is NULL, only the mode is affected; a new "
9515 "buffer will be allocated on the next read or write operation. The "
9516 "B<setvbuf>() function may be used only after opening a stream and before "
9517 "any other operations have been performed on it."
9521 #: build/C/man3/setbuf.3:135
9523 "The other three calls are, in effect, simply aliases for calls to "
9524 "B<setvbuf>(). The B<setbuf>() function is exactly equivalent to the call"
9528 #: build/C/man3/setbuf.3:138
9529 msgid "setvbuf(stream, buf, buf ? _IOFBF : _IONBF, BUFSIZ);"
9533 #: build/C/man3/setbuf.3:148
9535 "The B<setbuffer>() function is the same, except that the size of the buffer "
9536 "is up to the caller, rather than being determined by the default B<BUFSIZ>. "
9537 "The B<setlinebuf>() function is exactly equivalent to the call:"
9541 #: build/C/man3/setbuf.3:151
9542 msgid "setvbuf(stream, NULL, _IOLBF, 0);"
9546 #: build/C/man3/setbuf.3:162
9548 "The function B<setvbuf>() returns 0 on success. It returns nonzero on "
9549 "failure (I<mode> is invalid or the request cannot be honored). It may set "
9550 "I<errno> on failure."
9554 #: build/C/man3/setbuf.3:164
9555 msgid "The other functions do not return a value."
9559 #: build/C/man3/setbuf.3:170
9560 msgid "The B<setbuf>() and B<setvbuf>() functions conform to C89 and C99."
9564 #: build/C/man3/setbuf.3:180
9566 "The B<setbuffer>() and B<setlinebuf>() functions are not portable to "
9567 "versions of BSD before 4.2BSD, and are available under Linux since libc "
9568 "4.5.21. On 4.2BSD and 4.3BSD systems, B<setbuf>() always uses a suboptimal "
9569 "buffer size and should be avoided."
9573 #: build/C/man3/setbuf.3:187
9575 "You must make sure that the space that I<buf> points to still exists by the "
9576 "time I<stream> is closed, which also happens at program termination. For "
9577 "example, the following is invalid:"
9581 #: build/C/man3/setbuf.3:190
9583 msgid "#include E<lt>stdio.hE<gt>\n"
9587 #: build/C/man3/setbuf.3:199
9593 " char buf[BUFSIZ];\n"
9594 " setbuf(stdin, buf);\n"
9595 " printf(\"Hello, world!\\en\");\n"
9601 #: build/C/man3/setbuf.3:208
9603 "B<fclose>(3), B<fflush>(3), B<fopen>(3), B<fread>(3), B<malloc>(3), "
9604 "B<printf>(3), B<puts>(3)"
9608 #: build/C/man3/stdin.3:13
9614 #: build/C/man3/stdin.3:13 build/C/man3/tmpfile.3:31
9620 #: build/C/man3/stdin.3:16
9621 msgid "stdin, stdout, stderr - standard I/O streams"
9625 #: build/C/man3/stdin.3:23
9628 "B<extern FILE *>I<stdin>B<;>\n"
9629 "B<extern FILE *>I<stdout>B<;>\n"
9630 "B<extern FILE *>I<stderr>B<;>\n"
9634 #: build/C/man3/stdin.3:35
9636 "Under normal circumstances every UNIX program has three streams opened for "
9637 "it when it starts up, one for input, one for output, and one for printing "
9638 "diagnostic or error messages. These are typically attached to the user's "
9639 "terminal (see B<tty>(4) but might instead refer to files or other devices, "
9640 "depending on what the parent process chose to set up. (See also the "
9641 "\"Redirection\" section of B<sh>(1).)"
9645 #: build/C/man3/stdin.3:45
9647 "The input stream is referred to as \"standard input\"; the output stream is "
9648 "referred to as \"standard output\"; and the error stream is referred to as "
9649 "\"standard error\". These terms are abbreviated to form the symbols used to "
9650 "refer to these files, namely I<stdin>, I<stdout>, and I<stderr>."
9654 #: build/C/man3/stdin.3:54
9656 "Each of these symbols is a B<stdio>(3) macro of type pointer to I<FILE>, "
9657 "and can be used with functions like B<fprintf>(3) or B<fread>(3)."
9661 #: build/C/man3/stdin.3:63
9663 "Since I<FILE>s are a buffering wrapper around UNIX file descriptors, the "
9664 "same underlying files may also be accessed using the raw UNIX file "
9665 "interface, that is, the functions like B<read>(2) and B<lseek>(2)."
9669 #: build/C/man3/stdin.3:82
9671 "On program startup, the integer file descriptors associated with the streams "
9672 "I<stdin>, I<stdout>, and I<stderr> are 0, 1, and 2, respectively. The "
9673 "preprocessor symbols B<STDIN_FILENO>, B<STDOUT_FILENO>, and B<STDERR_FILENO> "
9674 "are defined with these values in I<E<lt>unistd.hE<gt>>. (Applying "
9675 "B<freopen>(3) to one of these streams can change the file descriptor number "
9676 "associated with the stream.)"
9680 #: build/C/man3/stdin.3:95
9682 "Note that mixing use of I<FILE>s and raw file descriptors can produce "
9683 "unexpected results and should generally be avoided. (For the masochistic "
9684 "among you: POSIX.1, section 8.2.3, describes in detail how this interaction "
9685 "is supposed to work.) A general rule is that file descriptors are handled "
9686 "in the kernel, while stdio is just a library. This means for example, that "
9687 "after an B<exec>(3), the child inherits all open file descriptors, but all "
9688 "old streams have become inaccessible."
9692 #: build/C/man3/stdin.3:113
9694 "Since the symbols I<stdin>, I<stdout>, and I<stderr> are specified to be "
9695 "macros, assigning to them is nonportable. The standard streams can be made "
9696 "to refer to different files with help of the library function B<freopen>(3), "
9697 "specially introduced to make it possible to reassign I<stdin>, I<stdout>, "
9698 "and I<stderr>. The standard streams are closed by a call to B<exit>(3) and "
9699 "by normal program termination."
9703 #: build/C/man3/stdin.3:122
9705 "The I<stdin>, I<stdout>, and I<stderr> macros conform to C89 and this "
9706 "standard also stipulates that these three streams shall be open at program "
9711 #: build/C/man3/stdin.3:154
9713 "The stream I<stderr> is unbuffered. The stream I<stdout> is line-buffered "
9714 "when it points to a terminal. Partial lines will not appear until "
9715 "B<fflush>(3) or B<exit>(3) is called, or a newline is printed. This can "
9716 "produce unexpected results, especially with debugging output. The buffering "
9717 "mode of the standard streams (or any other stream) can be changed using the "
9718 "B<setbuf>(3) or B<setvbuf>(3) call. Note that in case I<stdin> is "
9719 "associated with a terminal, there may also be input buffering in the "
9720 "terminal driver, entirely unrelated to stdio buffering. (Indeed, normally "
9721 "terminal input is line buffered in the kernel.) This kernel input handling "
9722 "can be modified using calls like B<tcsetattr>(3); see also B<stty>(1), and "
9727 #: build/C/man3/stdin.3:160
9728 msgid "B<csh>(1), B<sh>(1), B<open>(2), B<fopen>(3), B<stdio>(3)"
9732 #: build/C/man3/stdio.3:39
9738 #: build/C/man3/stdio.3:39
9744 #: build/C/man3/stdio.3:42
9745 msgid "stdio - standard input/output library functions"
9749 #: build/C/man3/stdio.3:46
9750 msgid "B<FILE *>I<stdin>B<;>"
9754 #: build/C/man3/stdio.3:48
9755 msgid "B<FILE *>I<stdout>B<;>"
9759 #: build/C/man3/stdio.3:50
9760 msgid "B<FILE *>I<stderr>B<;>"
9764 #: build/C/man3/stdio.3:57
9766 "The standard I/O library provides a simple and efficient buffered stream I/O "
9767 "interface. Input and output is mapped into logical data streams and the "
9768 "physical I/O characteristics are concealed. The functions and macros are "
9769 "listed below; more information is available from the individual man pages."
9773 #: build/C/man3/stdio.3:80
9775 "A stream is associated with an external file (which may be a physical "
9776 "device) by I<opening> a file, which may involve creating a new file. "
9777 "Creating an existing file causes its former contents to be discarded. If a "
9778 "file can support positioning requests (such as a disk file, as opposed to a "
9779 "terminal) then a I<file position indicator> associated with the stream is "
9780 "positioned at the start of the file (byte zero), unless the file is opened "
9781 "with append mode. If append mode is used, it is unspecified whether the "
9782 "position indicator will be placed at the start or the end of the file. The "
9783 "position indicator is maintained by subsequent reads, writes and positioning "
9784 "requests. All input occurs as if the characters were read by successive "
9785 "calls to the B<fgetc>(3) function; all output takes place as if all "
9786 "characters were written by successive calls to the B<fputc>(3) function."
9790 #: build/C/man3/stdio.3:90
9792 "A file is disassociated from a stream by I<closing> the file. Output "
9793 "streams are flushed (any unwritten buffer contents are transferred to the "
9794 "host environment) before the stream is disassociated from the file. The "
9795 "value of a pointer to a I<FILE> object is indeterminate after a file is "
9800 #: build/C/man3/stdio.3:103
9802 "A file may be subsequently reopened, by the same or another program "
9803 "execution, and its contents reclaimed or modified (if it can be repositioned "
9804 "at the start). If the main function returns to its original caller, or the "
9805 "B<exit>(3) function is called, all open files are closed (hence all output "
9806 "streams are flushed) before program termination. Other methods of program "
9807 "termination, such as B<abort>(3) do not bother about closing files "
9812 #: build/C/man3/stdio.3:119
9814 "At program startup, three text streams are predefined and need not be opened "
9815 "explicitly: I<standard input> (for reading conventional input), I<standard "
9816 "output> (for writing conventional input), and I<standard error> (for writing "
9817 "diagnostic output). These streams are abbreviated I<stdin>,I<stdout> and "
9818 "I<stderr>. When opened, the standard error stream is not fully buffered; "
9819 "the standard input and output streams are fully buffered if and only if the "
9820 "streams do not refer to an interactive device."
9824 #: build/C/man3/stdio.3:129
9826 "Output streams that refer to terminal devices are always line buffered by "
9827 "default; pending output to such streams is written automatically whenever an "
9828 "input stream that refers to a terminal device is read. In cases where a "
9829 "large amount of computation is done after printing part of a line on an "
9830 "output terminal, it is necessary to B<fflush>(3) the standard output before "
9831 "going off and computing so that the output will appear."
9835 #: build/C/man3/stdio.3:143
9837 "The I<stdio> library is a part of the library B<libc> and routines are "
9838 "automatically loaded as needed by the compilers B<cc>(1) and B<pc>(1). The "
9839 "SYNOPSIS sections of the following manual pages indicate which include files "
9840 "are to be used, what the compiler declaration for the function looks like "
9841 "and which external variables are of interest."
9844 #. Not on Linux: .BR fropen ,
9845 #. Not on Linux: .BR fwopen ,
9847 #: build/C/man3/stdio.3:183
9849 "The following are defined as macros; these names may not be reused without "
9850 "first removing their current definitions with B<#undef>: B<BUFSIZ>, B<EOF>, "
9851 "B<FILENAME_MAX>, B<FOPEN_MAX>, B<L_cuserid>, B<L_ctermid>, B<L_tmpnam>, "
9852 "B<NULL>, B<SEEK_END>, B<SEEK_SET>, B<SEEK_CUR>, B<TMP_MAX>, B<clearerr>, "
9853 "B<feof>, B<ferror>, B<fileno>, B<getc>, B<getchar>, B<putc>, B<putchar>, "
9854 "B<stderr>, B<stdin>, B<stdout>. Function versions of the macro functions "
9855 "B<feof>, B<ferror>, B<clearerr>, B<fileno>, B<getc>, B<getchar>, B<putc>, "
9856 "and B<putchar> exist and will be used if the macros definitions are "
9857 "explicitly removed."
9861 #: build/C/man3/stdio.3:183
9863 msgid "List of functions"
9867 #: build/C/man3/stdio.3:188
9869 msgid "Function\tDescription\n"
9873 #: build/C/man3/stdio.3:189
9879 #: build/C/man3/stdio.3:190
9881 msgid "clearerr\tcheck and reset stream status\n"
9885 #: build/C/man3/stdio.3:191
9887 msgid "fclose\tclose a stream\n"
9891 #: build/C/man3/stdio.3:192
9893 msgid "fdopen\tstream open functions\n"
9897 #: build/C/man3/stdio.3:193
9899 msgid "feof\tcheck and reset stream status\n"
9903 #: build/C/man3/stdio.3:194
9905 msgid "ferror\tcheck and reset stream status\n"
9909 #: build/C/man3/stdio.3:195
9911 msgid "fflush\tflush a stream\n"
9915 #: build/C/man3/stdio.3:196
9917 msgid "fgetc\tget next character or word from input stream\n"
9921 #: build/C/man3/stdio.3:197
9923 msgid "fgetpos\treposition a stream\n"
9927 #: build/C/man3/stdio.3:198
9929 msgid "fgets\tget a line from a stream\n"
9933 #: build/C/man3/stdio.3:199
9935 msgid "fileno\treturn the integer descriptor of the argument stream\n"
9939 #: build/C/man3/stdio.3:200
9941 msgid "fopen\tstream open functions\n"
9945 #: build/C/man3/stdio.3:201
9947 msgid "fprintf\tformatted output conversion\n"
9951 #: build/C/man3/stdio.3:202
9953 msgid "fpurge\tflush a stream\n"
9957 #: build/C/man3/stdio.3:203
9959 msgid "fputc\toutput a character or word to a stream\n"
9963 #: build/C/man3/stdio.3:204
9965 msgid "fputs\toutput a line to a stream\n"
9969 #: build/C/man3/stdio.3:205
9971 msgid "fread\tbinary stream input/output\n"
9975 #: build/C/man3/stdio.3:206
9977 msgid "freopen\tstream open functions\n"
9981 #: build/C/man3/stdio.3:207
9983 msgid "fscanf\tinput format conversion\n"
9987 #: build/C/man3/stdio.3:208
9989 msgid "fseek\treposition a stream\n"
9993 #: build/C/man3/stdio.3:209
9995 msgid "fsetpos\treposition a stream\n"
9999 #: build/C/man3/stdio.3:210
10001 msgid "ftell\treposition a stream\n"
10005 #: build/C/man3/stdio.3:211
10007 msgid "fwrite\tbinary stream input/output\n"
10011 #: build/C/man3/stdio.3:212
10013 msgid "getc\tget next character or word from input stream\n"
10017 #: build/C/man3/stdio.3:213
10019 msgid "getchar\tget next character or word from input stream\n"
10023 #: build/C/man3/stdio.3:214
10025 msgid "gets\tget a line from a stream\n"
10029 #: build/C/man3/stdio.3:215
10031 msgid "getw\tget next character or word from input stream\n"
10035 #: build/C/man3/stdio.3:216
10037 msgid "mktemp\tmake temporary filename (unique)\n"
10041 #: build/C/man3/stdio.3:217
10043 msgid "perror\tsystem error messages\n"
10047 #: build/C/man3/stdio.3:218
10049 msgid "printf\tformatted output conversion\n"
10053 #: build/C/man3/stdio.3:219
10055 msgid "putc\toutput a character or word to a stream\n"
10059 #: build/C/man3/stdio.3:220
10061 msgid "putchar\toutput a character or word to a stream\n"
10065 #: build/C/man3/stdio.3:221
10067 msgid "puts\toutput a line to a stream\n"
10071 #: build/C/man3/stdio.3:222
10073 msgid "putw\toutput a character or word to a stream\n"
10077 #: build/C/man3/stdio.3:223
10079 msgid "remove\tremove directory entry\n"
10083 #: build/C/man3/stdio.3:224
10085 msgid "rewind\treposition a stream\n"
10089 #: build/C/man3/stdio.3:225
10091 msgid "scanf\tinput format conversion\n"
10095 #: build/C/man3/stdio.3:226
10097 msgid "setbuf\tstream buffering operations\n"
10101 #: build/C/man3/stdio.3:227
10103 msgid "setbuffer\tstream buffering operations\n"
10107 #: build/C/man3/stdio.3:228
10109 msgid "setlinebuf\tstream buffering operations\n"
10113 #: build/C/man3/stdio.3:229
10115 msgid "setvbuf\tstream buffering operations\n"
10119 #: build/C/man3/stdio.3:230
10121 msgid "sprintf\tformatted output conversion\n"
10125 #: build/C/man3/stdio.3:231
10127 msgid "sscanf\tinput format conversion\n"
10131 #: build/C/man3/stdio.3:232
10133 msgid "strerror\tsystem error messages\n"
10137 #: build/C/man3/stdio.3:233
10139 msgid "sys_errlist\tsystem error messages\n"
10143 #: build/C/man3/stdio.3:234
10145 msgid "sys_nerr\tsystem error messages\n"
10149 #: build/C/man3/stdio.3:235
10151 msgid "tempnam\ttemporary file routines\n"
10155 #: build/C/man3/stdio.3:236
10157 msgid "tmpfile\ttemporary file routines\n"
10161 #: build/C/man3/stdio.3:237
10163 msgid "tmpnam\ttemporary file routines\n"
10167 #: build/C/man3/stdio.3:238
10169 msgid "ungetc\tun-get character from input stream\n"
10173 #: build/C/man3/stdio.3:239
10175 msgid "vfprintf\tformatted output conversion\n"
10179 #: build/C/man3/stdio.3:240
10181 msgid "vfscanf\tinput format conversion\n"
10185 #: build/C/man3/stdio.3:241
10187 msgid "vprintf\tformatted output conversion\n"
10191 #: build/C/man3/stdio.3:242
10193 msgid "vscanf\tinput format conversion\n"
10197 #: build/C/man3/stdio.3:243
10199 msgid "vsprintf\tformatted output conversion\n"
10203 #: build/C/man3/stdio.3:244
10205 msgid "vsscanf\tinput format conversion\n"
10208 #. type: Plain text
10209 #: build/C/man3/stdio.3:250
10210 msgid "The I<stdio> library conforms to C89."
10213 #. type: Plain text
10214 #: build/C/man3/stdio.3:257
10216 "B<close>(2), B<open>(2), B<read>(2), B<write>(2), B<stdout>(3), "
10217 "B<unlocked_stdio>(3)"
10221 #: build/C/man3/stdio_ext.3:25
10226 #. type: Plain text
10227 #: build/C/man3/stdio_ext.3:30
10229 "__fbufsize, __flbf, __fpending, __fpurge, __freadable, __freading, "
10230 "__fsetlocking, __fwritable, __fwriting, _flushlbf - interfaces to stdio FILE "
10234 #. type: Plain text
10235 #: build/C/man3/stdio_ext.3:34
10236 msgid "B<#include E<lt>stdio_ext.hE<gt>>"
10239 #. type: Plain text
10240 #: build/C/man3/stdio_ext.3:36
10241 msgid "B<size_t __fbufsize(FILE *>I<stream>B<);>"
10244 #. type: Plain text
10245 #: build/C/man3/stdio_ext.3:38
10246 msgid "B<size_t __fpending(FILE *>I<stream>B<);>"
10249 #. type: Plain text
10250 #: build/C/man3/stdio_ext.3:40
10251 msgid "B<int __flbf(FILE *>I<stream>B<);>"
10254 #. type: Plain text
10255 #: build/C/man3/stdio_ext.3:42
10256 msgid "B<int __freadable(FILE *>I<stream>B<);>"
10259 #. type: Plain text
10260 #: build/C/man3/stdio_ext.3:44
10261 msgid "B<int __fwritable(FILE *>I<stream>B<);>"
10264 #. type: Plain text
10265 #: build/C/man3/stdio_ext.3:46
10266 msgid "B<int __freading(FILE *>I<stream>B<);>"
10269 #. type: Plain text
10270 #: build/C/man3/stdio_ext.3:48
10271 msgid "B<int __fwriting(FILE *>I<stream>B<);>"
10274 #. type: Plain text
10275 #: build/C/man3/stdio_ext.3:50
10276 msgid "B<int __fsetlocking(FILE *>I<stream>B<, int >I<type>B<);>"
10279 #. type: Plain text
10280 #: build/C/man3/stdio_ext.3:52
10281 msgid "B<void _flushlbf(void);>"
10284 #. type: Plain text
10285 #: build/C/man3/stdio_ext.3:54
10286 msgid "B<void __fpurge(FILE *>I<stream>B<);>"
10289 #. type: Plain text
10290 #: build/C/man3/stdio_ext.3:59
10292 "Solaris introduced routines to allow portable access to the internals of the "
10293 "I<FILE> structure, and glibc also implemented these."
10296 #. type: Plain text
10297 #: build/C/man3/stdio_ext.3:64
10299 "The B<__fbufsize>() function returns the size of the buffer currently used "
10300 "by the given stream."
10303 #. type: Plain text
10304 #: build/C/man3/stdio_ext.3:71
10306 "The B<__fpending>() function returns the number of bytes in the output "
10307 "buffer. For wide-oriented streams the unit is wide characters. This "
10308 "function is undefined on buffers in reading mode, or opened read-only."
10311 #. type: Plain text
10312 #: build/C/man3/stdio_ext.3:76
10314 "The B<__flbf>() function returns a nonzero value if the stream is "
10315 "line-buffered, and zero otherwise."
10318 #. type: Plain text
10319 #: build/C/man3/stdio_ext.3:81
10321 "The B<__freadable>() function returns a nonzero value if the stream allows "
10322 "reading, and zero otherwise."
10325 #. type: Plain text
10326 #: build/C/man3/stdio_ext.3:86
10328 "The B<__fwritable>() function returns a nonzero value if the stream allows "
10329 "writing, and zero otherwise."
10332 #. type: Plain text
10333 #: build/C/man3/stdio_ext.3:92
10335 "The B<__freading>() function returns a nonzero value if the stream is "
10336 "read-only, or if the last operation on the stream was a read operation, and "
10340 #. type: Plain text
10341 #: build/C/man3/stdio_ext.3:98
10343 "The B<__fwriting>() function returns a nonzero value if the stream is "
10344 "write-only (or append-only), or if the last operation on the stream was a "
10345 "write operation, and zero otherwise."
10348 #. type: Plain text
10349 #: build/C/man3/stdio_ext.3:106
10351 "The B<__fsetlocking>() function can be used to select the desired type of "
10352 "locking on the stream. It returns the current type. The I<type> argument "
10353 "can take the following three values:"
10357 #: build/C/man3/stdio_ext.3:106
10359 msgid "B<FSETLOCKING_INTERNAL>"
10362 #. type: Plain text
10363 #: build/C/man3/stdio_ext.3:111
10365 "Perform implicit locking around every operation on the given stream (except "
10366 "for the *_unlocked ones). This is the default."
10370 #: build/C/man3/stdio_ext.3:111
10372 msgid "B<FSETLOCKING_BYCALLER>"
10375 #. type: Plain text
10376 #: build/C/man3/stdio_ext.3:118
10378 "The caller will take care of the locking (possibly using B<flockfile>(3) in "
10379 "case there is more than one thread), and the stdio routines will not do "
10380 "locking until the state is reset to B<FSETLOCKING_INTERNAL>."
10384 #: build/C/man3/stdio_ext.3:118
10386 msgid "B<FSETLOCKING_QUERY>"
10389 #. type: Plain text
10390 #: build/C/man3/stdio_ext.3:122
10391 msgid "Don't change the type of locking. (Only return it.)"
10394 #. type: Plain text
10395 #: build/C/man3/stdio_ext.3:128
10397 "The B<_flushlbf>() function flushes all line-buffered streams. (Presumably "
10398 "so that output to a terminal is forced out, say before reading keyboard "
10402 #. type: Plain text
10403 #: build/C/man3/stdio_ext.3:132
10404 msgid "The B<__fpurge>() function discards the contents of the stream's buffer."
10407 #. type: Plain text
10408 #: build/C/man3/stdio_ext.3:141
10410 "The B<__fbufsize>(), B<__fpending>(), B<__fpurge>() and B<__fsetlocking>() "
10411 "functions do not lock the stream, so they are not thread-safe."
10414 #. type: Plain text
10415 #: build/C/man3/stdio_ext.3:151
10417 "The B<__flbf>(), B<__freadable>(), B<__freading>(), B<__fwritable>(), "
10418 "B<__fwriting>() and B<_flushlbf>() functions are thread-safe."
10421 #. type: Plain text
10422 #: build/C/man3/stdio_ext.3:154
10423 msgid "B<flockfile>(3), B<fpurge>(3)"
10427 #: build/C/man2/symlink.2:32 build/C/man7/symlink.7:36
10432 #. type: Plain text
10433 #: build/C/man2/symlink.2:35
10434 msgid "symlink - make a new name for a file"
10437 #. type: Plain text
10438 #: build/C/man2/symlink.2:39
10439 msgid "B<int symlink(const char *>I<oldpath>B<, const char *>I<newpath>B<);>"
10442 #. type: Plain text
10443 #: build/C/man2/symlink.2:47
10444 msgid "B<symlink>():"
10447 #. type: Plain text
10448 #: build/C/man2/symlink.2:58
10450 "B<symlink>() creates a symbolic link named I<newpath> which contains the "
10451 "string I<oldpath>."
10454 #. type: Plain text
10455 #: build/C/man2/symlink.2:62
10457 "Symbolic links are interpreted at run time as if the contents of the link "
10458 "had been substituted into the path being followed to find a file or "
10462 #. type: Plain text
10463 #: build/C/man2/symlink.2:67
10465 "Symbolic links may contain I<..> path components, which (if used at the "
10466 "start of the link) refer to the parent directories of that in which the link "
10470 #. type: Plain text
10471 #: build/C/man2/symlink.2:71
10473 "A symbolic link (also known as a soft link) may point to an existing file or "
10474 "to a nonexistent one; the latter case is known as a dangling link."
10477 #. type: Plain text
10478 #: build/C/man2/symlink.2:78
10480 "The permissions of a symbolic link are irrelevant; the ownership is ignored "
10481 "when following the link, but is checked when removal or renaming of the link "
10482 "is requested and the link is in a directory with the sticky bit (B<S_ISVTX>) "
10486 #. type: Plain text
10487 #: build/C/man2/symlink.2:99
10489 "Write access to the directory containing I<newpath> is denied, or one of the "
10490 "directories in the path prefix of I<newpath> did not allow search "
10491 "permission. (See also B<path_resolution>(7).)"
10494 #. type: Plain text
10495 #: build/C/man2/symlink.2:104
10497 "The user's quota of resources on the filesystem has been exhausted. The "
10498 "resources could be inodes or disk blocks, depending on the filesystem "
10502 #. type: Plain text
10503 #: build/C/man2/symlink.2:118
10504 msgid "Too many symbolic links were encountered in resolving I<newpath>."
10507 #. type: Plain text
10508 #: build/C/man2/symlink.2:128
10510 "A directory component in I<newpath> does not exist or is a dangling symbolic "
10511 "link, or I<oldpath> is the empty string."
10514 #. type: Plain text
10515 #: build/C/man2/symlink.2:140
10516 msgid "A component used as a directory in I<newpath> is not, in fact, a directory."
10519 #. type: Plain text
10520 #: build/C/man2/symlink.2:145
10522 "The filesystem containing I<newpath> does not support the creation of "
10526 #. type: Plain text
10527 #: build/C/man2/symlink.2:149
10528 msgid "I<newpath> is on a read-only filesystem."
10531 #. type: Plain text
10532 #: build/C/man2/symlink.2:159
10533 msgid "No checking of I<oldpath> is done."
10536 #. type: Plain text
10537 #: build/C/man2/symlink.2:164
10539 "Deleting the name referred to by a symlink will actually delete the file "
10540 "(unless it also has other hard links). If this behavior is not desired, use "
10544 #. type: Plain text
10545 #: build/C/man2/symlink.2:176
10547 "B<ln>(1), B<lchown>(2), B<link>(2), B<lstat>(2), B<open>(2), B<readlink>(2), "
10548 "B<rename>(2), B<symlinkat>(2), B<unlink>(2), B<path_resolution>(7), "
10553 #: build/C/man7/symlink.7:36
10558 #. type: Plain text
10559 #: build/C/man7/symlink.7:39
10560 msgid "symlink - symbolic link handling"
10564 #: build/C/man7/symlink.7:39
10566 msgid "SYMBOLIC LINK HANDLING"
10569 #. type: Plain text
10570 #: build/C/man7/symlink.7:43
10572 "Symbolic links are files that act as pointers to other files. To understand "
10573 "their behavior, you must first understand how hard links work."
10576 #. type: Plain text
10577 #: build/C/man7/symlink.7:59
10579 "A hard link to a file is indistinguishable from the original file because it "
10580 "is a reference to the object underlying the original filename. (To be "
10581 "precise: each of the hard links to a file is a reference to the same "
10582 "I<i-node number>, where an i-node number is an index into the i-node table, "
10583 "which contains metadata about all files on a filesystem. See B<stat>(2).) "
10584 "Changes to a file are independent of the name used to reference the file. "
10585 "Hard links may not refer to directories (to prevent the possibility of loops "
10586 "within the filesystem tree, which would confuse many programs) and may not "
10587 "refer to files on different filesystems (because i-node numbers are not "
10588 "unique across filesystems)."
10591 #. type: Plain text
10592 #: build/C/man7/symlink.7:66
10594 "A symbolic link is a special type of file whose contents are a string that "
10595 "is the pathname another file, the file to which the link refers. In other "
10596 "words, a symbolic link is a pointer to another name, and not to an "
10597 "underlying object. For this reason, symbolic links may refer to directories "
10598 "and may cross filesystem boundaries."
10601 #. type: Plain text
10602 #: build/C/man7/symlink.7:72
10604 "There is no requirement that the pathname referred to by a symbolic link "
10605 "should exist. A symbolic link that refers to a pathname that does not exist "
10606 "is said to be a I<dangling link>."
10609 #. type: Plain text
10610 #: build/C/man7/symlink.7:84
10612 "Because a symbolic link and its referenced object coexist in the filesystem "
10613 "name space, confusion can arise in distinguishing between the link itself "
10614 "and the referenced object. On historical systems, commands and system calls "
10615 "adopted their own link-following conventions in a somewhat ad-hoc fashion. "
10616 "Rules for a more uniform approach, as they are implemented on Linux and "
10617 "other systems, are outlined here. It is important that site-local "
10618 "applications also conform to these rules, so that the user interface can be "
10619 "as consistent as possible."
10623 #: build/C/man7/symlink.7:84
10625 msgid "Symbolic link ownership, permissions, and timestamps"
10628 #. type: Plain text
10629 #: build/C/man7/symlink.7:92
10631 "The owner and group of an existing symbolic link can be changed using "
10632 "B<lchown>(2). The only time that the ownership of a symbolic link matters "
10633 "is when the link is being removed or renamed in a directory that has the "
10634 "sticky bit set (see B<stat>(2))."
10637 #. type: Plain text
10638 #: build/C/man7/symlink.7:98
10640 "The last access and last modification timestamps of a symbolic link can be "
10641 "changed using B<utimensat>(2) or B<lutimes>(3)."
10644 #. Linux does not currently implement an lchmod(2).
10648 #. system differs from historical
10650 #. systems in that the system call
10652 #. has been changed to follow symbolic links.
10655 #. system call was added later when the limitations of the new
10657 #. became apparent.
10658 #. type: Plain text
10659 #: build/C/man7/symlink.7:117
10661 "On Linux, the permissions of a symbolic link are not used in any operations; "
10662 "the permissions are always 0777 (read, write, and execute for all user "
10663 "categories), and can't be changed."
10667 #: build/C/man7/symlink.7:117
10669 msgid "Handling of symbolic links by system calls and commands"
10672 #. type: Plain text
10673 #: build/C/man7/symlink.7:132
10675 "Symbolic links are handled either by operating on the link itself, or by "
10676 "operating on the object referred to by the link. In the latter case, an "
10677 "application or system call is said to I<follow> the link. Symbolic links "
10678 "may refer to other symbolic links, in which case the links are dereferenced "
10679 "until an object that is not a symbolic link is found, a symbolic link that "
10680 "refers to a file which does not exist is found, or a loop is detected. "
10681 "(Loop detection is done by placing an upper limit on the number of links "
10682 "that may be followed, and an error results if this limit is exceeded.)"
10685 #. type: Plain text
10686 #: build/C/man7/symlink.7:135
10688 "There are three separate areas that need to be discussed. They are as "
10693 #: build/C/man7/symlink.7:135
10698 #. type: Plain text
10699 #: build/C/man7/symlink.7:137
10700 msgid "Symbolic links used as filename arguments for system calls."
10704 #: build/C/man7/symlink.7:137
10709 #. type: Plain text
10710 #: build/C/man7/symlink.7:140
10712 "Symbolic links specified as command-line arguments to utilities that are not "
10713 "traversing a file tree."
10717 #: build/C/man7/symlink.7:140
10722 #. type: Plain text
10723 #: build/C/man7/symlink.7:144
10725 "Symbolic links encountered by utilities that are traversing a file tree "
10726 "(either specified on the command line or encountered as part of the file "
10731 #: build/C/man7/symlink.7:144
10733 msgid "System calls"
10736 #. type: Plain text
10737 #: build/C/man7/symlink.7:147
10739 "The first area is symbolic links used as filename arguments for system "
10743 #. type: Plain text
10744 #: build/C/man7/symlink.7:157
10746 "Except as noted below, all system calls follow symbolic links. For example, "
10747 "if there were a symbolic link I<slink> which pointed to a file named "
10748 "I<afile>, the system call I<open(\"slink\" ...\\&)> would return a file "
10749 "descriptor referring to the file I<afile>."
10752 #. Maybe one day: .BR fchownat (2)
10753 #. type: Plain text
10754 #: build/C/man7/symlink.7:207
10756 "Various system calls do not follow links, and operate on the symbolic link "
10757 "itself. They are: B<lchown>(2), B<lgetxattr>(2), B<llistxattr>(2), "
10758 "B<lremovexattr>(2), B<lsetxattr>(2), B<lstat>(2), B<readlink>(2), "
10759 "B<rename>(2), B<rmdir>(2), and B<unlink>(2). Certain other system calls "
10760 "optionally follow symbolic links. They are: B<faccessat>(2), "
10761 "B<fchownat>(2), B<fstatat>(2), B<linkat>(2), B<open>(2), B<openat>(2), and "
10762 "B<utimensat>(2); see their manual pages for details. Because B<remove>(3) "
10763 "is an alias for B<unlink>(2), that library function also does not follow "
10764 "symbolic links. When B<rmdir>(2) is applied to a symbolic link, it fails "
10765 "with the error B<ENOTDIR>. The B<link>(2) warrants special discussion. "
10766 "POSIX.1-2001 specifies that B<link>(2) should dereference I<oldpath> if it "
10767 "is a symbolic link. However, Linux does not do this. (By default Solaris "
10768 "is the same, but the POSIX.1-2001 specified behavior can be obtained with "
10769 "suitable compiler options.) The upcoming POSIX.1 revision changes the "
10770 "specification to allow either behavior in an implementation."
10774 #: build/C/man7/symlink.7:207
10776 msgid "Commands not traversing a file tree"
10779 #. type: Plain text
10780 #: build/C/man7/symlink.7:210
10782 "The second area is symbolic links, specified as command-line filename "
10783 "arguments, to commands which are not traversing a file tree."
10786 #. type: Plain text
10787 #: build/C/man7/symlink.7:221
10789 "Except as noted below, commands follow symbolic links named as command-line "
10790 "arguments. For example, if there were a symbolic link I<slink> which "
10791 "pointed to a file named I<afile>, the command I<cat slink> would display the "
10792 "contents of the file I<afile>."
10795 #. type: Plain text
10796 #: build/C/man7/symlink.7:229
10798 "It is important to realize that this rule includes commands which may "
10799 "optionally traverse file trees, e.g., the command I<chown file> is included "
10800 "in this rule, while the command I<chown\\ -R file>, which performs a tree "
10801 "traversal, is not. (The latter is described in the third area, below.)"
10804 #. type: Plain text
10805 #: build/C/man7/symlink.7:247
10807 "If it is explicitly intended that the command operate on the symbolic link "
10808 "instead of following the symbolic link, e.g., it is desired that I<chown "
10809 "slink> change the ownership of the file that I<slink> is, whether it is a "
10810 "symbolic link or not, the I<-h> option should be used. In the above "
10811 "example, I<chown root slink> would change the ownership of the file referred "
10812 "to by I<slink>, while I<chown\\ -h root slink> would change the ownership of "
10816 #. type: Plain text
10817 #: build/C/man7/symlink.7:249
10818 msgid "There are some exceptions to this rule:"
10821 #. type: Plain text
10822 #: build/C/man7/symlink.7:259
10824 "The B<mv>(1) and B<rm>(1) commands do not follow symbolic links named as "
10825 "arguments, but respectively attempt to rename and delete them. (Note, if "
10826 "the symbolic link references a file via a relative path, moving it to "
10827 "another directory may very well cause it to stop working, since the path may "
10828 "no longer be correct.)"
10831 #. type: Plain text
10832 #: build/C/man7/symlink.7:289
10834 "The B<ls>(1) command is also an exception to this rule. For compatibility "
10835 "with historic systems (when B<ls>(1) is not doing a tree walk, i.e., the "
10836 "I<-R> option is not specified), the B<ls>(1) command follows symbolic links "
10837 "named as arguments if the I<-H> or I<-L> option is specified, or if the "
10838 "I<-F>, I<-d>, or I<-l> options are not specified. (The B<ls>(1) command is "
10839 "the only command where the I<-H> and I<-L> options affect its behavior even "
10840 "though it is not doing a walk of a file tree.)"
10844 #. The 4.4BSD system differs from historical 4BSD systems in that the
10848 #. commands follow symbolic links specified on the command line.
10849 #. type: Plain text
10850 #: build/C/man7/symlink.7:307
10852 "The B<file>(1) command is also an exception to this rule. The B<file>(1) "
10853 "command does not follow symbolic links named as argument by default. The "
10854 "B<file>(1) command does follow symbolic links named as argument if the "
10855 "I<-L> option is specified."
10859 #: build/C/man7/symlink.7:307
10861 msgid "Commands traversing a file tree"
10864 #. type: Plain text
10865 #: build/C/man7/symlink.7:320
10867 "The following commands either optionally or always traverse file trees: "
10868 "B<chgrp>(1), B<chmod>(1), B<chown>(1), B<cp>(1), B<du>(1), B<find>(1), "
10869 "B<ls>(1), B<pax>(1), B<rm>(1), and B<tar>(1)."
10872 #. type: Plain text
10873 #: build/C/man7/symlink.7:324
10875 "It is important to realize that the following rules apply equally to "
10876 "symbolic links encountered during the file tree traversal and symbolic links "
10877 "listed as command-line arguments."
10880 #. type: Plain text
10881 #: build/C/man7/symlink.7:329
10883 "The I<first rule> applies to symbolic links that reference files other than "
10884 "directories. Operations that apply to symbolic links are performed on the "
10885 "links themselves, but otherwise the links are ignored."
10888 #. type: Plain text
10889 #: build/C/man7/symlink.7:341
10891 "The command I<rm\\ -r slink directory> will remove I<slink>, as well as any "
10892 "symbolic links encountered in the tree traversal of I<directory>, because "
10893 "symbolic links may be removed. In no case will B<rm>(1) affect the file "
10894 "referred to by I<slink>."
10897 #. type: Plain text
10898 #: build/C/man7/symlink.7:346
10900 "The I<second rule> applies to symbolic links that refer to directories. "
10901 "Symbolic links that refer to directories are never followed by default. "
10902 "This is often referred to as a \"physical\" walk, as opposed to a "
10903 "\"logical\" walk (where symbolic links the refer to directories are "
10907 #. type: Plain text
10908 #: build/C/man7/symlink.7:349
10910 "Certain conventions are (should be) followed as consistently as possible by "
10911 "commands that perform file tree walks:"
10914 #. type: Plain text
10915 #: build/C/man7/symlink.7:362
10917 "A command can be made to follow any symbolic links named on the command "
10918 "line, regardless of the type of file they reference, by specifying the I<-H> "
10919 "(for \"half-logical\") flag. This flag is intended to make the command-line "
10920 "name space look like the logical name space. (Note, for commands that do "
10921 "not always do file tree traversals, the I<-H> flag will be ignored if the "
10922 "I<-R> flag is not also specified.)"
10925 #. type: Plain text
10926 #: build/C/man7/symlink.7:378
10928 "For example, the command I<chown\\ -HR user slink> will traverse the file "
10929 "hierarchy rooted in the file pointed to by I<slink>. Note, the I<-H> is not "
10930 "the same as the previously discussed I<-h> flag. The I<-H> flag causes "
10931 "symbolic links specified on the command line to be dereferenced for the "
10932 "purposes of both the action to be performed and the tree walk, and it is as "
10933 "if the user had specified the name of the file to which the symbolic link "
10937 #. type: Plain text
10938 #: build/C/man7/symlink.7:392
10940 "A command can be made to follow any symbolic links named on the command "
10941 "line, as well as any symbolic links encountered during the traversal, "
10942 "regardless of the type of file they reference, by specifying the I<-L> (for "
10943 "\"logical\") flag. This flag is intended to make the entire name space look "
10944 "like the logical name space. (Note, for commands that do not always do file "
10945 "tree traversals, the I<-L> flag will be ignored if the I<-R> flag is not "
10949 #. type: Plain text
10950 #: build/C/man7/symlink.7:407
10952 "For example, the command I<chown\\ -LR user slink> will change the owner of "
10953 "the file referred to by I<slink>. If I<slink> refers to a directory, "
10954 "B<chown> will traverse the file hierarchy rooted in the directory that it "
10955 "references. In addition, if any symbolic links are encountered in any file "
10956 "tree that B<chown> traverses, they will be treated in the same fashion as "
10960 #. type: Plain text
10961 #: build/C/man7/symlink.7:414
10963 "A command can be made to provide the default behavior by specifying the "
10964 "I<-P> (for \"physical\") flag. This flag is intended to make the entire "
10965 "name space look like the physical name space."
10968 #. type: Plain text
10969 #: build/C/man7/symlink.7:432
10971 "For commands that do not by default do file tree traversals, the I<-H>, "
10972 "I<-L>, and I<-P> flags are ignored if the I<-R> flag is not also specified. "
10973 "In addition, you may specify the I<-H>, I<-L>, and I<-P> options more than "
10974 "once; the last one specified determines the command's behavior. This is "
10975 "intended to permit you to alias commands to behave one way or the other, and "
10976 "then override that behavior on the command line."
10979 #. type: Plain text
10980 #: build/C/man7/symlink.7:438
10981 msgid "The B<ls>(1) and B<rm>(1) commands have exceptions to these rules:"
10984 #. type: Plain text
10985 #: build/C/man7/symlink.7:451
10987 "The B<rm>(1) command operates on the symbolic link, and not the file it "
10988 "references, and therefore never follows a symbolic link. The B<rm>(1) "
10989 "command does not support the I<-H>, I<-L>, or I<-P> options."
10992 #. type: Plain text
10993 #: build/C/man7/symlink.7:471
10995 "To maintain compatibility with historic systems, the B<ls>(1) command acts "
10996 "a little differently. If you do not specify the I<-F>, I<-d> or I<-l> "
10997 "options, B<ls>(1) will follow symbolic links specified on the command "
10998 "line. If the I<-L> flag is specified, B<ls>(1) follows all symbolic links, "
10999 "regardless of their type, whether specified on the command line or "
11000 "encountered in the tree walk."
11003 #. type: Plain text
11004 #: build/C/man7/symlink.7:489
11006 "B<chgrp>(1), B<chmod>(1), B<find>(1), B<ln>(1), B<ls>(1), B<mv>(1), "
11007 "B<rm>(1), B<lchown>(2), B<link>(2), B<lstat>(2), B<readlink>(2), "
11008 "B<rename>(2), B<symlink>(2), B<unlink>(2), B<utimensat>(2), B<lutimes>(3), "
11009 "B<path_resolution>(7)"
11013 #: build/C/man3/tempnam.3:25
11018 #. type: Plain text
11019 #: build/C/man3/tempnam.3:28
11020 msgid "tempnam - create a name for a temporary file"
11023 #. type: Plain text
11024 #: build/C/man3/tempnam.3:33
11026 msgid "B<char *tempnam(const char *>I<dir>B<, const char *>I<pfx>B<);>\n"
11029 #. type: Plain text
11030 #: build/C/man3/tempnam.3:42
11031 msgid "B<tempnam>(): _BSD_SOURCE || _SVID_SOURCE"
11034 #. type: Plain text
11035 #: build/C/man3/tempnam.3:56
11037 "The B<tempnam>() function returns a pointer to a string that is a valid "
11038 "filename, and such that a file with this name did not exist when "
11039 "B<tempnam>() checked. The filename suffix of the pathname generated will "
11040 "start with I<pfx> in case I<pfx> is a non-NULL string of at most five "
11041 "bytes. The directory prefix part of the pathname generated is required to "
11042 "be \"appropriate\" (often that at least implies writable)."
11045 #. type: Plain text
11046 #: build/C/man3/tempnam.3:59
11047 msgid "Attempts to find an appropriate directory go through the following steps:"
11051 #: build/C/man3/tempnam.3:59
11056 #. type: Plain text
11057 #: build/C/man3/tempnam.3:65
11059 "In case the environment variable B<TMPDIR> exists and contains the name of "
11060 "an appropriate directory, that is used."
11064 #: build/C/man3/tempnam.3:65
11069 #. type: Plain text
11070 #: build/C/man3/tempnam.3:70
11071 msgid "Otherwise, if the I<dir> argument is non-NULL and appropriate, it is used."
11075 #: build/C/man3/tempnam.3:70
11080 #. type: Plain text
11081 #: build/C/man3/tempnam.3:77
11083 "Otherwise, I<P_tmpdir> (as defined in I<E<lt>stdio.hE<gt>>) is used when "
11088 #: build/C/man3/tempnam.3:77
11093 #. type: Plain text
11094 #: build/C/man3/tempnam.3:80
11095 msgid "Finally an implementation-defined directory may be used."
11098 #. type: Plain text
11099 #: build/C/man3/tempnam.3:87
11101 "The string returned by B<tempnam>() is allocated using B<malloc>(3) and "
11102 "hence should be freed by B<free>(3)."
11105 #. type: Plain text
11106 #: build/C/man3/tempnam.3:94
11108 "On success, the B<tempnam>() function returns a pointer to a unique "
11109 "temporary filename. It returns NULL if a unique name cannot be generated, "
11110 "with I<errno> set to indicate the cause of the error."
11113 #. type: Plain text
11114 #: build/C/man3/tempnam.3:98
11115 msgid "Allocation of storage failed."
11118 #. type: Plain text
11119 #: build/C/man3/tempnam.3:103
11120 msgid "SVr4, 4.3BSD, POSIX.1-2001. POSIX.1-2008 marks B<tempnam>() as obsolete."
11123 #. type: Plain text
11124 #: build/C/man3/tempnam.3:122
11126 "Although B<tempnam>() generates names that are difficult to guess, it is "
11127 "nevertheless possible that between the time that B<tempnam>() returns a "
11128 "pathname, and the time that the program opens it, another program might "
11129 "create that pathname using B<open>(2), or create it as a symbolic link. "
11130 "This can lead to security holes. To avoid such possibilities, use the "
11131 "B<open>(2) B<O_EXCL> flag to open the pathname. Or better yet, use "
11132 "B<mkstemp>(3) or B<tmpfile>(3)."
11135 #. type: Plain text
11136 #: build/C/man3/tempnam.3:130
11138 "SUSv2 does not mention the use of B<TMPDIR>; glibc will use it only when the "
11139 "program is not set-user-ID. On SVr4, the directory used under B<d)> is "
11140 "I</tmp> (and this is what glibc does)."
11143 #. type: Plain text
11144 #: build/C/man3/tempnam.3:135
11146 "Because it dynamically allocates memory used to return the pathname, "
11147 "B<tempnam>() is reentrant, and thus thread safe, unlike B<tmpnam>(3)."
11150 #. type: Plain text
11151 #: build/C/man3/tempnam.3:148
11153 "The B<tempnam>() function generates a different string each time it is "
11154 "called, up to B<TMP_MAX> (defined in I<E<lt>stdio.hE<gt>>) times. If it is "
11155 "called more than B<TMP_MAX> times, the behavior is implementation defined."
11158 #. type: Plain text
11159 #: build/C/man3/tempnam.3:152
11160 msgid "B<tempnam>() uses at most the first five bytes from I<pfx>."
11163 #. type: Plain text
11164 #: build/C/man3/tempnam.3:158
11166 "The glibc implementation of B<tempnam>() will fail with the error B<EEXIST> "
11167 "upon failure to find a unique name."
11170 #. type: Plain text
11171 #: build/C/man3/tempnam.3:161
11173 "The precise meaning of \"appropriate\" is undefined; it is unspecified how "
11174 "accessibility of a directory is determined."
11177 #. type: Plain text
11178 #: build/C/man3/tempnam.3:168 build/C/man3/tmpnam.3:163
11179 msgid "Never use this function. Use B<mkstemp>(3) or B<tmpfile>(3) instead."
11182 #. type: Plain text
11183 #: build/C/man3/tempnam.3:173
11184 msgid "B<mkstemp>(3), B<mktemp>(3), B<tmpfile>(3), B<tmpnam>(3)"
11188 #: build/C/man3/tmpfile.3:31
11193 #. type: Plain text
11194 #: build/C/man3/tmpfile.3:34
11195 msgid "tmpfile - create a temporary file"
11198 #. type: Plain text
11199 #: build/C/man3/tmpfile.3:39
11201 msgid "B<FILE *tmpfile(void);>\n"
11204 #. type: Plain text
11205 #: build/C/man3/tmpfile.3:47
11207 "The B<tmpfile>() function opens a unique temporary file in binary "
11208 "read/write (w+b) mode. The file will be automatically deleted when it is "
11209 "closed or the program terminates."
11212 #. type: Plain text
11213 #: build/C/man3/tmpfile.3:56
11215 "The B<tmpfile>() function returns a stream descriptor, or NULL if a unique "
11216 "filename cannot be generated or the unique file cannot be opened. In the "
11217 "latter case, I<errno> is set to indicate the error."
11220 #. type: Plain text
11221 #: build/C/man3/tmpfile.3:60
11222 msgid "Search permission denied for directory in file's path prefix."
11225 #. type: Plain text
11226 #: build/C/man3/tmpfile.3:63
11227 msgid "Unable to generate a unique filename."
11230 #. type: Plain text
11231 #: build/C/man3/tmpfile.3:66
11232 msgid "The call was interrupted by a signal."
11235 #. type: Plain text
11236 #: build/C/man3/tmpfile.3:69
11237 msgid "Too many file descriptors in use by the process."
11240 #. type: Plain text
11241 #: build/C/man3/tmpfile.3:72
11242 msgid "Too many files open in the system."
11245 #. type: Plain text
11246 #: build/C/man3/tmpfile.3:75
11247 msgid "There was no room in the directory to add the new filename."
11250 #. type: Plain text
11251 #: build/C/man3/tmpfile.3:78
11252 msgid "Read-only filesystem."
11255 #. type: Plain text
11256 #: build/C/man3/tmpfile.3:80
11257 msgid "SVr4, 4.3BSD, C89, C99, SUSv2, POSIX.1-2001."
11260 #. type: Plain text
11261 #: build/C/man3/tmpfile.3:86
11263 "POSIX.1-2001 specifies: an error message may be written to I<stdout> if the "
11264 "stream cannot be opened."
11267 #. type: Plain text
11268 #: build/C/man3/tmpfile.3:97
11270 "The standard does not specify the directory that B<tmpfile>() will use. "
11271 "Glibc will try the path prefix I<P_tmpdir> defined in I<E<lt>stdio.hE<gt>>, "
11272 "and if that fails the directory I</tmp>."
11275 #. type: Plain text
11276 #: build/C/man3/tmpfile.3:103
11277 msgid "B<exit>(3), B<mkstemp>(3), B<mktemp>(3), B<tempnam>(3), B<tmpnam>(3)"
11281 #: build/C/man3/tmpnam.3:27
11286 #. type: Plain text
11287 #: build/C/man3/tmpnam.3:30
11288 msgid "tmpnam, tmpnam_r - create a name for a temporary file"
11291 #. type: Plain text
11292 #: build/C/man3/tmpnam.3:35
11294 msgid "B<char *tmpnam(char *>I<s>B<);>\n"
11297 #. type: Plain text
11298 #: build/C/man3/tmpnam.3:58
11300 "The B<tmpnam>() function returns a pointer to a string that is a valid "
11301 "filename, and such that a file with this name did not exist at some point in "
11302 "time, so that naive programmers may think it a suitable name for a temporary "
11303 "file. If the argument I<s> is NULL this name is generated in an internal "
11304 "static buffer and may be overwritten by the next call to B<tmpnam>(). If "
11305 "I<s> is not NULL, the name is copied to the character array (of length at "
11306 "least I<L_tmpnam>) pointed to by I<s> and the value I<s> is returned in "
11310 #. type: Plain text
11311 #: build/C/man3/tmpnam.3:70
11313 "The pathname that is created, has a directory prefix I<P_tmpdir>. (Both "
11314 "I<L_tmpnam> and I<P_tmpdir> are defined in I<E<lt>stdio.hE<gt>>, just like "
11315 "the B<TMP_MAX> mentioned below.)"
11318 #. type: Plain text
11319 #: build/C/man3/tmpnam.3:75
11321 "The B<tmpnam>() function returns a pointer to a unique temporary filename, "
11322 "or NULL if a unique name cannot be generated."
11325 #. type: Plain text
11326 #: build/C/man3/tmpnam.3:77
11327 msgid "No errors are defined."
11330 #. type: Plain text
11331 #: build/C/man3/tmpnam.3:83
11333 "The B<tmpnam>() function is thread-safe with exceptions. It is not "
11334 "thread-safe if called with a NULL parameter."
11337 #. type: Plain text
11338 #: build/C/man3/tmpnam.3:87
11339 msgid "The B<tmpnam_r>() function is thread-safe."
11342 #. type: Plain text
11343 #: build/C/man3/tmpnam.3:92
11345 "SVr4, 4.3BSD, C89, C99, POSIX.1-2001. POSIX.1-2008 marks B<tmpnam>() as "
11349 #. type: Plain text
11350 #: build/C/man3/tmpnam.3:103
11352 "The B<tmpnam>() function generates a different string each time it is "
11353 "called, up to B<TMP_MAX> times. If it is called more than B<TMP_MAX> times, "
11354 "the behavior is implementation defined."
11357 #. type: Plain text
11358 #: build/C/man3/tmpnam.3:122
11360 "Although B<tmpnam>() generates names that are difficult to guess, it is "
11361 "nevertheless possible that between the time that B<tmpnam>() returns a "
11362 "pathname, and the time that the program opens it, another program might "
11363 "create that pathname using B<open>(2), or create it as a symbolic link. "
11364 "This can lead to security holes. To avoid such possibilities, use the "
11365 "B<open>(2) B<O_EXCL> flag to open the pathname. Or better yet, use "
11366 "B<mkstemp>(3) or B<tmpfile>(3)."
11369 #. type: Plain text
11370 #: build/C/man3/tmpnam.3:130
11372 "Portable applications that use threads cannot call B<tmpnam>() with a NULL "
11373 "argument if either B<_POSIX_THREADS> or B<_POSIX_THREAD_SAFE_FUNCTIONS> is "
11377 #. type: Plain text
11378 #: build/C/man3/tmpnam.3:134
11379 msgid "A POSIX draft proposed to use a function B<tmpnam_r>() defined by"
11382 #. type: Plain text
11383 #: build/C/man3/tmpnam.3:142
11387 "tmpnam_r(char *s)\n"
11389 " return s ? tmpnam(s) : NULL;\n"
11393 #. type: Plain text
11394 #: build/C/man3/tmpnam.3:156
11396 "apparently as a warning not to use NULL. A few systems implement it. To "
11397 "get a glibc prototype for this function from I<E<lt>stdio.hE<gt>>, define "
11398 "B<_SVID_SOURCE> or B<_BSD_SOURCE> (before including I<any> header file)."
11401 #. type: Plain text
11402 #: build/C/man3/tmpnam.3:168
11403 msgid "B<mkstemp>(3), B<mktemp>(3), B<tempnam>(3), B<tmpfile>(3)"
11407 #: build/C/man2/unlink.2:32
11413 #: build/C/man2/unlink.2:32
11418 #. type: Plain text
11419 #: build/C/man2/unlink.2:35
11420 msgid "unlink - delete a name and possibly the file it refers to"
11423 #. type: Plain text
11424 #: build/C/man2/unlink.2:39
11425 msgid "B<int unlink(const char *>I<pathname>B<);>"
11428 #. type: Plain text
11429 #: build/C/man2/unlink.2:45
11431 "B<unlink>() deletes a name from the filesystem. If that name was the last "
11432 "link to a file and no processes have the file open the file is deleted and "
11433 "the space it was using is made available for reuse."
11436 #. type: Plain text
11437 #: build/C/man2/unlink.2:49
11439 "If the name was the last link to a file but any processes still have the "
11440 "file open the file will remain in existence until the last file descriptor "
11441 "referring to it is closed."
11444 #. type: Plain text
11445 #: build/C/man2/unlink.2:51
11446 msgid "If the name referred to a symbolic link the link is removed."
11449 #. type: Plain text
11450 #: build/C/man2/unlink.2:55
11452 "If the name referred to a socket, fifo or device the name for it is removed "
11453 "but processes which have the object open may continue to use it."
11456 #. type: Plain text
11457 #: build/C/man2/unlink.2:71
11459 "Write access to the directory containing I<pathname> is not allowed for the "
11460 "process's effective UID, or one of the directories in I<pathname> did not "
11461 "allow search permission. (See also B<path_resolution>(7).)"
11464 #. type: Plain text
11465 #: build/C/man2/unlink.2:80
11467 "The file I<pathname> cannot be unlinked because it is being used by the "
11468 "system or another process; for example, it is a mount point or the NFS "
11469 "client software created it to represent an active but otherwise nameless "
11470 "inode (\"NFS silly renamed\")."
11473 #. type: Plain text
11474 #: build/C/man2/unlink.2:92
11476 "I<pathname> refers to a directory. (This is the non-POSIX value returned by "
11477 "Linux since 2.1.132.)"
11480 #. type: Plain text
11481 #: build/C/man2/unlink.2:96
11482 msgid "Too many symbolic links were encountered in translating I<pathname>."
11485 #. type: Plain text
11486 #: build/C/man2/unlink.2:106
11488 "A component in I<pathname> does not exist or is a dangling symbolic link, or "
11489 "I<pathname> is empty."
11492 #. type: Plain text
11493 #: build/C/man2/unlink.2:114
11494 msgid "A component used as a directory in I<pathname> is not, in fact, a directory."
11497 #. type: Plain text
11498 #: build/C/man2/unlink.2:123
11500 "The system does not allow unlinking of directories, or unlinking of "
11501 "directories requires privileges that the calling process doesn't have. "
11502 "(This is the POSIX prescribed error return; as noted above, Linux returns "
11503 "B<EISDIR> for this case.)"
11507 #: build/C/man2/unlink.2:123
11509 msgid "B<EPERM> (Linux only)"
11512 #. type: Plain text
11513 #: build/C/man2/unlink.2:126
11514 msgid "The filesystem does not allow unlinking of files."
11517 #. type: Plain text
11518 #: build/C/man2/unlink.2:137
11520 "The directory containing I<pathname> has the sticky bit (B<S_ISVTX>) set "
11521 "and the process's effective UID is neither the UID of the file to be deleted "
11522 "nor that of the directory containing it, and the process is not privileged "
11523 "(Linux: does not have the B<CAP_FOWNER> capability)."
11526 #. type: Plain text
11527 #: build/C/man2/unlink.2:141
11528 msgid "I<pathname> refers to a file on a read-only filesystem."
11531 #. type: Plain text
11532 #: build/C/man2/unlink.2:161
11534 "B<rm>(1), B<chmod>(2), B<link>(2), B<mknod>(2), B<open>(2), B<rename>(2), "
11535 "B<rmdir>(2), B<unlinkat>(2), B<mkfifo>(3), B<remove>(3), "
11536 "B<path_resolution>(7), B<symlink>(7)"
11540 #: build/C/man3/unlocked_stdio.3:25
11542 msgid "UNLOCKED_STDIO"
11546 #: build/C/man3/unlocked_stdio.3:25
11551 #. type: Plain text
11552 #: build/C/man3/unlocked_stdio.3:29
11554 "getc_unlocked, getchar_unlocked, putc_unlocked, putchar_unlocked - "
11555 "nonlocking stdio functions"
11558 #. type: Plain text
11559 #: build/C/man3/unlocked_stdio.3:37
11562 "B<int getc_unlocked(FILE *>I<stream>B<);>\n"
11563 "B<int getchar_unlocked(void);>\n"
11564 "B<int putc_unlocked(int >I<c>B<, FILE *>I<stream>B<);>\n"
11565 "B<int putchar_unlocked(int >I<c>B<);>\n"
11568 #. type: Plain text
11569 #: build/C/man3/unlocked_stdio.3:49
11572 "B<void clearerr_unlocked(FILE *>I<stream>B<);>\n"
11573 "B<int feof_unlocked(FILE *>I<stream>B<);>\n"
11574 "B<int ferror_unlocked(FILE *>I<stream>B<);>\n"
11575 "B<int fileno_unlocked(FILE *>I<stream>B<);>\n"
11576 "B<int fflush_unlocked(FILE *>I<stream>B<);>\n"
11577 "B<int fgetc_unlocked(FILE *>I<stream>B<);>\n"
11578 "B<int fputc_unlocked(int >I<c>B<, FILE *>I<stream>B<);>\n"
11579 "B<size_t fread_unlocked(void *>I<ptr>B<, size_t >I<size>B<, size_t "
11581 "B< FILE *>I<stream>B<);>\n"
11582 "B<size_t fwrite_unlocked(const void *>I<ptr>B<, size_t >I<size>B<, size_t "
11584 "B< FILE *>I<stream>B<);>\n"
11587 #. type: Plain text
11588 #: build/C/man3/unlocked_stdio.3:52
11591 "B<char *fgets_unlocked(char *>I<s>B<, int >I<n>B<, FILE *>I<stream>B<);>\n"
11592 "B<int fputs_unlocked(const char *>I<s>B<, FILE *>I<stream>B<);>\n"
11595 #. type: Plain text
11596 #: build/C/man3/unlocked_stdio.3:63
11599 "B<wint_t getwc_unlocked(FILE *>I<stream>B<);>\n"
11600 "B<wint_t getwchar_unlocked(void);>\n"
11601 "B<wint_t fgetwc_unlocked(FILE *>I<stream>B<);>\n"
11602 "B<wint_t fputwc_unlocked(wchar_t >I<wc>B<, FILE *>I<stream>B<);>\n"
11603 "B<wint_t putwc_unlocked(wchar_t >I<wc>B<, FILE *>I<stream>B<);>\n"
11604 "B<wint_t putwchar_unlocked(wchar_t >I<wc>B<);>\n"
11605 "B<wchar_t *fgetws_unlocked(wchar_t *>I<ws>B<, int >I<n>B<, FILE "
11606 "*>I<stream>B<);>\n"
11607 "B<int fputws_unlocked(const wchar_t *>I<ws>B<, FILE *>I<stream>B<);>\n"
11610 #. type: Plain text
11611 #: build/C/man3/unlocked_stdio.3:75
11613 "B<getc_unlocked>(), B<getchar_unlocked>(), B<putc_unlocked>(), "
11614 "B<putchar_unlocked>():"
11617 #. type: Plain text
11618 #: build/C/man3/unlocked_stdio.3:78
11620 "_POSIX_C_SOURCE\\ E<gt>=\\ 1 || _XOPEN_SOURCE || _POSIX_SOURCE || "
11621 "_BSD_SOURCE || _SVID_SOURCE"
11624 #. type: Plain text
11625 #: build/C/man3/unlocked_stdio.3:89
11627 "B<clearerr_unlocked>(), B<feof_unlocked>(), B<ferror_unlocked>(), "
11628 "B<fileno_unlocked>(), B<fflush_unlocked>(), B<fgetc_unlocked>(), "
11629 "B<fputc_unlocked>(), B<fread_unlocked>(), B<fwrite_unlocked>():"
11632 #. type: Plain text
11633 #: build/C/man3/unlocked_stdio.3:91
11634 msgid "_BSD_SOURCE || _SVID_SOURCE"
11637 #. type: Plain text
11638 #: build/C/man3/unlocked_stdio.3:102
11640 "B<fgets_unlocked>(), B<fputs_unlocked>(), B<getwc_unlocked>(), "
11641 "B<getwchar_unlocked>(), B<fgetwc_unlocked>(), B<fputwc_unlocked>(), "
11642 "B<putwchar_unlocked>(), B<fgetws_unlocked>(), B<fputws_unlocked>():"
11645 #. type: Plain text
11646 #: build/C/man3/unlocked_stdio.3:113
11648 "Each of these functions has the same behavior as its counterpart without the "
11649 "\"_unlocked\" suffix, except that they do not use locking (they do not set "
11650 "locks themselves, and do not test for the presence of locks set by others) "
11651 "and hence are thread-unsafe. See B<flockfile>(3)."
11654 #. type: Plain text
11655 #: build/C/man3/unlocked_stdio.3:120
11657 "The four functions B<getc_unlocked>(), B<getchar_unlocked>(), "
11658 "B<putc_unlocked>(), B<putchar_unlocked>() are in POSIX.1-2001."
11661 #. E.g., in HP-UX 10.0. In HP-UX 10.30 they are called obsolescent, and
11662 #. moved to a compatibility library.
11663 #. Available in HP-UX 10.0: clearerr_unlocked, fclose_unlocked,
11664 #. feof_unlocked, ferror_unlocked, fflush_unlocked, fgets_unlocked,
11665 #. fgetwc_unlocked, fgetws_unlocked, fileno_unlocked, fputs_unlocked,
11666 #. fputwc_unlocked, fputws_unlocked, fread_unlocked, fseek_unlocked,
11667 #. ftell_unlocked, fwrite_unlocked, getc_unlocked, getchar_unlocked,
11668 #. getw_unlocked, getwc_unlocked, getwchar_unlocked, putc_unlocked,
11669 #. putchar_unlocked, puts_unlocked, putws_unlocked, putw_unlocked,
11670 #. putwc_unlocked, putwchar_unlocked, rewind_unlocked, setvbuf_unlocked,
11671 #. ungetc_unlocked, ungetwc_unlocked.
11672 #. type: Plain text
11673 #: build/C/man3/unlocked_stdio.3:136
11675 "The nonstandard B<*_unlocked>() variants occur on a few UNIX systems, and "
11676 "are available in recent glibc. They should probably not be used."
11679 #. type: Plain text
11680 #: build/C/man3/unlocked_stdio.3:139
11681 msgid "B<flockfile>(3), B<stdio>(3)"
11685 #: build/C/man3/wprintf.3:16
11691 #: build/C/man3/wprintf.3:16
11696 #. type: Plain text
11697 #: build/C/man3/wprintf.3:20
11699 "wprintf, fwprintf, swprintf, vwprintf, vfwprintf, vswprintf - formatted "
11700 "wide-character output conversion"
11703 #. type: Plain text
11704 #: build/C/man3/wprintf.3:24
11707 "B<#include E<lt>stdio.hE<gt>>\n"
11708 "B<#include E<lt>wchar.hE<gt>>\n"
11711 #. type: Plain text
11712 #: build/C/man3/wprintf.3:29
11715 "B<int wprintf(const wchar_t *>I<format>B<, ...);>\n"
11716 "B<int fwprintf(FILE *>I<stream>B<, const wchar_t *>I<format>B<, ...);>\n"
11717 "B<int swprintf(wchar_t *>I<wcs>B<, size_t >I<maxlen>B<,>\n"
11718 "B< const wchar_t *>I<format>B<, ...);>\n"
11721 #. type: Plain text
11722 #: build/C/man3/wprintf.3:34
11725 "B<int vwprintf(const wchar_t *>I<format>B<, va_list >I<args>B<);>\n"
11726 "B<int vfwprintf(FILE *>I<stream>B<, const wchar_t *>I<format>B<, va_list "
11728 "B<int vswprintf(wchar_t *>I<wcs>B<, size_t >I<maxlen>B<,>\n"
11729 "B< const wchar_t *>I<format>B<, va_list >I<args>B<);>\n"
11733 #. .BR fwprintf (),
11734 #. .BR swprintf (),
11735 #. .BR vwprintf (),
11736 #. .BR vfwprintf (),
11737 #. .BR vswprintf ():
11738 #. type: Plain text
11739 #: build/C/man3/wprintf.3:51
11740 msgid "_XOPEN_SOURCE\\ E<gt>=\\ 500 || _ISOC99_SOURCE ||"
11743 #. type: Plain text
11744 #: build/C/man3/wprintf.3:53
11745 msgid "_ISOC95_SOURCE /* Since glibc 2.12 */ ||"
11748 #. type: Plain text
11749 #: build/C/man3/wprintf.3:55
11750 msgid "_POSIX_C_SOURCE\\ E<gt>=\\ 200112L;"
11753 #. type: Plain text
11754 #: build/C/man3/wprintf.3:58
11755 msgid "or I<cc\\ -std=c99>"
11758 #. type: Plain text
11759 #: build/C/man3/wprintf.3:69
11761 "The B<wprintf>() family of functions is the wide-character equivalent of "
11762 "the B<printf>(3) family of functions. It performs formatted output of wide "
11766 #. type: Plain text
11767 #: build/C/man3/wprintf.3:81
11769 "The B<wprintf>() and B<vwprintf>() functions perform wide-character output "
11770 "to I<stdout>. I<stdout> must not be byte oriented; see B<fwide>(3) for "
11771 "more information."
11774 #. type: Plain text
11775 #: build/C/man3/wprintf.3:93
11777 "The B<fwprintf>() and B<vfwprintf>() functions perform wide-character "
11778 "output to I<stream>. I<stream> must not be byte oriented; see B<fwide>(3) "
11779 "for more information."
11782 #. type: Plain text
11783 #: build/C/man3/wprintf.3:107
11785 "The B<swprintf>() and B<vswprintf>() functions perform wide-character "
11786 "output to an array of wide characters. The programmer must ensure that "
11787 "there is room for at least I<maxlen> wide characters at I<wcs>."
11790 #. type: Plain text
11791 #: build/C/man3/wprintf.3:118
11793 "These functions are like the B<printf>(3), B<vprintf>(3), B<fprintf>(3), "
11794 "B<vfprintf>(3), B<sprintf>(3), B<vsprintf>(3) functions except for the "
11795 "following differences:"
11799 #: build/C/man3/wprintf.3:118 build/C/man3/wprintf.3:123 build/C/man3/wprintf.3:126
11804 #. type: Plain text
11805 #: build/C/man3/wprintf.3:123
11806 msgid "The I<format> string is a wide-character string."
11809 #. type: Plain text
11810 #: build/C/man3/wprintf.3:126
11811 msgid "The output consists of wide characters, not bytes."
11814 #. type: Plain text
11815 #: build/C/man3/wprintf.3:145
11817 "B<swprintf>() and B<vswprintf>() take a I<maxlen> argument, B<sprintf>(3) "
11818 "and B<vsprintf>(3) do not. (B<snprintf>(3) and B<vsnprintf>(3) take a "
11819 "I<maxlen> argument, but these functions do not return -1 upon buffer "
11820 "overflow on Linux.)"
11823 #. type: Plain text
11824 #: build/C/man3/wprintf.3:151
11825 msgid "The treatment of the conversion characters B<c> and B<s> is different:"
11828 #. type: Plain text
11829 #: build/C/man3/wprintf.3:165
11831 "If no B<l> modifier is present, the I<int> argument is converted to a wide "
11832 "character by a call to the B<btowc>(3) function, and the resulting wide "
11833 "character is written. If an B<l> modifier is present, the I<wint_t> (wide "
11834 "character) argument is written."
11837 #. type: Plain text
11838 #: build/C/man3/wprintf.3:205
11840 "If no B<l> modifier is present: The I<const\\ char\\ *> argument is expected "
11841 "to be a pointer to an array of character type (pointer to a string) "
11842 "containing a multibyte character sequence beginning in the initial shift "
11843 "state. Characters from the array are converted to wide characters (each by "
11844 "a call to the B<mbrtowc>(3) function with a conversion state starting in "
11845 "the initial state before the first byte). The resulting wide characters are "
11846 "written up to (but not including) the terminating null wide character "
11847 "(L\\(aq\\e0\\(aq). If a precision is specified, no more wide characters "
11848 "than the number specified are written. Note that the precision determines "
11849 "the number of I<wide characters> written, not the number of I<bytes> or "
11850 "I<screen positions>. The array must contain a terminating null byte "
11851 "(\\(aq\\e0\\(aq), unless a precision is given and it is so small that the "
11852 "number of converted wide characters reaches it before the end of the array "
11853 "is reached. If an B<l> modifier is present: The I<const\\ wchar_t\\ *> "
11854 "argument is expected to be a pointer to an array of wide characters. Wide "
11855 "characters from the array are written up to (but not including) a "
11856 "terminating null wide character. If a precision is specified, no more than "
11857 "the number specified are written. The array must contain a terminating null "
11858 "wide character, unless a precision is given and it is smaller than or equal "
11859 "to the number of wide characters in the array."
11862 #. type: Plain text
11863 #: build/C/man3/wprintf.3:213
11865 "The functions return the number of wide characters written, excluding the "
11866 "terminating null wide character in case of the functions B<swprintf>() and "
11867 "B<vswprintf>(). They return -1 when an error occurs."
11870 #. type: Plain text
11871 #: build/C/man3/wprintf.3:215
11875 #. type: Plain text
11876 #: build/C/man3/wprintf.3:223
11878 "The behavior of B<wprintf>() et al. depends on the B<LC_CTYPE> category of "
11879 "the current locale."
11882 #. type: Plain text
11883 #: build/C/man3/wprintf.3:253
11885 "If the I<format> string contains non-ASCII wide characters, the program will "
11886 "work correctly only if the B<LC_CTYPE> category of the current locale at run "
11887 "time is the same as the B<LC_CTYPE> category of the current locale at "
11888 "compile time. This is because the I<wchar_t> representation is platform- "
11889 "and locale-dependent. (The glibc represents wide characters using their "
11890 "Unicode (ISO-10646) code point, but other platforms don't do this. Also, "
11891 "the use of C99 universal character names of the form \\eunnnn does not solve "
11892 "this problem.) Therefore, in internationalized programs, the I<format> "
11893 "string should consist of ASCII wide characters only, or should be "
11894 "constructed at run time in an internationalized way (e.g., using "
11895 "B<gettext>(3) or B<iconv>(3), followed by B<mbstowcs>(3))."
11899 #. type: Plain text
11900 #: build/C/man3/wprintf.3:260
11901 msgid "B<fprintf>(3), B<fputwc>(3), B<fwide>(3), B<printf>(3), B<snprintf>(3)"
11905 #: build/C/man2/write.2:39
11910 #. type: Plain text
11911 #: build/C/man2/write.2:42
11912 msgid "write - write to a file descriptor"
11915 #. type: Plain text
11916 #: build/C/man2/write.2:46
11917 msgid "B<ssize_t write(int >I<fd>B<, const void *>I<buf>B<, size_t >I<count>B<);>"
11920 #. type: Plain text
11921 #: build/C/man2/write.2:54
11923 "B<write>() writes up to I<count> bytes from the buffer pointed I<buf> to "
11924 "the file referred to by the file descriptor I<fd>."
11927 #. type: Plain text
11928 #: build/C/man2/write.2:68
11930 "The number of bytes written may be less than I<count> if, for example, there "
11931 "is insufficient space on the underlying physical medium, or the "
11932 "B<RLIMIT_FSIZE> resource limit is encountered (see B<setrlimit>(2)), or the "
11933 "call was interrupted by a signal handler after having written less than "
11934 "I<count> bytes. (See also B<pipe>(7).)"
11937 #. type: Plain text
11938 #: build/C/man2/write.2:82
11940 "For a seekable file (i.e., one to which B<lseek>(2) may be applied, for "
11941 "example, a regular file) writing takes place at the current file offset, "
11942 "and the file offset is incremented by the number of bytes actually written. "
11943 "If the file was B<open>(2)ed with B<O_APPEND>, the file offset is first set "
11944 "to the end of the file before writing. The adjustment of the file offset "
11945 "and the write operation are performed as an atomic step."
11948 #. type: Plain text
11949 #: build/C/man2/write.2:89
11951 "POSIX requires that a B<read>(2) which can be proved to occur after a "
11952 "B<write>() has returned returns the new data. Note that not all "
11953 "filesystems are POSIX conforming."
11956 #. type: Plain text
11957 #: build/C/man2/write.2:94
11959 "On success, the number of bytes written is returned (zero indicates nothing "
11960 "was written). On error, -1 is returned, and I<errno> is set appropriately."
11963 #. type: Plain text
11964 #: build/C/man2/write.2:107
11966 "If I<count> is zero and I<fd> refers to a regular file, then B<write>() may "
11967 "return a failure status if one of the errors below is detected. If no "
11968 "errors are detected, 0 will be returned without causing any other effect. "
11969 "If I<count> is zero and I<fd> refers to a file other than a regular file, "
11970 "the results are not specified."
11973 #. type: Plain text
11974 #: build/C/man2/write.2:115
11976 "The file descriptor I<fd> refers to a file other than a socket and has been "
11977 "marked nonblocking (B<O_NONBLOCK>), and the write would block."
11980 #. Actually EAGAIN on Linux
11981 #. type: Plain text
11982 #: build/C/man2/write.2:126
11984 "The file descriptor I<fd> refers to a socket and has been marked nonblocking "
11985 "(B<O_NONBLOCK>), and the write would block. POSIX.1-2001 allows either "
11986 "error to be returned for this case, and does not require these constants to "
11987 "have the same value, so a portable application should check for both "
11991 #. type: Plain text
11992 #: build/C/man2/write.2:130
11993 msgid "I<fd> is not a valid file descriptor or is not open for writing."
11997 #: build/C/man2/write.2:130
11999 msgid "B<EDESTADDRREQ>"
12002 #. type: Plain text
12003 #: build/C/man2/write.2:135
12005 "I<fd> refers to a datagram socket for which a peer address has not been set "
12006 "using B<connect>(2)."
12009 #. type: Plain text
12010 #: build/C/man2/write.2:141
12012 "The user's quota of disk blocks on the filesystem containing the file "
12013 "referred to by I<fd> has been exhausted."
12016 #. type: Plain text
12017 #: build/C/man2/write.2:150
12019 "An attempt was made to write a file that exceeds the implementation-defined "
12020 "maximum file size or the process's file size limit, or to write at a "
12021 "position past the maximum allowed offset."
12024 #. type: Plain text
12025 #: build/C/man2/write.2:154
12027 "The call was interrupted by a signal before any data was written; see "
12031 #. type: Plain text
12032 #: build/C/man2/write.2:165
12034 "I<fd> is attached to an object which is unsuitable for writing; or the file "
12035 "was opened with the B<O_DIRECT> flag, and either the address specified in "
12036 "I<buf>, the value specified in I<count>, or the current file offset is not "
12037 "suitably aligned."
12040 #. type: Plain text
12041 #: build/C/man2/write.2:168
12042 msgid "A low-level I/O error occurred while modifying the inode."
12045 #. type: Plain text
12046 #: build/C/man2/write.2:173
12048 "The device containing the file referred to by I<fd> has no room for the "
12053 #: build/C/man2/write.2:173
12058 #. type: Plain text
12059 #: build/C/man2/write.2:182
12061 "I<fd> is connected to a pipe or socket whose reading end is closed. When "
12062 "this happens the writing process will also receive a B<SIGPIPE> signal. "
12063 "(Thus, the write return value is seen only if the program catches, blocks or "
12064 "ignores this signal.)"
12067 #. type: Plain text
12068 #: build/C/man2/write.2:185
12069 msgid "Other errors may occur, depending on the object connected to I<fd>."
12072 #. type: Plain text
12073 #: build/C/man2/write.2:194
12075 "Under SVr4 a write may be interrupted and return B<EINTR> at any point, not "
12076 "just before any data is written."
12079 #. type: Plain text
12080 #: build/C/man2/write.2:203
12082 "A successful return from B<write>() does not make any guarantee that data "
12083 "has been committed to disk. In fact, on some buggy implementations, it does "
12084 "not even guarantee that space has successfully been reserved for the data. "
12085 "The only way to be sure is to call B<fsync>(2) after you are done writing "
12089 #. type: Plain text
12090 #: build/C/man2/write.2:211
12092 "If a B<write>() is interrupted by a signal handler before any bytes are "
12093 "written, then the call fails with the error B<EINTR>; if it is interrupted "
12094 "after at least one byte has been written, the call succeeds, and returns the "
12095 "number of bytes written."
12098 #. type: Plain text
12099 #: build/C/man2/write.2:223
12101 "B<close>(2), B<fcntl>(2), B<fsync>(2), B<ioctl>(2), B<lseek>(2), B<open>(2), "
12102 "B<pwrite>(2), B<read>(2), B<select>(2), B<writev>(2), B<fwrite>(3)"