vm: remove leftover diag print
[minix.git] / servers / vfs / time.c
blob7ee63e57b46cedf0406c66b6cd04728b9915641b
1 /* This file takes care of those system calls that deal with time.
3 * The entry points into this file are
4 * do_utime: perform the UTIME system call
5 */
7 #include "fs.h"
8 #include <minix/callnr.h>
9 #include <minix/com.h>
10 #include "file.h"
11 #include "fproc.h"
12 #include "param.h"
13 #include "vnode.h"
14 #include <minix/vfsif.h>
15 #include "vmnt.h"
17 /*===========================================================================*
18 * do_utime *
19 *===========================================================================*/
20 PUBLIC int do_utime()
22 /* Perform the utime(name, timep) system call. */
23 register int len;
24 int r;
25 time_t actime, modtime;
26 struct vnode *vp;
28 /* Adjust for case of 'timep' being NULL;
29 * utime_strlen then holds the actual size: strlen(name)+1 */
30 len = m_in.utime_length;
31 if(len == 0) len = m_in.utime_strlen;
33 /* Temporarily open the file */
34 if (fetch_name(m_in.utime_file, len, M1) != OK) return(err_code);
35 if ((vp = eat_path(PATH_NOFLAGS)) == NIL_VNODE) return(err_code);
37 /* Only the owner of a file or the super user can change its name. */
38 r = OK;
39 if (vp->v_uid != fp->fp_effuid && fp->fp_effuid != SU_UID) r = EPERM;
40 if (m_in.utime_length == 0 && r != OK) r = forbidden(vp, W_BIT);
41 if (read_only(vp) != OK) r = EROFS; /* Not even su can touch if R/O */
42 if (r == OK) {
43 /* Issue request */
44 if(m_in.utime_length == 0) {
45 actime = modtime = clock_time();
46 } else {
47 actime = m_in.utime_actime;
48 modtime = m_in.utime_modtime;
50 r = req_utime(vp->v_fs_e, vp->v_inode_nr, actime, modtime);
53 put_vnode(vp);
54 return(r);