Re: [PATCH] fsync.2: ERRORS: add EIO and ENOSPC

2020-09-17 Thread Michael Kerrisk (man-pages)
ction 2) man pages. Maybe not all at > once though. It is really up to Michael if that is a direction he is > interesting in following. I think it's useful, and I'd accept patches that make such distinctions. Of course, if we said *everything* should get fixed at the same time, nothing would g

Re: [PATCH v5 0/5] mm: introduce memfd_secret system call to create "secret" memory areas

2020-09-16 Thread Michael Kerrisk (man-pages)
estging/selftests/ would be helpful, especially > for arch maintainers. > > I assume that user-facing manpage alterations are planned? I was just about to write a mail into this thread when I saw this :-). So far, I don't think I saw a manual page patch. Mike, how about it? Thanks, Michael --

Re: [PATCH 4/5] Add manpage for fsopen(2) and fsmount(2)

2020-09-11 Thread Michael Kerrisk (man-pages)
Hi David, A ping for these five patches please! Cheers, Michael On Wed, 2 Sep 2020 at 22:14, Michael Kerrisk (man-pages) wrote: > > On Wed, 2 Sep 2020 at 18:14, David Howells wrote: > > > > Michael Kerrisk (man-pages) wrote: > > > > > The term

Re: [PATCH 19/24] pthread_setname_np.3: ffix

2020-09-11 Thread Michael Kerrisk (man-pages)
age, and if you > think it's ok keep it, else find something nice :) Sorry -- I was being a bit slow. Now I see what you mean. I've fixed it, but in a different way. Thanks, Michael > On 2020-09-11 09:58, Michael Kerrisk (man-pages) wrote: >> Hi Alex, >> >> On 9/10/20 11:13

Re: [PATCH 09/24] clock_getcpuclockid.3: Remove unneeded cast

2020-09-11 Thread Michael Kerrisk (man-pages)
On 9/11/20 12:25 PM, Alejandro Colomar wrote: > Hi Michael, > > On 2020-09-11 09:48, Michael Kerrisk (man-pages) wrote: >> Hi Alex, >> >> On 9/10/20 11:13 PM, Alejandro Colomar wrote: >>> Member 'tv_nsec' of 'struct timespec' is of type 'long' (see tim

Re: [PATCH 02/24] endian.3: Use 'PRIx32' rather than "%x" when printing 'uint32_t' values

2020-09-11 Thread Michael Kerrisk (man-pages)
32(x.u32)); > +printf("x.u32 = 0x%"PRIx32"\en", x.u32); > +printf("htole32(x.u32) = 0x%"PRIx32"\en", htole32(x.u32)); > +printf("htobe32(x.u32) = 0x%"PRIx32"\en", htobe32(x.u32)); > > exit(EXIT_SUCCESS); > } > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 23/24] select_tut.2: Use MAX(a, b) from

2020-09-11 Thread Michael Kerrisk (man-pages)
On 9/11/20 10:46 AM, Alejandro Colomar wrote: > Hi Michael, > > On 2020-09-11 09:54, Michael Kerrisk (man-pages) wrote: >> Hi Alex, >> >> On 9/10/20 11:13 PM, Alejandro Colomar wrote: >>> Signed-off-by: Alejandro Colomar >> >> I'm reluctant to appl

Re: [PATCH 01/24] inet_net_pton.3: Use 'PRIx32' rather than "%x" when printing 'uint32_t' values

2020-09-11 Thread Michael Kerrisk (man-pages)
rence, I guess. I guess. But even un the 80s, when (I think) htonl() appeared, I kind of doubt that there were many such systems. I think I'll skip these patches. Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH v3 11/24] stat.2: wsfix

2020-09-11 Thread Michael Kerrisk (man-pages)
On 9/11/20 11:34 AM, Alejandro Colomar wrote: > > Hi Michael, > > On 2020-09-11 11:19, Michael Kerrisk (man-pages) wrote: >> On 9/11/20 11:16 AM, Alejandro Colomar wrote: >>> Hi Michael, >>> >>> On 2020-09-11 09:25, Michael Kerrisk (man-p

Re: [PATCH 00/24] Many patches

2020-09-11 Thread Michael Kerrisk (man-pages)
etely unrelated email threads for completely unrelated > patches, please tell me. The sorting was sufficient for me. Thanks for all of the patches! Cheers, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 01/24] inet_net_pton.3: Use 'PRIx32' rather than "%x" when printing 'uint32_t' values

2020-09-11 Thread Michael Kerrisk (man-pages)
32"\en", htonl(addr.s_addr)); > > exit(EXIT_SUCCESS); > } So, I'm in a little bit of doubt about patches 01 and 02. Does this really win us anything? On the one hand, %"PRIx32" is more difficult to read than %x. On the other, does it win us anything in terms of

Re: [PATCH v2 11/24] stat.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"

2020-09-11 Thread Michael Kerrisk (man-pages)
On 9/11/20 11:16 AM, Alejandro Colomar wrote: > Hi Michael, > > On 2020-09-11 09:25, Michael Kerrisk (man-pages) wrote: >> See my reply to patch 10/24. > > As with 10/24, here's the new version. Thanks, Alex. Appli

Re: [PATCH v2 10/24] ioctl_ns.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"

2020-09-11 Thread Michael Kerrisk (man-pages)
On 9/11/20 11:13 AM, Alejandro Colomar wrote: > Hi Michael, > > On 2020-09-11 09:24, Michael Kerrisk (man-pages) wrote: >> This may be true on Linux, but is not true on other systems. >> For example, on HP-UX, according to one header file I'm >> looking at

Re: [PATCH 24/24] bpf.2: Add missing headers

2020-09-11 Thread Michael Kerrisk (man-pages)
#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > +#include > + > int > main(int argc, char **argv) > { > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 03/24] timerfd_create.2: Use 'PRIxN' macros when printing C99 fixed-width integer types

2020-09-11 Thread Michael Kerrisk (man-pages)
long long) tot_exp); > +printf("read: %"PRIu64"; total=%"PRIu64"\en", exp, tot_exp); > } > > exit(EXIT_SUCCESS); > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 04/24] eventfd.2: Use 'PRIxN' macros when printing C99 fixed-width integer types

2020-09-11 Thread Michael Kerrisk (man-pages)
; -(unsigned long long) u, (unsigned long long) u); > +printf("Parent read %"PRIu64" (0x%"PRIx64") from efd\en", u, u); > exit(EXIT_SUCCESS); > > case \-1: > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 18/24] core.5: Use adequate type

2020-09-11 Thread Michael Kerrisk (man-pages)
hile ((nread = read(STDIN_FILENO, buf, BUF_SIZE)) > 0) > tot += nread; > -fprintf(fp, "Total bytes in core dump: %d\en", tot); > +fprintf(fp, "Total bytes in core dump: %zd\en", tot); > > fclose(fp); > exit(EXIT_SUCCESS); > -- Mic

