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 * do_stime: PM informs FS about STIME system call
9 #include <minix/callnr.h>
10 #include <minix/com.h>
16 /*===========================================================================*
18 *===========================================================================*/
21 /* Perform the utime(name, timep) system call. */
23 register struct inode
*rip
;
26 /* Adjust for case of 'timep' being NULL;
27 * utime_strlen then holds the actual size: strlen(name)+1.
29 len
= m_in
.utime_length
;
30 if (len
== 0) len
= m_in
.utime_strlen
;
32 /* Temporarily open the file. */
33 if (fetch_name(m_in
.utime_file
, len
, M1
) != OK
) return(err_code
);
34 if ( (rip
= eat_path(user_path
)) == NIL_INODE
) return(err_code
);
36 /* Only the owner of a file or the super_user can change its time. */
38 if (rip
->i_uid
!= fp
->fp_effuid
&& !super_user
) r
= EPERM
;
39 if (m_in
.utime_length
== 0 && r
!= OK
) r
= forbidden(rip
, W_BIT
);
40 if (read_only(rip
) != OK
) r
= EROFS
; /* not even su can touch if R/O */
42 if (m_in
.utime_length
== 0) {
43 rip
->i_atime
= clock_time();
44 rip
->i_mtime
= rip
->i_atime
;
46 rip
->i_atime
= m_in
.utime_actime
;
47 rip
->i_mtime
= m_in
.utime_modtime
;
49 rip
->i_update
= CTIME
; /* discard any stale ATIME and MTIME flags */
57 /*===========================================================================*
59 *===========================================================================*/
62 /* Perform the stime(tp) system call. */
63 boottime
= (long) m_in
.pm_stime
;