Implement linux_chown and linux_lchown. The fchown syscall maps

directly to the native syscall, because no filename handling
needs to be done.

Tested by: Martin Blapp <mb@imp.ch>
This commit is contained in:
Marcel Moolenaar 2001-10-16 06:15:36 +00:00
parent 2bf1eed95b
commit 4c1e3817c4
6 changed files with 52 additions and 22 deletions

View File

@ -62,11 +62,9 @@ DUMMY(capget);
DUMMY(capset); DUMMY(capset);
DUMMY(sendfile); DUMMY(sendfile);
DUMMY(chown);
DUMMY(getdtablesize); DUMMY(getdtablesize);
DUMMY(gethostname); DUMMY(gethostname);
DUMMY(getpagesize); DUMMY(getpagesize);
DUMMY(lchown);
DUMMY(madvise); DUMMY(madvise);
DUMMY(mincore); DUMMY(mincore);
DUMMY(old_adjtimex); DUMMY(old_adjtimex);

View File

@ -1127,3 +1127,45 @@ linux_fcntl64(struct thread *td, struct linux_fcntl64_args *args)
return (fcntl_common(td, args)); return (fcntl_common(td, args));
} }
#endif /* __i386__ */ #endif /* __i386__ */
int
linux_chown(struct thread *td, struct linux_chown_args *args)
{
struct chown_args bsd;
caddr_t sg;
sg = stackgap_init();
CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(chown))
printf(ARGS(chown, "%s, %d, %d"), args->path, args->uid,
args->gid);
#endif
bsd.path = args->path;
bsd.uid = args->uid;
bsd.gid = args->gid;
return (chown(td, &bsd));
}
int
linux_lchown(struct thread *td, struct linux_lchown_args *args)
{
struct lchown_args bsd;
caddr_t sg;
sg = stackgap_init();
CHECKALTEXIST(td, &sg, args->path);
#ifdef DEBUG
if (ldebug(lchown))
printf(ARGS(lchown, "%s, %d, %d"), args->path, args->uid,
args->gid);
#endif
bsd.path = args->path;
bsd.uid = args->uid;
bsd.gid = args->gid;
return (lchown(td, &bsd));
}

View File

@ -67,9 +67,6 @@ DUMMY(sendfile);
DUMMY(mmap2); DUMMY(mmap2);
DUMMY(truncate64); DUMMY(truncate64);
DUMMY(ftruncate64); DUMMY(ftruncate64);
DUMMY(lchown);
DUMMY(fchown);
DUMMY(chown);
DUMMY(setfsuid); DUMMY(setfsuid);
DUMMY(setfsgid); DUMMY(setfsgid);
DUMMY(pivot_root); DUMMY(pivot_root);

View File

