Skip to content

Commit aa147e7

Browse files
authored
Use utimes from musl (#16282)
Followup to #16262
1 parent 27de9b4 commit aa147e7

File tree

2 files changed

+1
-46
lines changed

2 files changed

+1
-46
lines changed

src/library.js

Lines changed: 0 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -69,51 +69,6 @@ LibraryManager.library = {
6969
return cString;
7070
},
7171

72-
// ==========================================================================
73-
// utime.h
74-
// ==========================================================================
75-
76-
#if FILESYSTEM
77-
$setFileTime__deps: ['$FS', '$setErrNo'],
78-
$setFileTime: function(path, time) {
79-
path = UTF8ToString(path);
80-
try {
81-
FS.utime(path, time, time);
82-
return 0;
83-
} catch (e) {
84-
if (!(e instanceof FS.ErrnoError)) throw e + ' : ' + stackTrace();
85-
setErrNo(e.errno);
86-
return -1;
87-
}
88-
},
89-
#else
90-
$setFileTime__deps: ['$setErrNo'],
91-
$setFileTime: function(path, time) {
92-
// No filesystem support; return an error as if the file does not exist
93-
// (which it almost certainly does not, except for standard streams).
94-
setErrNo({{{ cDefine('ENOENT') }}});
95-
return -1;
96-
},
97-
#endif
98-
99-
utimes__deps: ['$setFileTime'],
100-
utimes__proxy: 'sync',
101-
utimes__sig: 'iii',
102-
utimes: function(path, times) {
103-
// utimes is just like utime but take an array of 2 times: `struct timeval times[2]`
104-
// times[0] is the new access time (which we currently ignore)
105-
// times[1] is the new modification time.
106-
var time;
107-
if (times) {
108-
var mtime = times + {{{ C_STRUCTS.timeval.__size__ }}};
109-
time = {{{ makeGetValue('mtime', C_STRUCTS.timeval.tv_sec, 'i32') }}} * 1000;
110-
time += {{{ makeGetValue('mtime', C_STRUCTS.timeval.tv_usec, 'i32') }}} / 1000;
111-
} else {
112-
time = Date.now();
113-
}
114-
return setFileTime(path, time);
115-
},
116-
11772
exit__sig: 'vi',
11873
#if MINIMAL_RUNTIME
11974
// minimal runtime doesn't do any exit cleanup handling so just

tools/system_libs.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -916,7 +916,7 @@ def get_files(self):
916916

917917
libc_files += files_in_path(
918918
path='system/lib/libc/musl/src/linux',
919-
filenames=['getdents.c', 'gettid.c'])
919+
filenames=['getdents.c', 'gettid.c', 'utimes.c'])
920920
libc_files += files_in_path(
921921
path='system/lib/libc/musl/src/env',
922922
filenames=['__environ.c', 'getenv.c', 'putenv.c', 'setenv.c', 'unsetenv.c'])

0 commit comments

Comments
 (0)