Re: [PATCH 15/24] unix.7: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Michael Kerrisk (man-pages)
== \-1) { > perror("read"); > exit(EXIT_FAILURE); > @@ -1124,7 +1124,7 @@ main(int argc, char *argv[]) > > /* Ensure buffer is 0\-terminated. */ > > -buffer[BUFFER_SIZE \- 1] = 0; > +buffer[sizeof(buffer) \- 1] = 0; > > printf("Result = %s\en", buffer); > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 05/24] offsetof.3: Use "%zu" rather than "%zd" when printing 'size_t' values

2020-09-11 Thread Michael Kerrisk (man-pages)
u\en", > offsetof(struct s, i), offsetof(struct s, c), > offsetof(struct s, d), offsetof(struct s, a)); > -printf("sizeof(struct s)=%zd\en", sizeof(struct s)); > +printf("sizeof(struct s)=%zu\en", sizeof(struct s)); > >

Re: [PATCH 14/24] fread.3: Move ARRAY_SIZE logic into macro

2020-09-11 Thread Michael Kerrisk (man-pages)
ead(buffer, ARRAY_SIZE(buffer), sizeof(*buffer), fp); > if (ret != sizeof(*buffer)) { > fprintf(stderr, "fread() failed: %zu\en", ret); > exit(EXIT_FAILURE); > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 15/24] unix.7: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Michael Kerrisk (man-pages)
== \-1) { > perror("read"); > exit(EXIT_FAILURE); > @@ -1124,7 +1124,7 @@ main(int argc, char *argv[]) > > /* Ensure buffer is 0\-terminated. */ > > -buffer[BUFFER_SIZE \- 1] = 0; > +buffer[sizeof(buffer) \- 1] = 0; > > printf("Result = %s\en", buffer); > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 19/24] pthread_setname_np.3: ffix

2020-09-11 Thread Michael Kerrisk (man-pages)
error(msg); exit(EXIT_FAILURE); \e > +#define errExitEN(en, msg) do \e > +{ \ > +errno = en; perror(msg); exit(EXIT_FAILURE); \e > } while (0) > > static void * > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 06/24] timer_create.2: Cast to 'unsigned long' rathen than 'long' when printing with "%lx"

2020-09-11 Thread Michael Kerrisk (man-pages)
CLOCKID, , ) == \-1) > errExit("timer_create"); > > -printf("timer ID is 0x%lx\en", (long) timerid); > +printf("timer ID is 0x%lx\en", (unsigned long) timerid); > > /* Start the timer */ > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 23/24] select_tut.2: Use MAX(a, b) from

2020-09-11 Thread Michael Kerrisk (man-pages)
1); > } > if (fd2 > 0) { > FD_SET(fd2, ); > - nfds = max(nfds, fd2); > +nfds = MAX(nfds, fd2); > } > > ready = select(nfds + 1, , , , NULL); > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 07/24] request_key.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"

2020-09-11 Thread Michael Kerrisk (man-pages)
%lx\en", (unsigned long) key); > > exit(EXIT_SUCCESS); > } > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 08/24] add_key.2: Cast to 'unsigned long' rather than 'long' when printing with "%lx"

2020-09-11 Thread Michael Kerrisk (man-pages)
3d2..bbd2d1d03 100644 > --- a/man2/add_key.2 > +++ b/man2/add_key.2 > @@ -262,7 +262,7 @@ main(int argc, char *argv[]) > exit(EXIT_FAILURE); > } > > -printf("Key ID is %lx\en", (long) key); > +printf("Key ID is %lx\en", (unsigned

Re: [PATCH 09/24] clock_getcpuclockid.3: Remove unneeded cast

2020-09-11 Thread Michael Kerrisk (man-pages)
+154,7 @@ main(int argc, char *argv[]) > } > > printf("CPU-time clock for PID %s is %ld.%09ld seconds\en", > -argv[1], (long) ts.tv_sec, (long) ts.tv_nsec); > +argv[1], (long) ts.tv_sec, ts.tv_nsec); > exit(EXIT_SUCCESS); > } > .EE >

Re: [PATCH 11/24] stat.2: Remove unneeded cast

2020-09-11 Thread Michael Kerrisk (man-pages)
x]\en", > + major(sb.st_dev), minor(sb.st_dev)); > > printf("File type:"); > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 10/24] ioctl_ns.2: Remove unneeded cast

2020-09-11 Thread Michael Kerrisk (man-pages)
dev), > -(long) sb.st_ino); > +printf("Device/Inode of parent namespace is: [%x,%x] / %ld\en", > +major(sb.st_dev), minor(sb.st_dev), (long) sb.st_ino); > > close(parent_fd); > } > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 13/24] getpwent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Michael Kerrisk (man-pages)
> break; > printf("%s (%d)\etHOME %s\etSHELL %s\en", pwp\->pw_name, > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 12/24] getgrent_r.3: Use sizeof() to get buffer size (instead of hardcoding macro name)

2020-09-11 Thread Michael Kerrisk (man-pages)
> break; > printf("%s (%d):", grpp\->gr_name, grpp\->gr_gid); > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 22/24] membarrier.2: Note that glibc does not provide a wrapper

2020-09-11 Thread Michael Kerrisk (man-pages)
H EXAMPLES > Assuming a multithreaded application where "fast_path()" is executed > very frequently, and where "slow_path()" is executed infrequently, the > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 21/24] aio.7: Use perror() directly

2020-09-11 Thread Michael Kerrisk (man-pages)
tf("Canceled\en"); > break; > default: > - errMsg("aio_error"); > +perror("aio_error"); > break; > } > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 16/24] getpwent_r.3: Declare variables with different types in different lines

