Conflicts:
	AUTHORS
This commit is contained in:
Alon Zakai 2014-08-12 14:45:18 -07:00
Родитель d83e83b062 045157e7c0
Коммит b8c49ac75f
4 изменённых файлов: 162 добавлений и 80 удалений

Просмотреть файл

@ -155,4 +155,5 @@ a license to everyone to use it as detailed in LICENSE.)
* Zachary Pomerantz <zmp@umich.edu>
* Boris Tsarev <boristsarev@gmail.com>
* Mark Logan <mark@artillery.com> (copyright owned by Artillery Games, Inc.)
* Коренберг Марк <socketpair@gmail.com>

Просмотреть файл

@ -1148,14 +1148,6 @@ LibraryManager.library = {
return -1;
}
},
alarm: function(seconds) {
// unsigned alarm(unsigned seconds);
// http://pubs.opengroup.org/onlinepubs/000095399/functions/alarm.html
// We don't support signals, and there's no way to indicate failure, so just
// fail silently.
return 0;
},
ualarm: 'alarm',
confstr__deps: ['__setErrNo', '$ERRNO_CODES', '$ENV'],
confstr: function(name, buf, len) {
// size_t confstr(int name, char *buf, size_t len);
@ -1354,14 +1346,6 @@ LibraryManager.library = {
___setErrNo(ERRNO_CODES.EPERM);
return 0;
},
pause__deps: ['__setErrNo', '$ERRNO_CODES'],
pause: function() {
// int pause(void);
// http://pubs.opengroup.org/onlinepubs/000095399/functions/pause.html
// We don't support signals, so we return immediately.
___setErrNo(ERRNO_CODES.EINTR);
return -1;
},
setgid__deps: ['__setErrNo', '$ERRNO_CODES'],
setgid: function(gid) {
// int setgid(gid_t gid);
@ -5670,9 +5654,6 @@ LibraryManager.library = {
return 0;
},
setitimer: function() { throw 'setitimer not implemented yet' },
getitimer: function() { throw 'getitimer not implemented yet' },
// ==========================================================================
// sys/time.h
// ==========================================================================
@ -5861,66 +5842,6 @@ LibraryManager.library = {
_longjmp(env, value);
},
// ==========================================================================
// signal.h
// ==========================================================================
signal: function(sig, func) {
// TODO
return 0;
},
sigemptyset: function(set) {
// int sigemptyset(sigset_t *set);
{{{ makeSetValue('set', '0', '0', 'i32') }}};
return 0;
},
sigfillset: function(set) {
{{{ makeSetValue('set', '0', '-1>>>0', 'i32') }}};
return 0;
},
sigaddset: function(set, signum) {
{{{ makeSetValue('set', '0', makeGetValue('set', '0', 'i32') + '| (1 << (signum-1))', 'i32') }}};
return 0;
},
sigdelset: function(set, signum) {
{{{ makeSetValue('set', '0', makeGetValue('set', '0', 'i32') + '& (~(1 << (signum-1)))', 'i32') }}};
return 0;
},
sigismember: function(set, signum) {
return {{{ makeGetValue('set', '0', 'i32') }}} & (1 << (signum-1));
},
sigaction: function(set) {
// TODO:
return 0;
},
sigprocmask: 'sigaction',
__libc_current_sigrtmin: function() {
return 0;
},
__libc_current_sigrtmax: function() {
return 0;
},
kill__deps: ['$ERRNO_CODES', '__setErrNo'],
kill: function(pid, sig) {
// int kill(pid_t pid, int sig);
// http://pubs.opengroup.org/onlinepubs/000095399/functions/kill.html
// Makes no sense in a single-process environment.
___setErrNo(ERRNO_CODES.EPERM);
return -1;
},
killpg: 'kill',
siginterrupt: function() { throw 'siginterrupt not implemented' },
raise__deps: ['$ERRNO_CODES', '__setErrNo'],
raise: function(sig) {
___setErrNo(ERRNO_CODES.ENOSYS);
#if ASSERTIONS
Runtime.warnOnce('raise() returning an error as we do not support it');
#endif
return -1;
},
// ==========================================================================
// sys/wait.h
// ==========================================================================

135
src/library_signals.js Normal file
Просмотреть файл

@ -0,0 +1,135 @@
// 'use strict'
var funs = {
signal: function(sig, func) {
Module.printErr('Calling stub instead of signal()');
return 0;
},
sigemptyset: function(set) {
{{{ makeSetValue('set', '0', '0', 'i32') }}};
return 0;
},
sigfillset: function(set) {
{{{ makeSetValue('set', '0', '-1>>>0', 'i32') }}};
return 0;
},
sigaddset: function(set, signum) {
{{{ makeSetValue('set', '0', makeGetValue('set', '0', 'i32') + '| (1 << (signum-1))', 'i32') }}};
return 0;
},
sigdelset: function(set, signum) {
{{{ makeSetValue('set', '0', makeGetValue('set', '0', 'i32') + '& (~(1 << (signum-1)))', 'i32') }}};
return 0;
},
sigismember: function(set, signum) {
return {{{ makeGetValue('set', '0', 'i32') }}} & (1 << (signum-1));
},
sigaction: function(signum, act, oldact) {
//int sigaction(int signum, const struct sigaction *act, struct sigaction *oldact);
Module.printErr('Calling stub instead of sigaction()');
return 0;
},
sigprocmask: function() {
Module.printErr('Calling stub instead of sigprocmask()');
return 0;
},
__libc_current_sigrtmin: function() {
Module.printErr('Calling stub instead of __libc_current_sigrtmin');
return 0;
},
__libc_current_sigrtmax: function() {
Module.printErr('Calling stub instead of __libc_current_sigrtmax');
return 0;
},
kill__deps: ['$ERRNO_CODES', '__setErrNo'],
kill: function(pid, sig) {
// http://pubs.opengroup.org/onlinepubs/000095399/functions/kill.html
// Makes no sense in a single-process environment.
// Should kill itself somtimes depending on `pid`
Module.printErr('Calling stub instead of kill()');
___setErrNo(ERRNO_CODES.EPERM);
return -1;
},
killpg__deps: ['$ERRNO_CODES', '__setErrNo'],
killpg: function() {
Module.printErr('Calling stub instead of killpg()');
___setErrNo(ERRNO_CODES.EPERM);
return -1;
},
siginterrupt: function() {
Module.printErr('Calling stub instead of siginterrupt()');
return 0;
},
raise__deps: ['$ERRNO_CODES', '__setErrNo'],
raise: function(sig) {
Module.printErr('Calling stub instead of raise()');
___setErrNo(ERRNO_CODES.ENOSYS);
#if ASSERTIONS
Runtime.warnOnce('raise() returning an error as we do not support it');
#endif
return -1;
},
alarm: function(seconds) {
// unsigned alarm(unsigned seconds);
// http://pubs.opengroup.org/onlinepubs/000095399/functions/alarm.html
// We don't support signals, and there's no way to indicate failure, so just
// fail silently.
throw 'alarm() is not implemented yet';
},
ualarm: function() {
throw 'ualarm() is not implemented yet';
},
setitimer: function() {
throw 'setitimer() is not implemented yet';
},
getitimer: function() {
throw 'getitimer() is not implemented yet';
},
pause__deps: ['__setErrNo', '$ERRNO_CODES'],
pause: function() {
// int pause(void);
// http://pubs.opengroup.org/onlinepubs/000095399/functions/pause.html
// We don't support signals, so we return immediately.
Module.printErr('Calling stub instead of pause()');
___setErrNo(ERRNO_CODES.EINTR);
return -1;
}
//signalfd
//ppoll
//epoll_pwait
//pselect
//sigvec
//sigmask
//sigblock
//sigsetmask
//siggetmask
//sigpending
//sigsuspend
//bsd_signal
//siginterrupt
//sigqueue
//sysv_signal
//signal
//pthread_kill
//gsignal
//ssignal
//psignal
//psiginfo
//sigpause
//sigisemptyset
//sigtimedwait
//sigwaitinfo
//sigreturn
//sigstack
//sigaltstack(2)
//sigsetops(3),
//sighold
//sigrelse
//sigignore
//sigset
};
mergeInto(LibraryManager.library, funs);

Просмотреть файл

@ -425,7 +425,32 @@ var LibraryManager = {
load: function() {
if (this.library) return;
var libraries = ['library.js', 'library_path.js', 'library_fs.js', 'library_idbfs.js', 'library_memfs.js', 'library_nodefs.js', 'library_sockfs.js', 'library_tty.js', 'library_browser.js', 'library_sdl.js', 'library_gl.js', 'library_glut.js', 'library_xlib.js', 'library_egl.js', 'library_gc.js', 'library_jansson.js', 'library_openal.js', 'library_glfw.js', 'library_uuid.js', 'library_glew.js', 'library_html5.js', 'library_async.js'].concat(additionalLibraries);
var libraries = [
'library.js',
'library_path.js',
'library_fs.js',
'library_idbfs.js',
'library_memfs.js',
'library_nodefs.js',
'library_sockfs.js',
'library_tty.js',
'library_browser.js',
'library_sdl.js',
'library_gl.js',
'library_glut.js',
'library_xlib.js',
'library_egl.js',
'library_gc.js',
'library_jansson.js',
'library_openal.js',
'library_glfw.js',
'library_uuid.js',
'library_glew.js',
'library_html5.js',
'library_signals.js',
'library_async.js'
].concat(additionalLibraries);
for (var i = 0; i < libraries.length; i++) {
var filename = libraries[i];
var src = read(filename);