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
8 #include <minix/callnr.h>
14 #include <minix/vfsif.h>
17 /*===========================================================================*
19 *===========================================================================*/
22 /* Perform the utime(name, timep) system call. */
26 time_t actime
, modtime
;
29 /* Adjust for case of 'timep' being NULL;
30 * utime_strlen then holds the actual size: strlen(name)+1 */
31 len
= m_in
.utime_length
;
32 if(len
== 0) len
= m_in
.utime_strlen
;
34 /* Temporarily open the file */
35 if (fetch_name(m_in
.utime_file
, len
, M1
) != OK
) return(err_code
);
36 if ((vp
= eat_path(PATH_NOFLAGS
)) == NIL_VNODE
) return(err_code
);
38 /* Only the owner of a file or the super user can change its name. */
40 if (vp
->v_uid
!= fp
->fp_effuid
&& fp
->fp_effuid
!= SU_UID
) r
= EPERM
;
41 if (m_in
.utime_length
== 0 && r
!= OK
) r
= forbidden(vp
, W_BIT
);
42 if (read_only(vp
) != OK
) r
= EROFS
; /* Not even su can touch if R/O */
45 if(m_in
.utime_length
== 0) {
46 actime
= modtime
= clock_time();
48 actime
= m_in
.utime_actime
;
49 modtime
= m_in
.utime_modtime
;
51 r
= req_utime(vp
->v_fs_e
, vp
->v_inode_nr
, actime
, modtime
);