On Mon 01 Aug 2011 at 12:09:34 +0200, Joerg Sonnenberger wrote:
> You are adding a lot of complexity to workaround portability issues of a
> single application. Let's start the other way -- has FreeBSD added
> llink(2)? What about OSX? Solaris?

FreeBSD 8 has ln -P. From the manual, it seems that the system call used
for it must be linkat(2), which has an added flags argument. (A check
with ktrace confirms that)

>From FreeBSD 8.2's link(2):

SYNOPSIS
     #include <unistd.h>

     int
     link(const char *name1, const char *name2);

     int
     linkat(int fd1, const char *name1, int fd2, const char *name2, int flag);

...
     The linkat() system call is equivalent to link except in the case where
     either name1 or name2 or both are relative paths.  In this case a rela-
     tive path name1 is interpreted relative to the directory associated with
     the file descriptor fd1 instead of the current working directory and sim-
     ilarly for name2 and the file descriptor fd2.

     Values for flag are constructed by a bitwise-inclusive OR of flags from
     the following list, defined in <fcntl.h>:

     AT_SYMLINK_FOLLOW
             If name1 names a symbolic link, a new link for the target of the
             symbolic link is created.

http://www.freebsd.org/cgi/man.cgi?query=link&apropos=0&sektion=2&manpath=FreeBSD+8.2-RELEASE&format=html

> Joerg
-Olaf.
-- 
___ Olaf 'Rhialto' Seibert  -- There's no point being grown-up if you 
\X/ rhialto/at/xs4all.nl    -- can't be childish sometimes. -The 4th Doctor

Reply via email to