Equivalent of openat() on osx?
site_archiver@lists.apple.com Delivered-To: darwin-dev@lists.apple.com Dkim-signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:date:message-id:subject:from:to :content-type; bh=BZOy6NIkiBW5gGx+14lhm1E/+NIF3TcD4KcP1ohJ9cc=; b=P+Jib9ZIYj/zJ5COgL7l0GCboW6jhjo7yH2JgKkq9zywSkmYo/e6MD1Yx41cWK3Uxs YA32FD7M15O07FccVsbF+3khi6R3A6pYAkLtVX4UNcavXkNvKwycgbOlVR01dYoyZUcm ROsa4eV5HbjASQWgIce8bE9qd1bg4Ws011sY8= Domainkey-signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:date:message-id:subject:from:to:content-type; b=U4PDBh1X45bOBQRCbquYTr+0RTW8D7yheXVO7Y6B3nJAmBloExskumlWyXPEgYNgg8 JKEi1C29cOXP/y6cSVvfp3ZGoOYnc4OTLzCoz9r7S/tGXUWNzeBfGO203wuc1zWrtYTB 6T/t5g48w4aF7Og5vjH33JJporeU9C740aWaI= 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 (Darwin-dev@lists.apple.com) Help/Unsubscribe/Update your Subscription: http://lists.apple.com/mailman/options/darwin-dev/site_archiver%40lists.appl... This email sent to site_archiver@lists.apple.com
participants (1)
-
Anatol Pomozov