2020-09-11 Thread Michael Kerrisk (man-pages)
> index 0f7581091..b6c1c281f 100644 > --- a/man3/getpwent_r.3 > +++ b/man3/getpwent_r.3 > @@ -184,7 +184,8 @@ in the stream with all other threads. > int > main(void) > { > -struct passwd pw, *pwp; > +struct passwd pw; > +struct passwd *pwp; > char buf[

Re: [PATCH 17/24] get_phys_pages.3: Write 'long' instead of 'long int'

2020-09-11 Thread Michael Kerrisk (man-pages)
g int get_phys_pages(void); > -.B long int get_avphys_pages(void); > +.B long get_phys_pages(void); > +.B long get_avphys_pages(void); > .fi > .SH DESCRIPTION > The function > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 20/24] loop.4: ffix

2020-09-11 Thread Michael Kerrisk (man-pages)
71d..1b5d05666 100644 > --- a/man4/loop.4 > +++ b/man4/loop.4 > @@ -227,7 +227,7 @@ in > .IR loop_config.info.lo_flags ; > and > .IP * > -Explicitly request read-only mode by setting > +explicitly request read-only mode by setting > .BR LO_FLAGS_READ_ONLY > in > .IR loop

Re: [PATCH] fsync.2: ERRORS: add EIO and ENOSPC

2020-09-09 Thread Michael Kerrisk (man-pages)
[CC += Neil, since he wrote the text we're talking about] Hello Jan, On 9/9/20 1:21 PM, Jan Kara wrote: > On Wed 09-09-20 12:52:48, Michael Kerrisk (man-pages) wrote: >>> So the error state isn't really stored "on pages in the file mapping". >>> Current implementa

Re: [PATCH] fsync.2: ERRORS: add EIO and ENOSPC

2020-09-09 Thread Michael Kerrisk (man-pages)
Hello Jeff, On 9/8/20 9:44 PM, Jeff Layton wrote: > On Tue, 2020-09-08 at 13:27 +0200, Jan Kara wrote: >> Added Jeff to CC since he has written the code... >> >> On Mon 07-09-20 09:11:06, Michael Kerrisk (man-pages) wrote: >>> [Widening the CC to include Andrew

Re: [PATCH] fsync.2: ERRORS: add EIO and ENOSPC

2020-09-09 Thread Michael Kerrisk (man-pages)
Hello Jan, Thank you for jumping in on this thread. On 9/8/20 1:27 PM, Jan Kara wrote: > Added Jeff to CC since he has written the code... > > On Mon 07-09-20 09:11:06, Michael Kerrisk (man-pages) wrote: >> [Widening the CC to include Andrew and linux-fsdevel@] >> [Milan:

Re: [PATCH] fsync.2: ERRORS: add EIO and ENOSPC

2020-09-07 Thread Michael Kerrisk (man-pages)
n without error. It is > +.I not > +safe to retry synchronisation and assume that a non-error return means prior > writes are now on disk. > .SH SEE ALSO > .BR sync (1), > .BR bdflush (2), > -- > 2.7.4 > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 4/5] Add manpage for fsopen(2) and fsmount(2)

2020-09-02 Thread Michael Kerrisk (man-pages)
On Wed, 2 Sep 2020 at 18:14, David Howells wrote: > > Michael Kerrisk (man-pages) wrote: > > > The term "filesystem configuration context" is introduced, but never > > really explained. I think it would be very helpful to have a sentence > > or three th

Re: [PATCH 4/5] Add manpage for fsopen(2) and fsmount(2)

2020-09-02 Thread Michael Kerrisk (man-pages)
scriptor, > +which it then returns. The term "filesystem configuration context" is introduced, but never really explained. I think it would be very helpful to have a sentence or three that explains this concept at the start of the page. Cheers, Michael -- Michael Kerrisk Linux man-pages mainta

Re: [PATCH 2/5] Add manpages for move_mount(2)

2020-08-27 Thread Michael Kerrisk (man-pages)
;/b". It can also be used in s/It/move_mount()/ > +conjunction with > +.BR open_tree "(2) or " open "(2) with " O_PATH : > +.PP > +.RS > +.nf > +fd = open_tree(AT_FDCWD, "/mnt", 0); > +move_mount(fd, "", AT_FDCWD, "/mnt2"

Re: [PATCH 02/18] fsinfo: Add fsinfo() syscall to query filesystem information [ver #21]

2020-08-27 Thread Michael Kerrisk (man-pages)
date manual page for this system call? Could you please (re)post to the same CC as this mail, plus linux-man@? Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 1/5] Add manpage for open_tree(2)

2020-08-27 Thread Michael Kerrisk (man-pages)
_tree () > +was added to Linux in kernel 5.2. > +.SH CONFORMING TO > +.BR open_tree () > +is Linux-specific. > +.SH NOTES > +Glibc does not (yet) provide a wrapper for the > +.BR open_tree () > +system call; call it using > +.BR syscall (2). What's the current status with respect to glibc support? Is it coming/is someone working on this? > +.SH EXAMPLE s/EXAMPLE/EXAMPLES/ (That's the standard section header name these days.) > +The > +.BR open_tree () > +function can be used like the following: The following example does a recursive bind mount, right? Can you please add some words to say that explicitly. > +.PP > +.RS > +.nf > +fd1 = open_tree(AT_FDCWD, "/mnt", 0); > +fd2 = open_tree(fd1, "", > +AT_EMPTY_PATH | OPEN_TREE_CLONE | AT_RECURSIVE); > +move_mount(fd2, "", AT_FDCWD, "/mnt2", MOVE_MOUNT_F_EMPTY_PATH); > +.fi > +.RE > +.PP > +This would attach the path point for "/mnt" to fd1, then it would copy the What is a "path point"? This is not standard terminology. Can you replace this with something better? > +entire subtree at the point referred to by fd1 and attach that to fd2; > lastly, > +it would attach the clone to "/mnt2". > +.SH SEE ALSO > +.BR fsmount (2), > +.BR move_mount (2), > +.BR open (2) Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 1/2] Add a manpage for watch_queue(7)

2020-08-27 Thread Michael Kerrisk (man-pages)
; +tagged with 0x33 in the info ID field. > +.PP > +When it is determined that there is something in the buffer, messages can be > +read out of the ring with something like the following: > +.PP > +.in +4n > +.EX > +for (;;) { > + unsigned char buf[WATCH_INFO_LENGTH]; > + read(fd, buf, sizeof(buf)); > + struct watch_notification *n = (struct watch_notification *)buf; > + switch (n->type) { > + case WATCH_TYPE_META: > + switch (n->subtype) { > + case WATCH_META_REMOVAL_NOTIFICATION: > + saw_removal_notification(n); > + break; > + case WATCH_META_LOSS_NOTIFICATION: > + printf("-- LOSS --\n"); > + break; > + } > + break; > + case WATCH_TYPE_KEY_NOTIFY: > + saw_key_change(n); > + break; > + } > +} > +.EE > +.in > +.PP > + Remove preceding two lines. > +.SH SEE ALSO > +.ad l > +.nh > +.BR keyctl (1), > +.BR ioctl (2), > +.BR pipe2 (2), > +.BR read (2), > +.BR keyctl_watch_key (3) Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 4/5] Add manpage for fsopen(2) and fsmount(2)

2020-08-27 Thread Michael Kerrisk (man-pages)
mount(mfd, "", AT_FDCWD, "/mnt", MOVE_MOUNT_F_EMPTY_PATH); > +.fi > +.in > +.PP > +Here, an ext4 context is created first and attached to sfd. The context is > +then told where its source will be, given a bunch of options and a superblock > +record object is t

Re: [PATCH 5/5] Add manpage for fsconfig(2)

