Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/symlink.html on line 1
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/symlink.html on line 1
Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/symlink.html on line 8
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/symlink.html on line 8
Create a symbolic link to a path
#include <unistd.h>
int symlink( const char* pname,
const char* slink );
- pname
- The path that you want to link to.
- slink
- The symbolic link that you want to create.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The symlink() function creates a symbolic link named
slink that contains the pathname specified by pname
(slink is the name of the symbolic link created,
pname is the pathname contained in the symbolic link).
File access checking isn't performed on the file named by
pname, and the file need not exist.
If the symlink() function is unsuccessful, any file named by
slink is unaffected.
- 0
- Success.
- -1
- An error occurred (errno
is set).
- EACCES
- A component of the slink path prefix denies search
permission, or write permission is denied in the parent directory of
the symbolic link to be created.
- EEXIST
- A file named by slink already exists.
- ELOOP
- A loop exists in symbolic links encountered during resolution of the
slink argument, and it resolves to more then
SYMLOOP_MAX levels.
- ENAMETOOLONG
- A component of the path specified by slink exceeds
NAME_MAX bytes, or the length of the entire pathname
exceeded PATH_MAX characters.
- ENOSPC
- The new symbolic link can't be created because there's no space left
on the filesystem that will contain the symbolic link.
- ENOSYS
- The symlink() function
isn't implemented for the filesystem specified
in slink.
- ENOTDIR
- A component of the path prefix of slink isn't a directory.
- EROFS
- The file slink would reside on a read-only filesystem.
/*
* create a symbolic link to "/usr/nto/include"
*/
#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
int main( void )
{
if( symlink( "/usr/nto/include", "slink" ) == -1) {
perror( "slink -> /usr/nto/include" );
exit( EXIT_FAILURE );
}
exit( EXIT_SUCCESS );
}
POSIX 1003.1
Safety: | |
Cancellation point |
No |
Interrupt handler |
No |
Signal handler |
Yes |
Thread |
Yes |
errno,
link(),
lstat(),
pathmgr_symlink(),
pathmgr_unlink(),
readlink(),
unlink()
Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/s/symlink.html on line 211
Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/s/symlink.html on line 211