PERFORCE change 116412 for review
Roman Divacky
rdivacky at FreeBSD.org
Fri Mar 23 12:52:34 UTC 2007
http://perforce.freebsd.org/chv.cgi?CH=116412
Change 116412 by rdivacky at rdivacky_witten on 2007/03/23 12:52:07
Implement empty stubs for *at family of syscalls.
Affected files ...
.. //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_dummy.c#10 edit
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_file.c#16 edit
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#63 edit
.. //depot/projects/linuxolator/src/sys/compat/linux/linux_util.h#3 edit
.. //depot/projects/linuxolator/src/sys/i386/linux/linux_dummy.c#10 edit
Differences ...
==== //depot/projects/linuxolator/src/sys/amd64/linux32/linux32_dummy.c#10 (text+ko) ====
@@ -96,16 +96,6 @@
DUMMY(inotify_add_watch);
DUMMY(inotify_rm_watch);
DUMMY(migrate_pages);
-DUMMY(mkdirat);
-DUMMY(mknodat);
-DUMMY(fchownat);
-DUMMY(futimesat);
-DUMMY(fstatat64);
-DUMMY(unlinkat);
-DUMMY(renameat);
-DUMMY(linkat);
-DUMMY(symlinkat);
-DUMMY(readlinkat);
DUMMY(fchmodat);
DUMMY(faccessat);
DUMMY(pselect6);
==== //depot/projects/linuxolator/src/sys/compat/linux/linux_file.c#16 (text+ko) ====
@@ -68,6 +68,63 @@
#endif
#include <compat/linux/linux_util.h>
+/*
+ * common code for linux *at set of syscalls
+ *
+ * works like this:
+ * if filename is absolute
+ * ignore dirfd
+ * else
+ * if dirfd == AT_FDCWD
+ * return CWD/filename
+ * else
+ * return DIRFD/filename
+ */
+int
+linux_at(struct thread *td, int dirfd, char *filename, char **newpath, char **freebuf)
+{
+ struct file *fp;
+ int error = 0;
+ struct vnode *dvp;
+ struct filedesc *fdp = td->td_proc->p_fd;
+ char *fullpath = "unknown";
+ char *freepath = NULL;
+
+ /* don't do anything if the pathname is absolute */
+ if (*filename == '/') {
+ *newpath= filename;
+ return (0);
+ }
+
+ /* check for AT_FDWCD */
+ if (dirfd == LINUX_AT_FDCWD) {
+ FILEDESC_LOCK(fdp);
+ dvp = fdp->fd_cdir;
+ FILEDESC_UNLOCK(fdp);
+ } else {
+ error = fget(td, dirfd, &fp);
+ if (error)
+ return (error);
+ dvp = fp->f_vnode;
+ /* only a dir can be dfd */
+ if (dvp->v_type != VDIR) {
+ fdrop(fp, td);
+ return (ENOTDIR);
+ }
+ fdrop(fp, td);
+ }
+
+ error = vn_fullpath(td, dvp, &fullpath, &freepath);
+ if (!error) {
+ *newpath = malloc(strlen(fullpath) + strlen(filename) + 2, M_TEMP, M_WAITOK | M_ZERO);
+ *freebuf = freepath;
+ sprintf(*newpath, "%s/%s", fullpath, filename);
+ }
+
+ return (error);
+}
+
+
int
linux_creat(struct thread *td, struct linux_creat_args *args)
{
@@ -177,62 +234,6 @@
return error;
}
-/*
- * common code for linux *at set of syscalls
- *
- * works like this:
- * if filename is absolute
- * ignore dirfd
- * else
- * if dirfd == AT_FDCWD
- * return CWD/filename
- * else
- * return DIRFD/filename
- */
-static int
-linux_at(struct thread *td, int dirfd, char *filename, char **newpath, char **freebuf)
-{
- struct file *fp;
- int error = 0;
- struct vnode *dvp;
- struct filedesc *fdp = td->td_proc->p_fd;
- char *fullpath = "unknown";
- char *freepath = NULL;
-
- /* don't do anything if the pathname is absolute */
- if (*filename == '/') {
- *newpath= filename;
- return (0);
- }
-
- /* check for AT_FDWCD */
- if (dirfd == LINUX_AT_FDCWD) {
- FILEDESC_LOCK(fdp);
- dvp = fdp->fd_cdir;
- FILEDESC_UNLOCK(fdp);
- } else {
- error = fget(td, dirfd, &fp);
- if (error)
- return (error);
- dvp = fp->f_vnode;
- /* only a dir can be dfd */
- if (dvp->v_type != VDIR) {
- fdrop(fp, td);
- return (ENOTDIR);
- }
- fdrop(fp, td);
- }
-
- error = vn_fullpath(td, dvp, &fullpath, &freepath);
- if (!error) {
- *newpath = malloc(strlen(fullpath) + strlen(filename) + 2, M_TEMP, M_WAITOK | M_ZERO);
- *freebuf = freepath;
- sprintf(*newpath, "%s/%s", fullpath, filename);
- }
-
- return (error);
-}
-
int
linux_openat(struct thread *td, struct linux_openat_args *args)
{
@@ -658,6 +659,12 @@
}
int
+linux_unlinkat(struct thread *td, struct linux_unlinkat_args *args)
+{
+ return (ENOSYS);
+}
+
+int
linux_chdir(struct thread *td, struct linux_chdir_args *args)
{
char *path;
@@ -709,6 +716,12 @@
}
int
+linux_mkdirat(struct thread *td, struct linux_mkdirat_args *args)
+{
+ return (ENOSYS);
+}
+
+int
linux_rmdir(struct thread *td, struct linux_rmdir_args *args)
{
char *path;
@@ -750,6 +763,12 @@
}
int
+linux_renameat(struct thread *td, struct linux_renameat_args *args)
+{
+ return (ENOSYS);
+}
+
+int
linux_symlink(struct thread *td, struct linux_symlink_args *args)
{
char *path, *to;
@@ -774,6 +793,12 @@
}
int
+linux_symlinkat(struct thread *td, struct linux_symlinkat_args *args)
+{
+ return (ENOSYS);
+}
+
+int
linux_readlink(struct thread *td, struct linux_readlink_args *args)
{
char *name;
@@ -793,6 +818,12 @@
}
int
+linux_readlinkat(struct thread *td, struct linux_readlinkat_args *args)
+{
+ return (ENOSYS);
+}
+
+int
linux_truncate(struct thread *td, struct linux_truncate_args *args)
{
char *path;
@@ -850,6 +881,12 @@
}
int
+linux_linkat(struct thread *td, struct linux_linkat_args *args)
+{
+ return (ENOSYS);
+}
+
+int
linux_fdatasync(td, uap)
struct thread *td;
struct linux_fdatasync_args *uap;
@@ -1330,3 +1367,22 @@
LFREEPATH(path);
return (error);
}
+
+int
+linux_futimesat(struct thread *td, struct linux_futimesat_args *args)
+{
+ return (ENOSYS);
+}
+
+int
+linux_fstatat64(struct thread *td, struct linux_fstatat64_args *args)
+{
+ return (ENOSYS);
+}
+
+int
+linux_fchownat(struct thread *td, struct linux_fchownat_args *args)
+{
+ return (ENOSYS);
+}
+
==== //depot/projects/linuxolator/src/sys/compat/linux/linux_misc.c#63 (text+ko) ====
@@ -971,6 +971,12 @@
return (error);
}
+int
+linux_mknodat(struct thread *td, struct linux_mknodat_args *args)
+{
+ return (ENOSYS);
+}
+
/*
* UGH! This is just about the dumbest idea I've ever heard!!
*/
==== //depot/projects/linuxolator/src/sys/compat/linux/linux_util.h#3 (text+ko) ====
@@ -104,4 +104,7 @@
char *linux_get_char_devices(void);
void linux_free_get_char_devices(char *string);
+/* XXX: doesnt belong here */
+int linux_at(struct thread *td, int dirfd, char *filename, char **newpath, char **freebuf);
+
#endif /* !_LINUX_UTIL_H_ */
==== //depot/projects/linuxolator/src/sys/i386/linux/linux_dummy.c#10 (text+ko) ====
@@ -86,18 +86,6 @@
DUMMY(inotify_add_watch);
DUMMY(inotify_rm_watch);
DUMMY(migrate_pages);
-DUMMY(mkdirat);
-DUMMY(mknodat);
-DUMMY(fchownat);
-DUMMY(futimesat);
-DUMMY(fstatat64);
-DUMMY(unlinkat);
-DUMMY(renameat);
-DUMMY(linkat);
-DUMMY(symlinkat);
-DUMMY(readlinkat);
-DUMMY(fchmodat);
-DUMMY(faccessat);
DUMMY(pselect6);
DUMMY(ppoll);
DUMMY(unshare);
More information about the p4-projects
mailing list