2020-08-27 Thread Michael Kerrisk (man-pages)
ers does not refer to a block device (and a device was s/Once/One/ > +required). > +.TP > +.B ENOTDIR > +.IR pathname , But there is no argument "pathname" mentioned in this page!? > +or a prefix of > +.IR source , > +is not a directory. But there is no argument "source" mentioned in this page!? (Can you please review all of the errors listed in this section to check that they apply to fsconfig().) > +.TP > +.B EOPNOTSUPP > +The command given by > +.I cmd > +was not valid. > +.TP > +.B ENXIO > +The major number of a block device parameter is out of range. > +.TP > +.B EPERM > +The caller does not have the required privileges. Please name the capability. Also, there was no mention of privileges in the text above, so could you please add some text about why/when privilege is needed. > +.SH CONFORMING TO > +These functions are Linux-specific and should not be used in programs > intended > +to be portable. > +.SH VERSIONS > +.BR fsconfig () > +was added to Linux in kernel 5.2. > +.SH NOTES > +Glibc does not (yet) provide a wrapper for the > +.BR fsconfig () > +system call; call it using > +.BR syscall (2). > +.SH SEE ALSO > +.BR mountpoint (1), > +.BR fsmount (2), > +.BR fsopen (2), > +.BR fspick (2), > +.BR mount_namespaces (7), > +.BR path_resolution (7) Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 3/5] Add manpage for fspick(2)

2020-08-27 Thread Michael Kerrisk (man-pages)
here was no mention of capabilities/privileges in DESCRIPTION. Should there have been? > +.SH CONFORMING TO > +These functions are Linux-specific and should not be used in programs > intended > +to be portable. > +.SH VERSIONS > +.BR fsopen "(), " fsmount "() and "

Re: [PATCH 2/5] Add manpages for move_mount(2) and open_tree(2)

2020-08-26 Thread Michael Kerrisk (man-pages)
On 8/24/20 12:08 PM, David Howells wrote: > Michael Kerrisk (man-pages) wrote: > >>> +To access the source mount object or the destination mountpoint, no >>> +permissions are required on the object itself, but if either pathname is >>> +supplied, execute (sear

Re: [PATCH v1] perf_event_open.2: update the man page with CAP_PERFMON related information

2020-08-23 Thread Michael Kerrisk (man-pages)
Hello Alexey, Could you look at the question below and update the patch. On 2/17/20 9:18 AM, Alexey Budankov wrote: Extend perf_event_open 2 man page with the information about CAP_PERFMON capability designed to secure performance monitoring and observability operation in a system according

Re: [PATCH 5/5] Add manpage for fsconfig(2)

2020-08-22 Thread Michael Kerrisk (man-pages)
ecified block device is located on a filesystem mounted with the > +.B MS_NODEV > +option. > +.\" mtk: Probably: write permission is required for MS_BIND, with > +.\" the error EPERM if not present; CAP_DAC_OVERRIDE is required. > +.TP > +.B EBADF > +The file desc

Re: [PATCH 4/5] Add manpage for fsopen(2) and fsmount(2)

2020-08-22 Thread Michael Kerrisk (man-pages)
quot; > +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Please delete the above three lines. > +.SH RETURN VALUE > +On success, both functions return a file descriptor. On error, \-1 is > +returned, and > +.I errno > +is set appropriately. > +.SH ERRORS > +The error values given below result from filesystem type independent > +errors. > +Each filesystem type may have its own special errors and its > +own special behavior. > +See the Linux kernel source code for details. > +.TP > +.B EBUSY > +The context referred to by > +.I fd > +is not in the right state to be used by > +.BR fsmount (). > +.TP > +.B EFAULT > +One of the pointer arguments points outside the user address space. > +.TP > +.B EINVAL > +.I flags > +had an invalid flag set. > +.TP > +.B EINVAL > +.I mount_attrs, > +includes invalid > +.BR MOUNT_ATTR_* > +flags. > +.TP > +.B EMFILE > +The system has too many open files to create more. > +.TP > +.B ENFILE > +The process has too many open files to create more. > +.TP > +.B ENODEV > +Filesystem s/Filesystem/The filesystem/ > +.I fsname > +not configured in the kernel. > +.TP > +.B ENOMEM > +The kernel could not allocate sufficient memory to complete the call. > +.TP > +.B EPERM > +The caller does not have the required privileges. Please name the required capability. > +.SH CONFORMING TO > +These functions are Linux-specific and should not be used in programs > intended > +to be portable. > +.SH VERSIONS > +.BR fsopen "(), and " fsmount () > +were added to Linux in kernel 5.1. 5.2. > +.SH NOTES > +Glibc does not (yet) provide a wrapper for the > +.BR fsopen "() or " fsmount "()" > +system calls; call them using > +.BR syscall (2). > +.SH SEE ALSO > +.BR mountpoint (1), > +.BR fsconfig (2), > +.BR fspick (2), > +.BR move_mount (2), > +.BR open_tree (2), > +.BR umount (2), > +.BR mount_namespaces (7), > +.BR path_resolution (7), > +.BR findmnt (8), > +.BR lsblk (8), > +.BR mount (8), > +.BR umount (8) Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 3/5] Add manpage for fspick(2)

2020-08-22 Thread Michael Kerrisk (man-pages)
uot;""""""""""""""""""""""""""""""""""""""""""""""""" Please remove above *six* lines. > +.SH RETURN VALUE > +On success, the function returns a file descriptor. On error, \-1 is > returned, > +and > +.I errno > +is set appropriately. > +.SH ERRORS > +The error values given below result from filesystem type independent > +errors. > +Each filesystem type may have its own special errors and its s/Each/Additionally, each/ ? > +own special behavior. > +See the Linux kernel source code for details. > +.TP > +.B EACCES > +A component of a path was not searchable. > +(See also > +.BR path_resolution (7).) > +.TP > +.B EFAULT > +.I pathname > +points outside the user address space. > +.TP > +.B EINVAL > +.I flags > +includes an undefined value. > +.TP > +.B ELOOP > +Too many links encountered during pathname resolution. > +.TP > +.B EMFILE > +The system has too many open files to create more. > +.TP > +.B ENFILE > +The process has too many open files to create more. > +.TP > +.B ENAMETOOLONG > +A pathname was longer than > +.BR MAXPATHLEN . > +.TP > +.B ENOENT > +A pathname was empty or had a nonexistent component. > +.TP > +.B ENOMEM > +The kernel could not allocate sufficient memory to complete the call. > +.TP > +.B EPERM > +The caller does not have the required privileges. > +.SH CONFORMING TO > +These functions are Linux-specific and should not be used in programs > intended > +to be portable. > +.SH VERSIONS > +.BR fsopen "(), " fsmount "() and " fspick () > +were added to Linux in kernel 5.1. 5.2! > +.SH NOTES > +Glibc does not (yet) provide a wrapper for the > +.BR fspick "()" > +system call; call it using > +.BR syscall (2). > +.SH SEE ALSO > +.BR mountpoint (1), > +.BR fsconfig (2), > +.BR fsopen (2), > +.BR path_resolution (7), > +.BR mount (8) Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH 2/5] Add manpages for move_mount(2) and open_tree(2)

