PERFORCE change 122074 for review
Roman Divacky
rdivacky at FreeBSD.org
Thu Jun 21 09:35:34 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=122074
Change 122074 by rdivacky at rdivacky_witten on 2007/06/21 09:35:23
Add faccessat() syscall. We ignore the mode argument. We implement
the AT_EACCESS flag.
Untested.
Affected files ...
.. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/init_sysent.c#2 edit
.. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/syscalls.c#2 edit
.. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/syscalls.master#2 edit
.. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/systrace_args.c#2 edit
.. //depot/projects/soc2007/rdivacky/linux_at/sys/kern/vfs_syscalls.c#19 edit
.. //depot/projects/soc2007/rdivacky/linux_at/sys/sys/fcntl.h#5 edit
.. //depot/projects/soc2007/rdivacky/linux_at/sys/sys/syscall.h#2 edit
.. //depot/projects/soc2007/rdivacky/linux_at/sys/sys/syscall.mk#2 edit
.. //depot/projects/soc2007/rdivacky/linux_at/sys/sys/sysproto.h#2 edit
Differences ...
==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/init_sysent.c#2 (text+ko) ====
@@ -2,7 +2,7 @@
* System call switch table.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/init_sysent.c,v 1.228 2006/11/11 22:01:25 ru Exp $
+ * $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp
*/
@@ -504,4 +504,5 @@
{ AS(sctp_generic_sendmsg_args), (sy_call_t *)sctp_generic_sendmsg, AUE_NULL, NULL, 0, 0 }, /* 472 = sctp_generic_sendmsg */
{ AS(sctp_generic_sendmsg_iov_args), (sy_call_t *)sctp_generic_sendmsg_iov, AUE_NULL, NULL, 0, 0 }, /* 473 = sctp_generic_sendmsg_iov */
{ AS(sctp_generic_recvmsg_args), (sy_call_t *)sctp_generic_recvmsg, AUE_NULL, NULL, 0, 0 }, /* 474 = sctp_generic_recvmsg */
+ { AS(faccessat_args), (sy_call_t *)faccessat, AUE_ACCESS, NULL, 0, 0 }, /* 475 = faccessat */
};
==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/syscalls.c#2 (text+ko) ====
@@ -2,7 +2,7 @@
* System call names.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/syscalls.c,v 1.212 2006/11/11 22:01:25 ru Exp $
+ * $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp
*/
@@ -482,4 +482,5 @@
"sctp_generic_sendmsg", /* 472 = sctp_generic_sendmsg */
"sctp_generic_sendmsg_iov", /* 473 = sctp_generic_sendmsg_iov */
"sctp_generic_recvmsg", /* 474 = sctp_generic_recvmsg */
+ "faccessat", /* 475 = faccessat */
};
==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/syscalls.master#2 (text+ko) ====
@@ -835,5 +835,6 @@
474 AUE_NULL STD { int sctp_generic_recvmsg(int sd, struct iovec *iov, int iovlen, \
struct sockaddr * from, __socklen_t *fromlenaddr, \
struct sctp_sndrcvinfo *sinfo, int *msg_flags); }
+475 AUE_ACCESS STD { int faccessat(int dirfd, char *path, int mode, int flags); }
; Please copy any additions and changes to the following compatability tables:
; sys/compat/freebsd32/syscalls.master
==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/systrace_args.c#2 (text+ko) ====
@@ -2,7 +2,7 @@
* System call argument to DTrace register array converstion.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/kern/systrace_args.c,v 1.12 2006/11/11 22:01:25 ru Exp $
+ * $FreeBSD$
* This file is part of the DTrace syscall provider.
*/
@@ -2805,6 +2805,16 @@
*n_args = 7;
break;
}
+ /* faccessat */
+ case 475: {
+ struct faccessat_args *p = params;
+ iarg[0] = p->dirfd; /* int */
+ uarg[1] = (intptr_t) p->path; /* char * */
+ iarg[2] = p->mode; /* int */
+ iarg[3] = p->flags; /* int */
+ *n_args = 4;
+ break;
+ }
default:
*n_args = 0;
break;
==== //depot/projects/soc2007/rdivacky/linux_at/sys/kern/vfs_syscalls.c#19 (text+ko) ====
@@ -1999,6 +1999,20 @@
return (kern_access(td, uap->path, UIO_USERSPACE, uap->flags));
}
+#ifndef _SYS_SYSPROTO_H_
+struct faccessat_args {
+ int dirfd;
+ char *path;
+ int mode;
+ int flags;
+}
+#endif
+int faccessat(struct thread *td, struct faccessat_args *args)
+{
+ /* XXX: what about mode? */
+ return kern_accessat(td, args->path, UIO_USERSPACE, args->flags, args->dirfd);
+}
+
int
kern_access(struct thread *td, char *path, enum uio_seg pathseg, int flags)
{
@@ -2029,8 +2043,13 @@
*/
cred = td->td_ucred;
tmpcred = crdup(cred);
- tmpcred->cr_uid = cred->cr_ruid;
- tmpcred->cr_groups[0] = cred->cr_rgid;
+ if (flags & AT_EACCESS) {
+ tmpcred->cr_uid = cred->cr_uid;
+ tmpcred->cr_groups[0] = cred->cr_groups[0];
+ } else {
+ tmpcred->cr_uid = cred->cr_ruid;
+ tmpcred->cr_groups[0] = cred->cr_rgid;
+ }
td->td_ucred = tmpcred;
if ((error = namei(&nd)) != 0)
goto out;
==== //depot/projects/soc2007/rdivacky/linux_at/sys/sys/fcntl.h#5 (text+ko) ====
@@ -108,9 +108,7 @@
to determine the target of relative
file paths.
*/
-#ifdef notyet
#define AT_EACCESS 0x100 /* Check access using effective user and group ID */
-#endif
#define AT_SYMLINK_NOFOLLOW 0x200 /* Do not follow symbolic links */
#define AT_SYMLINK_FOLLOW 0x400 /* Follow symbolic link */
#define AT_REMOVEDIR 0x800 /* Remove directory instead of file */
==== //depot/projects/soc2007/rdivacky/linux_at/sys/sys/syscall.h#2 (text+ko) ====
@@ -2,7 +2,7 @@
* System call numbers.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/sys/syscall.h,v 1.209 2006/11/11 22:01:24 ru Exp $
+ * $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp
*/
@@ -394,4 +394,5 @@
#define SYS_sctp_generic_sendmsg 472
#define SYS_sctp_generic_sendmsg_iov 473
#define SYS_sctp_generic_recvmsg 474
-#define SYS_MAXSYSCALL 475
+#define SYS_faccessat 475
+#define SYS_MAXSYSCALL 476
==== //depot/projects/soc2007/rdivacky/linux_at/sys/sys/syscall.mk#2 (text+ko) ====
@@ -1,6 +1,6 @@
# FreeBSD system call names.
# DO NOT EDIT-- this file is automatically generated.
-# $FreeBSD: src/sys/sys/syscall.mk,v 1.164 2006/11/11 22:01:24 ru Exp $
+# $FreeBSD$
# created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp
MIASM = \
syscall.o \
@@ -335,4 +335,5 @@
sctp_peeloff.o \
sctp_generic_sendmsg.o \
sctp_generic_sendmsg_iov.o \
- sctp_generic_recvmsg.o
+ sctp_generic_recvmsg.o \
+ faccessat.o
==== //depot/projects/soc2007/rdivacky/linux_at/sys/sys/sysproto.h#2 (text+ko) ====
@@ -2,7 +2,7 @@
* System call prototypes.
*
* DO NOT EDIT-- this file is automatically generated.
- * $FreeBSD: src/sys/sys/sysproto.h,v 1.213 2006/11/11 22:01:24 ru Exp $
+ * $FreeBSD$
* created from FreeBSD: src/sys/kern/syscalls.master,v 1.231 2006/11/03 15:23:14 rrs Exp
*/
@@ -1482,6 +1482,12 @@
char sinfo_l_[PADL_(struct sctp_sndrcvinfo *)]; struct sctp_sndrcvinfo * sinfo; char sinfo_r_[PADR_(struct sctp_sndrcvinfo *)];
char msg_flags_l_[PADL_(int *)]; int * msg_flags; char msg_flags_r_[PADR_(int *)];
};
+struct faccessat_args {
+ char dirfd_l_[PADL_(int)]; int dirfd; char dirfd_r_[PADR_(int)];
+ char path_l_[PADL_(char *)]; char * path; char path_r_[PADR_(char *)];
+ char mode_l_[PADL_(int)]; int mode; char mode_r_[PADR_(int)];
+ 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 *);
@@ -1814,6 +1820,7 @@
int sctp_generic_sendmsg(struct thread *, struct sctp_generic_sendmsg_args *);
int sctp_generic_sendmsg_iov(struct thread *, struct sctp_generic_sendmsg_iov_args *);
int sctp_generic_recvmsg(struct thread *, struct sctp_generic_recvmsg_args *);
+int faccessat(struct thread *, struct faccessat_args *);
#ifdef COMPAT_43
@@ -2365,6 +2372,7 @@
#define SYS_AUE_sctp_generic_sendmsg AUE_NULL
#define SYS_AUE_sctp_generic_sendmsg_iov AUE_NULL
#define SYS_AUE_sctp_generic_recvmsg AUE_NULL
+#define SYS_AUE_faccessat AUE_ACCESS
#undef PAD_
#undef PADL_
More information about the p4-projects
mailing list