Re: FYI: new openat-like function: mkdirat

2005-12-01 Thread Jim Meyering
Daniel Jacobowitz <[EMAIL PROTECTED]> wrote: > You're talking about exec. If you're going to use execve anyway, > there's no way you need your old initial working directory back, is > there? Right. As James pointed out, the forked child can simply call fchdir just before execvp, just as find alr

Re: FYI: new openat-like function: mkdirat

2005-12-01 Thread Jakub Jelinek
On Wed, Nov 30, 2005 at 09:53:53PM +0100, Jim Meyering wrote: > Roland McGrath <[EMAIL PROTECTED]> wrote: > > I think that the Solaris *at functions were really primarily intended for > > use with O_XATTR to get at "file attribute" magic pseudo-directories rather > > than to optimize use of normal

Re: FYI: new openat-like function: mkdirat

2005-12-01 Thread Daniel Jacobowitz
On Wed, Nov 30, 2005 at 11:34:40PM +0100, Jim Meyering wrote: > Roland McGrath <[EMAIL PROTECTED]> wrote: > >> So I guess the exec*at business would ultimately be more complicated, > >> with two file descriptor parameters: one identifying the working > >> directory, and another by which to interpre

Re: FYI: new openat-like function: mkdirat

2005-11-30 Thread James Youngman
On Wed, Nov 30, 2005 at 09:53:53PM +0100, Jim Meyering wrote: > I haven't looked too closely at find, but its -execdir predicate > makes me think having exec*at functions would be useful, too. Only slightly. POSIX requires that -exec should happen with the working directory the same as it was wh

Re: FYI: new openat-like function: mkdirat

2005-11-30 Thread Roland McGrath
> So I guess the exec*at business would ultimately be more complicated, > with two file descriptor parameters: one identifying the working > directory, and another by which to interpret the first parameter > if it's a relative file name. It seems adequate to just use chdir/fchdir for changing cwd,

Re: FYI: new openat-like function: mkdirat

2005-11-30 Thread Roland McGrath
> cp, cpio, mv, and tar currently use mkfifo and mknod, > so you might want to add mkfifoat and mknodat to the list, too. I suppose, though those are used by so few programs it is a bit more questionable. > I haven't looked too closely at find, but its -execdir predicate > makes me think having e

Re: FYI: new openat-like function: mkdirat

2005-11-30 Thread Roland McGrath
I think that the Solaris *at functions were really primarily intended for use with O_XATTR to get at "file attribute" magic pseudo-directories rather than to optimize use of normal directories and files. Probably mkdirat doesn't make sense in Solaris attribute pseudo-directories. But mkdirat is a

Re: FYI: new openat-like function: mkdirat

2005-11-30 Thread Jim Meyering
Roland McGrath <[EMAIL PROTECTED]> wrote: >> So I guess the exec*at business would ultimately be more complicated, >> with two file descriptor parameters: one identifying the working >> directory, and another by which to interpret the first parameter >> if it's a relative file name. > > It seems ad

Re: FYI: new openat-like function: mkdirat

2005-11-30 Thread Jim Meyering
Roland McGrath <[EMAIL PROTECTED]> wrote: >> cp, cpio, mv, and tar currently use mkfifo and mknod, >> so you might want to add mkfifoat and mknodat to the list, too. > > I suppose, though those are used by so few programs it is a bit more > questionable. Either way, it doesn't change much, since o

Re: FYI: new openat-like function: mkdirat

2005-11-30 Thread Jim Meyering
Roland McGrath <[EMAIL PROTECTED]> wrote: > I think that the Solaris *at functions were really primarily intended for > use with O_XATTR to get at "file attribute" magic pseudo-directories rather > than to optimize use of normal directories and files. Probably mkdirat > doesn't make sense in Solar

FYI: new openat-like function: mkdirat

2005-11-30 Thread Jim Meyering
Thinking about how to make thread-safe the directory-creating parts of cp -r, mv, tar, cpio, and even mkdir -p (i.e., don't change the initial working directory), while remaining efficient even for deep hierarchies, I realized that we need a new function, mkdirat, which I've just checked in to core