2020-08-22 Thread Michael Kerrisk (man-pages)
t;""""""""""""""""""""""""""""""""""""""""" > +.\"""""""

Re: [PATCH 1/5] Add manpage for open_tree(2)

2020-08-22 Thread Michael Kerrisk (man-pages)
;"""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" Lines like the above are rather clutter in the page source. I prefer not to have them. Could you remove in all pages please. > +.SH RETURN VALUE > +On success, the new file descriptor is returned. On error, \-1 is returned, > +and > +.I errno > +is set appropriately. > +.SH ERRORS > +.TP > +.B EACCES > +Search permission is denied for one of the directories > +in the path prefix of > +.IR pathname . > +(See also > +.BR path_resolution (7).) > +.TP > +.B EBADF > +.I dirfd > +is not a valid open file descriptor. > +.TP > +.B EFAULT > +.I pathname > +is NULL or > +.IR pathname > +point to a location outside the process's accessible address space. > +.TP > +.B EINVAL > +Reserved flag specified in > +.IR flags . > +.TP > +.B ELOOP > +Too many symbolic links encountered while traversing the pathname. > +.TP > +.B ENAMETOOLONG > +.I pathname > +is too long. > +.TP > +.B ENOENT > +A component of > +.I pathname > +does not exist, or > +.I pathname > +is an empty string and > +.B AT_EMPTY_PATH > +was not specified in > +.IR flags . > +.TP > +.B ENOMEM > +Out of memory (i.e., kernel memory). > +.TP > +.B ENOTDIR > +A component of the path prefix of > +.I pathname > +is not a directory or > +.I pathname > +is relative and > +.I dirfd > +is a file descriptor referring to a file other than a directory. > +.SH VERSIONS > +.BR open_tree () > +was added to Linux in kernel 4.18. The version number here is wrong. It's 5.2. I presume this needs to be fixed in all of the other pages. > +.SH CONFORMING TO > +.BR open_tree () > +is Linux-specific. > +.SH NOTES > +Glibc does not (yet) provide a wrapper for the > +.BR open_tree () > +system call; call it using > +.BR syscall (2). > +.SH SEE ALSO > +.BR fsmount (2), > +.BR move_mount (2), > +.BR open (2) Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

man-pages-5.08 is released

2020-08-13 Thread Michael Kerrisk (man-pages)
] Add tagged address ABI control prctls (arm64) Add documentation for the the PR_SET_TAGGED_ADDR_CTRL and PR_GET_TAGGED_ADDR_CTRL prctls added in Linux 5.4 for arm64. setns.2 Michael Kerrisk Document the use of PID file descriptors with setns

Re: [PATCH] selftests/socket: Introduce simple SCM_RIGHTS tests

2020-08-11 Thread Michael Kerrisk (man-pages)
; a test script and wire it up to the selftests. > > Signed-off-by: Kees Cook Acked-by: Michael Kerrisk (As per off-list discussion with Kees), I confirm that I'm okay with relicensing to GPL2+. Cheers, Michael > --- > FYI, this also relicenses Michael's code (with his permission)

Re: Mount API manual pages

2020-08-03 Thread Michael Kerrisk (man-pages)
On Fri, 24 Jul 2020 at 12:45, David Howells wrote: > > Michael Kerrisk (man-pages) wrote: > > > Would you be willing to do the following please: > > > > 1. Review the pages that you already wrote to see what needs to be > > updated. (I did take a look at

Re: [PATCH] seccomp.2: Improve x32 and nr truncation notes

2020-07-24 Thread Michael Kerrisk (man-pages)
mind that arguments are often > +.IR args, > +keep in mind that arguments are often > silently truncated before being processed, but after the seccomp check. > For example, this happens if the i386 ABI is used on an > x86-64 kernel: although the kernel will normally not look beyond > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: Mount API manual pages

2020-07-24 Thread Michael Kerrisk (man-pages)
On Fri, 24 Jul 2020 at 12:45, David Howells wrote: > > Michael Kerrisk (man-pages) wrote: > > > Would you be willing to do the following please: > > > > 1. Review the pages that you already wrote to see what needs to be > > updated. (I did take a look at

Re: [PATCH 3/6] mm: introduce secretmemfd system call to create "secret" memory areas

2020-07-21 Thread Michael Kerrisk (man-pages)
ram(2) sched_setscheduler(2) sched_yield(2) timer_create(2) timer_delete(2) timer_getoverrun(2) timer_gettime(2) timer_settime(2) timerfd_create(2) timerfd_gettime(2) timerfd_settime(2) -- Michael Kerrisk Linux man-pages

Mount API manual pages

2020-07-21 Thread Michael Kerrisk (man-pages)
/27446.1570738...@warthog.procyon.org.uk/ -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH] mount_setattr.2: New manual page documenting the mount_setattr() system call

2020-07-21 Thread Michael Kerrisk (man-pages)
and Wording problem... s/zero is returned/returns 0/ > +.I errno > +is set to indicate the cause of the error. > +.SH ERRORS > +.TP > +.B EBADF > +.I dfd > +is not a valid file descriptor. > +.TP > +.B ENOENT > +A pathname was empty or had a nonexistent componen

Re: [Ksummit-discuss] [Tech-board-discuss] [PATCH] CodingStyle: Inclusive Terminology

2020-07-06 Thread Michael Kerrisk (man-pages)
year (thanks > mkerrisk). :) Actually, the manual pages are ahead of the game only thanks to a nice presentation last year @OSS from Stephen Kenigbolo :-). -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH v2] sync.2: syncfs() now returns errors if writeback fails

2020-06-26 Thread Michael Kerrisk (man-pages)
.\" commit 735e4ae5ba28c886d249ad04d3c8cc097dad6336 > +.BR syncfs () > +will only fail when passed a bad file descriptor (EBADF). In 5.8 > +and later kernels, it will also report an error if one or more inodes failed > +to be written back since the last syncfs call. > .SH BUGS >

Re: [PATCH][man-pages] sync.2: syncfs() now returns errors if writeback fails

2020-06-25 Thread Michael Kerrisk (man-pages)
f one or more inodes >>> failed >>> +to be written back since the last syncfs call. >> >> The sentence "In mainline kernel versions prior to 5.8, syncfs() will only >> fail >> with EBADF when passed a bad file descriptor" is ambiguous. It could mean >> that >> EBADF can now mean other things too. >> >> Maybe write: "In mainline kernel versions prior to 5.8, syncfs() will only >> fail >> when passed a bad file descriptor (EBADF)." >> >> - Eric > > Good point. Fixed in my tree using your verbiage. I'll send out a v2 > patch once I give others a chance to comment. > > Thanks! > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH] symlink.7: document magic-links more completely

2020-06-19 Thread Michael Kerrisk (man-pages)
and execute for all > +user categories), and can't be changed. > +.PP > +However, magic-links do not follow this rule. They can have a non-0777 mode, > +though this mode is not currently used in any permission checks. > + > .\" > .\" The > .\" 4.4BSD > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH] nsfs: add NS_GET_INIT_PID ioctl

2020-06-18 Thread Michael Kerrisk (man-pages)
On Thu, 18 Jun 2020 at 10:45, Christian Brauner wrote: > > Add an ioctl() to return the PID of the init process/child reaper of a pid > namespace as seen in the caller's pid namespace. What are the pros and cons of returning a PID FD instead of a PID? Thanks, Michael

