Re: *at syscalls for xattrs?

2007-07-16 Thread H. Peter Anvin
Jeff Garzik wrote: >> >> Well, as Jeremy pointed out, in the absence of threads you can do the >> same thing with fchdir(), however, that's much more of a hack. > > My posixutils project (coreutils replacement) used fchdir(2), but that > still doesn't get you 100% race-free. It gets you close, ye

Re: *at syscalls for xattrs?

2007-07-16 Thread Jeff Garzik
H. Peter Anvin wrote: Jeff Garzik wrote: What the *at() interfaces really do is fix/paper over a longstanding wart in Unix: the cwd really should have been a standard file descriptor (like stdin/stdout/stderr) instead of a magic piece of state maintained in kernel space. It's more than a wart,

Re: *at syscalls for xattrs?

2007-07-16 Thread H. Peter Anvin
Jeff Garzik wrote: >> >> What the *at() interfaces really do is fix/paper over a longstanding >> wart in Unix: the cwd really should have been a standard file descriptor >> (like stdin/stdout/stderr) instead of a magic piece of state maintained >> in kernel space. > > It's more than a wart, IMO.

Re: *at syscalls for xattrs?

2007-07-16 Thread Jeff Garzik
H. Peter Anvin wrote: Miklos Szeredi wrote: The *at() thing basically gives you the advantages of a CWD without the disadvantages. For example it could be useful to implement the functionality of find(1) as a library interface. What the *at() interfaces really do is fix/paper over a longstan

Re: *at syscalls for xattrs?

2007-07-16 Thread H. Peter Anvin
Miklos Szeredi wrote: > > The *at() thing basically gives you the advantages of a CWD without > the disadvantages. > > For example it could be useful to implement the functionality of > find(1) as a library interface. > What the *at() interfaces really do is fix/paper over a longstanding wart i

Re: *at syscalls for xattrs?

2007-07-16 Thread Andreas Schwab
Jeremy Fitzhardinge <[EMAIL PROTECTED]> writes: > This should work: > >fchdir(fd1); >open("file1", O_RDWR | O_CREAT); >fchdir(fd2); >open("file2", O_RDWR | O_CREAT); This is not thread-safe. Andreas. -- Andreas Schwab, SuSE Labs, [EMAIL PROTECTED] SuSE Linux Products GmbH, Maxf

Re: *at syscalls for xattrs?

2007-07-16 Thread Miklos Szeredi
> > fd1 = open("dir1", O_DIRECTORY): > > fd2 = open("dir2", O_DIRECTORY); > > system("mount -t tmpfs none dir1"); > > system("mount -t tmpfs none dir2"); > > openat(fd1, "file1", O_RDWR | O_CREAT); > > openat(fd2, "file2", O_RDWR | O_CREAT); > > If you have a better way to accomplish this, let me k

Re: *at syscalls for xattrs?

2007-07-16 Thread Jeremy Fitzhardinge
Jan Engelhardt wrote: fd1 = open("dir1", O_DIRECTORY): fd2 = open("dir2", O_DIRECTORY); system("mount -t tmpfs none dir1"); system("mount -t tmpfs none dir2"); openat(fd1, "file1", O_RDWR | O_CREAT); openat(fd2, "file2", O_RDWR | O_CREAT); If you have a better way to accomplish this, let me know.

Re: *at syscalls for xattrs?

2007-07-16 Thread Al Viro
On Mon, Jul 16, 2007 at 09:56:10AM +0200, Jan Engelhardt wrote: > >Just one question: what the bleeding hell for? Not that the rest of > >..at() family made any damn sense as an interface... > > fd1 = open("dir1", O_DIRECTORY): > fd2 = open("dir2", O_DIRECTORY); > system("mount -t tmpfs none dir1

Re: *at syscalls for xattrs?

2007-07-16 Thread Jan Engelhardt
On Jul 15 2007 23:23, Al Viro wrote: >On Sun, Jul 15, 2007 at 02:13:21PM -0700, Nicholas Miell wrote: >> >> I suspect he was asking for >> >> int getxattrat(int fd, const char *path, const char *name, void *value, >> size_t size, int flags) >> int setxattrat(int fd, const char *pa

Re: *at syscalls for xattrs?

2007-07-15 Thread H. Peter Anvin
Al Viro wrote: > BTW, why is fstatat called fstatat and not statat? (Same goes for futimesat.) It does not take a file descriptor for the file argument. Otherwise we'd also need fopenat/funlinkat, etc. Any reasons? >>> Ulrich having an odd taste? >> Solaris compatibility. > > "Su

Re: *at syscalls for xattrs?

2007-07-15 Thread Al Viro
On Sun, Jul 15, 2007 at 02:13:21PM -0700, Nicholas Miell wrote: > > I suspect he was asking for > > int getxattrat(int fd, const char *path, const char *name, void *value, > size_t size, int flags) > int setxattrat(int fd, const char *path, const char *name, void *value, >

Re: *at syscalls for xattrs?

2007-07-15 Thread Nicholas Miell
On Sun, 2007-07-15 at 21:53 +0100, Al Viro wrote: > On Sun, Jul 15, 2007 at 09:46:27PM +0200, Jan Engelhardt wrote: > > Hi, > > > > > > recently, the family of *at() syscalls and functions (openat, fstatat, > > etc.) have been added to Linux and Glibc, respectively. > > In short: I am missing xa

Re: *at syscalls for xattrs?

2007-07-15 Thread Al Viro
On Sun, Jul 15, 2007 at 09:46:27PM +0200, Jan Engelhardt wrote: > Hi, > > > recently, the family of *at() syscalls and functions (openat, fstatat, > etc.) have been added to Linux and Glibc, respectively. > In short: I am missing xattr at functions :) No. They are not fscking forks. They are

*at syscalls for xattrs?

2007-07-15 Thread Jan Engelhardt
Hi, recently, the family of *at() syscalls and functions (openat, fstatat, etc.) have been added to Linux and Glibc, respectively. In short: I am missing xattr at functions :) BTW, why is fstatat called fstatat and not statat? (Same goes for futimesat.) It does not take a file descriptor for t