@ -3,7 +3,7 @@
* *
* DO NOT EDIT-- this file is automatically generated. * DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$ * $FreeBSD$
* created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.44 2001/09/28 01:30:59 marcel Exp * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.45 2001/10/16 06:11:11 marcel Exp
*/ */
#ifndef _LINUX_SYSPROTO_H_ #ifndef _LINUX_SYSPROTO_H_
@ -586,9 +586,9 @@ struct linux_fstat64_args {
char flags_l_[PADL_(l_long)]; l_long flags; char flags_r_[PADR_(l_long)]; char flags_l_[PADL_(l_long)]; l_long flags; char flags_r_[PADR_(l_long)];
}; };
struct linux_lchown_args { struct linux_lchown_args {
char filename_l_[PADL_(char *)]; char * filename; char filename_r_[PADR_(char *)]; char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
char user_l_[PADL_(l_uid_t)]; l_uid_t user; char user_r_[PADR_(l_uid_t)]; char uid_l_[PADL_(l_uid_t)]; l_uid_t uid; char uid_r_[PADR_(l_uid_t)];
char group_l_[PADL_(l_gid_t)]; l_gid_t group; char group_r_[PADR_(l_gid_t)]; char gid_l_[PADL_(l_gid_t)]; l_gid_t gid; char gid_r_[PADR_(l_gid_t)];
}; };
struct linux_getuid_args { struct linux_getuid_args {
register_t dummy; register_t dummy;
@ -604,15 +604,10 @@ struct linux_setgroups_args {
char gidsetsize_l_[PADL_(l_int)]; l_int gidsetsize; char gidsetsize_r_[PADR_(l_int)]; char gidsetsize_l_[PADL_(l_int)]; l_int gidsetsize; char gidsetsize_r_[PADR_(l_int)];
char grouplist_l_[PADL_(l_gid_t *)]; l_gid_t * grouplist; char grouplist_r_[PADR_(l_gid_t *)]; char grouplist_l_[PADL_(l_gid_t *)]; l_gid_t * grouplist; char grouplist_r_[PADR_(l_gid_t *)];
}; };
struct linux_fchown_args {
char fd_l_[PADL_(l_uint)]; l_uint fd; char fd_r_[PADR_(l_uint)];
char user_l_[PADL_(l_uid_t)]; l_uid_t user; char user_r_[PADR_(l_uid_t)];
char group_l_[PADL_(l_gid_t)]; l_gid_t group; char group_r_[PADR_(l_gid_t)];
};
struct linux_chown_args { struct linux_chown_args {
char filename_l_[PADL_(char *)]; char * filename; char filename_r_[PADR_(char *)]; char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
char user_l_[PADL_(l_uid_t)]; l_uid_t user; char user_r_[PADR_(l_uid_t)]; char uid_l_[PADL_(l_uid_t)]; l_uid_t uid; char uid_r_[PADR_(l_uid_t)];
char group_l_[PADL_(l_gid_t)]; l_gid_t group; char group_r_[PADR_(l_gid_t)]; char gid_l_[PADL_(l_gid_t)]; l_gid_t gid; char gid_r_[PADR_(l_gid_t)];
}; };
struct linux_setfsuid_args { struct linux_setfsuid_args {
char uid_l_[PADL_(l_uid_t)]; l_uid_t uid; char uid_r_[PADR_(l_uid_t)]; char uid_l_[PADL_(l_uid_t)]; l_uid_t uid; char uid_r_[PADR_(l_uid_t)];
@ -787,7 +782,6 @@ int linux_getuid __P((struct thread *, struct linux_getuid_args *));
int linux_getgid __P((struct thread *, struct linux_getgid_args *)); int linux_getgid __P((struct thread *, struct linux_getgid_args *));
int linux_getgroups __P((struct thread *, struct linux_getgroups_args *)); int linux_getgroups __P((struct thread *, struct linux_getgroups_args *));
int linux_setgroups __P((struct thread *, struct linux_setgroups_args *)); int linux_setgroups __P((struct thread *, struct linux_setgroups_args *));
int linux_fchown __P((struct thread *, struct linux_fchown_args *));
int linux_chown __P((struct thread *, struct linux_chown_args *)); int linux_chown __P((struct thread *, struct linux_chown_args *));
int linux_setfsuid __P((struct thread *, struct linux_setfsuid_args *)); int linux_setfsuid __P((struct thread *, struct linux_setfsuid_args *));
int linux_setfsgid __P((struct thread *, struct linux_setfsgid_args *)); int linux_setfsgid __P((struct thread *, struct linux_setfsgid_args *));

View File

@ -3,7 +3,7 @@
* *
* DO NOT EDIT-- this file is automatically generated. * DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$ * $FreeBSD$
* created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.44 2001/09/28 01:30:59 marcel Exp * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.45 2001/10/16 06:11:11 marcel Exp
*/ */
#define LINUX_SYS_exit 1 #define LINUX_SYS_exit 1
@ -199,7 +199,6 @@
#define LINUX_SYS_setregid 204 #define LINUX_SYS_setregid 204
#define LINUX_SYS_linux_getgroups 205 #define LINUX_SYS_linux_getgroups 205
#define LINUX_SYS_linux_setgroups 206 #define LINUX_SYS_linux_setgroups 206
#define LINUX_SYS_linux_fchown 207
#define LINUX_SYS_setresuid 208 #define LINUX_SYS_setresuid 208
#define LINUX_SYS_getresuid 209 #define LINUX_SYS_getresuid 209
#define LINUX_SYS_setresgid 210 #define LINUX_SYS_setresgid 210

View File

@ -3,7 +3,7 @@
* *
* DO NOT EDIT-- this file is automatically generated. * DO NOT EDIT-- this file is automatically generated.
* $FreeBSD$ * $FreeBSD$
* created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.44 2001/09/28 01:30:59 marcel Exp * created from FreeBSD: src/sys/i386/linux/syscalls.master,v 1.45 2001/10/16 06:11:11 marcel Exp
*/ */
#include "opt_compat.h" #include "opt_compat.h"
@ -224,7 +224,7 @@ struct sysent linux_sysent[] = {
{ AS(setregid_args), (sy_call_t *)setregid }, /* 204 = setregid */ { AS(setregid_args), (sy_call_t *)setregid }, /* 204 = setregid */
{ AS(linux_getgroups_args), (sy_call_t *)linux_getgroups }, /* 205 = linux_getgroups */ { AS(linux_getgroups_args), (sy_call_t *)linux_getgroups }, /* 205 = linux_getgroups */
{ AS(linux_setgroups_args), (sy_call_t *)linux_setgroups }, /* 206 = linux_setgroups */ { AS(linux_setgroups_args), (sy_call_t *)linux_setgroups }, /* 206 = linux_setgroups */
{ AS(linux_fchown_args), (sy_call_t *)linux_fchown }, /* 207 = linux_fchown */ { AS(fchown_args), (sy_call_t *)fchown }, /* 207 = fchown */
{ AS(setresuid_args), (sy_call_t *)setresuid }, /* 208 = setresuid */ { AS(setresuid_args), (sy_call_t *)setresuid }, /* 208 = setresuid */
{ AS(getresuid_args), (sy_call_t *)getresuid }, /* 209 = getresuid */ { AS(getresuid_args), (sy_call_t *)getresuid }, /* 209 = getresuid */
{ AS(setresgid_args), (sy_call_t *)setresgid }, /* 210 = setresgid */ { AS(setresgid_args), (sy_call_t *)setresgid }, /* 210 = setresgid */