From: Ben Gras Date: Fri, 17 Mar 2006 09:10:39 +0000 (+0000) Subject: Readlink, symlink manpage; fix for lstat X-Git-Tag: v3.1.2a~205 X-Git-Url: http://zhaoyanbai.com/repos/COPYRIGHT?a=commitdiff_plain;h=ce64a1d5422fe61bf5f1bff368f5196a7d45637a;p=minix.git Readlink, symlink manpage; fix for lstat --- diff --git a/man/man2/readlink.2 b/man/man2/readlink.2 new file mode 100644 index 000000000..018fce205 --- /dev/null +++ b/man/man2/readlink.2 @@ -0,0 +1,54 @@ +.TH READLINK 2 "March 17, 2006" +.UC 4 +.SH NAME +readlink \- read the contents of a symlink +.SH SYNOPSIS +.nf +.ft B +#include + +int readlink(const char *\fIpath\fP, char *\fIbuf\fP, size_t bufsize) +.fi +.ft R +.SH DESCRIPTION +The +.I readlink +call reads the contents of the symlink +.I name1 +and returns it in +.I buf +up to a maximum of +.I bufsize +bytes. A terminating NUL byte is NOT put in the buffer. +.SH "RETURN VALUE +Upon successful completion, a value of 0 is returned. Otherwise, +a value of \-1 is returned and +.B errno +is set to indicate the error. +.SH "ERRORS +.B Readlink +will fail if one or more of the following are true: +.TP 15 +[ENOTDIR] +A component of either path prefix is not a directory. +.TP 15 +[ENAMETOOLONG] +A path name exceeds PATH_MAX characters. +.TP 15 +[ENOENT] +A component of the path does not exist. +.TP 15 +[EACCES] +A component of the path denies search permission. +.TP 15 +[ELOOP] +Too many symbolic links were encountered in translating one of the pathnames. +.TP 15 +[ENOENT] +The link named by \fIpath\fP does not exist. +.TP 15 +[EFAULT] +The buffer specified is outside the process's allocated address space. +.SH "SEE ALSO" +.BR symlink (2), +.BR unlink (2). diff --git a/man/man2/stat.2 b/man/man2/stat.2 index 36e11dbfd..f33c620ef 100644 --- a/man/man2/stat.2 +++ b/man/man2/stat.2 @@ -16,7 +16,7 @@ stat, lstat, fstat \- get file status .ta +54n int stat(const char *\fIpath\fP, struct stat *\fIbuf\fP) -int lstat(const char *\fIpath\fP, struct stat *\fIbuf\fP) (Minix-vmd) +int lstat(const char *\fIpath\fP, struct stat *\fIbuf\fP) int fstat(int \fIfd\fP, struct stat *\fIbuf\fP) .fi .ft R @@ -36,7 +36,6 @@ returns information about the link, while .B stat returns information about the file the link references. -(Minix-vmd) (Under minix, lstat behaves like stat.) .PP .B Fstat obtains the same information about an open file @@ -119,7 +118,7 @@ The file type information in \fBst_mode\fP has bits: #define\ \ \ \ S_IFDIR 0040000 /* directory */ #define\ \ \ \ S_IFBLK 0060000 /* block special */ #define\ \ \ \ S_IFREG 0100000 /* regular */ -#define\ \ \ \ S_IFLNK 0120000 /* symbolic link (Minix-vmd) */ +#define\ \ \ \ S_IFLNK 0120000 /* symbolic link */ .fi .in -5n .PP @@ -151,7 +150,6 @@ Search permission is denied for a component of the path prefix. .TP 15 [ELOOP] Too many symbolic links were encountered in translating the pathname. -(Minix-vmd) .TP 15 [EFAULT] .I Buf diff --git a/man/man2/symlink.2 b/man/man2/symlink.2 new file mode 100644 index 000000000..9215d7b08 --- /dev/null +++ b/man/man2/symlink.2 @@ -0,0 +1,77 @@ +.TH SYMLINK 2 "March 17, 2006" +.UC 4 +.SH NAME +symlink \- make a symbolic link to a file +.SH SYNOPSIS +.nf +.ft B +#include + +int symlink(const char *\fIname1\fP, const char *\fIname2\fP) +.fi +.ft R +.SH DESCRIPTION +A symbolic link +.I name2 +is created. +The link has the name +.IR name1 . +.SH "RETURN VALUE +Upon successful completion, a value of 0 is returned. Otherwise, +a value of \-1 is returned and +.B errno +is set to indicate the error. +.SH "ERRORS +.B Symlink +will fail and no link will be created if one or more of the following +are true: +.TP 15 +[ENOTDIR] +A component of either path prefix is not a directory. +.TP 15 +[ENAMETOOLONG] +A path name exceeds PATH_MAX characters. +.TP 15 +[ENOENT] +A component of either path prefix does not exist. +.TP 15 +[EACCES] +A component of either path prefix denies search permission. +.TP 15 +[EACCES] +The requested link requires writing in a directory with a mode +that denies write permission. +.TP 15 +[ELOOP] +Too many symbolic links were encountered in translating one of the pathnames. +.TP 15 +[EEXIST] +The link named by \fIname2\fP exists. +.TP 15 +[ENOSPC] +The directory in which the entry for the new link is being placed +cannot be extended because there is no space left on the file +system containing the directory. +.ig +.TP 15 +[EDQUOT] +The directory in which the entry for the new link +is being placed cannot be extended because the +user's quota of disk blocks on the file system +containing the directory has been exhausted. +.. +.TP 15 +[EIO] +An I/O error occurred while reading from or writing to +the file system to make the directory entry. +.TP 15 +[EROFS] +The requested link requires writing in a directory on a read-only file +system. +.TP 15 +[EFAULT] +One of the pathnames specified +is outside the process's allocated address space. +.SH "SEE ALSO" +.BR link (2), +.BR unlink (2).