Re: [PATCH v2 3/4] nsproxy: attach to namespaces via pidfds

2020-06-15 Thread Michael Kerrisk (man-pages)
ve talked about some of these problem during the hallway track (something > only the pre-COVID-19 generation will remember) of Plumbers in Los Angeles > in 2018(?). Even if all these issues could be avoided with super careful > userspace coding it would be nicer to have this done in-kernel. Pi

man-pages-5.07 is released

2020-06-09 Thread Michael Kerrisk (man-pages)
Changes in man-pages-5.07 New and rewritten pages --- ioctl_fslabel.2 Eric Sandeen New page documenting filesystem get/set label ioctl(2) operations Removed pages - ioctl_list.2 Michael Kerrisk [Heinrich Schuchardt, Eugene

Re: [PATCH v5 1/3] open: add close_range()

2020-06-03 Thread Michael Kerrisk (man-pages)
de/linux/fdtable.h > +++ b/include/linux/fdtable.h > @@ -121,6 +121,8 @@ extern void __fd_install(struct files_struct *files, > unsigned int fd, struct file *file); > extern int __close_fd(struct files_struct *files, > unsigned int fd); > +extern

Re: clone3: allow creation of time namespace with offset

2020-05-29 Thread Michael Kerrisk (man-pages)
gt;struct timespec val; > }; > > This way it is possible to pass the information of multiple clocks with > seconds and nanonseconds to clone3(). > > To me this seems the better approach, but I am not totally convinced > that it is the right thing. If there are other ideas

Re: [PATCH] proc.5: add "wf" to VmFlags in /proc/[pid]/smaps

2020-05-25 Thread Michael Kerrisk (man-pages)
On Mon, 25 May 2020 at 16:59, Kirill A. Shutemov wrote: > > On Mon, May 25, 2020 at 03:50:38PM +0200, Michael Kerrisk (man-pages) wrote: > > On 5/22/20 1:13 AM, Ian Rogers wrote: > > > On Thu, May 21, 2020 at 3:25 PM Ian Rogers wrote: > > >> > &g

Re: [PATCH] proc.5: add "wf" to VmFlags in /proc/[pid]/smaps

2020-05-25 Thread Michael Kerrisk (man-pages)
um - userfaultfd missing pages tracking (since Linux 4.3) uw - userfaultfd wprotect pages tracking (since Linux 4.3) sf - perform synchronous page faults (since Linux 4.15) Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH] proc.5: add "wf" to VmFlags in /proc/[pid]/smaps

2020-05-25 Thread Michael Kerrisk (man-pages)
using the following two-letter codes: > ht - area uses huge tlb pages > nl - non-linear mapping > ar - architecture specific flag > +wf - wipe on fork > dd - do not include area into core dump > sd - soft-dirty flag > mm - mixed map area >

Re: [PATCH v2] clone.2: Document CLONE_INTO_CGROUP

2020-05-19 Thread Michael Kerrisk (man-pages)
On 5/19/20 3:51 PM, Christian Brauner wrote: > On Tue, May 19, 2020 at 03:36:28PM +0200, Michael Kerrisk (man-pages) wrote: >> On 5/18/20 7:55 PM, Christian Brauner wrote: >>> From: Christian Brauner >>> + >>> +Spawning a process into a cgroup different

Re: [PATCH v2] clone.2: Document CLONE_INTO_CGROUP

2020-05-19 Thread Michael Kerrisk (man-pages)
Hello Christian, Thanks for this patch! On 5/18/20 7:55 PM, Christian Brauner wrote: > From: Christian Brauner > > Signed-off-by: Christian Brauner > --- > /* v2 */ > - Michael Kerrisk (man-pages) : > - Fix various types and add examples and how to specify the

Re: [PATCH RFC 1/3] symlink.7: document magic-links more completely

2020-05-15 Thread Michael Kerrisk (man-pages)
Hi Aleksa, Did you have a chance to look into writing this patch? Thanks, Michael On Fri, 17 Apr 2020 at 17:37, Aleksa Sarai wrote: > > On 2020-04-17, Michael Kerrisk (man-pages) wrote: > > Hi Aleksa, > > > > Re our discussion of documentation to be

Re: [PATCH] clone.2: Document CLONE_INTO_CGROUP

2020-05-15 Thread Michael Kerrisk (man-pages)
Hello Christian, Ping! Thanks, Michael On Thu, 23 Apr 2020 at 12:14, Christian Brauner wrote: > > On Tue, Apr 21, 2020 at 04:30:46PM +0200, Michael Kerrisk (man-pages) wrote: > > Hi Christian, > > > > Ping! > > Will likely take a few days until I can get around

Setting mount propagation type in new mount API

2020-05-15 Thread Michael Kerrisk (man-pages)
SUID | MOUNT_ATTR_NODEV | MOUNT_ATTR_NOEXEC | MOUNT_ATTR__ATIME | MOUNT_ATTR_NODIRATIME)) return -EINVAL; Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel

Re: [PATCH v4 10/10] loop: Add LOOP_CONFIGURE ioctl

2020-05-06 Thread Michael Kerrisk (man-pages)
.94s real 0m00.01s user 0m00.01s system > > Signed-off-by: Martijn Coenen Can we have also a patch for the loop.4 manual page please? Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH man-pages v2 2/2] openat2.2: document new openat2(2) syscall

