Skip to content

Commit

Permalink
zos: make platform functional
Browse files Browse the repository at this point in the history
Fix all functional test cases:

* use PLO compare,swap,store for atomic instruction
* do not use semaphore.h
* use xplink flag when linking
* scandir implementation
* nanosleep implementation
* add proctitle
* uv_loadavg
* uv_fs_event_init/start
* uv_fs_event_stop
* uv_exepath using __getthent syscall
* read free/total memory from mvs data areas
* uv_resident_set_memory implementation
* network interfaces implementation
* cpu_info implementation
* implement uv__hrtime
* make uv__fs_mkdtemp implementation
* epoll implementation for asyncio
* uv__fs_event_close implementation
* set process title
* read ancillary data that remains on queue
* ancillary data
* implement uv__fs_access
* use /dev/urandom for temporary directory name
* disable proctitle on zos completely

PR-URL: #1037
Reviewed-By: Saúl Ibarra Corretgé <saghul@gmail.com>
  • Loading branch information
jBarz authored and saghul committed Jan 18, 2017
1 parent 36ba7eb commit 011e02e
Show file tree
Hide file tree
Showing 12 changed files with 1,309 additions and 15 deletions.
6 changes: 4 additions & 2 deletions Makefile.am
Original file line number Diff line number Diff line change
Expand Up @@ -402,8 +402,10 @@ libuv_la_CFLAGS += -D_UNIX03_THREADS \
-qFLOAT=IEEE
libuv_la_LDFLAGS += -qXPLINK
libuv_la_SOURCES += src/unix/pthread-fixes.c \
src/unix/pthread-barrier.c
libuv_la_SOURCES += src/unix/os390.c
src/unix/pthread-barrier.c \
src/unix/os390.c \
src/unix/os390-syscalls.c \
src/unix/proctitle.c
endif

if HAVE_PKG_CONFIG
Expand Down
2 changes: 2 additions & 0 deletions include/pthread-barrier.h
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,9 @@ OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#define _UV_PTHREAD_BARRIER_
#include <errno.h>
#include <pthread.h>
#if !defined(__MVS__)
#include <semaphore.h> /* sem_t */
#endif

#define PTHREAD_BARRIER_SERIAL_THREAD 0x12345

Expand Down
3 changes: 3 additions & 0 deletions include/uv-os390.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,4 +24,7 @@

#define UV_PLATFORM_SEM_T int

#define UV_PLATFORM_LOOP_FIELDS \
void* ep; \

#endif /* UV_MVS_H */
4 changes: 4 additions & 0 deletions include/uv-unix.h
Original file line number Diff line number Diff line change
Expand Up @@ -36,14 +36,18 @@
#include <termios.h>
#include <pwd.h>

#if !defined(__MVS__)
#include <semaphore.h>
#endif
#include <pthread.h>
#include <signal.h>

#include "uv-threadpool.h"

#if defined(__linux__)
# include "uv-linux.h"
#elif defined (__MVS__)
# include "uv-os390.h"
#elif defined(_AIX)
# include "uv-aix.h"
#elif defined(__sun)
Expand Down
27 changes: 18 additions & 9 deletions src/unix/atomic-ops.h
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,12 @@ UV_UNUSED(static int cmpxchgi(int* ptr, int oldval, int newval)) {
__compare_and_swap(ptr, &oldval, newval);
return out;
#elif defined(__MVS__)
return __plo_CS(ptr, (unsigned int*) ptr,
oldval, (unsigned int*) &newval);
unsigned int op4;
if (__plo_CSST(ptr, (unsigned int*) &oldval, newval,
(unsigned int*) ptr, *ptr, &op4))
return oldval;
else
return op4;
#else
return __sync_val_compare_and_swap(ptr, oldval, newval);
#endif
Expand All @@ -67,13 +71,18 @@ UV_UNUSED(static long cmpxchgl(long* ptr, long oldval, long newval)) {
# endif /* if defined(__64BIT__) */
return out;
#elif defined (__MVS__)
# ifdef _LP64
return __plo_CSGR(ptr, (unsigned long long*) ptr,
oldval, (unsigned long long*) &newval);
# else
return __plo_CS(ptr, (unsigned int*) ptr,
oldval, (unsigned int*) &newval);
# endif
#ifdef _LP64
unsigned long long op4;
if (__plo_CSSTGR(ptr, (unsigned long long*) &oldval, newval,
(unsigned long long*) ptr, *ptr, &op4))
#else
unsigned long op4;
if (__plo_CSST(ptr, (unsigned int*) &oldval, newval,
(unsigned int*) ptr, *ptr, &op4))
#endif
return oldval;
else
return op4;
#else
return __sync_val_compare_and_swap(ptr, oldval, newval);
#endif
Expand Down
3 changes: 3 additions & 0 deletions src/unix/core.c
Original file line number Diff line number Diff line change
Expand Up @@ -517,6 +517,9 @@ int uv__close_nocheckstdio(int fd) {

int uv__close(int fd) {
assert(fd > STDERR_FILENO); /* Catch stdio close bugs. */
#if defined(__MVS__)
epoll_file_close(fd);
#endif
return uv__close_nocheckstdio(fd);
}

Expand Down
4 changes: 4 additions & 0 deletions src/unix/internal.h
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,10 @@
# include "linux-syscalls.h"
#endif /* __linux__ */

#if defined(__MVS__)
# include "os390-syscalls.h"
#endif /* __MVS__ */

#if defined(__sun)
# include <sys/port.h>
# include <port.h>
Expand Down
Loading

0 comments on commit 011e02e

Please sign in to comment.