Debian Codegraph @

po/ar/man2/open_by_handle_at.2.po

raw
1 # Arabic translation of manpages
2 # This file is distributed under the same license as the manpages-l10n package.
3 # Copyright © of this file:
4 # زايد السعيدي <[email protected]>, 2026.
5 msgid ""
6 msgstr ""
7 "Project-Id-Version: manpages-l10n 4.30.2\n"
8 "POT-Creation-Date: 2026-06-05 06:33+0200\n"
9 "PO-Revision-Date: 2026-05-18 18:46+0400\n"
10 "Last-Translator: Zayed Al-Saidi <[email protected]>\n"
11 "Language-Team: Arabic <[email protected]>\n"
12 "Language: ar\n"
13 "MIME-Version: 1.0\n"
14 "Content-Type: text/plain; charset=UTF-8\n"
15 "Content-Transfer-Encoding: 8bit\n"
16 "Plural-Forms: nplurals=6; plural=n==0 ? 0 : n==1 ? 1 : n==2 ? 2 : n%100>=3 "
17 "&& n%100<=10 ? 3 : n%100>=11 && n%100<=99 ? 4 : 5;\n"
18 "X-Generator: Lokalize 23.08.5\n"
19
20 #. type: TH
21 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
22 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
23 #, no-wrap
24 msgid "open_by_handle_at"
25 msgstr "open_by_handle_at"
26
27 #. type: TH
28 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
29 #, no-wrap
30 msgid "2026-02-22"
31 msgstr "22 فبراير 2026"
32
33 #. type: TH
34 #: archlinux debian-unstable
35 #, no-wrap
36 msgid "Linux man-pages 6.18"
37 msgstr "صفحات دليل لينكس 6.18"
38
39 #. type: SH
40 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
41 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
42 #, no-wrap
43 msgid "NAME"
44 msgstr "الاسم"
45
46 #. type: Plain text
47 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
48 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
49 msgid ""
50 "name_to_handle_at, open_by_handle_at - obtain handle for a pathname and open "
51 "file via a handle"
52 msgstr ""
53 "name_to_handle_at, open_by_handle_at - الحصول على مقبض لمسار ملف وفتح ملف "
54 "عبر مقبض"
55
56 #. type: SH
57 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
58 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
59 #, no-wrap
60 msgid "LIBRARY"
61 msgstr "المكتبة"
62
63 #. type: Plain text
64 #: archlinux debian-unstable fedora-44 fedora-rawhide mageia-cauldron
65 #: opensuse-leap-16-1 opensuse-tumbleweed
66 msgid "Standard C library (I<libc>,\\ I<-lc>)"
67 msgstr "مكتبة سي المعيارية (I<libc>،\\ I<-lc>)"
68
69 #. type: SH
70 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
71 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
72 #, no-wrap
73 msgid "SYNOPSIS"
74 msgstr "موجز"
75
76 #. type: Plain text
77 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
78 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
79 #, no-wrap
80 msgid ""
81 "B<#define _GNU_SOURCE> /* See feature_test_macros(7) */\n"
82 "B<#include E<lt>fcntl.hE<gt>>\n"
83 msgstr ""
84 "B<#define _GNU_SOURCE> /* انظر feature_test_macros(7) */\n"
85 "B<#include E<lt>fcntl.hE<gt>>\n"
86
87 #. type: Plain text
88 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
89 #: opensuse-tumbleweed
90 #, no-wrap
91 msgid ""
92 "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<path>B<,>\n"
93 "B< struct file_handle *>I<handle>B<,>\n"
94 "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
95 "B<int open_by_handle_at(int >I<mount_fd>B<, struct file_handle *>I<handle>B<,>\n"
96 "B< int >I<flags>B<);>\n"
97 msgstr ""
98 "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<path>B<,>\n"
99 "B< struct file_handle *>I<handle>B<,>\n"
100 "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
101 "B<int open_by_handle_at(int >I<mount_fd>B<, struct file_handle *>I<handle>B<,>\n"
102 "B< int >I<flags>B<);>\n"
103
104 #. type: SH
105 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
106 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
107 #, no-wrap
108 msgid "DESCRIPTION"
109 msgstr "الوصف"
110
111 #. type: Plain text
112 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
113 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
114 msgid ""
115 "The B<name_to_handle_at>() and B<open_by_handle_at>() system calls split "
116 "the functionality of B<openat>(2) into two parts: B<name_to_handle_at>() "
117 "returns an opaque handle that corresponds to a specified file; "
118 "B<open_by_handle_at>() opens the file corresponding to a handle returned by "
119 "a previous call to B<name_to_handle_at>() and returns an open file "
120 "descriptor."
121 msgstr ""
122 "استدعاءات النظام B<name_to_handle_at>() و B<open_by_handle_at>() تقسم وظيفة "
123 "B<openat>(2) إلى جزئين: يُعيد B<name_to_handle_at>() مقبضًا غير شفاف يتوافق مع "
124 "ملف محدد؛ ويفتح B<open_by_handle_at>() الملف المقابل لمقبض أُعيد بواسطة "
125 "استدعاء سابق لـ B<name_to_handle_at>() ويُعيد واصف ملف مفتوح."
126
127 #. type: SS
128 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
129 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
130 #, no-wrap
131 msgid "name_to_handle_at()"
132 msgstr "name_to_handle_at()"
133
134 #. type: Plain text
135 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
136 #: opensuse-tumbleweed
137 msgid ""
138 "The B<name_to_handle_at>() system call returns a file handle and a mount ID "
139 "corresponding to the file specified by the I<dirfd> and I<path> arguments. "
140 "The file handle is returned via the argument I<handle>, which is a pointer "
141 "to a structure of the following form:"
142 msgstr ""
143 "يُعيد استدعاء النظام B<name_to_handle_at>() مقبض ملف ومعرف وصل يتوافقان مع "
144 "الملف المحدد بوسيطي I<dirfd> و I<path>. يُعاد مقبض الملف عبر الوسيط "
145 "I<handle>، وهو مؤشر لبنية بالشكل التالي:"
146
147 #. type: Plain text
148 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
149 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
150 #, no-wrap
151 msgid ""
152 "struct file_handle {\n"
153 " unsigned int handle_bytes; /* Size of f_handle [in, out] */\n"
154 " int handle_type; /* Handle type [out] */\n"
155 " unsigned char f_handle[0]; /* File identifier (sized by\n"
156 " caller) [out] */\n"
157 "};\n"
158 msgstr ""
159 "struct file_handle {\n"
160 " unsigned int handle_bytes; /* حجم f_handle [مدخل، مخرج] */\n"
161 " int handle_type; /* نوع المقبض [مخرج] */\n"
162 " unsigned char f_handle[0]; /* معرف الملف (حدد حجمه\n"
163 " المستدعِي) [مخرج] */\n"
164 "};\n"
165
166 #. type: Plain text
167 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
168 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
169 msgid ""
170 "It is the caller's responsibility to allocate the structure with a size "
171 "large enough to hold the handle returned in I<f_handle>. Before the call, "
172 "the I<handle_bytes> field should be initialized to contain the allocated "
173 "size for I<f_handle>. (The constant B<MAX_HANDLE_SZ>, defined in "
174 "I<E<lt>fcntl.hE<gt>>, specifies the maximum expected size for a file "
175 "handle. It is not a guaranteed upper limit as future filesystems may "
176 "require more space.) Upon successful return, the I<handle_bytes> field is "
177 "updated to contain the number of bytes actually written to I<f_handle>."
178 msgstr ""
179 "تقع على عاتق المستدعِي مسؤولية تخصيص البنية بحجم كبير كافٍ لاحتواء المقبض "
180 "المُعاد في I<f_handle>. قبل الاستدعاء، يجب تهيئة الحقل I<handle_bytes> "
181 "لاحتواء الحجم المخصص لـ I<f_handle>. (يحدد الثابت B<MAX_HANDLE_SZ>، المُعرّف "
182 "في I<E<lt>fcntl.hE<gt>>، أقصى حجم متوقع لمقبض ملف. ليس حدًا أعلى مضمونًا لأن "
183 "أنظمة الملفات المستقبلية قد تتطلب مساحة أكبر.) عند النجاح، يُحدّث الحقل "
184 "I<handle_bytes> لاحتواء عدد البايتات المكتوبة فعليًا في I<f_handle>."
185
186 #. type: Plain text
187 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
188 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
189 msgid ""
190 "The caller can discover the required size for the I<file_handle> structure "
191 "by making a call in which I<handle-E<gt>handle_bytes> is zero; in this case, "
192 "the call fails with the error B<EOVERFLOW> and I<handle-E<gt>handle_bytes> "
193 "is set to indicate the required size; the caller can then use this "
194 "information to allocate a structure of the correct size (see EXAMPLES "
195 "below). Some care is needed here as B<EOVERFLOW> can also indicate that no "
196 "file handle is available for this particular name in a filesystem which does "
197 "normally support file-handle lookup. This case can be detected when the "
198 "B<EOVERFLOW> error is returned without I<handle_bytes> being increased."
199 msgstr ""
200 "يمكن للمستدعِي اكتشاف الحجم المطلوب لبنية I<file_handle> عبر إجراء استدعاء "
201 "تكون فيه قيمة I<handle-E<gt>handle_bytes> صفرًا؛ وفي هذه الحالة، يفشل "
202 "الاستدعاء بالخطأ B<EOVERFLOW> وتُضبط قيمة I<handle-E<gt>handle_bytes> للإشارة "
203 "إلى الحجم المطلوب؛ يمكن للمستدعِي بعد ذلك استخدام هذه المعلومات لتخصيص بنية "
204 "بالحجم الصحيح (انظر الأمثلة أدناه). يجب توخي الحذر هنا لأن B<EOVERFLOW> قد "
205 "يشير أيضًا إلى عدم توفر مقبض ملف لهذا الاسم المعين في نظام ملفات يدعم عادةً "
206 "البحث عن مقابض الملفات. يمكن اكتشاف هذه الحالة عند إرجاع الخطأ B<EOVERFLOW> "
207 "دون زيادة I<handle_bytes>."
208
209 #. type: Plain text
210 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
211 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
212 msgid ""
213 "Other than the use of the I<handle_bytes> field, the caller should treat the "
214 "I<file_handle> structure as an opaque data type: the I<handle_type> and "
215 "I<f_handle> fields can be used in a subsequent call to "
216 "B<open_by_handle_at>(). The caller can also use the opaque I<file_handle> "
217 "to compare the identity of filesystem objects that were queried at different "
218 "times and possibly at different paths. The B<fanotify>(7) subsystem can "
219 "report events with an information record containing a I<file_handle> to "
220 "identify the filesystem object."
221 msgstr ""
222 "بخلاف استخدام حقل I<handle_bytes>، يجب على المستدعِي معاملة بنية "
223 "I<file_handle> كنوع بيانات غير شفاف: يمكن استخدام حقلي I<handle_type> و "
224 "I<f_handle> في استدعاء لاحق لـ B<open_by_handle_at>(). يمكن للمستدعِي أيضًا "
225 "استخدام I<file_handle> غير الشفاف لمقارنة هوية كائنات نظام الملفات التي تم "
226 "الاستعلام عنها في أوقات مختلفة وربما في مسارات مختلفة. يمكن للنظام الفرعي "
227 "B<fanotify>(7) الإبلاغ عن الأحداث بسجل معلومات يحتوي على I<file_handle> "
228 "لتحديد كائن نظام الملفات."
229
230 #. type: Plain text
231 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
232 #: opensuse-tumbleweed
233 msgid ""
234 "The I<flags> argument is a bit mask constructed by ORing together zero or "
235 "more of B<AT_HANDLE_FID>, B<AT_HANDLE_MNT_ID_UNIQUE>, "
236 "B<AT_HANDLE_CONNECTABLE>, B<AT_EMPTY_PATH>, and B<AT_SYMLINK_FOLLOW>, "
237 "described below."
238 msgstr ""
239 "الوسيط I<flags> هو قناع بتات يُبنى عبر إجراء عملية OR لصفر أو أكثر من "
240 "B<AT_HANDLE_FID> و B<AT_HANDLE_MNT_ID_UNIQUE> و B<AT_HANDLE_CONNECTABLE> و "
241 "B<AT_EMPTY_PATH> و B<AT_SYMLINK_FOLLOW>، الموصوفة أدناه."
242
243 #. commit 96b2b072ee62be8ae68c8ecf14854c4d0505a8f8
244 #. type: Plain text
245 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
246 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
247 msgid ""
248 "When I<flags> contain the B<AT_HANDLE_FID> (since Linux 6.5) flag, the "
249 "caller indicates that the returned I<file_handle> is needed to identify the "
250 "filesystem object, and not for opening the file later, so it should be "
251 "expected that a subsequent call to B<open_by_handle_at>() with the returned "
252 "I<file_handle> may fail."
253 msgstr ""
254 "عندما يحتوي I<flags> على علم B<AT_HANDLE_FID> (منذ لينكس 6.5)، يشير المستدعِي "
255 "إلى أن I<file_handle> المُعاد مطلوب لتحديد كائن نظام الملفات، وليس لفتح الملف "
256 "لاحقًا، لذا يُتوقع أن استدعاءً لاحقًا لـ B<open_by_handle_at>() باستخدام "
257 "I<file_handle> المُعاد قد يفشل."
258
259 #. commit 4356d575ef0f39a3e8e0ce0c40d84ce900ac3b61
260 #. type: Plain text
261 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
262 #: opensuse-tumbleweed
263 msgid ""
264 "When I<flags> contain the B<AT_HANDLE_MNT_ID_UNIQUE> (since Linux 6.12) "
265 "flag, the caller indicates that the width of the I<mount_id> buffer is at "
266 "least 64 bits, and then the mount id returned in that buffer is the unique "
267 "mount id as the one returned by B<statx>(2) with the B<STATX_MNT_ID_UNIQUE> "
268 "flag."
269 msgstr ""
270 "عندما يحتوي I<flags> على علم B<AT_HANDLE_MNT_ID_UNIQUE> (منذ لينكس 6.12)، "
271 "يشير المستدعِي إلى أن عرض المخزن المؤقت I<mount_id> هو 64 بت على الأقل، "
272 "وعندها يكون معرف الوصل المُعاد في ذلك المخزن هو معرف الوصل الفريد مثل ذلك "
273 "الذي يُعيده B<statx>(2) مع علم B<STATX_MNT_ID_UNIQUE>."
274
275 #. commit a20853ab8296d4a8754482cb5e9adde8ab426a25
276 #. type: Plain text
277 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
278 #: opensuse-tumbleweed
279 msgid ""
280 "When I<flags> contain the B<AT_HANDLE_CONNECTABLE> (since Linux 6.13) flag, "
281 "the caller indicates that the returned I<file_handle> is needed to open a "
282 "file with known path later, so it should be expected that a subsequent call "
283 "to B<open_by_handle_at>() with the returned I<file_handle> may fail if the "
284 "file was moved, but otherwise, the path of the opened file is expected to be "
285 "visible from the I</proc/>pidI</fd/>* magic link. This flag can not be used "
286 "in combination with the flags B<AT_HANDLE_FID> and/or B<AT_EMPTY_PATH>."
287 msgstr ""
288 "عندما يحتوي I<flags> على علم B<AT_HANDLE_CONNECTABLE> (منذ لينكس 6.13)، يشير "
289 "المستدعِي إلى أن I<file_handle> المُعاد مطلوب لفتح ملف بمسار معروف لاحقًا، لذا "
290 "يُتوقع أن استدعاءً لاحقًا لـ B<open_by_handle_at>() باستخدام I<file_handle> "
291 "المُعاد قد يفشل إذا نُقل الملف، ولكن بخلاف ذلك، يُتوقع أن يكون مسار الملف "
292 "المفتوح مرئيًا من الرابط السحري I</proc/>pidI</fd/>*. لا يمكن استخدام هذا "
293 "العلم مع علمي B<AT_HANDLE_FID> و/أو B<AT_EMPTY_PATH>."
294
295 #. type: Plain text
296 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
297 #: opensuse-tumbleweed
298 msgid ""
299 "Together, the I<path> and I<dirfd> arguments identify the file for which a "
300 "handle is to be obtained. There are four distinct cases:"
301 msgstr ""
302 "يحدد وسيطا I<path> و I<dirfd> معًا الملف المطلوب الحصول على مقبض له. هناك "
303 "أربع حالات متميزة:"
304
305 #. type: IP
306 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
307 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
308 #, no-wrap
309 msgid "\\[bu]"
310 msgstr "\\[bu]"
311
312 #. type: Plain text
313 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
314 #: opensuse-tumbleweed
315 msgid ""
316 "If I<path> is a nonempty string containing an absolute pathname, then a "
317 "handle is returned for the file referred to by that pathname. In this case, "
318 "I<dirfd> is ignored."
319 msgstr ""
320 "إذا كان I<path> سلسلة غير فارغة تحتوي على اسم مسار مطلق، فيُعاد مقبض للملف "
321 "المشار إليه باسم المسار ذلك. وفي هذه الحالة، يُتجاهل I<dirfd>."
322
323 #. type: Plain text
324 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
325 #: opensuse-tumbleweed
326 msgid ""
327 "If I<path> is a nonempty string containing a relative pathname and I<dirfd> "
328 "has the special value B<AT_FDCWD>, then I<path> is interpreted relative to "
329 "the current working directory of the caller, and a handle is returned for "
330 "the file to which it refers."
331 msgstr ""
332 "إذا كان I<path> سلسلة غير فارغة تحتوي على اسم مسار نسبي وكانت قيمة I<dirfd> "
333 "هي القيمة الخاصة B<AT_FDCWD>، فيُفسر I<path> بالنسبة إلى دليل العمل الحالي "
334 "للمستدعِي، ويُعاد مقبض للملف الذي يشير إليه."
335
336 #. type: Plain text
337 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
338 #: opensuse-tumbleweed
339 msgid ""
340 "If I<path> is a nonempty string containing a relative pathname and I<dirfd> "
341 "is a file descriptor referring to a directory, then I<path> is interpreted "
342 "relative to the directory referred to by I<dirfd>, and a handle is returned "
343 "for the file to which it refers. (See B<openat>(2) for an explanation of "
344 "why \"directory file descriptors\" are useful.)"
345 msgstr ""
346 "إذا كان I<path> سلسلة غير فارغة تحتوي على اسم مسار نسبي وكان I<dirfd> واصف "
347 "ملف يشير إلى دليل، فيُفسر I<path> بالنسبة إلى الدليل المشار إليه بواسطة "
348 "I<dirfd>، ويُعاد مقبض للملف الذي يشير إليه. (انظر B<openat>(2) لشرح سبب فائدة "
349 "\"واصفات ملفات الدليل\".)"
350
351 #. type: Plain text
352 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
353 #: opensuse-tumbleweed
354 msgid ""
355 "If I<path> is an empty string and I<flags> specifies the value "
356 "B<AT_EMPTY_PATH>, then I<dirfd> can be an open file descriptor referring to "
357 "any type of file, or B<AT_FDCWD>, meaning the current working directory, and "
358 "a handle is returned for the file to which it refers."
359 msgstr ""
360 "إذا كان I<path> سلسلة فارغة وحدد I<flags> القيمة B<AT_EMPTY_PATH>، فيمكن أن "
361 "يكون I<dirfd> واصف ملف مفتوح يشير إلى أي نوع من الملفات، أو B<AT_FDCWD>، "
362 "بمعنى دليل العمل الحالي، ويُعاد مقبض للملف الذي يشير إليه."
363
364 #. type: Plain text
365 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
366 #: opensuse-tumbleweed
367 msgid ""
368 "The I<mount_id> argument returns an identifier for the filesystem mount that "
369 "corresponds to I<path>. This corresponds to the first field in one of the "
370 "records in I</proc/self/mountinfo>. Opening the pathname in the fifth field "
371 "of that record yields a file descriptor for the mount point; that file "
372 "descriptor can be used in a subsequent call to B<open_by_handle_at>(). "
373 "I<mount_id> is returned both for a successful call and for a call that "
374 "results in the error B<EOVERFLOW>."
375 msgstr ""
376 "يُعيد وسيط I<mount_id> معرفًا لوصل نظام الملفات الذي يتوافق مع I<path>. يتوافق "
377 "هذا مع الحقل الأول في أحد السجلات في I</proc/self/mountinfo>. ويؤدي فتح اسم "
378 "المسار في الحقل الخامس من ذلك السجل إلى الحصول على واصف ملف لنقطة الوصل؛ "
379 "يمكن استخدام واصف الملف هذا في استدعاء لاحق لـ B<open_by_handle_at>(). يُعاد "
380 "I<mount_id> في حال نجاح الاستدعاء وأيضًا في حال الاستدعاء الذي ينتج عنه الخطأ "
381 "B<EOVERFLOW>."
382
383 #. type: Plain text
384 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
385 #: opensuse-tumbleweed
386 msgid ""
387 "By default, B<name_to_handle_at>() does not dereference I<path> if it is a "
388 "symbolic link, and thus returns a handle for the link itself. If "
389 "B<AT_SYMLINK_FOLLOW> is specified in I<flags>, I<path> is dereferenced if it "
390 "is a symbolic link (so that the call returns a handle for the file referred "
391 "to by the link)."
392 msgstr ""
393 "افتراضيًا، لا يتبع B<name_to_handle_at>() المسار I<path> إذا كان رابطًا رمزيًا، "
394 "وبالتالي يُعيد مقبضًا للرابط نفسه. إذا حُدد B<AT_SYMLINK_FOLLOW> في I<flags>، "
395 "فسيُتبع المسار I<path> إذا كان رابطًا رمزيًا (بحيث يُعيد الاستدعاء مقبضًا للملف "
396 "الذي يشير إليه الرابط)."
397
398 #. commit 20fa19027286983ab2734b5910c4a687436e0c31
399 #. type: Plain text
400 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
401 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
402 msgid ""
403 "B<name_to_handle_at>() does not trigger a mount when the final component of "
404 "the pathname is an automount point. When a filesystem supports both file "
405 "handles and automount points, a B<name_to_handle_at>() call on an automount "
406 "point will return with error B<EOVERFLOW> without having increased "
407 "I<handle_bytes>. This can happen since Linux 4.13 with NFS when accessing a "
408 "directory which is on a separate filesystem on the server. In this case, "
409 "the automount can be triggered by adding a \"/\" to the end of the pathname."
410 msgstr ""
411 "لا يطلق B<name_to_handle_at>() عملية وصل عندما يكون المكون الأخير من اسم "
412 "المسار نقطة وصل آلي. عندما يدعم نظام ملفات مقابض الملفات ونقاط الوصل الآلي "
413 "معًا، فإن استدعاء B<name_to_handle_at>() على نقطة وصل آلي سينتهي بالخطأ "
414 "B<EOVERFLOW> دون زيادة I<handle_bytes>. يمكن أن يحدث هذا منذ لينكس 4.13 مع "
415 "NFS عند الوصول إلى دليل موجود على نظام ملفات منفصل على الخادم. في هذه "
416 "الحالة، يمكن إطلاق الوصل الآلي عبر إضافة \"/\" إلى نهاية اسم المسار."
417
418 #. type: SS
419 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
420 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
421 #, no-wrap
422 msgid "open_by_handle_at()"
423 msgstr "open_by_handle_at()"
424
425 #. type: Plain text
426 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
427 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
428 msgid ""
429 "The B<open_by_handle_at>() system call opens the file referred to by "
430 "I<handle>, a file handle returned by a previous call to "
431 "B<name_to_handle_at>()."
432 msgstr ""
433 "يفتح استدعاء النظام B<open_by_handle_at>() الملف المشار إليه بواسطة "
434 "I<handle>، وهو مقبض ملف أُعيد بواسطة استدعاء سابق لـ B<name_to_handle_at>()."
435
436 #. type: Plain text
437 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
438 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
439 msgid ""
440 "The I<mount_fd> argument is a file descriptor for any object (file, "
441 "directory, etc.) in the mounted filesystem with respect to which I<handle> "
442 "should be interpreted. The special value B<AT_FDCWD> can be specified, "
443 "meaning the current working directory of the caller."
444 msgstr ""
445 "وسيط I<mount_fd> هو واصف ملف لأي كائن (ملف، دليل، إلخ) في نظام الملفات "
446 "الموصول والذي يجب تفسير I<handle> بالنسبة إليه. يمكن تحديد القيمة الخاصة "
447 "B<AT_FDCWD>، وتعني دليل العمل الحالي للمستدعِي."
448
449 #. type: Plain text
450 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
451 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
452 msgid ""
453 "The I<flags> argument is as for B<open>(2). If I<handle> refers to a "
454 "symbolic link, the caller must specify the B<O_PATH> flag, and the symbolic "
455 "link is not dereferenced; the B<O_NOFOLLOW> flag, if specified, is ignored."
456 msgstr ""
457 "وسيط I<flags> مماثل لوسيط B<open>(2). إذا كان I<handle> يشير إلى رابط رمزي، "
458 "فيجب على المستدعِي تحديد علم B<O_PATH>، ولا يُتبع الرابط الرمزي؛ ويُتجاهل علم "
459 "B<O_NOFOLLOW> إذا حُدد."
460
461 #. type: Plain text
462 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
463 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
464 msgid ""
465 "The caller must have the B<CAP_DAC_READ_SEARCH> capability to invoke "
466 "B<open_by_handle_at>()."
467 msgstr ""
468 "يجب أن يمتلك المستدعِي قدرة B<CAP_DAC_READ_SEARCH> لاستدعاء "
469 "B<open_by_handle_at>()."
470
471 #. type: SH
472 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
473 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
474 #, no-wrap
475 msgid "RETURN VALUE"
476 msgstr "قيمة الإرجاع"
477
478 #. type: Plain text
479 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
480 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
481 msgid ""
482 "On success, B<name_to_handle_at>() returns 0, and B<open_by_handle_at>() "
483 "returns a file descriptor (a nonnegative integer)."
484 msgstr ""
485 "عند النجاح، يُعيد B<name_to_handle_at>() القيمة 0، ويُعيد "
486 "B<open_by_handle_at>() واصف ملف (عدد صحيح غير سالب)."
487
488 #. type: Plain text
489 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
490 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
491 msgid ""
492 "In the event of an error, both system calls return -1 and set I<errno> to "
493 "indicate the error."
494 msgstr ""
495 "في حال حدوث خطأ، يُعيد كلا الاستدعاءين -1 وتُضبط قيمة I<errno> للإشارة إلى "
496 "الخطأ."
497
498 #. type: SH
499 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
500 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
501 #, no-wrap
502 msgid "ERRORS"
503 msgstr "الأخطاء"
504
505 #. type: Plain text
506 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
507 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
508 msgid ""
509 "B<name_to_handle_at>() and B<open_by_handle_at>() can fail for the same "
510 "errors as B<openat>(2). In addition, they can fail with the errors noted "
511 "below."
512 msgstr ""
513 "يمكن أن يفشل B<name_to_handle_at>() و B<open_by_handle_at>() لنفس أخطاء "
514 "B<openat>(2). وبالإضافة إلى ذلك، يمكن أن يفشلا بالأخطاء المذكورة أدناه."
515
516 #. type: Plain text
517 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
518 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
519 msgid "B<name_to_handle_at>() can fail with the following errors:"
520 msgstr "يمكن أن يفشل B<name_to_handle_at>() بالأخطاء التالية:"
521
522 #. type: TP
523 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
524 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
525 #, no-wrap
526 msgid "B<EFAULT>"
527 msgstr "B<EFAULT>"
528
529 #. type: Plain text
530 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
531 #: opensuse-tumbleweed
532 msgid ""
533 "I<path>, I<mount_id>, or I<handle> points outside your accessible address "
534 "space."
535 msgstr ""
536 "يشير I<path> أو I<mount_id> أو I<handle> إلى خارج مساحة العنوان القابلة "
537 "للوصول."
538
539 #. type: TP
540 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
541 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
542 #, no-wrap
543 msgid "B<EINVAL>"
544 msgstr "B<EINVAL>"
545
546 #. type: Plain text
547 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
548 #: opensuse-tumbleweed
549 msgid "I<flags> includes an invalid bit value or an invalid bit combination."
550 msgstr "يتضمن I<flags> قيمة بت غير صالحة أو تركيبة بتات غير صالحة."
551
552 #. type: Plain text
553 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
554 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
555 msgid "I<handle-E<gt>handle_bytes> is greater than B<MAX_HANDLE_SZ>."
556 msgstr "قيمة I<handle-E<gt>handle_bytes> أكبر من B<MAX_HANDLE_SZ>."
557
558 #. type: TP
559 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
560 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
561 #, no-wrap
562 msgid "B<ENOENT>"
563 msgstr "B<ENOENT>"
564
565 #. type: Plain text
566 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
567 #: opensuse-tumbleweed
568 msgid ""
569 "I<path> is an empty string, but B<AT_EMPTY_PATH> was not specified in "
570 "I<flags>."
571 msgstr "المسار I<path> سلسلة فارغة، ولكن لم يُحدد B<AT_EMPTY_PATH> في I<flags>."
572
573 #. type: TP
574 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
575 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
576 #, no-wrap
577 msgid "B<ENOTDIR>"
578 msgstr "B<ENOTDIR>"
579
580 #. type: Plain text
581 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
582 #: opensuse-tumbleweed
583 msgid ""
584 "The file descriptor supplied in I<dirfd> does not refer to a directory, and "
585 "it is not the case that both I<flags> includes B<AT_EMPTY_PATH> and I<path> "
586 "is an empty string."
587 msgstr ""
588 "واصف الملف المقدم في I<dirfd> لا يشير إلى دليل، وليست هذه هي الحالة التي "
589 "يتضمن فيها I<flags> العلم B<AT_EMPTY_PATH> ويكون I<path> سلسلة فارغة."
590
591 #. type: TP
592 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
593 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
594 #, no-wrap
595 msgid "B<EOPNOTSUPP>"
596 msgstr "B<EOPNOTSUPP>"
597
598 #. type: Plain text
599 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
600 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
601 msgid ""
602 "The filesystem does not support decoding of a pathname to a file handle."
603 msgstr "نظام الملفات لا يدعم فك ترميز اسم مسار إلى مقبض ملف."
604
605 #. type: TP
606 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
607 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
608 #, no-wrap
609 msgid "B<EOVERFLOW>"
610 msgstr "B<EOVERFLOW>"
611
612 #. type: Plain text
613 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
614 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
615 msgid ""
616 "The I<handle-E<gt>handle_bytes> value passed into the call was too small. "
617 "When this error occurs, I<handle-E<gt>handle_bytes> is updated to indicate "
618 "the required size for the handle."
619 msgstr ""
620 "قيمة I<handle-E<gt>handle_bytes> الممررة في الاستدعاء كانت صغيرة جدًا. عند "
621 "حدوث هذا الخطأ، تُحدث قيمة I<handle-E<gt>handle_bytes> للإشارة إلى الحجم "
622 "المطلوب للمقبض."
623
624 #. type: Plain text
625 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
626 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
627 msgid "B<open_by_handle_at>() can fail with the following errors:"
628 msgstr "يمكن أن يفشل B<open_by_handle_at>() بالأخطاء التالية:"
629
630 #. type: TP
631 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
632 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
633 #, no-wrap
634 msgid "B<EBADF>"
635 msgstr "B<EBADF>"
636
637 #. type: Plain text
638 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
639 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
640 msgid "I<mount_fd> is not an open file descriptor."
641 msgstr "I<mount_fd> ليس واصف ملف مفتوح."
642
643 #. type: Plain text
644 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
645 #: opensuse-tumbleweed
646 msgid ""
647 "I<path> is relative but I<dirfd> is neither B<AT_FDCWD> nor a valid file "
648 "descriptor."
649 msgstr "المسار I<path> نسبي ولكن I<dirfd> ليس B<AT_FDCWD> ولا واصف ملف صالح."
650
651 #. type: Plain text
652 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
653 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
654 msgid "I<handle> points outside your accessible address space."
655 msgstr "يشير I<handle> إلى خارج مساحة العنوان القابل للوصول."
656
657 #. type: Plain text
658 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
659 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
660 msgid ""
661 "I<handle-E<gt>handle_bytes> is greater than B<MAX_HANDLE_SZ> or is equal to "
662 "zero."
663 msgstr ""
664 "قيمة I<handle-E<gt>handle_bytes> أكبر من B<MAX_HANDLE_SZ> أو تساوي الصفر."
665
666 #. type: TP
667 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
668 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
669 #, no-wrap
670 msgid "B<ELOOP>"
671 msgstr "B<ELOOP>"
672
673 #. type: Plain text
674 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
675 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
676 msgid ""
677 "I<handle> refers to a symbolic link, but B<O_PATH> was not specified in "
678 "I<flags>."
679 msgstr "يشير I<handle> إلى رابط رمزي، ولكن لم يُحدد B<O_PATH> في I<flags>."
680
681 #. type: TP
682 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
683 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
684 #, no-wrap
685 msgid "B<EPERM>"
686 msgstr "B<EPERM>"
687
688 #. type: Plain text
689 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
690 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
691 msgid "The caller does not have the B<CAP_DAC_READ_SEARCH> capability."
692 msgstr "المستدعِي لا يملك قدرة B<CAP_DAC_READ_SEARCH>."
693
694 #. type: TP
695 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
696 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
697 #, no-wrap
698 msgid "B<ESTALE>"
699 msgstr "B<ESTALE>"
700
701 #. type: Plain text
702 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
703 #: opensuse-tumbleweed
704 msgid ""
705 "The specified I<handle> is not valid for opening a file. This error will "
706 "occur if, for example, the file has been deleted. This error can also occur "
707 "if the I<handle> was acquired using the B<AT_HANDLE_FID> flag and the "
708 "filesystem does not support B<open_by_handle_at>(). This error can also "
709 "occur if the I<handle> was acquired using the B<AT_HANDLE_CONNECTABLE> flag "
710 "and the file was moved to a different parent."
711 msgstr ""
712 "قيمة I<handle> المحددة غير صالحة لفتح ملف. يحدث هذا الخطأ إذا حُذف الملف "
713 "مثلًا. ويمكن أن يحدث هذا الخطأ أيضًا إذا تم الحصول على I<handle> باستخدام علم "
714 "B<AT_HANDLE_FID> ونظام الملفات لا يدعم B<open_by_handle_at>(). كما يمكن أن "
715 "يحدث هذا الخطأ إذا تم الحصول على I<handle> باستخدام علم "
716 "B<AT_HANDLE_CONNECTABLE> ونُقل الملف إلى أصل مختلف."
717
718 #. type: SH
719 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
720 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
721 #, no-wrap
722 msgid "VERSIONS"
723 msgstr "الإصدارات"
724
725 #. type: Plain text
726 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
727 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
728 msgid ""
729 "FreeBSD has a broadly similar pair of system calls in the form of "
730 "B<getfh>() and B<fhopen>()."
731 msgstr ""
732 "يحتوي FreeBSD على زوج مشابه إلى حد كبير من استدعاءات النظام في شكل "
733 "B<getfh>() و B<fhopen>()."
734
735 #. type: SH
736 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
737 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
738 #, no-wrap
739 msgid "STANDARDS"
740 msgstr "المعايير"
741
742 #. type: Plain text
743 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
744 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
745 msgid "Linux."
746 msgstr "لينكس."
747
748 #. type: SH
749 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
750 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
751 #, no-wrap
752 msgid "HISTORY"
753 msgstr "التاريخ"
754
755 #. type: Plain text
756 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
757 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
758 msgid "Linux 2.6.39, glibc 2.14."
759 msgstr "لينكس 2.6.39، glibc 2.14."
760
761 #. type: SH
762 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
763 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
764 #, no-wrap
765 msgid "NOTES"
766 msgstr "ملاحظات"
767
768 #. type: Plain text
769 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
770 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
771 msgid ""
772 "A file handle can be generated in one process using B<name_to_handle_at>() "
773 "and later used in a different process that calls B<open_by_handle_at>()."
774 msgstr ""
775 "يمكن إنشاء مقبض ملف في عملية واحدة باستخدام B<name_to_handle_at>() "
776 "واستخدامه لاحقًا في عملية مختلفة تستدعي B<open_by_handle_at>()."
777
778 #. type: Plain text
779 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
780 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
781 msgid ""
782 "Some filesystem don't support the translation of pathnames to file handles, "
783 "for example, I</proc>, I</sys>, and various network filesystems. Some "
784 "filesystems support the translation of pathnames to file handles, but do not "
785 "support using those file handles in B<open_by_handle_at>()."
786 msgstr ""
787 "بعض أنظمة الملفات لا تدعم ترجمة أسماء المسارات إلى مقابض ملفات، على سبيل "
788 "المثال، I</proc> و I</sys> وأنظمة ملفات شبكية متنوعة. بعض أنظمة الملفات تدعم "
789 "ترجمة أسماء المسارات إلى مقابض ملفات، لكنها لا تدعم استخدام مقابض الملفات "
790 "تلك في B<open_by_handle_at>()."
791
792 #. type: Plain text
793 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
794 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
795 msgid ""
796 "A file handle may become invalid (\"stale\") if a file is deleted, or for "
797 "other filesystem-specific reasons. Invalid handles are notified by an "
798 "B<ESTALE> error from B<open_by_handle_at>()."
799 msgstr ""
800 "قد يصبح مقبض الملف غير صالح (\"قديم\") إذا تم حذف ملف، أو لأسباب أخرى خاصة "
801 "بنظام الملفات. يتم الإبلاغ عن المقابض غير الصالحة بواسطة خطأ B<ESTALE> من "
802 "B<open_by_handle_at>()."
803
804 #. https://lwn.net/Articles/375888/
805 #. "Open by handle" - Jonathan Corbet, 2010-02-23
806 #. type: Plain text
807 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
808 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
809 msgid ""
810 "These system calls are designed for use by user-space file servers. For "
811 "example, a user-space NFS server might generate a file handle and pass it to "
812 "an NFS client. Later, when the client wants to open the file, it could pass "
813 "the handle back to the server. This sort of functionality allows a user-"
814 "space file server to operate in a stateless fashion with respect to the "
815 "files it serves."
816 msgstr ""
817 "صُممت استدعاءات النظام هذه لاستخدامها من قبل خوادم الملفات في مساحة المستخدم. "
818 "على سبيل المثال، قد يُنشئ خادم NFS في مساحة المستخدم مقبض ملف ويمرره إلى عميل "
819 "NFS. لاحقًا، عندما يريد العميل فتح الملف، يمكنه تمرير المقبض مرة أخرى إلى "
820 "الخادم. هذا النوع من الوظائف يسمح لخادم الملفات في مساحة المستخدم بالعمل "
821 "بطريقة عديمة الحالة فيما يتعلق بالملفات التي يخدمها."
822
823 #. commit bcda76524cd1fa32af748536f27f674a13e56700
824 #. type: Plain text
825 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
826 #: opensuse-tumbleweed
827 msgid ""
828 "If I<path> refers to a symbolic link and I<flags> does not specify "
829 "B<AT_SYMLINK_FOLLOW>, then B<name_to_handle_at>() returns a handle for the "
830 "link (rather than the file to which it refers). The process receiving the "
831 "handle can later perform operations on the symbolic link by converting the "
832 "handle to a file descriptor using B<open_by_handle_at>() with the B<O_PATH> "
833 "flag, and then passing the file descriptor as the I<dirfd> argument in "
834 "system calls such as B<readlinkat>(2) and B<fchownat>(2)."
835 msgstr ""
836 "إذا كان I<path> يشير إلى رابط رمزي و I<flags> لا يحدد B<AT_SYMLINK_FOLLOW>، "
837 "فإن B<name_to_handle_at>() تُرجع مقبضًا للرابط (بدلاً من الملف الذي يشير "
838 "إليه). يمكن للعملية التي تستلم المقبض لاحقًا تنفيذ عمليات على الرابط الرمزي "
839 "عن طريق تحويل المقبض إلى واصف ملف باستخدام B<open_by_handle_at>() مع العلم "
840 "B<O_PATH>، ثم تمرير واصف الملف كوسيطة I<dirfd> في استدعاءات النظام مثل "
841 "B<readlinkat>(2) و B<fchownat>(2)."
842
843 #. type: SS
844 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
845 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
846 #, no-wrap
847 msgid "Obtaining a persistent filesystem ID"
848 msgstr "الحصول على معرف نظام ملفات دائم"
849
850 #. type: Plain text
851 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
852 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
853 msgid ""
854 "The mount IDs in I</proc/self/mountinfo> can be reused as filesystems are "
855 "unmounted and mounted. Therefore, the mount ID returned by "
856 "B<name_to_handle_at>() (in I<*mount_id>) should not be treated as a "
857 "persistent identifier for the corresponding mounted filesystem. However, an "
858 "application can use the information in the I<mountinfo> record that "
859 "corresponds to the mount ID to derive a persistent identifier."
860 msgstr ""
861 "يمكن إعادة استخدام معرفات التوصيل في I</proc/self/mountinfo> عند فصل وتوصيل "
862 "أنظمة الملفات. لذلك، لا ينبغي التعامل مع معرف التوصيل الذي تُرجعه "
863 "B<name_to_handle_at>() (في I<*mount_id>) كمعرف دائم لنظام الملفات المُوصَّل "
864 "المقابل. ومع ذلك، يمكن للتطبيق استخدام المعلومات في سجل I<mountinfo> الذي "
865 "يتوافق مع معرف التوصيل لاستخلاص معرف دائم."
866
867 #. e.g., http://stackoverflow.com/questions/6748429/using-libblkid-to-find-uuid-of-a-partition
868 #. type: Plain text
869 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
870 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
871 msgid ""
872 "For example, one can use the device name in the fifth field of the "
873 "I<mountinfo> record to search for the corresponding device UUID via the "
874 "symbolic links in I</dev/disks/by-uuid>. (A more comfortable way of "
875 "obtaining the UUID is to use the B<libblkid>(3) library.) That process can "
876 "then be reversed, using the UUID to look up the device name, and then "
877 "obtaining the corresponding mount point, in order to produce the I<mount_fd> "
878 "argument used by B<open_by_handle_at>()."
879 msgstr ""
880 "على سبيل المثال، يمكن استخدام اسم الجهاز في الحقل الخامس من سجل I<mountinfo> "
881 "للبحث عن UUID الجهاز المقابل عبر الروابط الرمزية في I</dev/disks/by-uuid>. "
882 "(طريقة أكثر راحة للحصول على UUID هي استخدام مكتبة B<libblkid>(3).) يمكن بعد "
883 "ذلك عكس تلك العملية، باستخدام UUID للبحث عن اسم الجهاز، ثم الحصول على نقطة "
884 "التوصيل المقابلة، لإنتاج وسيطة I<mount_fd> التي تستخدمها "
885 "B<open_by_handle_at>()."
886
887 #. type: SH
888 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
889 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
890 #, no-wrap
891 msgid "EXAMPLES"
892 msgstr "أمثلة"
893
894 #. type: Plain text
895 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
896 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
897 msgid ""
898 "The two programs below demonstrate the use of B<name_to_handle_at>() and "
899 "B<open_by_handle_at>(). The first program (I<t_name_to_handle_at.c>) uses "
900 "B<name_to_handle_at>() to obtain the file handle and mount ID for the file "
901 "specified in its command-line argument; the handle and mount ID are written "
902 "to standard output."
903 msgstr ""
904 "يوضح البرنامجان أدناه استخدام B<name_to_handle_at>() و "
905 "B<open_by_handle_at>(). يستخدم البرنامج الأول (I<t_name_to_handle_at.c>) "
906 "B<name_to_handle_at>() للحصول على مقبض ملف ومعرف وصل للملف المحدد في وسيط "
907 "سطر الأوامر؛ ويُكتب المقبض ومعرف الوصل إلى المخرج القياسي."
908
909 #. type: Plain text
910 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
911 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
912 msgid ""
913 "The second program (I<t_open_by_handle_at.c>) reads a mount ID and file "
914 "handle from standard input. The program then employs "
915 "B<open_by_handle_at>() to open the file using that handle. If an optional "
916 "command-line argument is supplied, then the I<mount_fd> argument for "
917 "B<open_by_handle_at>() is obtained by opening the directory named in that "
918 "argument. Otherwise, I<mount_fd> is obtained by scanning I</proc/self/"
919 "mountinfo> to find a record whose mount ID matches the mount ID read from "
920 "standard input, and the mount directory specified in that record is opened. "
921 "(These programs do not deal with the fact that mount IDs are not persistent.)"
922 msgstr ""
923 "يقرأ البرنامج الثاني (I<t_open_by_handle_at.c>) معرف توصيل ومقبض ملف من "
924 "الإدخال القياسي. ثم يستخدم البرنامج B<open_by_handle_at>() لفتح الملف "
925 "باستخدام ذلك المقبض. إذا تم توفير وسيطة اختيارية في سطر الأوامر، فسيتم "
926 "الحصول على وسيطة I<mount_fd> لـ B<open_by_handle_at>() عن طريق فتح الدليل "
927 "المسمى في تلك الوسيطة. بخلاف ذلك، يتم الحصول على I<mount_fd> عن طريق مسح I</"
928 "proc/self/mountinfo> للعثور على سجل يتطابق معرف التوصيل فيه مع معرف التوصيل "
929 "المقروء من الإدخال القياسي، ويتم فتح دليل التوصيل المحدد في ذلك السجل. (لا "
930 "تتعامل هذه البرامج مع حقيقة أن معرفات التوصيل ليست دائمة.)"
931
932 #. type: Plain text
933 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
934 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
935 msgid "The following shell session demonstrates the use of these two programs:"
936 msgstr "توضح جلسة الصدفة التالية استخدام هذين البرنامجين:"
937
938 #. type: Plain text
939 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
940 #: opensuse-tumbleweed
941 #, no-wrap
942 msgid ""
943 "$B< echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>;\n"
944 "$B< ./t_name_to_handle_at cecilia.txt E<gt> fh>;\n"
945 "$B< ./t_open_by_handle_at E<lt> fh>;\n"
946 "open_by_handle_at: Operation not permitted\n"
947 "$B< sudo ./t_open_by_handle_at E<lt> fh>; # Need CAP_SYS_ADMIN\n"
948 "Read 31 bytes\n"
949 "$B< rm cecilia.txt>;\n"
950 msgstr ""
951 "$B< echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>;\n"
952 "$B< ./t_name_to_handle_at cecilia.txt E<gt> fh>;\n"
953 "$B< ./t_open_by_handle_at E<lt> fh>;\n"
954 "open_by_handle_at: Operation not permitted\n"
955 "$B< sudo ./t_open_by_handle_at E<lt> fh>; # Need CAP_SYS_ADMIN\n"
956 "Read 31 bytes\n"
957 "$B< rm cecilia.txt>;\n"
958
959 #. Christoph Hellwig: That's why the file handles contain a generation
960 #. counter that gets incremented in this case.
961 #. type: Plain text
962 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
963 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
964 msgid ""
965 "Now we delete and (quickly) re-create the file so that it has the same "
966 "content and (by chance) the same inode. Nevertheless, "
967 "B<open_by_handle_at>() recognizes that the original file referred to by the "
968 "file handle no longer exists."
969 msgstr ""
970 "الآن نحذف الملف ونعيد إنشاءه (بسرعة) بحيث يكون له نفس المحتوى و (بالصدفة) "
971 "نفس العقدة. ومع ذلك، تتعرف B<open_by_handle_at>() على أن الملف الأصلي "
972 "المشار إليه بواسطة مقبض الملف لم يعد موجودًا."
973
974 #. type: Plain text
975 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
976 #: opensuse-tumbleweed
977 #, no-wrap
978 msgid ""
979 "$B< stat --printf=\\[dq]%i\\[rs]n\\[dq] cecilia.txt>; # Display inode number\n"
980 "4072121\n"
981 "$B< rm cecilia.txt>;\n"
982 "$B< echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>;\n"
983 "$B< stat --printf=\\[dq]%i\\[rs]n\\[dq] cecilia.txt>; # Check inode number\n"
984 "4072121\n"
985 "$B< sudo ./t_open_by_handle_at E<lt> fh>;\n"
986 "open_by_handle_at: Stale NFS file handle\n"
987 msgstr ""
988 "$B< stat --printf=\\[dq]%i\\[rs]n\\[dq] cecilia.txt>; # Display inode number\n"
989 "4072121\n"
990 "$B< rm cecilia.txt>;\n"
991 "$B< echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>;\n"
992 "$B< stat --printf=\\[dq]%i\\[rs]n\\[dq] cecilia.txt>; # Check inode number\n"
993 "4072121\n"
994 "$B< sudo ./t_open_by_handle_at E<lt> fh>;\n"
995 "open_by_handle_at: Stale NFS file handle\n"
996
997 #. type: SS
998 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
999 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1000 #, no-wrap
1001 msgid "Program source: t_name_to_handle_at.c"
1002 msgstr "مصدر البرنامج: t_name_to_handle_at.c"
1003
1004 #. type: Plain text
1005 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1006 #: opensuse-tumbleweed
1007 #, no-wrap
1008 msgid ""
1009 "#define _GNU_SOURCE\n"
1010 "#include E<lt>err.hE<gt>\n"
1011 "#include E<lt>errno.hE<gt>\n"
1012 "#include E<lt>fcntl.hE<gt>\n"
1013 "#include E<lt>stdio.hE<gt>\n"
1014 "#include E<lt>stdlib.hE<gt>\n"
1015 "\\&\n"
1016 "int\n"
1017 "main(int argc, char *argv[])\n"
1018 "{\n"
1019 " int mount_id, fhsize, flags, dirfd;\n"
1020 " char *path;\n"
1021 " struct file_handle *fhp;\n"
1022 "\\&\n"
1023 " if (argc != 2) {\n"
1024 " fprintf(stderr, \"Usage: %s path\\[rs]n\", argv[0]);\n"
1025 " exit(EXIT_FAILURE);\n"
1026 " }\n"
1027 "\\&\n"
1028 " path = argv[1];\n"
1029 "\\&\n"
1030 " /* Allocate file_handle structure. */\n"
1031 "\\&\n"
1032 " fhsize = sizeof(*fhp);\n"
1033 " fhp = malloc(fhsize);\n"
1034 " if (fhp == NULL)\n"
1035 " err(EXIT_FAILURE, \"malloc\");\n"
1036 "\\&\n"
1037 " /* Make an initial call to name_to_handle_at() to discover\n"
1038 " the size required for file handle. */\n"
1039 "\\&\n"
1040 " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n"
1041 " flags = 0; /* For name_to_handle_at() calls */\n"
1042 " fhp-E<gt>handle_bytes = 0;\n"
1043 " if (name_to_handle_at(dirfd, path, fhp, &mount_id, flags) != -1\n"
1044 " || errno != EOVERFLOW)\n"
1045 " {\n"
1046 " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\[rs]n\");\n"
1047 " exit(EXIT_FAILURE);\n"
1048 " }\n"
1049 "\\&\n"
1050 " /* Reallocate file_handle structure with correct size. */\n"
1051 "\\&\n"
1052 " fhsize = sizeof(*fhp) + fhp-E<gt>handle_bytes;\n"
1053 " fhp = realloc(fhp, fhsize); /* Copies fhp-E<gt>handle_bytes */\n"
1054 " if (fhp == NULL)\n"
1055 " err(EXIT_FAILURE, \"realloc\");\n"
1056 "\\&\n"
1057 " /* Get file handle from pathname supplied on command line. */\n"
1058 "\\&\n"
1059 " if (name_to_handle_at(dirfd, path, fhp, &mount_id, flags) == -1)\n"
1060 " err(EXIT_FAILURE, \"name_to_handle_at\");\n"
1061 "\\&\n"
1062 " /* Write mount ID, file handle size, and file handle to stdout,\n"
1063 " for later reuse by t_open_by_handle_at.c. */\n"
1064 "\\&\n"
1065 " printf(\"%d\\[rs]n\", mount_id);\n"
1066 " printf(\"%u %d \", fhp-E<gt>handle_bytes, fhp-E<gt>handle_type);\n"
1067 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1068 " printf(\" %02x\", fhp-E<gt>f_handle[j]);\n"
1069 " printf(\"\\[rs]n\");\n"
1070 "\\&\n"
1071 " exit(EXIT_SUCCESS);\n"
1072 "}\n"
1073 msgstr ""
1074 "#define _GNU_SOURCE\n"
1075 "#include E<lt>err.hE<gt>\n"
1076 "#include E<lt>errno.hE<gt>\n"
1077 "#include E<lt>fcntl.hE<gt>\n"
1078 "#include E<lt>stdio.hE<gt>\n"
1079 "#include E<lt>stdlib.hE<gt>\n"
1080 "\\&\n"
1081 "int\n"
1082 "main(int argc, char *argv[])\n"
1083 "{\n"
1084 " int mount_id, fhsize, flags, dirfd;\n"
1085 " char *path;\n"
1086 " struct file_handle *fhp;\n"
1087 "\\&\n"
1088 " if (argc != 2) {\n"
1089 " fprintf(stderr, \"Usage: %s path\\[rs]n\", argv[0]);\n"
1090 " exit(EXIT_FAILURE);\n"
1091 " }\n"
1092 "\\&\n"
1093 " path = argv[1];\n"
1094 "\\&\n"
1095 " /* Allocate file_handle structure. */\n"
1096 "\\&\n"
1097 " fhsize = sizeof(*fhp);\n"
1098 " fhp = malloc(fhsize);\n"
1099 " if (fhp == NULL)\n"
1100 " err(EXIT_FAILURE, \"malloc\");\n"
1101 "\\&\n"
1102 " /* Make an initial call to name_to_handle_at() to discover\n"
1103 " the size required for file handle. */\n"
1104 "\\&\n"
1105 " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n"
1106 " flags = 0; /* For name_to_handle_at() calls */\n"
1107 " fhp-E<gt>handle_bytes = 0;\n"
1108 " if (name_to_handle_at(dirfd, path, fhp, &mount_id, flags) != -1\n"
1109 " || errno != EOVERFLOW)\n"
1110 " {\n"
1111 " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\[rs]n\");\n"
1112 " exit(EXIT_FAILURE);\n"
1113 " }\n"
1114 "\\&\n"
1115 " /* Reallocate file_handle structure with correct size. */\n"
1116 "\\&\n"
1117 " fhsize = sizeof(*fhp) + fhp-E<gt>handle_bytes;\n"
1118 " fhp = realloc(fhp, fhsize); /* Copies fhp-E<gt>handle_bytes */\n"
1119 " if (fhp == NULL)\n"
1120 " err(EXIT_FAILURE, \"realloc\");\n"
1121 "\\&\n"
1122 " /* Get file handle from pathname supplied on command line. */\n"
1123 "\\&\n"
1124 " if (name_to_handle_at(dirfd, path, fhp, &mount_id, flags) == -1)\n"
1125 " err(EXIT_FAILURE, \"name_to_handle_at\");\n"
1126 "\\&\n"
1127 " /* Write mount ID, file handle size, and file handle to stdout,\n"
1128 " for later reuse by t_open_by_handle_at.c. */\n"
1129 "\\&\n"
1130 " printf(\"%d\\[rs]n\", mount_id);\n"
1131 " printf(\"%u %d \", fhp-E<gt>handle_bytes, fhp-E<gt>handle_type);\n"
1132 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1133 " printf(\" %02x\", fhp-E<gt>f_handle[j]);\n"
1134 " printf(\"\\[rs]n\");\n"
1135 "\\&\n"
1136 " exit(EXIT_SUCCESS);\n"
1137 "}\n"
1138
1139 #. SRC END
1140 #. type: SS
1141 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1142 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1143 #, no-wrap
1144 msgid "Program source: t_open_by_handle_at.c"
1145 msgstr "مصدر البرنامج: t_open_by_handle_at.c"
1146
1147 #. type: Plain text
1148 #: archlinux debian-unstable opensuse-leap-16-1 opensuse-tumbleweed
1149 #, no-wrap
1150 msgid ""
1151 "#define _GNU_SOURCE\n"
1152 "#include E<lt>err.hE<gt>\n"
1153 "#include E<lt>fcntl.hE<gt>\n"
1154 "#include E<lt>limits.hE<gt>\n"
1155 "#include E<lt>stdio.hE<gt>\n"
1156 "#include E<lt>stdlib.hE<gt>\n"
1157 "#include E<lt>string.hE<gt>\n"
1158 "#include E<lt>sys/types.hE<gt>\n"
1159 "#include E<lt>unistd.hE<gt>\n"
1160 "\\&\n"
1161 "#define streq(...) (strcmp(__VA_ARGS__) == 0)\n"
1162 "\\&\n"
1163 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
1164 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
1165 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
1166 " Open the corresponding mount path and return the resulting file\n"
1167 " descriptor. */\n"
1168 "\\&\n"
1169 "static int\n"
1170 "open_mount_path_by_id(int mount_id)\n"
1171 "{\n"
1172 " int mi_mount_id, found;\n"
1173 " char mount_path[PATH_MAX];\n"
1174 " char *linep;\n"
1175 " FILE *fp;\n"
1176 " size_t lsize;\n"
1177 " ssize_t nread;\n"
1178 "\\&\n"
1179 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
1180 " if (fp == NULL)\n"
1181 " err(EXIT_FAILURE, \"fopen\");\n"
1182 "\\&\n"
1183 " found = 0;\n"
1184 " linep = NULL;\n"
1185 " while (!found) {\n"
1186 " nread = getline(&linep, &lsize, fp);\n"
1187 " if (nread == -1)\n"
1188 " break;\n"
1189 "\\&\n"
1190 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
1191 " &mi_mount_id, mount_path);\n"
1192 " if (nread != 2) {\n"
1193 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
1194 " exit(EXIT_FAILURE);\n"
1195 " }\n"
1196 "\\&\n"
1197 " if (mi_mount_id == mount_id)\n"
1198 " found = 1;\n"
1199 " }\n"
1200 " free(linep);\n"
1201 "\\&\n"
1202 " fclose(fp);\n"
1203 "\\&\n"
1204 " if (!found) {\n"
1205 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
1206 " exit(EXIT_FAILURE);\n"
1207 " }\n"
1208 "\\&\n"
1209 " return open(mount_path, O_RDONLY);\n"
1210 "}\n"
1211 "\\&\n"
1212 "int\n"
1213 "main(int argc, char *argv[])\n"
1214 "{\n"
1215 " int mount_id, fd, mount_fd, handle_bytes;\n"
1216 " char buf[1000];\n"
1217 "#define LINE_SIZE 100\n"
1218 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
1219 " char *nextp;\n"
1220 " ssize_t nread;\n"
1221 " struct file_handle *fhp;\n"
1222 "\\&\n"
1223 " if ((argc E<gt> 1 && streq(argv[1], \"--help\")) || argc E<gt> 2) {\n"
1224 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
1225 " exit(EXIT_FAILURE);\n"
1226 " }\n"
1227 "\\&\n"
1228 " /* Standard input contains mount ID and file handle information:\n"
1229 "\\&\n"
1230 " Line 1: E<lt>mount_idE<gt>\n"
1231 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
1232 " */\n"
1233 "\\&\n"
1234 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
1235 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
1236 " {\n"
1237 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
1238 " exit(EXIT_FAILURE);\n"
1239 " }\n"
1240 "\\&\n"
1241 " mount_id = atoi(line1);\n"
1242 "\\&\n"
1243 " handle_bytes = strtoul(line2, &nextp, 0);\n"
1244 "\\&\n"
1245 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
1246 "\\&\n"
1247 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
1248 " if (fhp == NULL)\n"
1249 " err(EXIT_FAILURE, \"malloc\");\n"
1250 "\\&\n"
1251 " fhp-E<gt>handle_bytes = handle_bytes;\n"
1252 "\\&\n"
1253 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
1254 "\\&\n"
1255 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1256 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
1257 "\\&\n"
1258 " /* Obtain file descriptor for mount point, either by opening\n"
1259 " the pathname specified on the command line, or by scanning\n"
1260 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
1261 " that we received from stdin. */\n"
1262 "\\&\n"
1263 " if (argc E<gt> 1)\n"
1264 " mount_fd = open(argv[1], O_RDONLY);\n"
1265 " else\n"
1266 " mount_fd = open_mount_path_by_id(mount_id);\n"
1267 "\\&\n"
1268 " if (mount_fd == -1)\n"
1269 " err(EXIT_FAILURE, \"opening mount fd\");\n"
1270 "\\&\n"
1271 " /* Open file using handle and mount point. */\n"
1272 "\\&\n"
1273 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
1274 " if (fd == -1)\n"
1275 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
1276 "\\&\n"
1277 " /* Try reading a few bytes from the file. */\n"
1278 "\\&\n"
1279 " nread = read(fd, buf, sizeof(buf));\n"
1280 " if (nread == -1)\n"
1281 " err(EXIT_FAILURE, \"read\");\n"
1282 "\\&\n"
1283 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
1284 "\\&\n"
1285 " exit(EXIT_SUCCESS);\n"
1286 "}\n"
1287 msgstr ""
1288 "#define _GNU_SOURCE\n"
1289 "#include E<lt>err.hE<gt>\n"
1290 "#include E<lt>fcntl.hE<gt>\n"
1291 "#include E<lt>limits.hE<gt>\n"
1292 "#include E<lt>stdio.hE<gt>\n"
1293 "#include E<lt>stdlib.hE<gt>\n"
1294 "#include E<lt>string.hE<gt>\n"
1295 "#include E<lt>sys/types.hE<gt>\n"
1296 "#include E<lt>unistd.hE<gt>\n"
1297 "\\&\n"
1298 "#define streq(...) (strcmp(__VA_ARGS__) == 0)\n"
1299 "\\&\n"
1300 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
1301 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
1302 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
1303 " Open the corresponding mount path and return the resulting file\n"
1304 " descriptor. */\n"
1305 "\\&\n"
1306 "static int\n"
1307 "open_mount_path_by_id(int mount_id)\n"
1308 "{\n"
1309 " int mi_mount_id, found;\n"
1310 " char mount_path[PATH_MAX];\n"
1311 " char *linep;\n"
1312 " FILE *fp;\n"
1313 " size_t lsize;\n"
1314 " ssize_t nread;\n"
1315 "\\&\n"
1316 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
1317 " if (fp == NULL)\n"
1318 " err(EXIT_FAILURE, \"fopen\");\n"
1319 "\\&\n"
1320 " found = 0;\n"
1321 " linep = NULL;\n"
1322 " while (!found) {\n"
1323 " nread = getline(&linep, &lsize, fp);\n"
1324 " if (nread == -1)\n"
1325 " break;\n"
1326 "\\&\n"
1327 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
1328 " &mi_mount_id, mount_path);\n"
1329 " if (nread != 2) {\n"
1330 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
1331 " exit(EXIT_FAILURE);\n"
1332 " }\n"
1333 "\\&\n"
1334 " if (mi_mount_id == mount_id)\n"
1335 " found = 1;\n"
1336 " }\n"
1337 " free(linep);\n"
1338 "\\&\n"
1339 " fclose(fp);\n"
1340 "\\&\n"
1341 " if (!found) {\n"
1342 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
1343 " exit(EXIT_FAILURE);\n"
1344 " }\n"
1345 "\\&\n"
1346 " return open(mount_path, O_RDONLY);\n"
1347 "}\n"
1348 "\\&\n"
1349 "int\n"
1350 "main(int argc, char *argv[])\n"
1351 "{\n"
1352 " int mount_id, fd, mount_fd, handle_bytes;\n"
1353 " char buf[1000];\n"
1354 "#define LINE_SIZE 100\n"
1355 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
1356 " char *nextp;\n"
1357 " ssize_t nread;\n"
1358 " struct file_handle *fhp;\n"
1359 "\\&\n"
1360 " if ((argc E<gt> 1 && streq(argv[1], \"--help\")) || argc E<gt> 2) {\n"
1361 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
1362 " exit(EXIT_FAILURE);\n"
1363 " }\n"
1364 "\\&\n"
1365 " /* Standard input contains mount ID and file handle information:\n"
1366 "\\&\n"
1367 " Line 1: E<lt>mount_idE<gt>\n"
1368 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
1369 " */\n"
1370 "\\&\n"
1371 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
1372 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
1373 " {\n"
1374 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
1375 " exit(EXIT_FAILURE);\n"
1376 " }\n"
1377 "\\&\n"
1378 " mount_id = atoi(line1);\n"
1379 "\\&\n"
1380 " handle_bytes = strtoul(line2, &nextp, 0);\n"
1381 "\\&\n"
1382 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
1383 "\\&\n"
1384 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
1385 " if (fhp == NULL)\n"
1386 " err(EXIT_FAILURE, \"malloc\");\n"
1387 "\\&\n"
1388 " fhp-E<gt>handle_bytes = handle_bytes;\n"
1389 "\\&\n"
1390 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
1391 "\\&\n"
1392 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1393 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
1394 "\\&\n"
1395 " /* Obtain file descriptor for mount point, either by opening\n"
1396 " the pathname specified on the command line, or by scanning\n"
1397 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
1398 " that we received from stdin. */\n"
1399 "\\&\n"
1400 " if (argc E<gt> 1)\n"
1401 " mount_fd = open(argv[1], O_RDONLY);\n"
1402 " else\n"
1403 " mount_fd = open_mount_path_by_id(mount_id);\n"
1404 "\\&\n"
1405 " if (mount_fd == -1)\n"
1406 " err(EXIT_FAILURE, \"opening mount fd\");\n"
1407 "\\&\n"
1408 " /* Open file using handle and mount point. */\n"
1409 "\\&\n"
1410 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
1411 " if (fd == -1)\n"
1412 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
1413 "\\&\n"
1414 " /* Try reading a few bytes from the file. */\n"
1415 "\\&\n"
1416 " nread = read(fd, buf, sizeof(buf));\n"
1417 " if (nread == -1)\n"
1418 " err(EXIT_FAILURE, \"read\");\n"
1419 "\\&\n"
1420 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
1421 "\\&\n"
1422 " exit(EXIT_SUCCESS);\n"
1423 "}\n"
1424
1425 #. SRC END
1426 #. type: SH
1427 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1428 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1429 #, no-wrap
1430 msgid "SEE ALSO"
1431 msgstr "انظر أيضًا"
1432
1433 #. type: Plain text
1434 #: archlinux debian-trixie debian-unstable fedora-44 fedora-rawhide
1435 #: mageia-cauldron opensuse-leap-16-1 opensuse-tumbleweed
1436 msgid "B<open>(2), B<libblkid>(3), B<blkid>(8), B<findfs>(8), B<mount>(8)"
1437 msgstr "B<open>(2)،‏ B<libblkid>(3)،‏ B<blkid>(8)،‏ B<findfs>(8)،‏ B<mount>(8)"
1438
1439 #. type: Plain text
1440 #: archlinux debian-unstable mageia-cauldron opensuse-leap-16-1
1441 #: opensuse-tumbleweed
1442 msgid ""
1443 "The I<libblkid> and I<libmount> documentation in the latest I<util-linux> "
1444 "release at E<.UR https:\\://www.kernel.org/pub/linux/utils/util-linux/> E<."
1445 "UE>"
1446 msgstr ""
1447 "وثائق I<libblkid> و I<libmount> في أحدث إصدار من I<util-linux> على E<.UR "
1448 "https:\\://www.kernel.org/pub/linux/utils/util-linux/> E<.UE>"
1449
1450 #. type: TH
1451 #: debian-trixie
1452 #, no-wrap
1453 msgid "2024-06-15"
1454 msgstr "15 يونيو 2024"
1455
1456 #. type: TH
1457 #: debian-trixie
1458 #, no-wrap
1459 msgid "Linux man-pages 6.9.1"
1460 msgstr "صفحات دليل لينكس 6.9.1"
1461
1462 #. type: Plain text
1463 #: debian-trixie
1464 msgid "Standard C library (I<libc>, I<-lc>)"
1465 msgstr "مكتبة سي المعيارية (I<libc>، I<-lc>)"
1466
1467 #. type: Plain text
1468 #: debian-trixie fedora-44 fedora-rawhide
1469 #, no-wrap
1470 msgid ""
1471 "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<pathname>B<,>\n"
1472 "B< struct file_handle *>I<handle>B<,>\n"
1473 "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
1474 "B<int open_by_handle_at(int >I<mount_fd>B<, struct file_handle *>I<handle>B<,>\n"
1475 "B< int >I<flags>B<);>\n"
1476 msgstr ""
1477 "B<int name_to_handle_at(int >I<dirfd>B<, const char *>I<pathname>B<,>\n"
1478 "B< struct file_handle *>I<handle>B<,>\n"
1479 "B< int *>I<mount_id>B<, int >I<flags>B<);>\n"
1480 "B<int open_by_handle_at(int >I<mount_fd>B<, struct file_handle *>I<handle>B<,>\n"
1481 "B< int >I<flags>B<);>\n"
1482
1483 #. type: Plain text
1484 #: debian-trixie fedora-44 fedora-rawhide
1485 msgid ""
1486 "The B<name_to_handle_at>() system call returns a file handle and a mount ID "
1487 "corresponding to the file specified by the I<dirfd> and I<pathname> "
1488 "arguments. The file handle is returned via the argument I<handle>, which is "
1489 "a pointer to a structure of the following form:"
1490 msgstr ""
1491 "يُعيد استدعاء النظام B<name_to_handle_at>() مقبض ملف ومعرف وصل (mount ID) "
1492 "يقابل الملف المحدد عبر معطيات I<dirfd> و I<pathname>. يُعاد مقبض الملف عبر "
1493 "المعطى I<handle>، وهو مؤشر إلى بنية بالشكل التالي:"
1494
1495 #. type: Plain text
1496 #: debian-trixie fedora-44 fedora-rawhide
1497 msgid ""
1498 "The I<flags> argument is a bit mask constructed by ORing together zero or "
1499 "more of B<AT_HANDLE_FID>, B<AT_EMPTY_PATH>, and B<AT_SYMLINK_FOLLOW>, "
1500 "described below."
1501 msgstr ""
1502 "المعطى I<flags> هو قناع بتات (bit mask) يُبنى عبر إجراء عملية OR لصفر أو أكثر "
1503 "من القيم B<AT_HANDLE_FID>، و B<AT_EMPTY_PATH>، و B<AT_SYMLINK_FOLLOW>، "
1504 "الموصوفة أدناه."
1505
1506 #. type: Plain text
1507 #: debian-trixie fedora-44 fedora-rawhide
1508 msgid ""
1509 "Together, the I<pathname> and I<dirfd> arguments identify the file for which "
1510 "a handle is to be obtained. There are four distinct cases:"
1511 msgstr ""
1512 "يحدد المعطيان I<pathname> و I<dirfd> معًا الملف المراد الحصول على مقبض له. "
1513 "هناك أربع حالات متميزة:"
1514
1515 #. type: Plain text
1516 #: debian-trixie fedora-44 fedora-rawhide
1517 msgid ""
1518 "If I<pathname> is a nonempty string containing an absolute pathname, then a "
1519 "handle is returned for the file referred to by that pathname. In this case, "
1520 "I<dirfd> is ignored."
1521 msgstr ""
1522 "إذا كان I<pathname> سلسلة نصية غير فارغة تحتوي على مسار مطلق، فيُعاد مقبض "
1523 "للملف الذي يشير إليه ذلك المسار. في هذه الحالة، يُتجاهل I<dirfd>."
1524
1525 #. type: Plain text
1526 #: debian-trixie fedora-44 fedora-rawhide
1527 msgid ""
1528 "If I<pathname> is a nonempty string containing a relative pathname and "
1529 "I<dirfd> has the special value B<AT_FDCWD>, then I<pathname> is interpreted "
1530 "relative to the current working directory of the caller, and a handle is "
1531 "returned for the file to which it refers."
1532 msgstr ""
1533 "إذا كان I<pathname> سلسلة نصية غير فارغة تحتوي على مسار نسبي وكان لـ "
1534 "I<dirfd> القيمة الخاصة B<AT_FDCWD>، فسيُفسر I<pathname> نسبةً إلى دليل العمل "
1535 "الحالي لـ I<المستدعِي>، ويُعاد مقبض للملف الذي يشير إليه."
1536
1537 #. type: Plain text
1538 #: debian-trixie fedora-44 fedora-rawhide
1539 msgid ""
1540 "If I<pathname> is a nonempty string containing a relative pathname and "
1541 "I<dirfd> is a file descriptor referring to a directory, then I<pathname> is "
1542 "interpreted relative to the directory referred to by I<dirfd>, and a handle "
1543 "is returned for the file to which it refers. (See B<openat>(2) for an "
1544 "explanation of why \"directory file descriptors\" are useful.)"
1545 msgstr ""
1546 "إذا كان I<pathname> سلسلة نصية غير فارغة تحتوي على مسار نسبي وكان I<dirfd> "
1547 "واصف ملف يشير إلى دليل، فسيُفسر I<pathname> نسبةً إلى الدليل الذي يشير إليه "
1548 "I<dirfd>، ويُعاد مقبض للملف الذي يشير إليه. (راجع B<openat>(2) لشرح سبب فائدة "
1549 "\"واصفات ملفات الدليل\".)"
1550
1551 #. type: Plain text
1552 #: debian-trixie fedora-44 fedora-rawhide
1553 msgid ""
1554 "If I<pathname> is an empty string and I<flags> specifies the value "
1555 "B<AT_EMPTY_PATH>, then I<dirfd> can be an open file descriptor referring to "
1556 "any type of file, or B<AT_FDCWD>, meaning the current working directory, and "
1557 "a handle is returned for the file to which it refers."
1558 msgstr ""
1559 "إذا كان I<pathname> سلسلة فارغة وحددت I<flags> القيمة B<AT_EMPTY_PATH>، "
1560 "فيمكن لـ I<dirfd> أن يكون واصف ملف مفتوح يشير إلى أي نوع من الملفات، أو "
1561 "B<AT_FDCWD> (بمعنى دليل العمل الحالي)، ويُعاد مقبض للملف الذي يشير إليه."
1562
1563 #. type: Plain text
1564 #: debian-trixie fedora-44 fedora-rawhide
1565 msgid ""
1566 "The I<mount_id> argument returns an identifier for the filesystem mount that "
1567 "corresponds to I<pathname>. This corresponds to the first field in one of "
1568 "the records in I</proc/self/mountinfo>. Opening the pathname in the fifth "
1569 "field of that record yields a file descriptor for the mount point; that file "
1570 "descriptor can be used in a subsequent call to B<open_by_handle_at>(). "
1571 "I<mount_id> is returned both for a successful call and for a call that "
1572 "results in the error B<EOVERFLOW>."
1573 msgstr ""
1574 "يُعيد المعطى I<mount_id> معرفًا لوصل نظام الملفات الذي يقابل I<pathname>. وهذا "
1575 "يقابل الحقل الأول في أحد السجلات في I</proc/self/mountinfo>. ويؤدي فتح "
1576 "المسار الموجود في الحقل الخامس من ذلك السجل إلى الحصول على واصف ملف لنقطة "
1577 "الوصل؛ يمكن استخدام واصف الملف هذا في استدعاء لاحق لـ "
1578 "B<open_by_handle_at>(). يُعاد I<mount_id> في حال نجاح الاستدعاء وأيضًا في حال "
1579 "الاستدعاء الذي ينتج عنه الخطأ B<EOVERFLOW>."
1580
1581 #. type: Plain text
1582 #: debian-trixie fedora-44 fedora-rawhide
1583 msgid ""
1584 "By default, B<name_to_handle_at>() does not dereference I<pathname> if it "
1585 "is a symbolic link, and thus returns a handle for the link itself. If "
1586 "B<AT_SYMLINK_FOLLOW> is specified in I<flags>, I<pathname> is dereferenced "
1587 "if it is a symbolic link (so that the call returns a handle for the file "
1588 "referred to by the link)."
1589 msgstr ""
1590 "مبدئيًا، لا يتبع B<name_to_handle_at>() الارتباط التشعبي في I<pathname> إذا "
1591 "كان رابطًا رمزيًا، وبالتالي يُعيد مقبضًا للرابط نفسه. أما إذا حُددت "
1592 "B<AT_SYMLINK_FOLLOW> في I<flags>، فيُتَّبع الرابط إذا كان رابطًا رمزيًا (بحيث "
1593 "يُعيد الاستدعاء مقبضًا للملف الذي يشير إليه الرابط)."
1594
1595 #. type: Plain text
1596 #: debian-trixie fedora-44 fedora-rawhide
1597 msgid ""
1598 "I<pathname>, I<mount_id>, or I<handle> points outside your accessible "
1599 "address space."
1600 msgstr ""
1601 "يشير I<pathname> أو I<mount_id> أو I<handle> إلى خارج فضاء العناوين الذي "
1602 "يمكنك الوصول إليه."
1603
1604 #. type: Plain text
1605 #: debian-trixie fedora-44 fedora-rawhide
1606 msgid "I<flags> includes an invalid bit value."
1607 msgstr "تتضمن I<flags> قيمة بت غير صالحة."
1608
1609 #. type: Plain text
1610 #: debian-trixie fedora-44 fedora-rawhide
1611 msgid ""
1612 "I<pathname> is an empty string, but B<AT_EMPTY_PATH> was not specified in "
1613 "I<flags>."
1614 msgstr ""
1615 "المسار I<pathname> سلسلة فارغة، لكن لم تُحدد B<AT_EMPTY_PATH> في I<flags>."
1616
1617 #. type: Plain text
1618 #: debian-trixie fedora-44 fedora-rawhide
1619 msgid ""
1620 "The file descriptor supplied in I<dirfd> does not refer to a directory, and "
1621 "it is not the case that both I<flags> includes B<AT_EMPTY_PATH> and "
1622 "I<pathname> is an empty string."
1623 msgstr ""
1624 "واصف الملف المزود في I<dirfd> لا يشير إلى دليل، وليست الحالة هي تضمن "
1625 "I<flags> لـ B<AT_EMPTY_PATH> وكون I<pathname> سلسلة فارغة معًا."
1626
1627 #. type: Plain text
1628 #: debian-trixie fedora-44 fedora-rawhide
1629 msgid ""
1630 "I<pathname> is relative but I<dirfd> is neither B<AT_FDCWD> nor a valid file "
1631 "descriptor."
1632 msgstr ""
1633 "مسار الملف I<pathname> نسبي ولكن I<dirfd> ليس B<AT_FDCWD> ولا واصف ملف صالح."
1634
1635 #. type: Plain text
1636 #: debian-trixie fedora-44 fedora-rawhide
1637 msgid ""
1638 "The specified I<handle> is not valid for opening a file. This error will "
1639 "occur if, for example, the file has been deleted. This error can also occur "
1640 "if the I<handle> was acquired using the B<AT_HANDLE_FID> flag and the "
1641 "filesystem does not support B<open_by_handle_at>()."
1642 msgstr ""
1643 "المقبض I<handle> المحدد غير صالح لفتح ملف. يحدث هذا الخطأ إذا حُذف الملف "
1644 "مثلًا. يمكن أن يحدث هذا الخطأ أيضًا إذا استُحصل على I<handle> باستخدام علامة "
1645 "B<AT_HANDLE_FID> وكان نظام الملفات لا يدعم B<open_by_handle_at>()."
1646
1647 #. commit bcda76524cd1fa32af748536f27f674a13e56700
1648 #. type: Plain text
1649 #: debian-trixie fedora-44 fedora-rawhide
1650 msgid ""
1651 "If I<pathname> refers to a symbolic link and I<flags> does not specify "
1652 "B<AT_SYMLINK_FOLLOW>, then B<name_to_handle_at>() returns a handle for the "
1653 "link (rather than the file to which it refers). The process receiving the "
1654 "handle can later perform operations on the symbolic link by converting the "
1655 "handle to a file descriptor using B<open_by_handle_at>() with the B<O_PATH> "
1656 "flag, and then passing the file descriptor as the I<dirfd> argument in "
1657 "system calls such as B<readlinkat>(2) and B<fchownat>(2)."
1658 msgstr ""
1659 "إذا كان I<pathname> يشير إلى رابط رمزي ولم تحدد I<flags> القيمة "
1660 "B<AT_SYMLINK_FOLLOW>، فإن B<name_to_handle_at>() يُعيد مقبضًا للرابط (بدلًا من "
1661 "الملف الذي يشير إليه). يمكن للعملية التي تستلم المقبض إجراء عمليات لاحقًا على "
1662 "الرابط الرمزي عبر تحويل المقبض إلى واصف ملف باستخدام B<open_by_handle_at>() "
1663 "مع علامة B<O_PATH>، ثم تمرير واصف الملف كمعطى I<dirfd> في استدعاءات النظام "
1664 "مثل B<readlinkat>(2) و B<fchownat>(2)."
1665
1666 #. type: Plain text
1667 #: debian-trixie fedora-44 fedora-rawhide
1668 #, no-wrap
1669 msgid ""
1670 "$ B<echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>\n"
1671 "$ B<./t_name_to_handle_at cecilia.txt E<gt> fh>\n"
1672 "$ B<./t_open_by_handle_at E<lt> fh>\n"
1673 "open_by_handle_at: Operation not permitted\n"
1674 "$ B<sudo ./t_open_by_handle_at E<lt> fh> # Need CAP_SYS_ADMIN\n"
1675 "Read 31 bytes\n"
1676 "$ B<rm cecilia.txt>\n"
1677 msgstr ""
1678 "$ B<echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>\n"
1679 "$ B<./t_name_to_handle_at cecilia.txt E<gt> fh>\n"
1680 "$ B<./t_open_by_handle_at E<lt> fh>\n"
1681 "open_by_handle_at: Operation not permitted\n"
1682 "$ B<sudo ./t_open_by_handle_at E<lt> fh> # Need CAP_SYS_ADMIN\n"
1683 "Read 31 bytes\n"
1684 "$ B<rm cecilia.txt>\n"
1685
1686 #. type: Plain text
1687 #: debian-trixie fedora-44 fedora-rawhide
1688 #, no-wrap
1689 msgid ""
1690 "$ B<stat --printf=\"%i\\[rs]n\" cecilia.txt> # Display inode number\n"
1691 "4072121\n"
1692 "$ B<rm cecilia.txt>\n"
1693 "$ B<echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>\n"
1694 "$ B<stat --printf=\"%i\\[rs]n\" cecilia.txt> # Check inode number\n"
1695 "4072121\n"
1696 "$ B<sudo ./t_open_by_handle_at E<lt> fh>\n"
1697 "open_by_handle_at: Stale NFS file handle\n"
1698 msgstr ""
1699 "$ B<stat --printf=\"%i\\[rs]n\" cecilia.txt> # Display inode number\n"
1700 "4072121\n"
1701 "$ B<rm cecilia.txt>\n"
1702 "$ B<echo \\[aq]Can you please think about it?\\[aq] E<gt> cecilia.txt>\n"
1703 "$ B<stat --printf=\"%i\\[rs]n\" cecilia.txt> # Check inode number\n"
1704 "4072121\n"
1705 "$ B<sudo ./t_open_by_handle_at E<lt> fh>\n"
1706 "open_by_handle_at: Stale NFS file handle\n"
1707
1708 #. type: Plain text
1709 #: debian-trixie fedora-44 fedora-rawhide
1710 #, no-wrap
1711 msgid ""
1712 "#define _GNU_SOURCE\n"
1713 "#include E<lt>err.hE<gt>\n"
1714 "#include E<lt>errno.hE<gt>\n"
1715 "#include E<lt>fcntl.hE<gt>\n"
1716 "#include E<lt>stdio.hE<gt>\n"
1717 "#include E<lt>stdlib.hE<gt>\n"
1718 "\\&\n"
1719 "int\n"
1720 "main(int argc, char *argv[])\n"
1721 "{\n"
1722 " int mount_id, fhsize, flags, dirfd;\n"
1723 " char *pathname;\n"
1724 " struct file_handle *fhp;\n"
1725 "\\&\n"
1726 " if (argc != 2) {\n"
1727 " fprintf(stderr, \"Usage: %s pathname\\[rs]n\", argv[0]);\n"
1728 " exit(EXIT_FAILURE);\n"
1729 " }\n"
1730 "\\&\n"
1731 " pathname = argv[1];\n"
1732 "\\&\n"
1733 " /* Allocate file_handle structure. */\n"
1734 "\\&\n"
1735 " fhsize = sizeof(*fhp);\n"
1736 " fhp = malloc(fhsize);\n"
1737 " if (fhp == NULL)\n"
1738 " err(EXIT_FAILURE, \"malloc\");\n"
1739 "\\&\n"
1740 " /* Make an initial call to name_to_handle_at() to discover\n"
1741 " the size required for file handle. */\n"
1742 "\\&\n"
1743 " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n"
1744 " flags = 0; /* For name_to_handle_at() calls */\n"
1745 " fhp-E<gt>handle_bytes = 0;\n"
1746 " if (name_to_handle_at(dirfd, pathname, fhp,\n"
1747 " &mount_id, flags) != -1\n"
1748 " || errno != EOVERFLOW)\n"
1749 " {\n"
1750 " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\[rs]n\");\n"
1751 " exit(EXIT_FAILURE);\n"
1752 " }\n"
1753 "\\&\n"
1754 " /* Reallocate file_handle structure with correct size. */\n"
1755 "\\&\n"
1756 " fhsize = sizeof(*fhp) + fhp-E<gt>handle_bytes;\n"
1757 " fhp = realloc(fhp, fhsize); /* Copies fhp-E<gt>handle_bytes */\n"
1758 " if (fhp == NULL)\n"
1759 " err(EXIT_FAILURE, \"realloc\");\n"
1760 "\\&\n"
1761 " /* Get file handle from pathname supplied on command line. */\n"
1762 "\\&\n"
1763 " if (name_to_handle_at(dirfd, pathname, fhp, &mount_id, flags) == -1)\n"
1764 " err(EXIT_FAILURE, \"name_to_handle_at\");\n"
1765 "\\&\n"
1766 " /* Write mount ID, file handle size, and file handle to stdout,\n"
1767 " for later reuse by t_open_by_handle_at.c. */\n"
1768 "\\&\n"
1769 " printf(\"%d\\[rs]n\", mount_id);\n"
1770 " printf(\"%u %d \", fhp-E<gt>handle_bytes, fhp-E<gt>handle_type);\n"
1771 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1772 " printf(\" %02x\", fhp-E<gt>f_handle[j]);\n"
1773 " printf(\"\\[rs]n\");\n"
1774 "\\&\n"
1775 " exit(EXIT_SUCCESS);\n"
1776 "}\n"
1777 msgstr ""
1778 "#define _GNU_SOURCE\n"
1779 "#include E<lt>err.hE<gt>\n"
1780 "#include E<lt>errno.hE<gt>\n"
1781 "#include E<lt>fcntl.hE<gt>\n"
1782 "#include E<lt>stdio.hE<gt>\n"
1783 "#include E<lt>stdlib.hE<gt>\n"
1784 "\\&\n"
1785 "int\n"
1786 "main(int argc, char *argv[])\n"
1787 "{\n"
1788 " int mount_id, fhsize, flags, dirfd;\n"
1789 " char *pathname;\n"
1790 " struct file_handle *fhp;\n"
1791 "\\&\n"
1792 " if (argc != 2) {\n"
1793 " fprintf(stderr, \"Usage: %s pathname\\[rs]n\", argv[0]);\n"
1794 " exit(EXIT_FAILURE);\n"
1795 " }\n"
1796 "\\&\n"
1797 " pathname = argv[1];\n"
1798 "\\&\n"
1799 " /* Allocate file_handle structure. */\n"
1800 "\\&\n"
1801 " fhsize = sizeof(*fhp);\n"
1802 " fhp = malloc(fhsize);\n"
1803 " if (fhp == NULL)\n"
1804 " err(EXIT_FAILURE, \"malloc\");\n"
1805 "\\&\n"
1806 " /* Make an initial call to name_to_handle_at() to discover\n"
1807 " the size required for file handle. */\n"
1808 "\\&\n"
1809 " dirfd = AT_FDCWD; /* For name_to_handle_at() calls */\n"
1810 " flags = 0; /* For name_to_handle_at() calls */\n"
1811 " fhp-E<gt>handle_bytes = 0;\n"
1812 " if (name_to_handle_at(dirfd, pathname, fhp,\n"
1813 " &mount_id, flags) != -1\n"
1814 " || errno != EOVERFLOW)\n"
1815 " {\n"
1816 " fprintf(stderr, \"Unexpected result from name_to_handle_at()\\[rs]n\");\n"
1817 " exit(EXIT_FAILURE);\n"
1818 " }\n"
1819 "\\&\n"
1820 " /* Reallocate file_handle structure with correct size. */\n"
1821 "\\&\n"
1822 " fhsize = sizeof(*fhp) + fhp-E<gt>handle_bytes;\n"
1823 " fhp = realloc(fhp, fhsize); /* Copies fhp-E<gt>handle_bytes */\n"
1824 " if (fhp == NULL)\n"
1825 " err(EXIT_FAILURE, \"realloc\");\n"
1826 "\\&\n"
1827 " /* Get file handle from pathname supplied on command line. */\n"
1828 "\\&\n"
1829 " if (name_to_handle_at(dirfd, pathname, fhp, &mount_id, flags) == -1)\n"
1830 " err(EXIT_FAILURE, \"name_to_handle_at\");\n"
1831 "\\&\n"
1832 " /* Write mount ID, file handle size, and file handle to stdout,\n"
1833 " for later reuse by t_open_by_handle_at.c. */\n"
1834 "\\&\n"
1835 " printf(\"%d\\[rs]n\", mount_id);\n"
1836 " printf(\"%u %d \", fhp-E<gt>handle_bytes, fhp-E<gt>handle_type);\n"
1837 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1838 " printf(\" %02x\", fhp-E<gt>f_handle[j]);\n"
1839 " printf(\"\\[rs]n\");\n"
1840 "\\&\n"
1841 " exit(EXIT_SUCCESS);\n"
1842 "}\n"
1843
1844 #. type: Plain text
1845 #: debian-trixie fedora-44 fedora-rawhide
1846 #, no-wrap
1847 msgid ""
1848 "#define _GNU_SOURCE\n"
1849 "#include E<lt>err.hE<gt>\n"
1850 "#include E<lt>fcntl.hE<gt>\n"
1851 "#include E<lt>limits.hE<gt>\n"
1852 "#include E<lt>stdio.hE<gt>\n"
1853 "#include E<lt>stdlib.hE<gt>\n"
1854 "#include E<lt>string.hE<gt>\n"
1855 "#include E<lt>sys/types.hE<gt>\n"
1856 "#include E<lt>unistd.hE<gt>\n"
1857 "\\&\n"
1858 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
1859 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
1860 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
1861 " Open the corresponding mount path and return the resulting file\n"
1862 " descriptor. */\n"
1863 "\\&\n"
1864 "static int\n"
1865 "open_mount_path_by_id(int mount_id)\n"
1866 "{\n"
1867 " int mi_mount_id, found;\n"
1868 " char mount_path[PATH_MAX];\n"
1869 " char *linep;\n"
1870 " FILE *fp;\n"
1871 " size_t lsize;\n"
1872 " ssize_t nread;\n"
1873 "\\&\n"
1874 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
1875 " if (fp == NULL)\n"
1876 " err(EXIT_FAILURE, \"fopen\");\n"
1877 "\\&\n"
1878 " found = 0;\n"
1879 " linep = NULL;\n"
1880 " while (!found) {\n"
1881 " nread = getline(&linep, &lsize, fp);\n"
1882 " if (nread == -1)\n"
1883 " break;\n"
1884 "\\&\n"
1885 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
1886 " &mi_mount_id, mount_path);\n"
1887 " if (nread != 2) {\n"
1888 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
1889 " exit(EXIT_FAILURE);\n"
1890 " }\n"
1891 "\\&\n"
1892 " if (mi_mount_id == mount_id)\n"
1893 " found = 1;\n"
1894 " }\n"
1895 " free(linep);\n"
1896 "\\&\n"
1897 " fclose(fp);\n"
1898 "\\&\n"
1899 " if (!found) {\n"
1900 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
1901 " exit(EXIT_FAILURE);\n"
1902 " }\n"
1903 "\\&\n"
1904 " return open(mount_path, O_RDONLY);\n"
1905 "}\n"
1906 "\\&\n"
1907 "int\n"
1908 "main(int argc, char *argv[])\n"
1909 "{\n"
1910 " int mount_id, fd, mount_fd, handle_bytes;\n"
1911 " char buf[1000];\n"
1912 "#define LINE_SIZE 100\n"
1913 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
1914 " char *nextp;\n"
1915 " ssize_t nread;\n"
1916 " struct file_handle *fhp;\n"
1917 "\\&\n"
1918 " if ((argc E<gt> 1 && strcmp(argv[1], \"--help\") == 0) || argc E<gt> 2) {\n"
1919 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
1920 " exit(EXIT_FAILURE);\n"
1921 " }\n"
1922 "\\&\n"
1923 " /* Standard input contains mount ID and file handle information:\n"
1924 "\\&\n"
1925 " Line 1: E<lt>mount_idE<gt>\n"
1926 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
1927 " */\n"
1928 "\\&\n"
1929 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
1930 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
1931 " {\n"
1932 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
1933 " exit(EXIT_FAILURE);\n"
1934 " }\n"
1935 "\\&\n"
1936 " mount_id = atoi(line1);\n"
1937 "\\&\n"
1938 " handle_bytes = strtoul(line2, &nextp, 0);\n"
1939 "\\&\n"
1940 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
1941 "\\&\n"
1942 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
1943 " if (fhp == NULL)\n"
1944 " err(EXIT_FAILURE, \"malloc\");\n"
1945 "\\&\n"
1946 " fhp-E<gt>handle_bytes = handle_bytes;\n"
1947 "\\&\n"
1948 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
1949 "\\&\n"
1950 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
1951 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
1952 "\\&\n"
1953 " /* Obtain file descriptor for mount point, either by opening\n"
1954 " the pathname specified on the command line, or by scanning\n"
1955 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
1956 " that we received from stdin. */\n"
1957 "\\&\n"
1958 " if (argc E<gt> 1)\n"
1959 " mount_fd = open(argv[1], O_RDONLY);\n"
1960 " else\n"
1961 " mount_fd = open_mount_path_by_id(mount_id);\n"
1962 "\\&\n"
1963 " if (mount_fd == -1)\n"
1964 " err(EXIT_FAILURE, \"opening mount fd\");\n"
1965 "\\&\n"
1966 " /* Open file using handle and mount point. */\n"
1967 "\\&\n"
1968 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
1969 " if (fd == -1)\n"
1970 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
1971 "\\&\n"
1972 " /* Try reading a few bytes from the file. */\n"
1973 "\\&\n"
1974 " nread = read(fd, buf, sizeof(buf));\n"
1975 " if (nread == -1)\n"
1976 " err(EXIT_FAILURE, \"read\");\n"
1977 "\\&\n"
1978 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
1979 "\\&\n"
1980 " exit(EXIT_SUCCESS);\n"
1981 "}\n"
1982 msgstr ""
1983 "#define _GNU_SOURCE\n"
1984 "#include E<lt>err.hE<gt>\n"
1985 "#include E<lt>fcntl.hE<gt>\n"
1986 "#include E<lt>limits.hE<gt>\n"
1987 "#include E<lt>stdio.hE<gt>\n"
1988 "#include E<lt>stdlib.hE<gt>\n"
1989 "#include E<lt>string.hE<gt>\n"
1990 "#include E<lt>sys/types.hE<gt>\n"
1991 "#include E<lt>unistd.hE<gt>\n"
1992 "\\&\n"
1993 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
1994 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
1995 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
1996 " Open the corresponding mount path and return the resulting file\n"
1997 " descriptor. */\n"
1998 "\\&\n"
1999 "static int\n"
2000 "open_mount_path_by_id(int mount_id)\n"
2001 "{\n"
2002 " int mi_mount_id, found;\n"
2003 " char mount_path[PATH_MAX];\n"
2004 " char *linep;\n"
2005 " FILE *fp;\n"
2006 " size_t lsize;\n"
2007 " ssize_t nread;\n"
2008 "\\&\n"
2009 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
2010 " if (fp == NULL)\n"
2011 " err(EXIT_FAILURE, \"fopen\");\n"
2012 "\\&\n"
2013 " found = 0;\n"
2014 " linep = NULL;\n"
2015 " while (!found) {\n"
2016 " nread = getline(&linep, &lsize, fp);\n"
2017 " if (nread == -1)\n"
2018 " break;\n"
2019 "\\&\n"
2020 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
2021 " &mi_mount_id, mount_path);\n"
2022 " if (nread != 2) {\n"
2023 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
2024 " exit(EXIT_FAILURE);\n"
2025 " }\n"
2026 "\\&\n"
2027 " if (mi_mount_id == mount_id)\n"
2028 " found = 1;\n"
2029 " }\n"
2030 " free(linep);\n"
2031 "\\&\n"
2032 " fclose(fp);\n"
2033 "\\&\n"
2034 " if (!found) {\n"
2035 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
2036 " exit(EXIT_FAILURE);\n"
2037 " }\n"
2038 "\\&\n"
2039 " return open(mount_path, O_RDONLY);\n"
2040 "}\n"
2041 "\\&\n"
2042 "int\n"
2043 "main(int argc, char *argv[])\n"
2044 "{\n"
2045 " int mount_id, fd, mount_fd, handle_bytes;\n"
2046 " char buf[1000];\n"
2047 "#define LINE_SIZE 100\n"
2048 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
2049 " char *nextp;\n"
2050 " ssize_t nread;\n"
2051 " struct file_handle *fhp;\n"
2052 "\\&\n"
2053 " if ((argc E<gt> 1 && strcmp(argv[1], \"--help\") == 0) || argc E<gt> 2) {\n"
2054 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
2055 " exit(EXIT_FAILURE);\n"
2056 " }\n"
2057 "\\&\n"
2058 " /* Standard input contains mount ID and file handle information:\n"
2059 "\\&\n"
2060 " Line 1: E<lt>mount_idE<gt>\n"
2061 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
2062 " */\n"
2063 "\\&\n"
2064 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
2065 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
2066 " {\n"
2067 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
2068 " exit(EXIT_FAILURE);\n"
2069 " }\n"
2070 "\\&\n"
2071 " mount_id = atoi(line1);\n"
2072 "\\&\n"
2073 " handle_bytes = strtoul(line2, &nextp, 0);\n"
2074 "\\&\n"
2075 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
2076 "\\&\n"
2077 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
2078 " if (fhp == NULL)\n"
2079 " err(EXIT_FAILURE, \"malloc\");\n"
2080 "\\&\n"
2081 " fhp-E<gt>handle_bytes = handle_bytes;\n"
2082 "\\&\n"
2083 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
2084 "\\&\n"
2085 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
2086 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
2087 "\\&\n"
2088 " /* Obtain file descriptor for mount point, either by opening\n"
2089 " the pathname specified on the command line, or by scanning\n"
2090 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
2091 " that we received from stdin. */\n"
2092 "\\&\n"
2093 " if (argc E<gt> 1)\n"
2094 " mount_fd = open(argv[1], O_RDONLY);\n"
2095 " else\n"
2096 " mount_fd = open_mount_path_by_id(mount_id);\n"
2097 "\\&\n"
2098 " if (mount_fd == -1)\n"
2099 " err(EXIT_FAILURE, \"opening mount fd\");\n"
2100 "\\&\n"
2101 " /* Open file using handle and mount point. */\n"
2102 "\\&\n"
2103 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
2104 " if (fd == -1)\n"
2105 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
2106 "\\&\n"
2107 " /* Try reading a few bytes from the file. */\n"
2108 "\\&\n"
2109 " nread = read(fd, buf, sizeof(buf));\n"
2110 " if (nread == -1)\n"
2111 " err(EXIT_FAILURE, \"read\");\n"
2112 "\\&\n"
2113 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
2114 "\\&\n"
2115 " exit(EXIT_SUCCESS);\n"
2116 "}\n"
2117
2118 #. type: Plain text
2119 #: debian-trixie fedora-44 fedora-rawhide
2120 msgid ""
2121 "The I<libblkid> and I<libmount> documentation in the latest I<util-linux> "
2122 "release at E<.UR https://www.kernel.org/pub/linux/utils/util-linux/> E<.UE>"
2123 msgstr ""
2124 "وثائق I<libblkid> و I<libmount> في أحدث إصدار من I<util-linux> على E<.UR "
2125 "https://www.kernel.org/pub/linux/utils/util-linux/> E<.UE>"
2126
2127 #. type: TH
2128 #: fedora-44 fedora-rawhide
2129 #, no-wrap
2130 msgid "2024-07-23"
2131 msgstr "23 يوليو 2024"
2132
2133 #. type: TH
2134 #: fedora-44 fedora-rawhide
2135 #, no-wrap
2136 msgid "Linux man-pages 6.13"
2137 msgstr "صفحات دليل لينكس 6.13"
2138
2139 #. type: TH
2140 #: mageia-cauldron
2141 #, no-wrap
2142 msgid "2026-02-08"
2143 msgstr "8 فبراير 2026"
2144
2145 #. type: TH
2146 #: mageia-cauldron
2147 #, no-wrap
2148 msgid "Linux man-pages 6.17"
2149 msgstr "صفحات دليل لينكس 6.17"
2150
2151 #. type: Plain text
2152 #: mageia-cauldron
2153 #, no-wrap
2154 msgid ""
2155 "#define _GNU_SOURCE\n"
2156 "#include E<lt>err.hE<gt>\n"
2157 "#include E<lt>fcntl.hE<gt>\n"
2158 "#include E<lt>limits.hE<gt>\n"
2159 "#include E<lt>stdio.hE<gt>\n"
2160 "#include E<lt>stdlib.hE<gt>\n"
2161 "#include E<lt>string.hE<gt>\n"
2162 "#include E<lt>sys/types.hE<gt>\n"
2163 "#include E<lt>unistd.hE<gt>\n"
2164 "\\&\n"
2165 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
2166 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
2167 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
2168 " Open the corresponding mount path and return the resulting file\n"
2169 " descriptor. */\n"
2170 "\\&\n"
2171 "static int\n"
2172 "open_mount_path_by_id(int mount_id)\n"
2173 "{\n"
2174 " int mi_mount_id, found;\n"
2175 " char mount_path[PATH_MAX];\n"
2176 " char *linep;\n"
2177 " FILE *fp;\n"
2178 " size_t lsize;\n"
2179 " ssize_t nread;\n"
2180 "\\&\n"
2181 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
2182 " if (fp == NULL)\n"
2183 " err(EXIT_FAILURE, \"fopen\");\n"
2184 "\\&\n"
2185 " found = 0;\n"
2186 " linep = NULL;\n"
2187 " while (!found) {\n"
2188 " nread = getline(&linep, &lsize, fp);\n"
2189 " if (nread == -1)\n"
2190 " break;\n"
2191 "\\&\n"
2192 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
2193 " &mi_mount_id, mount_path);\n"
2194 " if (nread != 2) {\n"
2195 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
2196 " exit(EXIT_FAILURE);\n"
2197 " }\n"
2198 "\\&\n"
2199 " if (mi_mount_id == mount_id)\n"
2200 " found = 1;\n"
2201 " }\n"
2202 " free(linep);\n"
2203 "\\&\n"
2204 " fclose(fp);\n"
2205 "\\&\n"
2206 " if (!found) {\n"
2207 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
2208 " exit(EXIT_FAILURE);\n"
2209 " }\n"
2210 "\\&\n"
2211 " return open(mount_path, O_RDONLY);\n"
2212 "}\n"
2213 "\\&\n"
2214 "int\n"
2215 "main(int argc, char *argv[])\n"
2216 "{\n"
2217 " int mount_id, fd, mount_fd, handle_bytes;\n"
2218 " char buf[1000];\n"
2219 "#define LINE_SIZE 100\n"
2220 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
2221 " char *nextp;\n"
2222 " ssize_t nread;\n"
2223 " struct file_handle *fhp;\n"
2224 "\\&\n"
2225 " if ((argc E<gt> 1 && strcmp(argv[1], \"--help\") == 0) || argc E<gt> 2) {\n"
2226 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
2227 " exit(EXIT_FAILURE);\n"
2228 " }\n"
2229 "\\&\n"
2230 " /* Standard input contains mount ID and file handle information:\n"
2231 "\\&\n"
2232 " Line 1: E<lt>mount_idE<gt>\n"
2233 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
2234 " */\n"
2235 "\\&\n"
2236 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
2237 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
2238 " {\n"
2239 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
2240 " exit(EXIT_FAILURE);\n"
2241 " }\n"
2242 "\\&\n"
2243 " mount_id = atoi(line1);\n"
2244 "\\&\n"
2245 " handle_bytes = strtoul(line2, &nextp, 0);\n"
2246 "\\&\n"
2247 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
2248 "\\&\n"
2249 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
2250 " if (fhp == NULL)\n"
2251 " err(EXIT_FAILURE, \"malloc\");\n"
2252 "\\&\n"
2253 " fhp-E<gt>handle_bytes = handle_bytes;\n"
2254 "\\&\n"
2255 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
2256 "\\&\n"
2257 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
2258 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
2259 "\\&\n"
2260 " /* Obtain file descriptor for mount point, either by opening\n"
2261 " the pathname specified on the command line, or by scanning\n"
2262 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
2263 " that we received from stdin. */\n"
2264 "\\&\n"
2265 " if (argc E<gt> 1)\n"
2266 " mount_fd = open(argv[1], O_RDONLY);\n"
2267 " else\n"
2268 " mount_fd = open_mount_path_by_id(mount_id);\n"
2269 "\\&\n"
2270 " if (mount_fd == -1)\n"
2271 " err(EXIT_FAILURE, \"opening mount fd\");\n"
2272 "\\&\n"
2273 " /* Open file using handle and mount point. */\n"
2274 "\\&\n"
2275 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
2276 " if (fd == -1)\n"
2277 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
2278 "\\&\n"
2279 " /* Try reading a few bytes from the file. */\n"
2280 "\\&\n"
2281 " nread = read(fd, buf, sizeof(buf));\n"
2282 " if (nread == -1)\n"
2283 " err(EXIT_FAILURE, \"read\");\n"
2284 "\\&\n"
2285 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
2286 "\\&\n"
2287 " exit(EXIT_SUCCESS);\n"
2288 "}\n"
2289 msgstr ""
2290 "#define _GNU_SOURCE\n"
2291 "#include E<lt>err.hE<gt>\n"
2292 "#include E<lt>fcntl.hE<gt>\n"
2293 "#include E<lt>limits.hE<gt>\n"
2294 "#include E<lt>stdio.hE<gt>\n"
2295 "#include E<lt>stdlib.hE<gt>\n"
2296 "#include E<lt>string.hE<gt>\n"
2297 "#include E<lt>sys/types.hE<gt>\n"
2298 "#include E<lt>unistd.hE<gt>\n"
2299 "\\&\n"
2300 "/* Scan /proc/self/mountinfo to find the line whose mount ID matches\n"
2301 " \\[aq]mount_id\\[aq]. (An easier way to do this is to install and use the\n"
2302 " \\[aq]libmount\\[aq] library provided by the \\[aq]util-linux\\[aq] project.)\n"
2303 " Open the corresponding mount path and return the resulting file\n"
2304 " descriptor. */\n"
2305 "\\&\n"
2306 "static int\n"
2307 "open_mount_path_by_id(int mount_id)\n"
2308 "{\n"
2309 " int mi_mount_id, found;\n"
2310 " char mount_path[PATH_MAX];\n"
2311 " char *linep;\n"
2312 " FILE *fp;\n"
2313 " size_t lsize;\n"
2314 " ssize_t nread;\n"
2315 "\\&\n"
2316 " fp = fopen(\"/proc/self/mountinfo\", \"r\");\n"
2317 " if (fp == NULL)\n"
2318 " err(EXIT_FAILURE, \"fopen\");\n"
2319 "\\&\n"
2320 " found = 0;\n"
2321 " linep = NULL;\n"
2322 " while (!found) {\n"
2323 " nread = getline(&linep, &lsize, fp);\n"
2324 " if (nread == -1)\n"
2325 " break;\n"
2326 "\\&\n"
2327 " nread = sscanf(linep, \"%d %*d %*s %*s %s\",\n"
2328 " &mi_mount_id, mount_path);\n"
2329 " if (nread != 2) {\n"
2330 " fprintf(stderr, \"Bad sscanf()\\[rs]n\");\n"
2331 " exit(EXIT_FAILURE);\n"
2332 " }\n"
2333 "\\&\n"
2334 " if (mi_mount_id == mount_id)\n"
2335 " found = 1;\n"
2336 " }\n"
2337 " free(linep);\n"
2338 "\\&\n"
2339 " fclose(fp);\n"
2340 "\\&\n"
2341 " if (!found) {\n"
2342 " fprintf(stderr, \"Could not find mount point\\[rs]n\");\n"
2343 " exit(EXIT_FAILURE);\n"
2344 " }\n"
2345 "\\&\n"
2346 " return open(mount_path, O_RDONLY);\n"
2347 "}\n"
2348 "\\&\n"
2349 "int\n"
2350 "main(int argc, char *argv[])\n"
2351 "{\n"
2352 " int mount_id, fd, mount_fd, handle_bytes;\n"
2353 " char buf[1000];\n"
2354 "#define LINE_SIZE 100\n"
2355 " char line1[LINE_SIZE], line2[LINE_SIZE];\n"
2356 " char *nextp;\n"
2357 " ssize_t nread;\n"
2358 " struct file_handle *fhp;\n"
2359 "\\&\n"
2360 " if ((argc E<gt> 1 && strcmp(argv[1], \"--help\") == 0) || argc E<gt> 2) {\n"
2361 " fprintf(stderr, \"Usage: %s [mount-path]\\[rs]n\", argv[0]);\n"
2362 " exit(EXIT_FAILURE);\n"
2363 " }\n"
2364 "\\&\n"
2365 " /* Standard input contains mount ID and file handle information:\n"
2366 "\\&\n"
2367 " Line 1: E<lt>mount_idE<gt>\n"
2368 " Line 2: E<lt>handle_bytesE<gt> E<lt>handle_typeE<gt> E<lt>bytes of handle in hexE<gt>\n"
2369 " */\n"
2370 "\\&\n"
2371 " if (fgets(line1, sizeof(line1), stdin) == NULL ||\n"
2372 " fgets(line2, sizeof(line2), stdin) == NULL)\n"
2373 " {\n"
2374 " fprintf(stderr, \"Missing mount_id / file handle\\[rs]n\");\n"
2375 " exit(EXIT_FAILURE);\n"
2376 " }\n"
2377 "\\&\n"
2378 " mount_id = atoi(line1);\n"
2379 "\\&\n"
2380 " handle_bytes = strtoul(line2, &nextp, 0);\n"
2381 "\\&\n"
2382 " /* Given handle_bytes, we can now allocate file_handle structure. */\n"
2383 "\\&\n"
2384 " fhp = malloc(sizeof(*fhp) + handle_bytes);\n"
2385 " if (fhp == NULL)\n"
2386 " err(EXIT_FAILURE, \"malloc\");\n"
2387 "\\&\n"
2388 " fhp-E<gt>handle_bytes = handle_bytes;\n"
2389 "\\&\n"
2390 " fhp-E<gt>handle_type = strtoul(nextp, &nextp, 0);\n"
2391 "\\&\n"
2392 " for (size_t j = 0; j E<lt> fhp-E<gt>handle_bytes; j++)\n"
2393 " fhp-E<gt>f_handle[j] = strtoul(nextp, &nextp, 16);\n"
2394 "\\&\n"
2395 " /* Obtain file descriptor for mount point, either by opening\n"
2396 " the pathname specified on the command line, or by scanning\n"
2397 " /proc/self/mounts to find a mount that matches the \\[aq]mount_id\\[aq]\n"
2398 " that we received from stdin. */\n"
2399 "\\&\n"
2400 " if (argc E<gt> 1)\n"
2401 " mount_fd = open(argv[1], O_RDONLY);\n"
2402 " else\n"
2403 " mount_fd = open_mount_path_by_id(mount_id);\n"
2404 "\\&\n"
2405 " if (mount_fd == -1)\n"
2406 " err(EXIT_FAILURE, \"opening mount fd\");\n"
2407 "\\&\n"
2408 " /* Open file using handle and mount point. */\n"
2409 "\\&\n"
2410 " fd = open_by_handle_at(mount_fd, fhp, O_RDONLY);\n"
2411 " if (fd == -1)\n"
2412 " err(EXIT_FAILURE, \"open_by_handle_at\");\n"
2413 "\\&\n"
2414 " /* Try reading a few bytes from the file. */\n"
2415 "\\&\n"
2416 " nread = read(fd, buf, sizeof(buf));\n"
2417 " if (nread == -1)\n"
2418 " err(EXIT_FAILURE, \"read\");\n"
2419 "\\&\n"
2420 " printf(\"Read %zd bytes\\[rs]n\", nread);\n"
2421 "\\&\n"
2422 " exit(EXIT_SUCCESS);\n"
2423 "}\n"
2424
2425 #. type: TH
2426 #: opensuse-leap-16-1 opensuse-tumbleweed
2427 #, no-wrap
2428 msgid "Linux man-pages (unreleased)"
2429 msgstr "صفحات دليل لينكس (لم تصدر بعد)"