2020-05-04 Thread Michael Kerrisk (man-pages)
Hi Aleksa, Ping on this piece please: > > > It wouldn't hurt to add a longer description of magic-links in > > > symlink(7). I'll send you a small patch to beef up the description (I > > > had planned to include a longer rewrite with the O_EMPTYPATH patches but > > > those require quite a bit

Re: [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-12 Thread Michael Kerrisk (man-pages)
On 10/12/19 9:48 AM, Christian Brauner wrote: > On Sat, Oct 12, 2019 at 08:53:34AM +0200, Michael Kerrisk (man-pages) wrote: >> Hello Aleksa, >> >> On Sat, 12 Oct 2019 at 00:12, Aleksa Sarai wrote: >>> >>> On 2019-10-11, Michael Kerrisk wrote: >>

Re: [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-12 Thread Michael Kerrisk (man-pages)
Hello Aleksa, On Sat, 12 Oct 2019 at 00:12, Aleksa Sarai wrote: > > On 2019-10-11, Michael Kerrisk wrote: > > Why CLONE3_CLEAR_SIGHAND rather than just CLONE_CLEAR_SIGHAND? > > There are no more flag bits left for the classic clone()/clone2() (the > last one was used up by

Re: [PATCH 1/2] clone3: add CLONE3_CLEAR_SIGHAND

2019-10-11 Thread Michael Kerrisk
Hello Christian, Why CLONE3_CLEAR_SIGHAND rather than just CLONE_CLEAR_SIGHAND? Thanks, Michael

man-pages-5.03 is released

2019-10-11 Thread Michael Kerrisk (man-pages)
--- pidfd_open.2 Michael Kerrisk [Christian Brauner, Florian Weimer, Daniel Colascione] New page documenting pidfd_open(2) pidfd_send_signal.2 Michael Kerrisk [Florian Weimer, Christian Brauner] New page documenting pidfd_send_signal(2) pivot_root.2

Re: [PATCH 1/2] Add manpages for move_mount(2) and open_tree(2)

2019-10-10 Thread Michael Kerrisk (man-pages)
if it is a directory that is an automount point. This flag allows the > +automount point itself to be picked up or a mount cloned that is rooted on > the > +automount point. The > +.B AT_NO_AUTOMOUNT > +flag has no effect if the mount point has already been mounted over. > +This flag is Linux-specific; define > +.B _GNU_SOURCE > +.\" Before glibc 2.16, defining _ATFILE_SOURCE sufficed > +to obtain its definition. > +.TP > +.B AT_SYMLINK_NOFOLLOW > +If > +.I pathname > +is a symbolic link, do not dereference it: instead pick up or clone a mount > +rooted on the link itself. > +.TP > +.B OPEN_TREE_CLOEXEC > +Set the close-on-exec flag for the new file descriptor. This will cause the > +file descriptor to be closed automatically when a process exec's. > +.TP > +.B OPEN_TREE_CLONE > +Rather than directly attaching the selected object to the file descriptor, > +clone the object, set the root of the new mount object to that point and > +attach the clone to the file descriptor. > +.TP > +.B AT_RECURSIVE > +This is only permitted in conjunction with OPEN_TREE_CLONE. It causes the > +entire mount subtree rooted at the selected spot to be cloned rather than > just > +that one mount object. > + > + > +.SH EXAMPLE > +The > +.BR open_tree () > +function can be used like the following: > +.PP > +.RS > +.nf > +fd1 = open_tree(AT_FDCWD, "/mnt", 0); > +fd2 = open_tree(fd1, "", > +AT_EMPTY_PATH | OPEN_TREE_CLONE | AT_RECURSIVE); > +move_mount(fd2, "", AT_FDCWD, "/mnt2", MOVE_MOUNT_F_EMPTY_PATH); > +.fi > +.RE > +.PP > +This would attach the path point for "/mnt" to fd1, then it would copy the > +entire subtree at the point referred to by fd1 and attach that to fd2; > lastly, > +it would attach the clone to "/mnt2". > + > + > +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" > +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" > +.\""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""""" > +.SH RETURN VALUE > +On success, the new file descriptor is returned. On error, \-1 is returned, > +and > +.I errno > +is set appropriately. > +.SH ERRORS > +.TP > +.B EACCES > +Search permission is denied for one of the directories > +in the path prefix of > +.IR pathname . > +(See also > +.BR path_resolution (7).) > +.TP > +.B EBADF > +.I dirfd > +is not a valid open file descriptor. > +.TP > +.B EFAULT > +.I pathname > +is NULL or > +.IR pathname > +point to a location outside the process's accessible address space. > +.TP > +.B EINVAL > +Reserved flag specified in > +.IR flags . > +.TP > +.B ELOOP > +Too many symbolic links encountered while traversing the pathname. > +.TP > +.B ENAMETOOLONG > +.I pathname > +is too long. > +.TP > +.B ENOENT > +A component of > +.I pathname > +does not exist, or > +.I pathname > +is an empty string and > +.B AT_EMPTY_PATH > +was not specified in > +.IR flags . > +.TP > +.B ENOMEM > +Out of memory (i.e., kernel memory). > +.TP > +.B ENOTDIR > +A component of the path prefix of > +.I pathname > +is not a directory or > +.I pathname > +is relative and > +.I dirfd > +is a file descriptor referring to a file other than a directory. > +.SH VERSIONS > +.BR open_tree () > +was added to Linux in kernel 4.18. > +.SH CONFORMING TO > +.BR open_tree () > +is Linux-specific. > +.SH NOTES > +Glibc does not (yet) provide a wrapper for the > +.BR open_tree () > +system call; call it using > +.BR syscall (2). > +.SH SEE ALSO > +.BR fsmount (2), > +.BR move_mount (2), > +.BR open (2) > > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: For review: rewritten pivot_root(2) manual page

2019-10-10 Thread Michael Kerrisk (man-pages)
Hello Eric, I think I just understood something. See below. On 10/9/19 11:01 PM, Michael Kerrisk (man-pages) wrote: > Hello Eric, > > On 10/9/19 6:00 PM, Eric W. Biederman wrote: >> "Michael Kerrisk (man-pages)" writes: >> >>> Hello Eric, >&g

Re: For review: rewritten pivot_root(2) manual page

2019-10-09 Thread Michael Kerrisk (man-pages)
Hello Eric, On 10/9/19 6:00 PM, Eric W. Biederman wrote: > "Michael Kerrisk (man-pages)" writes: > >> Hello Eric, >> >> Thank you. I was hoping you might jump in on this thread. >> >> Please see below. >> >> On 10/9/19 10:46 AM, Eric W.

Re: [PATCH RFC 3/3] openat2.2: document new openat2(2) syscall

2019-10-09 Thread Michael Kerrisk (man-pages)
Hello Aleksa, On 10/9/19 12:17 PM, Aleksa Sarai wrote: > On 2019-10-09, Michael Kerrisk (man-pages) wrote: >> Hello Aleksa, >> >> Thanks for this. It's a great piece of documentation work! >> >> I would prefer the path_resolution(7) piece as a separat

Re: For review: rewritten pivot_root(2) manual page

2019-10-09 Thread Michael Kerrisk (man-pages)
Hello Eric, Thank you. I was hoping you might jump in on this thread. Please see below. On 10/9/19 10:46 AM, Eric W. Biederman wrote: > "Michael Kerrisk (man-pages)" writes: > >> Hello Philipp, >> >> My apologies that it has taken a while to reply. (I had bee

Re: [MANPAGE PATCH] Add manpage for fsinfo(2)

2019-10-09 Thread Michael Kerrisk (man-pages)
> +(See also > +.BR path_resolution (7).) > +.TP > +.B EBADF > +.I dirfd > +is not a valid open file descriptor. > +.TP > +.B EFAULT > +.I pathname > +is NULL or > +.IR pathname ", " params " or " buffer > +point to a location outside the process's

Re: [MANPAGE PATCH] Add manpage for fsopen(2), fspick(2) and fsmount(2)

2019-10-09 Thread Michael Kerrisk (man-pages)
; +A component of a path was not searchable. > +(See also > +.BR path_resolution (7).) > +.TP > +.B EACCES > +Mounting a read-only filesystem was attempted without giving the > +.B MS_RDONLY > +flag. > +.TP > +.B EACCES > +The block device > +.I source > +is located on a filesystem mounted with the > +.B MS_NODEV > +option. > +.\" mtk: Probably: write permission is required for MS_BIND, with > +.\" the error EPERM if not present; CAP_DAC_OVERRIDE is required. > +.TP > +.B EBUSY > +.I source > +cannot be reconfigured read-only, because it still holds files open for > +writing. > +.TP > +.B EFAULT > +One of the pointer arguments points outside the user address space. > +.TP > +.B EINVAL > +.I source > +had an invalid superblock. > +.TP > +.B EINVAL > +.I ms_flags > +includes more than one of > +.BR MS_SHARED , > +.BR MS_PRIVATE , > +.BR MS_SLAVE , > +or > +.BR MS_UNBINDABLE . > +.TP > +.BR EINVAL > +An attempt was made to bind mount an unbindable mount. > +.TP > +.B ELOOP > +Too many links encountered during pathname resolution. > +.TP > +.B EMFILE > +The system has too many open files to create more. > +.TP > +.B ENFILE > +The process has too many open files to create more. > +.TP > +.B ENAMETOOLONG > +A pathname was longer than > +.BR MAXPATHLEN . > +.TP > +.B ENODEV > +Filesystem > +.I fsname > +not configured in the kernel. > +.TP > +.B ENOENT > +A pathname was empty or had a nonexistent component. > +.TP > +.B ENOMEM > +The kernel could not allocate sufficient memory to complete the call. > +.TP > +.B ENOTBLK > +.I source > +is not a block device (and a device was required). > +.TP > +.B ENOTDIR > +.IR pathname , > +or a prefix of > +.IR source , > +is not a directory. > +.TP > +.B ENXIO > +The major number of the block device > +.I source > +is out of range. > +.TP > +.B EPERM > +The caller does not have the required privileges. > +.SH CONFORMING TO > +These functions are Linux-specific and should not be used in programs > intended > +to be portable. > +.SH VERSIONS > +.BR fsopen "(), " fsmount "() and " fspick () > +were added to Linux in kernel 4.18. > +.SH NOTES > +Glibc does not (yet) provide a wrapper for the > +.BR fsopen "() , " fsmount "() or " fspick "()" > +system calls; call them using > +.BR syscall (2). > +.SH SEE ALSO > +.BR mountpoint (1), > +.BR move_mount (2), > +.BR open_tree (2), > +.BR umount (2), > +.BR mount_namespaces (7), > +.BR path_resolution (7), > +.BR findmnt (8), > +.BR lsblk (8), > +.BR mount (8), > +.BR umount (8) > diff --git a/man2/fspick.2 b/man2/fspick.2 > new file mode 100644 > index 0..2bf59fc3e > --- /dev/null > +++ b/man2/fspick.2 > @@ -0,0 +1 @@ > +.so man2/fsopen.2 > -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [MANPAGE PATCH] Add manpages for move_mount(2) and open_tree(2)

2019-10-09 Thread Michael Kerrisk (man-pages)
AUTOMOUNT > +Don't automount the terminal ("basename") component of > +.I pathname > +if it is a directory that is an automount point. This flag allows the > +automount point itself to be picked up or a mount cloned that is rooted on > the > +automount point. The > +.B

Re: [PATCH RFC 3/3] openat2.2: document new openat2(2) syscall

2019-10-09 Thread Michael Kerrisk (man-pages)
> Pathnames not starting with a \(aq/\(aq are called relative pathnames. > + No blank line here. > .SS Step 2: walk along the path > Set the current lookup directory to the starting lookup directory. > Now, for each nonfinal component of the pathname, where a component > @@ -124,6 +132,13 @@ the kernel's pathname-resolution code > was reworked to eliminate the use of recursion, > so that the only limit that remains is the maximum of 40 > resolutions for the entire pathname. > +.PP > +The resolution of syscalls during this stage can be blocked by using "resolution of syscall" seems wrong? "syscall" should be something else? > +.BR openat2 (2), > +with the > +.B RESOLVE_NO_SYMLINKS > +flag set. > + > .SS Step 3: find the final entry > The lookup of the final component of the pathname goes just like > that of all other components, as described in the previous step, > @@ -160,7 +175,8 @@ The path resolution process will assume that these > entries have > their conventional meanings, regardless of whether they are > actually present in the physical filesystem. > .PP > -One cannot walk down past the root: "/.." is the same as "/". > +One cannot walk up past the root: "/.." is the same as "/". > + No blank line please. > .SS Mount points > After a "mount dev path" command, the pathname "path" refers to > the root of the filesystem hierarchy on the device "dev", and no > @@ -169,6 +185,13 @@ longer to whatever it referred to earlier. > One can walk out of a mounted filesystem: "path/.." refers to > the parent directory of "path", > outside of the filesystem hierarchy on "dev". > +.PP > +Mount-point crossings can be blocked by using Traversal of mount points can be disallowed by... > +.BR openat2 (2), > +with the > +.B RESOLVE_NO_XDEV > +flag set (though note that this also restricts bind-mount crossings). > + No blank line please. > .SS Trailing slashes > If a pathname ends in a \(aq/\(aq, that forces resolution of the preceding > component as in Step 2: it has to exist and resolve to a directory. > Thanks, Michael -- Michael Kerrisk Linux man-pages maintainer; http://www.kernel.org/doc/man-pages/ Linux/UNIX System Programming Training: http://man7.org/training/

Re: [PATCH RFC 2/3] open.2: add O_EMPTYPATH documentation

2019-10-09 Thread Michael Kerrisk (man-pages)
resolved to a file > .SH DESCRIPTION > @@ -198,6 +198,21 @@ successfully. > Linux returns > .B ENOENT > in this case. > +.PP > +As of Linux 5.FOO, an empty path argument can be used to indicate the > "re-open" > +an existing file descriptor if > +.B O_EMPTYPATH

Re: [PATCH RFC 1/3] symlink.7: document magic-links more completely

2019-10-09 Thread Michael Kerrisk (man-pages)
t; -.IR /proc/[pid]/fd/* > -files\(emthat have different permissions.) > +On Linux, the permissions of an ordinary symbolic link are not used in any > +operations; the permissions are always 0777 (read, write, and execute for all > +user categories), and can't be changed. > +.PP &g

Re: For review: rewritten pivot_root(2) manual page

2019-10-09 Thread Michael Kerrisk (man-pages)
Hello Philipp, My apologies that it has taken a while to reply. (I had been hoping and waiting that a few more people might weigh in on this thread.) On 9/23/19 3:42 PM, Philipp Wendler wrote: > Hello Michael, > > Am 23.09.19 um 14:04 schrieb Michael Kerrisk (man-pages): > >&g

Re: pivot_root(".", ".") and the fchdir() dance

2019-10-08 Thread Michael Kerrisk (man-pages)
On 10/8/19 9:40 PM, Eric W. Biederman wrote: > "Michael Kerrisk (man-pages)" writes: > >> Hello Eric, >> >>>>> Creating of a mount namespace in a user namespace automatically does >>>>> 'mount("", "/", MS_SLAVE | MS_R

<    1   2   3   4   5   6   7   8   9   10   >