Equivalent of openat() on osx?
Equivalent of openat() on osx?
- Subject: Equivalent of openat() on osx?
- From: Anatol Pomozov <email@hidden>
- Date: Tue, 03 May 2011 09:13:09 -0700
Hi,
I am porting a Linux program to macosx (target is 10.6 version) and
the program uses openat/unlinkat/... functions. Although these
functions are not in POSIX, they are widely used on *nixes and the
part proposal the next POSIX.
My question what is the best equivalent for the opentat() functions
that can be used in multithreaded application. Currently I use
something like this:
int openat(int dirfd, const char *pathname, int flags, ...)
{
int fd;
if(fchdir(dirfd) < 0) {
perror("fchdir");
return -1;
}
fd = open(pathname, flags, mode);
// chdir to the original CWD
return fd;
}
But this is not a perfect solution - current working directory is
shared among all threads, it means that openat() may affect other
threads. Is there an equivalent of this implementation without
changing the current directory?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Darwin-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden