Add the lchflags(2) syscall.

Reviewed by:	rwatson
This commit is contained in:
Maxime Henrion 2002-05-05 23:47:41 +00:00
parent 8d9b781fb5
commit 9d997d8be8
8 changed files with 63 additions and 7 deletions

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.109 2002/04/14 05:31:47 alc Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.111 2002/05/05 23:37:44 mux Exp
*/
#include "opt_compat.h"
@ -413,4 +413,5 @@ struct sysent sysent[] = {
{ 0, (sy_call_t *)nosys }, /* 388 = __mac_set_fd */
{ 0, (sy_call_t *)nosys }, /* 389 = __mac_set_file */
{ AS(kenv_args), (sy_call_t *)kenv }, /* 390 = kenv */
{ AS(lchflags_args), (sy_call_t *)lchflags }, /* 391 = lchflags */
};

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.109 2002/04/14 05:31:47 alc Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.111 2002/05/05 23:37:44 mux Exp
*/
char *syscallnames[] = {
@ -398,4 +398,5 @@ char *syscallnames[] = {
"#388", /* 388 = __mac_set_fd */
"#389", /* 389 = __mac_set_file */
"kenv", /* 390 = kenv */
"lchflags", /* 391 = lchflags */
};

View File

@ -2893,6 +2893,29 @@ chflags(td, uap)
return error;
}
/*
* Same as chflags() but doesn't follow symlinks.
*/
int
lchflags(td, uap)
struct thread *td;
register struct lchflags_args /* {
syscallarg(char *) path;
syscallarg(int) flags;
} */ *uap;
{
int error;
struct nameidata nd;
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), td);
if ((error = namei(&nd)) != 0)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfflags(td, nd.ni_vp, SCARG(uap, flags));
vrele(nd.ni_vp);
return error;
}
/*
* Change flags of a file given a file descriptor.
*/

View File

@ -2893,6 +2893,29 @@ chflags(td, uap)
return error;
}
/*
* Same as chflags() but doesn't follow symlinks.
*/
int
lchflags(td, uap)
struct thread *td;
register struct lchflags_args /* {
syscallarg(char *) path;
syscallarg(int) flags;
} */ *uap;
{
int error;
struct nameidata nd;
NDINIT(&nd, LOOKUP, NOFOLLOW, UIO_USERSPACE, SCARG(uap, path), td);
if ((error = namei(&nd)) != 0)
return (error);
NDFREE(&nd, NDF_ONLY_PNBUF);
error = setfflags(td, nd.ni_vp, SCARG(uap, flags));
vrele(nd.ni_vp);
return error;
}
/*
* Change flags of a file given a file descriptor.
*/

View File

@ -255,6 +255,7 @@ mode_t umask(mode_t);
#ifndef _POSIX_SOURCE
int chflags(const char *, u_long);
int lchflags(const char *, int);
int fchflags(int, u_long);
int fchmod(int, mode_t);
int lchmod(const char *, mode_t);

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.109 2002/04/14 05:31:47 alc Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.111 2002/05/05 23:37:44 mux Exp
*/
#define SYS_syscall 0
@ -304,4 +304,5 @@
#define SYS_thread_wakeup 382
#define SYS_kse_yield 383
#define SYS_kenv 390
#define SYS_MAXSYSCALL 391
#define SYS_lchflags 391
#define SYS_MAXSYSCALL 392

View File

@ -1,7 +1,7 @@
# FreeBSD system call names.
# DO NOT EDIT-- this file is automatically generated.
# $FreeBSD$
# created from FreeBSD: src/sys/kern/syscalls.master,v 1.109 2002/04/14 05:31:47 alc Exp
# created from FreeBSD: src/sys/kern/syscalls.master,v 1.111 2002/05/05 23:37:44 mux Exp
MIASM = \
syscall.o \
exit.o \
@ -253,4 +253,5 @@ MIASM = \
kse_new.o \
thread_wakeup.o \
kse_yield.o \
kenv.o
kenv.o \
lchflags.o

View File

@ -3,7 +3,7 @@
*
* DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.109 2002/04/14 05:31:47 alc Exp
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.111 2002/05/05 23:37:44 mux Exp
*/
#ifndef _SYS_SYSPROTO_H_
@ -1111,6 +1111,10 @@ struct kenv_args {
char value_l_[PADL_(char *)]; char * value; char value_r_[PADR_(char *)];
char len_l_[PADL_(int)]; int len; char len_r_[PADR_(int)];
};
struct lchflags_args {
char path_l_[PADL_(const char *)]; const char * path; char path_r_[PADR_(const char *)];
char flags_l_[PADL_(int)]; int flags; char flags_r_[PADR_(int)];
};
int nosys(struct thread *, struct nosys_args *);
void sys_exit(struct thread *, struct sys_exit_args *);
int fork(struct thread *, struct fork_args *);
@ -1361,6 +1365,7 @@ int kse_new(struct thread *, struct kse_new_args *);
int thread_wakeup(struct thread *, struct thread_wakeup_args *);
int kse_yield(struct thread *, struct kse_yield_args *);
int kenv(struct thread *, struct kenv_args *);
int lchflags(struct thread *, struct lchflags_args *);
#ifdef COMPAT_43