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
13The function
14.Fn lchmod
15sets the file permission bits of the file specified by the pathname
16.Fa path
17to
18.Fa mode .
19See
20.Xr chmod 2
21for the values of the
22.Fa flags .
23.Pp
24The
25.Fn lchmod
26call is like
27.Fn chmod
28except when the named file is a symbolic link,
29in which case
30.Fn lchmod
31will change the flags of the link itself,
32rather than the file it points to.
33.Sh NOTE
34Instead of being a system call,
35.Fn lchmod
36is emulated using
37.Xr setattrlist 2 .
38Not all file systems support
39.Xr setattrlist 2 .
40.Sh RETURN VALUES
41Upon successful completion, a value of 0 is returned.
42Otherwise, -1 is returned and the global variable
43.Va errno
44is set to indicate the error.
45.Sh ERRORS
46The
47.Fn lchmod
48call may return the same errors as
49.Xr chmod 2
50and
51.Xr setattrlist 2 .
52.Sh SEE ALSO
53.Xr chmod 2 ,
54.Xr setattrlist 2
55