/ emulated / lchmod.3
lchmod.3
 1  .Dd Oct 31, 2005
 2  .Dt LCHMOD 3
 3  .Os
 4  .Sh NAME
 5  .Nm lchmod
 6  .Nd change mode of file
 7  .Sh SYNOPSIS
 8  .In sys/stat.h
 9  .In unistd.h
10  .Ft int
11  .Fn lchmod "const char *path" "mode_t flags"
12  .Sh DESCRIPTION
13  The function
14  .Fn lchmod
15  sets the file permission bits of the file specified by the pathname
16  .Fa path
17  to
18  .Fa mode .
19  See
20  .Xr chmod 2
21  for the values of the
22  .Fa flags .
23  .Pp
24  The
25  .Fn lchmod
26  call is like
27  .Fn chmod
28  except when the named file is a symbolic link,
29  in which case
30  .Fn lchmod
31  will change the flags of the link itself,
32  rather than the file it points to.
33  .Sh NOTE
34  Instead of being a system call,
35  .Fn lchmod
36  is emulated using
37  .Xr setattrlist 2 .
38  Not all file systems support
39  .Xr setattrlist 2 .
40  .Sh RETURN VALUES
41  Upon successful completion, a value of 0 is returned.
42  Otherwise, -1 is returned and the global variable
43  .Va errno
44  is set to indicate the error.
45  .Sh ERRORS
46  The
47  .Fn lchmod
48  call may return the same errors as
49  .Xr chmod 2
50  and
51  .Xr setattrlist 2 .
52  .Sh SEE ALSO
53  .Xr chmod 2 ,
54  .Xr setattrlist 2