Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
L
linux
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
nexedi
linux
Commits
1a060ba3
Commit
1a060ba3
authored
Apr 08, 2017
by
Al Viro
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
utimes: move compat syscalls from compat.c
Signed-off-by:
Al Viro
<
viro@zeniv.linux.org.uk
>
parent
e99ca56c
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
61 additions
and
63 deletions
+61
-63
fs/compat.c
fs/compat.c
+0
-58
fs/utimes.c
fs/utimes.c
+61
-5
No files found.
fs/compat.c
View file @
1a060ba3
...
...
@@ -54,64 +54,6 @@
#include <asm/ioctls.h>
#include "internal.h"
/*
* Not all architectures have sys_utime, so implement this in terms
* of sys_utimes.
*/
COMPAT_SYSCALL_DEFINE2
(
utime
,
const
char
__user
*
,
filename
,
struct
compat_utimbuf
__user
*
,
t
)
{
struct
timespec
tv
[
2
];
if
(
t
)
{
if
(
get_user
(
tv
[
0
].
tv_sec
,
&
t
->
actime
)
||
get_user
(
tv
[
1
].
tv_sec
,
&
t
->
modtime
))
return
-
EFAULT
;
tv
[
0
].
tv_nsec
=
0
;
tv
[
1
].
tv_nsec
=
0
;
}
return
do_utimes
(
AT_FDCWD
,
filename
,
t
?
tv
:
NULL
,
0
);
}
COMPAT_SYSCALL_DEFINE4
(
utimensat
,
unsigned
int
,
dfd
,
const
char
__user
*
,
filename
,
struct
compat_timespec
__user
*
,
t
,
int
,
flags
)
{
struct
timespec
tv
[
2
];
if
(
t
)
{
if
(
compat_get_timespec
(
&
tv
[
0
],
&
t
[
0
])
||
compat_get_timespec
(
&
tv
[
1
],
&
t
[
1
]))
return
-
EFAULT
;
if
(
tv
[
0
].
tv_nsec
==
UTIME_OMIT
&&
tv
[
1
].
tv_nsec
==
UTIME_OMIT
)
return
0
;
}
return
do_utimes
(
dfd
,
filename
,
t
?
tv
:
NULL
,
flags
);
}
COMPAT_SYSCALL_DEFINE3
(
futimesat
,
unsigned
int
,
dfd
,
const
char
__user
*
,
filename
,
struct
compat_timeval
__user
*
,
t
)
{
struct
timespec
tv
[
2
];
if
(
t
)
{
if
(
get_user
(
tv
[
0
].
tv_sec
,
&
t
[
0
].
tv_sec
)
||
get_user
(
tv
[
0
].
tv_nsec
,
&
t
[
0
].
tv_usec
)
||
get_user
(
tv
[
1
].
tv_sec
,
&
t
[
1
].
tv_sec
)
||
get_user
(
tv
[
1
].
tv_nsec
,
&
t
[
1
].
tv_usec
))
return
-
EFAULT
;
if
(
tv
[
0
].
tv_nsec
>=
1000000
||
tv
[
0
].
tv_nsec
<
0
||
tv
[
1
].
tv_nsec
>=
1000000
||
tv
[
1
].
tv_nsec
<
0
)
return
-
EINVAL
;
tv
[
0
].
tv_nsec
*=
1000
;
tv
[
1
].
tv_nsec
*=
1000
;
}
return
do_utimes
(
dfd
,
filename
,
t
?
tv
:
NULL
,
0
);
}
COMPAT_SYSCALL_DEFINE2
(
utimes
,
const
char
__user
*
,
filename
,
struct
compat_timeval
__user
*
,
t
)
{
return
compat_sys_futimesat
(
AT_FDCWD
,
filename
,
t
);
}
static
int
cp_compat_stat
(
struct
kstat
*
stat
,
struct
compat_stat
__user
*
ubuf
)
{
struct
compat_stat
tmp
;
...
...
fs/utimes.c
View file @
1a060ba3
#include <linux/compiler.h>
#include <linux/file.h>
#include <linux/fs.h>
#include <linux/linkage.h>
#include <linux/mount.h>
#include <linux/namei.h>
#include <linux/sched.h>
#include <linux/stat.h>
#include <linux/utime.h>
#include <linux/syscalls.h>
#include <linux/uaccess.h>
#include <linux/compat.h>
#include <asm/unistd.h>
#ifdef __ARCH_WANT_SYS_UTIME
...
...
@@ -219,3 +215,63 @@ SYSCALL_DEFINE2(utimes, char __user *, filename,
{
return
sys_futimesat
(
AT_FDCWD
,
filename
,
utimes
);
}
#ifdef CONFIG_COMPAT
/*
* Not all architectures have sys_utime, so implement this in terms
* of sys_utimes.
*/
COMPAT_SYSCALL_DEFINE2
(
utime
,
const
char
__user
*
,
filename
,
struct
compat_utimbuf
__user
*
,
t
)
{
struct
timespec
tv
[
2
];
if
(
t
)
{
if
(
get_user
(
tv
[
0
].
tv_sec
,
&
t
->
actime
)
||
get_user
(
tv
[
1
].
tv_sec
,
&
t
->
modtime
))
return
-
EFAULT
;
tv
[
0
].
tv_nsec
=
0
;
tv
[
1
].
tv_nsec
=
0
;
}
return
do_utimes
(
AT_FDCWD
,
filename
,
t
?
tv
:
NULL
,
0
);
}
COMPAT_SYSCALL_DEFINE4
(
utimensat
,
unsigned
int
,
dfd
,
const
char
__user
*
,
filename
,
struct
compat_timespec
__user
*
,
t
,
int
,
flags
)
{
struct
timespec
tv
[
2
];
if
(
t
)
{
if
(
compat_get_timespec
(
&
tv
[
0
],
&
t
[
0
])
||
compat_get_timespec
(
&
tv
[
1
],
&
t
[
1
]))
return
-
EFAULT
;
if
(
tv
[
0
].
tv_nsec
==
UTIME_OMIT
&&
tv
[
1
].
tv_nsec
==
UTIME_OMIT
)
return
0
;
}
return
do_utimes
(
dfd
,
filename
,
t
?
tv
:
NULL
,
flags
);
}
COMPAT_SYSCALL_DEFINE3
(
futimesat
,
unsigned
int
,
dfd
,
const
char
__user
*
,
filename
,
struct
compat_timeval
__user
*
,
t
)
{
struct
timespec
tv
[
2
];
if
(
t
)
{
if
(
get_user
(
tv
[
0
].
tv_sec
,
&
t
[
0
].
tv_sec
)
||
get_user
(
tv
[
0
].
tv_nsec
,
&
t
[
0
].
tv_usec
)
||
get_user
(
tv
[
1
].
tv_sec
,
&
t
[
1
].
tv_sec
)
||
get_user
(
tv
[
1
].
tv_nsec
,
&
t
[
1
].
tv_usec
))
return
-
EFAULT
;
if
(
tv
[
0
].
tv_nsec
>=
1000000
||
tv
[
0
].
tv_nsec
<
0
||
tv
[
1
].
tv_nsec
>=
1000000
||
tv
[
1
].
tv_nsec
<
0
)
return
-
EINVAL
;
tv
[
0
].
tv_nsec
*=
1000
;
tv
[
1
].
tv_nsec
*=
1000
;
}
return
do_utimes
(
dfd
,
filename
,
t
?
tv
:
NULL
,
0
);
}
COMPAT_SYSCALL_DEFINE2
(
utimes
,
const
char
__user
*
,
filename
,
struct
compat_timeval
__user
*
,
t
)
{
return
compat_sys_futimesat
(
AT_FDCWD
,
filename
,
t
);
}
#endif
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment