diff options
author | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-16 18:49:26 +0900 |
---|---|---|
committer | Jari Vetoniemi <jari.vetoniemi@indooratlas.com> | 2020-03-30 00:39:06 +0900 |
commit | fcbf63e62c627deae76c1b8cb8c0876c536ed811 (patch) | |
tree | 64cb17de3f41a2b6fef2368028fbd00349946994 /jni/ruby/ext/etc |
Fresh start
Diffstat (limited to 'jni/ruby/ext/etc')
-rw-r--r-- | jni/ruby/ext/etc/Makefile | 278 | ||||
-rw-r--r-- | jni/ruby/ext/etc/constdefs.h | 1494 | ||||
-rw-r--r-- | jni/ruby/ext/etc/depend | 9 | ||||
-rw-r--r-- | jni/ruby/ext/etc/etc.c | 1199 | ||||
-rw-r--r-- | jni/ruby/ext/etc/extconf.h | 18 | ||||
-rw-r--r-- | jni/ruby/ext/etc/extconf.rb | 43 | ||||
-rw-r--r-- | jni/ruby/ext/etc/mkconstants.rb | 331 |
7 files changed, 3372 insertions, 0 deletions
diff --git a/jni/ruby/ext/etc/Makefile b/jni/ruby/ext/etc/Makefile new file mode 100644 index 0000000..da47e67 --- /dev/null +++ b/jni/ruby/ext/etc/Makefile @@ -0,0 +1,278 @@ + +SHELL = /bin/sh + +# V=0 quiet, V=1 verbose. other values don't work. +V = 0 +Q1 = $(V:1=) +Q = $(Q1:0=@) +ECHO1 = $(V:1=@:) +ECHO = $(ECHO1:0=@echo) +NULLCMD = : + +#### Start of system configuration section. #### +top_srcdir = $(topdir)/. +srcdir = $(top_srcdir)/ext/etc +topdir = ../.. +hdrdir = $(top_srcdir)/include +arch_hdrdir = $(extout)/include/$(arch) +PATH_SEPARATOR = : +VPATH = $(srcdir):$(arch_hdrdir)/ruby:$(hdrdir)/ruby +RUBYLIB = +RUBYOPT = - +prefix = $(DESTDIR)/usr/local +rubysitearchprefix = $(rubylibprefix)/$(sitearch) +rubyarchprefix = $(rubylibprefix)/$(arch) +rubylibprefix = $(libdir)/$(RUBY_BASE_NAME) +exec_prefix = $(prefix) +vendorarchhdrdir = $(vendorhdrdir)/$(sitearch) +sitearchhdrdir = $(sitehdrdir)/$(sitearch) +rubyarchhdrdir = $(rubyhdrdir)/$(arch) +vendorhdrdir = $(rubyhdrdir)/vendor_ruby +sitehdrdir = $(rubyhdrdir)/site_ruby +rubyhdrdir = $(includedir)/$(RUBY_VERSION_NAME) +vendorarchdir = $(vendorlibdir)/$(sitearch) +vendorlibdir = $(vendordir)/$(ruby_version) +vendordir = $(rubylibprefix)/vendor_ruby +sitearchdir = $(sitelibdir)/$(sitearch) +sitelibdir = $(sitedir)/$(ruby_version) +sitedir = $(rubylibprefix)/site_ruby +rubyarchdir = $(rubylibdir)/$(arch) +rubylibdir = $(rubylibprefix)/$(ruby_version) +sitearchincludedir = $(includedir)/$(sitearch) +archincludedir = $(includedir)/$(arch) +sitearchlibdir = $(libdir)/$(sitearch) +archlibdir = $(libdir)/$(arch) +ridir = $(datarootdir)/$(RI_BASE_NAME) +mandir = $(datarootdir)/man +localedir = $(datarootdir)/locale +libdir = $(exec_prefix)/lib +psdir = $(docdir) +pdfdir = $(docdir) +dvidir = $(docdir) +htmldir = $(docdir) +infodir = $(datarootdir)/info +docdir = $(datarootdir)/doc/$(PACKAGE) +oldincludedir = $(DESTDIR)/usr/include +includedir = $(prefix)/include +localstatedir = $(prefix)/var +sharedstatedir = $(prefix)/com +sysconfdir = $(prefix)/etc +datadir = $(datarootdir) +datarootdir = $(prefix)/share +libexecdir = $(exec_prefix)/libexec +sbindir = $(exec_prefix)/sbin +bindir = $(exec_prefix)/bin +archdir = $(rubyarchdir) + + +CC = gcc +CXX = g++ +LIBRUBY = $(LIBRUBY_SO) +LIBRUBY_A = lib$(RUBY_SO_NAME)-static.a +LIBRUBYARG_SHARED = -Wl,-R$(libdir) -L$(libdir) -l$(RUBY_SO_NAME) +LIBRUBYARG_STATIC = -Wl,-R$(libdir) -L$(libdir) -l$(RUBY_SO_NAME)-static +empty = +OUTFLAG = -o $(empty) +COUTFLAG = -o $(empty) + +RUBY_EXTCONF_H = extconf.h +cflags = $(optflags) $(debugflags) $(warnflags) +optflags = -O3 -fno-fast-math +debugflags = -ggdb3 +warnflags = -Wall -Wextra -Wno-unused-parameter -Wno-parentheses -Wno-long-long -Wno-missing-field-initializers -Wunused-variable -Wpointer-arith -Wwrite-strings -Wdeclaration-after-statement -Wimplicit-function-declaration -Wdeprecated-declarations -Wno-packed-bitfield-compat +CCDLFLAGS = -fPIC +CFLAGS = $(CCDLFLAGS) $(cflags) -fPIC $(ARCH_FLAG) +INCFLAGS = -I. -I$(arch_hdrdir) -I$(hdrdir) -I$(srcdir) +DEFS = +CPPFLAGS = -DRUBY_EXTCONF_H=\"$(RUBY_EXTCONF_H)\" $(DEFS) $(cppflags) +CXXFLAGS = $(CCDLFLAGS) $(cxxflags) $(ARCH_FLAG) +ldflags = -L. -fstack-protector -rdynamic -Wl,-export-dynamic +dldflags = +ARCH_FLAG = +DLDFLAGS = $(ldflags) $(dldflags) $(ARCH_FLAG) +LDSHARED = $(CC) -shared +LDSHAREDXX = $(CXX) -shared +AR = ar +EXEEXT = + +RUBY_INSTALL_NAME = $(RUBY_BASE_NAME) +RUBY_SO_NAME = ruby +RUBYW_INSTALL_NAME = +RUBY_VERSION_NAME = $(RUBY_BASE_NAME)-$(ruby_version) +RUBYW_BASE_NAME = rubyw +RUBY_BASE_NAME = ruby + +arch = x86_64-linux +sitearch = $(arch) +ruby_version = 2.2.0 +ruby = $(topdir)/miniruby -I'$(topdir)' -I'$(top_srcdir)/lib' -I'$(extout)/$(arch)' -I'$(extout)/common' +RUBY = $(ruby) +ruby_headers = $(hdrdir)/ruby.h $(hdrdir)/ruby/ruby.h $(hdrdir)/ruby/defines.h $(hdrdir)/ruby/missing.h $(hdrdir)/ruby/intern.h $(hdrdir)/ruby/st.h $(hdrdir)/ruby/subst.h $(arch_hdrdir)/ruby/config.h $(RUBY_EXTCONF_H) + +RM = rm -f +RM_RF = $(RUBY) -run -e rm -- -rf +RMDIRS = rmdir --ignore-fail-on-non-empty -p +MAKEDIRS = /bin/mkdir -p +INSTALL = /usr/bin/install -c +INSTALL_PROG = $(INSTALL) -m 0755 +INSTALL_DATA = $(INSTALL) -m 644 +COPY = cp +TOUCH = exit > + +#### End of system configuration section. #### + +preload = + +libpath = . $(topdir) +LIBPATH = -L. -L$(topdir) +DEFFILE = + +CLEANFILES = mkmf.log +DISTCLEANFILES = constdefs.h +DISTCLEANDIRS = + +extout = $(topdir)/.ext +extout_prefix = $(extout)$(target_prefix)/ +target_prefix = +LOCAL_LIBS = +LIBS = $(LIBRUBYARG_SHARED) -lpthread -lgmp -ldl -lcrypt -lm -lc +ORIG_SRCS = etc.c +SRCS = $(ORIG_SRCS) +OBJS = etc.o +HDRS = $(srcdir)/extconf.h $(srcdir)/constdefs.h +TARGET = etc +TARGET_NAME = etc +TARGET_ENTRY = Init_$(TARGET_NAME) +DLLIB = $(TARGET).so +EXTSTATIC = +STATIC_LIB = $(TARGET).a + +TIMESTAMP_DIR = $(extout)/.timestamp +BINDIR = $(extout)/bin +RUBYCOMMONDIR = $(extout)/common +RUBYLIBDIR = $(RUBYCOMMONDIR)$(target_prefix) +RUBYARCHDIR = $(extout)/$(arch)$(target_prefix) +HDRDIR = $(extout)/include/ruby$(target_prefix) +ARCHHDRDIR = $(extout)/include/$(arch)/ruby$(target_prefix) + +TARGET_SO = $(RUBYARCHDIR)/$(DLLIB) +CLEANLIBS = $(RUBYARCHDIR)/$(TARGET).so +CLEANOBJS = *.o *.bak + +all: install +static: all +.PHONY: all install static install-so install-rb +.PHONY: clean clean-so clean-static clean-rb + +clean-static:: +clean-rb-default:: +clean-rb:: +clean-so:: +clean: clean-so clean-static clean-rb-default clean-rb + -$(Q)$(RM) $(CLEANLIBS) $(CLEANOBJS) $(CLEANFILES) .*.time + +distclean-rb-default:: +distclean-rb:: +distclean-so:: +distclean-static:: +distclean: clean distclean-so distclean-static distclean-rb-default distclean-rb + -$(Q)$(RM) Makefile $(RUBY_EXTCONF_H) conftest.* mkmf.log + -$(Q)$(RM) core ruby$(EXEEXT) *~ $(DISTCLEANFILES) + -$(Q)$(RMDIRS) $(DISTCLEANDIRS) 2> /dev/null || true + +realclean: distclean +install: install-so install-rb + +install-so: $(RUBYARCHDIR)/$(DLLIB) +clean-so:: + -$(Q)$(RM) $(RUBYARCHDIR)/$(DLLIB) + -$(Q)$(RMDIRS) $(RUBYARCHDIR) 2> /dev/null || true +clean-static:: + -$(Q)$(RM) $(STATIC_LIB) +install-rb: pre-install-rb install-rb-default +install-rb-default: pre-install-rb-default +pre-install-rb: Makefile +pre-install-rb-default: Makefile +pre-install-rb-default: + @$(NULLCMD) +$(TIMESTAMP_DIR)/.RUBYARCHDIR.time: + $(Q) $(MAKEDIRS) $(@D) $(RUBYARCHDIR) + $(Q) $(TOUCH) $@ + +site-install: site-install-so site-install-rb +site-install-so: install-so +site-install-rb: install-rb + +.SUFFIXES: .c .m .cc .mm .cxx .cpp .o .S + +.cc.o: + $(ECHO) compiling $(<) + $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.cc.S: + $(ECHO) translating $(<) + $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $< + +.mm.o: + $(ECHO) compiling $(<) + $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.mm.S: + $(ECHO) translating $(<) + $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $< + +.cxx.o: + $(ECHO) compiling $(<) + $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.cxx.S: + $(ECHO) translating $(<) + $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $< + +.cpp.o: + $(ECHO) compiling $(<) + $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -c $< + +.cpp.S: + $(ECHO) translating $(<) + $(Q) $(CXX) $(INCFLAGS) $(CPPFLAGS) $(CXXFLAGS) $(COUTFLAG)$@ -S $< + +.c.o: + $(ECHO) compiling $(<) + $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< + +.c.S: + $(ECHO) translating $(<) + $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $< + +.m.o: + $(ECHO) compiling $(<) + $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -c $< + +.m.S: + $(ECHO) translating $(<) + $(Q) $(CC) $(INCFLAGS) $(CPPFLAGS) $(CFLAGS) $(COUTFLAG)$@ -S $< + +$(RUBYARCHDIR)/$(DLLIB): $(OBJS) Makefile $(TIMESTAMP_DIR)/.RUBYARCHDIR.time + $(ECHO) linking shared-object $(DLLIB) + -$(Q)$(RM) $(@) + $(Q) $(LDSHARED) -o $@ $(OBJS) $(LIBPATH) $(DLDFLAGS) $(LOCAL_LIBS) $(LIBS) + +$(STATIC_LIB): $(OBJS) + -$(Q)$(RM) $(@) + $(ECHO) linking static-library $(@) + $(Q) $(AR) cru $@ $(OBJS) + -$(Q)ranlib $(@) 2> /dev/null || true + +### +$(OBJS): $(RUBY_EXTCONF_H) + +etc.o : etc.c constdefs.h $(HDRS) $(ruby_headers) \ + $(hdrdir)/ruby/io.h \ + $(hdrdir)/ruby/encoding.h \ + $(hdrdir)/ruby/oniguruma.h + +constdefs.h : $(srcdir)/mkconstants.rb + @echo "generating constant definitions" + @$(RUBY) $(srcdir)/mkconstants.rb -o constdefs.h + diff --git a/jni/ruby/ext/etc/constdefs.h b/jni/ruby/ext/etc/constdefs.h new file mode 100644 index 0000000..1098b52 --- /dev/null +++ b/jni/ruby/ext/etc/constdefs.h @@ -0,0 +1,1494 @@ +/* autogenerated file */ + +#if !defined(_SC_AIO_LISTIO_MAX) +# if defined(HAVE_CONST__SC_AIO_LISTIO_MAX) +# define _SC_AIO_LISTIO_MAX _SC_AIO_LISTIO_MAX +# endif +#endif +#if !defined(_SC_AIO_MAX) +# if defined(HAVE_CONST__SC_AIO_MAX) +# define _SC_AIO_MAX _SC_AIO_MAX +# endif +#endif +#if !defined(_SC_AIO_PRIO_DELTA_MAX) +# if defined(HAVE_CONST__SC_AIO_PRIO_DELTA_MAX) +# define _SC_AIO_PRIO_DELTA_MAX _SC_AIO_PRIO_DELTA_MAX +# endif +#endif +#if !defined(_SC_ARG_MAX) +# if defined(HAVE_CONST__SC_ARG_MAX) +# define _SC_ARG_MAX _SC_ARG_MAX +# endif +#endif +#if !defined(_SC_ATEXIT_MAX) +# if defined(HAVE_CONST__SC_ATEXIT_MAX) +# define _SC_ATEXIT_MAX _SC_ATEXIT_MAX +# endif +#endif +#if !defined(_SC_BC_BASE_MAX) +# if defined(HAVE_CONST__SC_BC_BASE_MAX) +# define _SC_BC_BASE_MAX _SC_BC_BASE_MAX +# endif +#endif +#if !defined(_SC_BC_DIM_MAX) +# if defined(HAVE_CONST__SC_BC_DIM_MAX) +# define _SC_BC_DIM_MAX _SC_BC_DIM_MAX +# endif +#endif +#if !defined(_SC_BC_SCALE_MAX) +# if defined(HAVE_CONST__SC_BC_SCALE_MAX) +# define _SC_BC_SCALE_MAX _SC_BC_SCALE_MAX +# endif +#endif +#if !defined(_SC_BC_STRING_MAX) +# if defined(HAVE_CONST__SC_BC_STRING_MAX) +# define _SC_BC_STRING_MAX _SC_BC_STRING_MAX +# endif +#endif +#if !defined(_SC_CHILD_MAX) +# if defined(HAVE_CONST__SC_CHILD_MAX) +# define _SC_CHILD_MAX _SC_CHILD_MAX +# endif +#endif +#if !defined(_SC_CLK_TCK) +# if defined(HAVE_CONST__SC_CLK_TCK) +# define _SC_CLK_TCK _SC_CLK_TCK +# endif +#endif +#if !defined(_SC_COLL_WEIGHTS_MAX) +# if defined(HAVE_CONST__SC_COLL_WEIGHTS_MAX) +# define _SC_COLL_WEIGHTS_MAX _SC_COLL_WEIGHTS_MAX +# endif +#endif +#if !defined(_SC_DELAYTIMER_MAX) +# if defined(HAVE_CONST__SC_DELAYTIMER_MAX) +# define _SC_DELAYTIMER_MAX _SC_DELAYTIMER_MAX +# endif +#endif +#if !defined(_SC_EXPR_NEST_MAX) +# if defined(HAVE_CONST__SC_EXPR_NEST_MAX) +# define _SC_EXPR_NEST_MAX _SC_EXPR_NEST_MAX +# endif +#endif +#if !defined(_SC_HOST_NAME_MAX) +# if defined(HAVE_CONST__SC_HOST_NAME_MAX) +# define _SC_HOST_NAME_MAX _SC_HOST_NAME_MAX +# endif +#endif +#if !defined(_SC_IOV_MAX) +# if defined(HAVE_CONST__SC_IOV_MAX) +# define _SC_IOV_MAX _SC_IOV_MAX +# endif +#endif +#if !defined(_SC_LINE_MAX) +# if defined(HAVE_CONST__SC_LINE_MAX) +# define _SC_LINE_MAX _SC_LINE_MAX +# endif +#endif +#if !defined(_SC_LOGIN_NAME_MAX) +# if defined(HAVE_CONST__SC_LOGIN_NAME_MAX) +# define _SC_LOGIN_NAME_MAX _SC_LOGIN_NAME_MAX +# endif +#endif +#if !defined(_SC_NGROUPS_MAX) +# if defined(HAVE_CONST__SC_NGROUPS_MAX) +# define _SC_NGROUPS_MAX _SC_NGROUPS_MAX +# endif +#endif +#if !defined(_SC_GETGR_R_SIZE_MAX) +# if defined(HAVE_CONST__SC_GETGR_R_SIZE_MAX) +# define _SC_GETGR_R_SIZE_MAX _SC_GETGR_R_SIZE_MAX +# endif +#endif +#if !defined(_SC_GETPW_R_SIZE_MAX) +# if defined(HAVE_CONST__SC_GETPW_R_SIZE_MAX) +# define _SC_GETPW_R_SIZE_MAX _SC_GETPW_R_SIZE_MAX +# endif +#endif +#if !defined(_SC_MQ_OPEN_MAX) +# if defined(HAVE_CONST__SC_MQ_OPEN_MAX) +# define _SC_MQ_OPEN_MAX _SC_MQ_OPEN_MAX +# endif +#endif +#if !defined(_SC_MQ_PRIO_MAX) +# if defined(HAVE_CONST__SC_MQ_PRIO_MAX) +# define _SC_MQ_PRIO_MAX _SC_MQ_PRIO_MAX +# endif +#endif +#if !defined(_SC_OPEN_MAX) +# if defined(HAVE_CONST__SC_OPEN_MAX) +# define _SC_OPEN_MAX _SC_OPEN_MAX +# endif +#endif +#if !defined(_SC_ADVISORY_INFO) +# if defined(HAVE_CONST__SC_ADVISORY_INFO) +# define _SC_ADVISORY_INFO _SC_ADVISORY_INFO +# endif +#endif +#if !defined(_SC_BARRIERS) +# if defined(HAVE_CONST__SC_BARRIERS) +# define _SC_BARRIERS _SC_BARRIERS +# endif +#endif +#if !defined(_SC_ASYNCHRONOUS_IO) +# if defined(HAVE_CONST__SC_ASYNCHRONOUS_IO) +# define _SC_ASYNCHRONOUS_IO _SC_ASYNCHRONOUS_IO +# endif +#endif +#if !defined(_SC_CLOCK_SELECTION) +# if defined(HAVE_CONST__SC_CLOCK_SELECTION) +# define _SC_CLOCK_SELECTION _SC_CLOCK_SELECTION +# endif +#endif +#if !defined(_SC_CPUTIME) +# if defined(HAVE_CONST__SC_CPUTIME) +# define _SC_CPUTIME _SC_CPUTIME +# endif +#endif +#if !defined(_SC_FSYNC) +# if defined(HAVE_CONST__SC_FSYNC) +# define _SC_FSYNC _SC_FSYNC +# endif +#endif +#if !defined(_SC_IPV6) +# if defined(HAVE_CONST__SC_IPV6) +# define _SC_IPV6 _SC_IPV6 +# endif +#endif +#if !defined(_SC_JOB_CONTROL) +# if defined(HAVE_CONST__SC_JOB_CONTROL) +# define _SC_JOB_CONTROL _SC_JOB_CONTROL +# endif +#endif +#if !defined(_SC_MAPPED_FILES) +# if defined(HAVE_CONST__SC_MAPPED_FILES) +# define _SC_MAPPED_FILES _SC_MAPPED_FILES +# endif +#endif +#if !defined(_SC_MEMLOCK) +# if defined(HAVE_CONST__SC_MEMLOCK) +# define _SC_MEMLOCK _SC_MEMLOCK +# endif +#endif +#if !defined(_SC_MEMLOCK_RANGE) +# if defined(HAVE_CONST__SC_MEMLOCK_RANGE) +# define _SC_MEMLOCK_RANGE _SC_MEMLOCK_RANGE +# endif +#endif +#if !defined(_SC_MEMORY_PROTECTION) +# if defined(HAVE_CONST__SC_MEMORY_PROTECTION) +# define _SC_MEMORY_PROTECTION _SC_MEMORY_PROTECTION +# endif +#endif +#if !defined(_SC_MESSAGE_PASSING) +# if defined(HAVE_CONST__SC_MESSAGE_PASSING) +# define _SC_MESSAGE_PASSING _SC_MESSAGE_PASSING +# endif +#endif +#if !defined(_SC_MONOTONIC_CLOCK) +# if defined(HAVE_CONST__SC_MONOTONIC_CLOCK) +# define _SC_MONOTONIC_CLOCK _SC_MONOTONIC_CLOCK +# endif +#endif +#if !defined(_SC_PRIORITIZED_IO) +# if defined(HAVE_CONST__SC_PRIORITIZED_IO) +# define _SC_PRIORITIZED_IO _SC_PRIORITIZED_IO +# endif +#endif +#if !defined(_SC_PRIORITY_SCHEDULING) +# if defined(HAVE_CONST__SC_PRIORITY_SCHEDULING) +# define _SC_PRIORITY_SCHEDULING _SC_PRIORITY_SCHEDULING +# endif +#endif +#if !defined(_SC_RAW_SOCKETS) +# if defined(HAVE_CONST__SC_RAW_SOCKETS) +# define _SC_RAW_SOCKETS _SC_RAW_SOCKETS +# endif +#endif +#if !defined(_SC_READER_WRITER_LOCKS) +# if defined(HAVE_CONST__SC_READER_WRITER_LOCKS) +# define _SC_READER_WRITER_LOCKS _SC_READER_WRITER_LOCKS +# endif +#endif +#if !defined(_SC_REALTIME_SIGNALS) +# if defined(HAVE_CONST__SC_REALTIME_SIGNALS) +# define _SC_REALTIME_SIGNALS _SC_REALTIME_SIGNALS +# endif +#endif +#if !defined(_SC_REGEXP) +# if defined(HAVE_CONST__SC_REGEXP) +# define _SC_REGEXP _SC_REGEXP +# endif +#endif +#if !defined(_SC_SAVED_IDS) +# if defined(HAVE_CONST__SC_SAVED_IDS) +# define _SC_SAVED_IDS _SC_SAVED_IDS +# endif +#endif +#if !defined(_SC_SEMAPHORES) +# if defined(HAVE_CONST__SC_SEMAPHORES) +# define _SC_SEMAPHORES _SC_SEMAPHORES +# endif +#endif +#if !defined(_SC_SHARED_MEMORY_OBJECTS) +# if defined(HAVE_CONST__SC_SHARED_MEMORY_OBJECTS) +# define _SC_SHARED_MEMORY_OBJECTS _SC_SHARED_MEMORY_OBJECTS +# endif +#endif +#if !defined(_SC_SHELL) +# if defined(HAVE_CONST__SC_SHELL) +# define _SC_SHELL _SC_SHELL +# endif +#endif +#if !defined(_SC_SPAWN) +# if defined(HAVE_CONST__SC_SPAWN) +# define _SC_SPAWN _SC_SPAWN +# endif +#endif +#if !defined(_SC_SPIN_LOCKS) +# if defined(HAVE_CONST__SC_SPIN_LOCKS) +# define _SC_SPIN_LOCKS _SC_SPIN_LOCKS +# endif +#endif +#if !defined(_SC_SPORADIC_SERVER) +# if defined(HAVE_CONST__SC_SPORADIC_SERVER) +# define _SC_SPORADIC_SERVER _SC_SPORADIC_SERVER +# endif +#endif +#if !defined(_SC_SS_REPL_MAX) +# if defined(HAVE_CONST__SC_SS_REPL_MAX) +# define _SC_SS_REPL_MAX _SC_SS_REPL_MAX +# endif +#endif +#if !defined(_SC_SYNCHRONIZED_IO) +# if defined(HAVE_CONST__SC_SYNCHRONIZED_IO) +# define _SC_SYNCHRONIZED_IO _SC_SYNCHRONIZED_IO +# endif +#endif +#if !defined(_SC_THREAD_ATTR_STACKADDR) +# if defined(HAVE_CONST__SC_THREAD_ATTR_STACKADDR) +# define _SC_THREAD_ATTR_STACKADDR _SC_THREAD_ATTR_STACKADDR +# endif +#endif +#if !defined(_SC_THREAD_ATTR_STACKSIZE) +# if defined(HAVE_CONST__SC_THREAD_ATTR_STACKSIZE) +# define _SC_THREAD_ATTR_STACKSIZE _SC_THREAD_ATTR_STACKSIZE +# endif +#endif +#if !defined(_SC_THREAD_CPUTIME) +# if defined(HAVE_CONST__SC_THREAD_CPUTIME) +# define _SC_THREAD_CPUTIME _SC_THREAD_CPUTIME +# endif +#endif +#if !defined(_SC_THREAD_PRIO_INHERIT) +# if defined(HAVE_CONST__SC_THREAD_PRIO_INHERIT) +# define _SC_THREAD_PRIO_INHERIT _SC_THREAD_PRIO_INHERIT +# endif +#endif +#if !defined(_SC_THREAD_PRIO_PROTECT) +# if defined(HAVE_CONST__SC_THREAD_PRIO_PROTECT) +# define _SC_THREAD_PRIO_PROTECT _SC_THREAD_PRIO_PROTECT +# endif +#endif +#if !defined(_SC_THREAD_PRIORITY_SCHEDULING) +# if defined(HAVE_CONST__SC_THREAD_PRIORITY_SCHEDULING) +# define _SC_THREAD_PRIORITY_SCHEDULING _SC_THREAD_PRIORITY_SCHEDULING +# endif +#endif +#if !defined(_SC_THREAD_PROCESS_SHARED) +# if defined(HAVE_CONST__SC_THREAD_PROCESS_SHARED) +# define _SC_THREAD_PROCESS_SHARED _SC_THREAD_PROCESS_SHARED +# endif +#endif +#if !defined(_SC_THREAD_ROBUST_PRIO_INHERIT) +# if defined(HAVE_CONST__SC_THREAD_ROBUST_PRIO_INHERIT) +# define _SC_THREAD_ROBUST_PRIO_INHERIT _SC_THREAD_ROBUST_PRIO_INHERIT +# endif +#endif +#if !defined(_SC_THREAD_ROBUST_PRIO_PROTECT) +# if defined(HAVE_CONST__SC_THREAD_ROBUST_PRIO_PROTECT) +# define _SC_THREAD_ROBUST_PRIO_PROTECT _SC_THREAD_ROBUST_PRIO_PROTECT +# endif +#endif +#if !defined(_SC_THREAD_SAFE_FUNCTIONS) +# if defined(HAVE_CONST__SC_THREAD_SAFE_FUNCTIONS) +# define _SC_THREAD_SAFE_FUNCTIONS _SC_THREAD_SAFE_FUNCTIONS +# endif +#endif +#if !defined(_SC_THREAD_SPORADIC_SERVER) +# if defined(HAVE_CONST__SC_THREAD_SPORADIC_SERVER) +# define _SC_THREAD_SPORADIC_SERVER _SC_THREAD_SPORADIC_SERVER +# endif +#endif +#if !defined(_SC_THREADS) +# if defined(HAVE_CONST__SC_THREADS) +# define _SC_THREADS _SC_THREADS +# endif +#endif +#if !defined(_SC_TIMEOUTS) +# if defined(HAVE_CONST__SC_TIMEOUTS) +# define _SC_TIMEOUTS _SC_TIMEOUTS +# endif +#endif +#if !defined(_SC_TIMERS) +# if defined(HAVE_CONST__SC_TIMERS) +# define _SC_TIMERS _SC_TIMERS +# endif +#endif +#if !defined(_SC_TRACE) +# if defined(HAVE_CONST__SC_TRACE) +# define _SC_TRACE _SC_TRACE +# endif +#endif +#if !defined(_SC_TRACE_EVENT_FILTER) +# if defined(HAVE_CONST__SC_TRACE_EVENT_FILTER) +# define _SC_TRACE_EVENT_FILTER _SC_TRACE_EVENT_FILTER +# endif +#endif +#if !defined(_SC_TRACE_EVENT_NAME_MAX) +# if defined(HAVE_CONST__SC_TRACE_EVENT_NAME_MAX) +# define _SC_TRACE_EVENT_NAME_MAX _SC_TRACE_EVENT_NAME_MAX +# endif +#endif +#if !defined(_SC_TRACE_INHERIT) +# if defined(HAVE_CONST__SC_TRACE_INHERIT) +# define _SC_TRACE_INHERIT _SC_TRACE_INHERIT +# endif +#endif +#if !defined(_SC_TRACE_LOG) +# if defined(HAVE_CONST__SC_TRACE_LOG) +# define _SC_TRACE_LOG _SC_TRACE_LOG +# endif +#endif +#if !defined(_SC_TRACE_NAME_MAX) +# if defined(HAVE_CONST__SC_TRACE_NAME_MAX) +# define _SC_TRACE_NAME_MAX _SC_TRACE_NAME_MAX +# endif +#endif +#if !defined(_SC_TRACE_SYS_MAX) +# if defined(HAVE_CONST__SC_TRACE_SYS_MAX) +# define _SC_TRACE_SYS_MAX _SC_TRACE_SYS_MAX +# endif +#endif +#if !defined(_SC_TRACE_USER_EVENT_MAX) +# if defined(HAVE_CONST__SC_TRACE_USER_EVENT_MAX) +# define _SC_TRACE_USER_EVENT_MAX _SC_TRACE_USER_EVENT_MAX +# endif +#endif +#if !defined(_SC_TYPED_MEMORY_OBJECTS) +# if defined(HAVE_CONST__SC_TYPED_MEMORY_OBJECTS) +# define _SC_TYPED_MEMORY_OBJECTS _SC_TYPED_MEMORY_OBJECTS +# endif +#endif +#if !defined(_SC_VERSION) +# if defined(HAVE_CONST__SC_VERSION) +# define _SC_VERSION _SC_VERSION +# endif +#endif +#if !defined(_SC_V7_ILP32_OFF32) +# if defined(HAVE_CONST__SC_V7_ILP32_OFF32) +# define _SC_V7_ILP32_OFF32 _SC_V7_ILP32_OFF32 +# endif +#endif +#if !defined(_SC_V7_ILP32_OFFBIG) +# if defined(HAVE_CONST__SC_V7_ILP32_OFFBIG) +# define _SC_V7_ILP32_OFFBIG _SC_V7_ILP32_OFFBIG +# endif +#endif +#if !defined(_SC_V7_LP64_OFF64) +# if defined(HAVE_CONST__SC_V7_LP64_OFF64) +# define _SC_V7_LP64_OFF64 _SC_V7_LP64_OFF64 +# endif +#endif +#if !defined(_SC_V7_LPBIG_OFFBIG) +# if defined(HAVE_CONST__SC_V7_LPBIG_OFFBIG) +# define _SC_V7_LPBIG_OFFBIG _SC_V7_LPBIG_OFFBIG +# endif +#endif +#if !defined(_SC_V6_ILP32_OFF32) +# if defined(HAVE_CONST__SC_V6_ILP32_OFF32) +# define _SC_V6_ILP32_OFF32 _SC_V6_ILP32_OFF32 +# endif +#endif +#if !defined(_SC_V6_ILP32_OFFBIG) +# if defined(HAVE_CONST__SC_V6_ILP32_OFFBIG) +# define _SC_V6_ILP32_OFFBIG _SC_V6_ILP32_OFFBIG +# endif +#endif +#if !defined(_SC_V6_LP64_OFF64) +# if defined(HAVE_CONST__SC_V6_LP64_OFF64) +# define _SC_V6_LP64_OFF64 _SC_V6_LP64_OFF64 +# endif +#endif +#if !defined(_SC_V6_LPBIG_OFFBIG) +# if defined(HAVE_CONST__SC_V6_LPBIG_OFFBIG) +# define _SC_V6_LPBIG_OFFBIG _SC_V6_LPBIG_OFFBIG +# endif +#endif +#if !defined(_SC_2_C_BIND) +# if defined(HAVE_CONST__SC_2_C_BIND) +# define _SC_2_C_BIND _SC_2_C_BIND +# endif +#endif +#if !defined(_SC_2_C_DEV) +# if defined(HAVE_CONST__SC_2_C_DEV) +# define _SC_2_C_DEV _SC_2_C_DEV +# endif +#endif +#if !defined(_SC_2_CHAR_TERM) +# if defined(HAVE_CONST__SC_2_CHAR_TERM) +# define _SC_2_CHAR_TERM _SC_2_CHAR_TERM +# endif +#endif +#if !defined(_SC_2_FORT_DEV) +# if defined(HAVE_CONST__SC_2_FORT_DEV) +# define _SC_2_FORT_DEV _SC_2_FORT_DEV +# endif +#endif +#if !defined(_SC_2_FORT_RUN) +# if defined(HAVE_CONST__SC_2_FORT_RUN) +# define _SC_2_FORT_RUN _SC_2_FORT_RUN +# endif +#endif +#if !defined(_SC_2_LOCALEDEF) +# if defined(HAVE_CONST__SC_2_LOCALEDEF) +# define _SC_2_LOCALEDEF _SC_2_LOCALEDEF +# endif +#endif +#if !defined(_SC_2_PBS) +# if defined(HAVE_CONST__SC_2_PBS) +# define _SC_2_PBS _SC_2_PBS +# endif +#endif +#if !defined(_SC_2_PBS_ACCOUNTING) +# if defined(HAVE_CONST__SC_2_PBS_ACCOUNTING) +# define _SC_2_PBS_ACCOUNTING _SC_2_PBS_ACCOUNTING +# endif +#endif +#if !defined(_SC_2_PBS_CHECKPOINT) +# if defined(HAVE_CONST__SC_2_PBS_CHECKPOINT) +# define _SC_2_PBS_CHECKPOINT _SC_2_PBS_CHECKPOINT +# endif +#endif +#if !defined(_SC_2_PBS_LOCATE) +# if defined(HAVE_CONST__SC_2_PBS_LOCATE) +# define _SC_2_PBS_LOCATE _SC_2_PBS_LOCATE +# endif +#endif +#if !defined(_SC_2_PBS_MESSAGE) +# if defined(HAVE_CONST__SC_2_PBS_MESSAGE) +# define _SC_2_PBS_MESSAGE _SC_2_PBS_MESSAGE +# endif +#endif +#if !defined(_SC_2_PBS_TRACK) +# if defined(HAVE_CONST__SC_2_PBS_TRACK) +# define _SC_2_PBS_TRACK _SC_2_PBS_TRACK +# endif +#endif +#if !defined(_SC_2_SW_DEV) +# if defined(HAVE_CONST__SC_2_SW_DEV) +# define _SC_2_SW_DEV _SC_2_SW_DEV +# endif +#endif +#if !defined(_SC_2_UPE) +# if defined(HAVE_CONST__SC_2_UPE) +# define _SC_2_UPE _SC_2_UPE +# endif +#endif +#if !defined(_SC_2_VERSION) +# if defined(HAVE_CONST__SC_2_VERSION) +# define _SC_2_VERSION _SC_2_VERSION +# endif +#endif +#if !defined(_SC_PAGE_SIZE) +# if defined(HAVE_CONST__SC_PAGE_SIZE) +# define _SC_PAGE_SIZE _SC_PAGE_SIZE +# endif +#endif +#if !defined(_SC_PAGESIZE) +# if defined(HAVE_CONST__SC_PAGESIZE) +# define _SC_PAGESIZE _SC_PAGESIZE +# endif +#endif +#if !defined(_SC_THREAD_DESTRUCTOR_ITERATIONS) +# if defined(HAVE_CONST__SC_THREAD_DESTRUCTOR_ITERATIONS) +# define _SC_THREAD_DESTRUCTOR_ITERATIONS _SC_THREAD_DESTRUCTOR_ITERATIONS +# endif +#endif +#if !defined(_SC_THREAD_KEYS_MAX) +# if defined(HAVE_CONST__SC_THREAD_KEYS_MAX) +# define _SC_THREAD_KEYS_MAX _SC_THREAD_KEYS_MAX +# endif +#endif +#if !defined(_SC_THREAD_STACK_MIN) +# if defined(HAVE_CONST__SC_THREAD_STACK_MIN) +# define _SC_THREAD_STACK_MIN _SC_THREAD_STACK_MIN +# endif +#endif +#if !defined(_SC_THREAD_THREADS_MAX) +# if defined(HAVE_CONST__SC_THREAD_THREADS_MAX) +# define _SC_THREAD_THREADS_MAX _SC_THREAD_THREADS_MAX +# endif +#endif +#if !defined(_SC_RE_DUP_MAX) +# if defined(HAVE_CONST__SC_RE_DUP_MAX) +# define _SC_RE_DUP_MAX _SC_RE_DUP_MAX +# endif +#endif +#if !defined(_SC_RTSIG_MAX) +# if defined(HAVE_CONST__SC_RTSIG_MAX) +# define _SC_RTSIG_MAX _SC_RTSIG_MAX +# endif +#endif +#if !defined(_SC_SEM_NSEMS_MAX) +# if defined(HAVE_CONST__SC_SEM_NSEMS_MAX) +# define _SC_SEM_NSEMS_MAX _SC_SEM_NSEMS_MAX +# endif +#endif +#if !defined(_SC_SEM_VALUE_MAX) +# if defined(HAVE_CONST__SC_SEM_VALUE_MAX) +# define _SC_SEM_VALUE_MAX _SC_SEM_VALUE_MAX +# endif +#endif +#if !defined(_SC_SIGQUEUE_MAX) +# if defined(HAVE_CONST__SC_SIGQUEUE_MAX) +# define _SC_SIGQUEUE_MAX _SC_SIGQUEUE_MAX +# endif +#endif +#if !defined(_SC_STREAM_MAX) +# if defined(HAVE_CONST__SC_STREAM_MAX) +# define _SC_STREAM_MAX _SC_STREAM_MAX +# endif +#endif +#if !defined(_SC_SYMLOOP_MAX) +# if defined(HAVE_CONST__SC_SYMLOOP_MAX) +# define _SC_SYMLOOP_MAX _SC_SYMLOOP_MAX +# endif +#endif +#if !defined(_SC_TIMER_MAX) +# if defined(HAVE_CONST__SC_TIMER_MAX) +# define _SC_TIMER_MAX _SC_TIMER_MAX +# endif +#endif +#if !defined(_SC_TTY_NAME_MAX) +# if defined(HAVE_CONST__SC_TTY_NAME_MAX) +# define _SC_TTY_NAME_MAX _SC_TTY_NAME_MAX +# endif +#endif +#if !defined(_SC_TZNAME_MAX) +# if defined(HAVE_CONST__SC_TZNAME_MAX) +# define _SC_TZNAME_MAX _SC_TZNAME_MAX +# endif +#endif +#if !defined(_SC_XOPEN_CRYPT) +# if defined(HAVE_CONST__SC_XOPEN_CRYPT) +# define _SC_XOPEN_CRYPT _SC_XOPEN_CRYPT +# endif +#endif +#if !defined(_SC_XOPEN_ENH_I18N) +# if defined(HAVE_CONST__SC_XOPEN_ENH_I18N) +# define _SC_XOPEN_ENH_I18N _SC_XOPEN_ENH_I18N +# endif +#endif +#if !defined(_SC_XOPEN_REALTIME) +# if defined(HAVE_CONST__SC_XOPEN_REALTIME) +# define _SC_XOPEN_REALTIME _SC_XOPEN_REALTIME +# endif +#endif +#if !defined(_SC_XOPEN_REALTIME_THREADS) +# if defined(HAVE_CONST__SC_XOPEN_REALTIME_THREADS) +# define _SC_XOPEN_REALTIME_THREADS _SC_XOPEN_REALTIME_THREADS +# endif +#endif +#if !defined(_SC_XOPEN_SHM) +# if defined(HAVE_CONST__SC_XOPEN_SHM) +# define _SC_XOPEN_SHM _SC_XOPEN_SHM +# endif +#endif +#if !defined(_SC_XOPEN_STREAMS) +# if defined(HAVE_CONST__SC_XOPEN_STREAMS) +# define _SC_XOPEN_STREAMS _SC_XOPEN_STREAMS +# endif +#endif +#if !defined(_SC_XOPEN_UNIX) +# if defined(HAVE_CONST__SC_XOPEN_UNIX) +# define _SC_XOPEN_UNIX _SC_XOPEN_UNIX +# endif +#endif +#if !defined(_SC_XOPEN_UUCP) +# if defined(HAVE_CONST__SC_XOPEN_UUCP) +# define _SC_XOPEN_UUCP _SC_XOPEN_UUCP +# endif +#endif +#if !defined(_SC_XOPEN_VERSION) +# if defined(HAVE_CONST__SC_XOPEN_VERSION) +# define _SC_XOPEN_VERSION _SC_XOPEN_VERSION +# endif +#endif +#if !defined(_SC_PHYS_PAGES) +# if defined(HAVE_CONST__SC_PHYS_PAGES) +# define _SC_PHYS_PAGES _SC_PHYS_PAGES +# endif +#endif +#if !defined(_SC_AVPHYS_PAGES) +# if defined(HAVE_CONST__SC_AVPHYS_PAGES) +# define _SC_AVPHYS_PAGES _SC_AVPHYS_PAGES +# endif +#endif +#if !defined(_SC_NPROCESSORS_CONF) +# if defined(HAVE_CONST__SC_NPROCESSORS_CONF) +# define _SC_NPROCESSORS_CONF _SC_NPROCESSORS_CONF +# endif +#endif +#if !defined(_SC_NPROCESSORS_ONLN) +# if defined(HAVE_CONST__SC_NPROCESSORS_ONLN) +# define _SC_NPROCESSORS_ONLN _SC_NPROCESSORS_ONLN +# endif +#endif +#if !defined(_SC_CPUSET_SIZE) +# if defined(HAVE_CONST__SC_CPUSET_SIZE) +# define _SC_CPUSET_SIZE _SC_CPUSET_SIZE +# endif +#endif +#if !defined(_CS_PATH) +# if defined(HAVE_CONST__CS_PATH) +# define _CS_PATH _CS_PATH +# endif +#endif +#if !defined(_CS_POSIX_V7_ILP32_OFF32_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_ILP32_OFF32_CFLAGS) +# define _CS_POSIX_V7_ILP32_OFF32_CFLAGS _CS_POSIX_V7_ILP32_OFF32_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_ILP32_OFF32_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_ILP32_OFF32_LDFLAGS) +# define _CS_POSIX_V7_ILP32_OFF32_LDFLAGS _CS_POSIX_V7_ILP32_OFF32_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_ILP32_OFF32_LIBS) +# if defined(HAVE_CONST__CS_POSIX_V7_ILP32_OFF32_LIBS) +# define _CS_POSIX_V7_ILP32_OFF32_LIBS _CS_POSIX_V7_ILP32_OFF32_LIBS +# endif +#endif +#if !defined(_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_ILP32_OFFBIG_CFLAGS) +# define _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS _CS_POSIX_V7_ILP32_OFFBIG_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS) +# define _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_ILP32_OFFBIG_LIBS) +# if defined(HAVE_CONST__CS_POSIX_V7_ILP32_OFFBIG_LIBS) +# define _CS_POSIX_V7_ILP32_OFFBIG_LIBS _CS_POSIX_V7_ILP32_OFFBIG_LIBS +# endif +#endif +#if !defined(_CS_POSIX_V7_LP64_OFF64_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_LP64_OFF64_CFLAGS) +# define _CS_POSIX_V7_LP64_OFF64_CFLAGS _CS_POSIX_V7_LP64_OFF64_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_LP64_OFF64_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_LP64_OFF64_LDFLAGS) +# define _CS_POSIX_V7_LP64_OFF64_LDFLAGS _CS_POSIX_V7_LP64_OFF64_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_LP64_OFF64_LIBS) +# if defined(HAVE_CONST__CS_POSIX_V7_LP64_OFF64_LIBS) +# define _CS_POSIX_V7_LP64_OFF64_LIBS _CS_POSIX_V7_LP64_OFF64_LIBS +# endif +#endif +#if !defined(_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS) +# define _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS) +# define _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_LPBIG_OFFBIG_LIBS) +# if defined(HAVE_CONST__CS_POSIX_V7_LPBIG_OFFBIG_LIBS) +# define _CS_POSIX_V7_LPBIG_OFFBIG_LIBS _CS_POSIX_V7_LPBIG_OFFBIG_LIBS +# endif +#endif +#if !defined(_CS_POSIX_V7_THREADS_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_THREADS_CFLAGS) +# define _CS_POSIX_V7_THREADS_CFLAGS _CS_POSIX_V7_THREADS_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_THREADS_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V7_THREADS_LDFLAGS) +# define _CS_POSIX_V7_THREADS_LDFLAGS _CS_POSIX_V7_THREADS_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS) +# if defined(HAVE_CONST__CS_POSIX_V7_WIDTH_RESTRICTED_ENVS) +# define _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS _CS_POSIX_V7_WIDTH_RESTRICTED_ENVS +# endif +#endif +#if !defined(_CS_V7_ENV) +# if defined(HAVE_CONST__CS_V7_ENV) +# define _CS_V7_ENV _CS_V7_ENV +# endif +#endif +#if !defined(_CS_POSIX_V6_ILP32_OFF32_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V6_ILP32_OFF32_CFLAGS) +# define _CS_POSIX_V6_ILP32_OFF32_CFLAGS _CS_POSIX_V6_ILP32_OFF32_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V6_ILP32_OFF32_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V6_ILP32_OFF32_LDFLAGS) +# define _CS_POSIX_V6_ILP32_OFF32_LDFLAGS _CS_POSIX_V6_ILP32_OFF32_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V6_ILP32_OFF32_LIBS) +# if defined(HAVE_CONST__CS_POSIX_V6_ILP32_OFF32_LIBS) +# define _CS_POSIX_V6_ILP32_OFF32_LIBS _CS_POSIX_V6_ILP32_OFF32_LIBS +# endif +#endif +#if !defined(_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V6_ILP32_OFFBIG_CFLAGS) +# define _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS _CS_POSIX_V6_ILP32_OFFBIG_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS) +# define _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS _CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V6_ILP32_OFFBIG_LIBS) +# if defined(HAVE_CONST__CS_POSIX_V6_ILP32_OFFBIG_LIBS) +# define _CS_POSIX_V6_ILP32_OFFBIG_LIBS _CS_POSIX_V6_ILP32_OFFBIG_LIBS +# endif +#endif +#if !defined(_CS_POSIX_V6_LP64_OFF64_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V6_LP64_OFF64_CFLAGS) +# define _CS_POSIX_V6_LP64_OFF64_CFLAGS _CS_POSIX_V6_LP64_OFF64_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V6_LP64_OFF64_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V6_LP64_OFF64_LDFLAGS) +# define _CS_POSIX_V6_LP64_OFF64_LDFLAGS _CS_POSIX_V6_LP64_OFF64_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V6_LP64_OFF64_LIBS) +# if defined(HAVE_CONST__CS_POSIX_V6_LP64_OFF64_LIBS) +# define _CS_POSIX_V6_LP64_OFF64_LIBS _CS_POSIX_V6_LP64_OFF64_LIBS +# endif +#endif +#if !defined(_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS) +# define _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS) +# if defined(HAVE_CONST__CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS) +# define _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS _CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS +# endif +#endif +#if !defined(_CS_POSIX_V6_LPBIG_OFFBIG_LIBS) +# if defined(HAVE_CONST__CS_POSIX_V6_LPBIG_OFFBIG_LIBS) +# define _CS_POSIX_V6_LPBIG_OFFBIG_LIBS _CS_POSIX_V6_LPBIG_OFFBIG_LIBS +# endif +#endif +#if !defined(_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS) +# if defined(HAVE_CONST__CS_POSIX_V6_WIDTH_RESTRICTED_ENVS) +# define _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS _CS_POSIX_V6_WIDTH_RESTRICTED_ENVS +# endif +#endif +#if !defined(_CS_V6_ENV) +# if defined(HAVE_CONST__CS_V6_ENV) +# define _CS_V6_ENV _CS_V6_ENV +# endif +#endif +#if !defined(_CS_GNU_LIBC_VERSION) +# if defined(HAVE_CONST__CS_GNU_LIBC_VERSION) +# define _CS_GNU_LIBC_VERSION _CS_GNU_LIBC_VERSION +# endif +#endif +#if !defined(_CS_GNU_LIBPTHREAD_VERSION) +# if defined(HAVE_CONST__CS_GNU_LIBPTHREAD_VERSION) +# define _CS_GNU_LIBPTHREAD_VERSION _CS_GNU_LIBPTHREAD_VERSION +# endif +#endif +#if !defined(_PC_FILESIZEBITS) +# if defined(HAVE_CONST__PC_FILESIZEBITS) +# define _PC_FILESIZEBITS _PC_FILESIZEBITS +# endif +#endif +#if !defined(_PC_LINK_MAX) +# if defined(HAVE_CONST__PC_LINK_MAX) +# define _PC_LINK_MAX _PC_LINK_MAX +# endif +#endif +#if !defined(_PC_MAX_CANON) +# if defined(HAVE_CONST__PC_MAX_CANON) +# define _PC_MAX_CANON _PC_MAX_CANON +# endif +#endif +#if !defined(_PC_MAX_INPUT) +# if defined(HAVE_CONST__PC_MAX_INPUT) +# define _PC_MAX_INPUT _PC_MAX_INPUT +# endif +#endif +#if !defined(_PC_NAME_MAX) +# if defined(HAVE_CONST__PC_NAME_MAX) +# define _PC_NAME_MAX _PC_NAME_MAX +# endif +#endif +#if !defined(_PC_PATH_MAX) +# if defined(HAVE_CONST__PC_PATH_MAX) +# define _PC_PATH_MAX _PC_PATH_MAX +# endif +#endif +#if !defined(_PC_PIPE_BUF) +# if defined(HAVE_CONST__PC_PIPE_BUF) +# define _PC_PIPE_BUF _PC_PIPE_BUF +# endif +#endif +#if !defined(_PC_2_SYMLINKS) +# if defined(HAVE_CONST__PC_2_SYMLINKS) +# define _PC_2_SYMLINKS _PC_2_SYMLINKS +# endif +#endif +#if !defined(_PC_ALLOC_SIZE_MIN) +# if defined(HAVE_CONST__PC_ALLOC_SIZE_MIN) +# define _PC_ALLOC_SIZE_MIN _PC_ALLOC_SIZE_MIN +# endif +#endif +#if !defined(_PC_REC_INCR_XFER_SIZE) +# if defined(HAVE_CONST__PC_REC_INCR_XFER_SIZE) +# define _PC_REC_INCR_XFER_SIZE _PC_REC_INCR_XFER_SIZE +# endif +#endif +#if !defined(_PC_REC_MAX_XFER_SIZE) +# if defined(HAVE_CONST__PC_REC_MAX_XFER_SIZE) +# define _PC_REC_MAX_XFER_SIZE _PC_REC_MAX_XFER_SIZE +# endif +#endif +#if !defined(_PC_REC_MIN_XFER_SIZE) +# if defined(HAVE_CONST__PC_REC_MIN_XFER_SIZE) +# define _PC_REC_MIN_XFER_SIZE _PC_REC_MIN_XFER_SIZE +# endif +#endif +#if !defined(_PC_REC_XFER_ALIGN) +# if defined(HAVE_CONST__PC_REC_XFER_ALIGN) +# define _PC_REC_XFER_ALIGN _PC_REC_XFER_ALIGN +# endif +#endif +#if !defined(_PC_SYMLINK_MAX) +# if defined(HAVE_CONST__PC_SYMLINK_MAX) +# define _PC_SYMLINK_MAX _PC_SYMLINK_MAX +# endif +#endif +#if !defined(_PC_CHOWN_RESTRICTED) +# if defined(HAVE_CONST__PC_CHOWN_RESTRICTED) +# define _PC_CHOWN_RESTRICTED _PC_CHOWN_RESTRICTED +# endif +#endif +#if !defined(_PC_NO_TRUNC) +# if defined(HAVE_CONST__PC_NO_TRUNC) +# define _PC_NO_TRUNC _PC_NO_TRUNC +# endif +#endif +#if !defined(_PC_VDISABLE) +# if defined(HAVE_CONST__PC_VDISABLE) +# define _PC_VDISABLE _PC_VDISABLE +# endif +#endif +#if !defined(_PC_ASYNC_IO) +# if defined(HAVE_CONST__PC_ASYNC_IO) +# define _PC_ASYNC_IO _PC_ASYNC_IO +# endif +#endif +#if !defined(_PC_PRIO_IO) +# if defined(HAVE_CONST__PC_PRIO_IO) +# define _PC_PRIO_IO _PC_PRIO_IO +# endif +#endif +#if !defined(_PC_SYNC_IO) +# if defined(HAVE_CONST__PC_SYNC_IO) +# define _PC_SYNC_IO _PC_SYNC_IO +# endif +#endif +#if !defined(_PC_TIMESTAMP_RESOLUTION) +# if defined(HAVE_CONST__PC_TIMESTAMP_RESOLUTION) +# define _PC_TIMESTAMP_RESOLUTION _PC_TIMESTAMP_RESOLUTION +# endif +#endif + +/* autogenerated file */ + +#ifdef HAVE_LONG_LONG +#define INTEGER2NUM(n) \ + (FIXNUM_MAX < (n) ? ULL2NUM(n) : \ + FIXNUM_MIN > (LONG_LONG)(n) ? LL2NUM(n) : \ + LONG2FIX(n)) +#else +#define INTEGER2NUM(n) \ + (FIXNUM_MAX < (n) ? ULONG2NUM(n) : \ + FIXNUM_MIN > (long)(n) ? LONG2NUM(n) : \ + LONG2FIX(n)) +#endif + +static void +init_constants(VALUE mod) +{ +#if defined(_SC_AIO_LISTIO_MAX) + rb_define_const(mod, "SC_AIO_LISTIO_MAX", INTEGER2NUM(_SC_AIO_LISTIO_MAX)); +#endif +#if defined(_SC_AIO_MAX) + rb_define_const(mod, "SC_AIO_MAX", INTEGER2NUM(_SC_AIO_MAX)); +#endif +#if defined(_SC_AIO_PRIO_DELTA_MAX) + rb_define_const(mod, "SC_AIO_PRIO_DELTA_MAX", INTEGER2NUM(_SC_AIO_PRIO_DELTA_MAX)); +#endif +#if defined(_SC_ARG_MAX) + rb_define_const(mod, "SC_ARG_MAX", INTEGER2NUM(_SC_ARG_MAX)); +#endif +#if defined(_SC_ATEXIT_MAX) + rb_define_const(mod, "SC_ATEXIT_MAX", INTEGER2NUM(_SC_ATEXIT_MAX)); +#endif +#if defined(_SC_BC_BASE_MAX) + rb_define_const(mod, "SC_BC_BASE_MAX", INTEGER2NUM(_SC_BC_BASE_MAX)); +#endif +#if defined(_SC_BC_DIM_MAX) + rb_define_const(mod, "SC_BC_DIM_MAX", INTEGER2NUM(_SC_BC_DIM_MAX)); +#endif +#if defined(_SC_BC_SCALE_MAX) + rb_define_const(mod, "SC_BC_SCALE_MAX", INTEGER2NUM(_SC_BC_SCALE_MAX)); +#endif +#if defined(_SC_BC_STRING_MAX) + rb_define_const(mod, "SC_BC_STRING_MAX", INTEGER2NUM(_SC_BC_STRING_MAX)); +#endif +#if defined(_SC_CHILD_MAX) + rb_define_const(mod, "SC_CHILD_MAX", INTEGER2NUM(_SC_CHILD_MAX)); +#endif +#if defined(_SC_CLK_TCK) + rb_define_const(mod, "SC_CLK_TCK", INTEGER2NUM(_SC_CLK_TCK)); +#endif +#if defined(_SC_COLL_WEIGHTS_MAX) + rb_define_const(mod, "SC_COLL_WEIGHTS_MAX", INTEGER2NUM(_SC_COLL_WEIGHTS_MAX)); +#endif +#if defined(_SC_DELAYTIMER_MAX) + rb_define_const(mod, "SC_DELAYTIMER_MAX", INTEGER2NUM(_SC_DELAYTIMER_MAX)); +#endif +#if defined(_SC_EXPR_NEST_MAX) + rb_define_const(mod, "SC_EXPR_NEST_MAX", INTEGER2NUM(_SC_EXPR_NEST_MAX)); +#endif +#if defined(_SC_HOST_NAME_MAX) + rb_define_const(mod, "SC_HOST_NAME_MAX", INTEGER2NUM(_SC_HOST_NAME_MAX)); +#endif +#if defined(_SC_IOV_MAX) + rb_define_const(mod, "SC_IOV_MAX", INTEGER2NUM(_SC_IOV_MAX)); +#endif +#if defined(_SC_LINE_MAX) + rb_define_const(mod, "SC_LINE_MAX", INTEGER2NUM(_SC_LINE_MAX)); +#endif +#if defined(_SC_LOGIN_NAME_MAX) + rb_define_const(mod, "SC_LOGIN_NAME_MAX", INTEGER2NUM(_SC_LOGIN_NAME_MAX)); +#endif +#if defined(_SC_NGROUPS_MAX) + rb_define_const(mod, "SC_NGROUPS_MAX", INTEGER2NUM(_SC_NGROUPS_MAX)); +#endif +#if defined(_SC_GETGR_R_SIZE_MAX) + rb_define_const(mod, "SC_GETGR_R_SIZE_MAX", INTEGER2NUM(_SC_GETGR_R_SIZE_MAX)); +#endif +#if defined(_SC_GETPW_R_SIZE_MAX) + rb_define_const(mod, "SC_GETPW_R_SIZE_MAX", INTEGER2NUM(_SC_GETPW_R_SIZE_MAX)); +#endif +#if defined(_SC_MQ_OPEN_MAX) + rb_define_const(mod, "SC_MQ_OPEN_MAX", INTEGER2NUM(_SC_MQ_OPEN_MAX)); +#endif +#if defined(_SC_MQ_PRIO_MAX) + rb_define_const(mod, "SC_MQ_PRIO_MAX", INTEGER2NUM(_SC_MQ_PRIO_MAX)); +#endif +#if defined(_SC_OPEN_MAX) + rb_define_const(mod, "SC_OPEN_MAX", INTEGER2NUM(_SC_OPEN_MAX)); +#endif +#if defined(_SC_ADVISORY_INFO) + rb_define_const(mod, "SC_ADVISORY_INFO", INTEGER2NUM(_SC_ADVISORY_INFO)); +#endif +#if defined(_SC_BARRIERS) + rb_define_const(mod, "SC_BARRIERS", INTEGER2NUM(_SC_BARRIERS)); +#endif +#if defined(_SC_ASYNCHRONOUS_IO) + rb_define_const(mod, "SC_ASYNCHRONOUS_IO", INTEGER2NUM(_SC_ASYNCHRONOUS_IO)); +#endif +#if defined(_SC_CLOCK_SELECTION) + rb_define_const(mod, "SC_CLOCK_SELECTION", INTEGER2NUM(_SC_CLOCK_SELECTION)); +#endif +#if defined(_SC_CPUTIME) + rb_define_const(mod, "SC_CPUTIME", INTEGER2NUM(_SC_CPUTIME)); +#endif +#if defined(_SC_FSYNC) + rb_define_const(mod, "SC_FSYNC", INTEGER2NUM(_SC_FSYNC)); +#endif +#if defined(_SC_IPV6) + rb_define_const(mod, "SC_IPV6", INTEGER2NUM(_SC_IPV6)); +#endif +#if defined(_SC_JOB_CONTROL) + rb_define_const(mod, "SC_JOB_CONTROL", INTEGER2NUM(_SC_JOB_CONTROL)); +#endif +#if defined(_SC_MAPPED_FILES) + rb_define_const(mod, "SC_MAPPED_FILES", INTEGER2NUM(_SC_MAPPED_FILES)); +#endif +#if defined(_SC_MEMLOCK) + rb_define_const(mod, "SC_MEMLOCK", INTEGER2NUM(_SC_MEMLOCK)); +#endif +#if defined(_SC_MEMLOCK_RANGE) + rb_define_const(mod, "SC_MEMLOCK_RANGE", INTEGER2NUM(_SC_MEMLOCK_RANGE)); +#endif +#if defined(_SC_MEMORY_PROTECTION) + rb_define_const(mod, "SC_MEMORY_PROTECTION", INTEGER2NUM(_SC_MEMORY_PROTECTION)); +#endif +#if defined(_SC_MESSAGE_PASSING) + rb_define_const(mod, "SC_MESSAGE_PASSING", INTEGER2NUM(_SC_MESSAGE_PASSING)); +#endif +#if defined(_SC_MONOTONIC_CLOCK) + rb_define_const(mod, "SC_MONOTONIC_CLOCK", INTEGER2NUM(_SC_MONOTONIC_CLOCK)); +#endif +#if defined(_SC_PRIORITIZED_IO) + rb_define_const(mod, "SC_PRIORITIZED_IO", INTEGER2NUM(_SC_PRIORITIZED_IO)); +#endif +#if defined(_SC_PRIORITY_SCHEDULING) + rb_define_const(mod, "SC_PRIORITY_SCHEDULING", INTEGER2NUM(_SC_PRIORITY_SCHEDULING)); +#endif +#if defined(_SC_RAW_SOCKETS) + rb_define_const(mod, "SC_RAW_SOCKETS", INTEGER2NUM(_SC_RAW_SOCKETS)); +#endif +#if defined(_SC_READER_WRITER_LOCKS) + rb_define_const(mod, "SC_READER_WRITER_LOCKS", INTEGER2NUM(_SC_READER_WRITER_LOCKS)); +#endif +#if defined(_SC_REALTIME_SIGNALS) + rb_define_const(mod, "SC_REALTIME_SIGNALS", INTEGER2NUM(_SC_REALTIME_SIGNALS)); +#endif +#if defined(_SC_REGEXP) + rb_define_const(mod, "SC_REGEXP", INTEGER2NUM(_SC_REGEXP)); +#endif +#if defined(_SC_SAVED_IDS) + rb_define_const(mod, "SC_SAVED_IDS", INTEGER2NUM(_SC_SAVED_IDS)); +#endif +#if defined(_SC_SEMAPHORES) + rb_define_const(mod, "SC_SEMAPHORES", INTEGER2NUM(_SC_SEMAPHORES)); +#endif +#if defined(_SC_SHARED_MEMORY_OBJECTS) + rb_define_const(mod, "SC_SHARED_MEMORY_OBJECTS", INTEGER2NUM(_SC_SHARED_MEMORY_OBJECTS)); +#endif +#if defined(_SC_SHELL) + rb_define_const(mod, "SC_SHELL", INTEGER2NUM(_SC_SHELL)); +#endif +#if defined(_SC_SPAWN) + rb_define_const(mod, "SC_SPAWN", INTEGER2NUM(_SC_SPAWN)); +#endif +#if defined(_SC_SPIN_LOCKS) + rb_define_const(mod, "SC_SPIN_LOCKS", INTEGER2NUM(_SC_SPIN_LOCKS)); +#endif +#if defined(_SC_SPORADIC_SERVER) + rb_define_const(mod, "SC_SPORADIC_SERVER", INTEGER2NUM(_SC_SPORADIC_SERVER)); +#endif +#if defined(_SC_SS_REPL_MAX) + rb_define_const(mod, "SC_SS_REPL_MAX", INTEGER2NUM(_SC_SS_REPL_MAX)); +#endif +#if defined(_SC_SYNCHRONIZED_IO) + rb_define_const(mod, "SC_SYNCHRONIZED_IO", INTEGER2NUM(_SC_SYNCHRONIZED_IO)); +#endif +#if defined(_SC_THREAD_ATTR_STACKADDR) + rb_define_const(mod, "SC_THREAD_ATTR_STACKADDR", INTEGER2NUM(_SC_THREAD_ATTR_STACKADDR)); +#endif +#if defined(_SC_THREAD_ATTR_STACKSIZE) + rb_define_const(mod, "SC_THREAD_ATTR_STACKSIZE", INTEGER2NUM(_SC_THREAD_ATTR_STACKSIZE)); +#endif +#if defined(_SC_THREAD_CPUTIME) + rb_define_const(mod, "SC_THREAD_CPUTIME", INTEGER2NUM(_SC_THREAD_CPUTIME)); +#endif +#if defined(_SC_THREAD_PRIO_INHERIT) + rb_define_const(mod, "SC_THREAD_PRIO_INHERIT", INTEGER2NUM(_SC_THREAD_PRIO_INHERIT)); +#endif +#if defined(_SC_THREAD_PRIO_PROTECT) + rb_define_const(mod, "SC_THREAD_PRIO_PROTECT", INTEGER2NUM(_SC_THREAD_PRIO_PROTECT)); +#endif +#if defined(_SC_THREAD_PRIORITY_SCHEDULING) + rb_define_const(mod, "SC_THREAD_PRIORITY_SCHEDULING", INTEGER2NUM(_SC_THREAD_PRIORITY_SCHEDULING)); +#endif +#if defined(_SC_THREAD_PROCESS_SHARED) + rb_define_const(mod, "SC_THREAD_PROCESS_SHARED", INTEGER2NUM(_SC_THREAD_PROCESS_SHARED)); +#endif +#if defined(_SC_THREAD_ROBUST_PRIO_INHERIT) + rb_define_const(mod, "SC_THREAD_ROBUST_PRIO_INHERIT", INTEGER2NUM(_SC_THREAD_ROBUST_PRIO_INHERIT)); +#endif +#if defined(_SC_THREAD_ROBUST_PRIO_PROTECT) + rb_define_const(mod, "SC_THREAD_ROBUST_PRIO_PROTECT", INTEGER2NUM(_SC_THREAD_ROBUST_PRIO_PROTECT)); +#endif +#if defined(_SC_THREAD_SAFE_FUNCTIONS) + rb_define_const(mod, "SC_THREAD_SAFE_FUNCTIONS", INTEGER2NUM(_SC_THREAD_SAFE_FUNCTIONS)); +#endif +#if defined(_SC_THREAD_SPORADIC_SERVER) + rb_define_const(mod, "SC_THREAD_SPORADIC_SERVER", INTEGER2NUM(_SC_THREAD_SPORADIC_SERVER)); +#endif +#if defined(_SC_THREADS) + rb_define_const(mod, "SC_THREADS", INTEGER2NUM(_SC_THREADS)); +#endif +#if defined(_SC_TIMEOUTS) + rb_define_const(mod, "SC_TIMEOUTS", INTEGER2NUM(_SC_TIMEOUTS)); +#endif +#if defined(_SC_TIMERS) + rb_define_const(mod, "SC_TIMERS", INTEGER2NUM(_SC_TIMERS)); +#endif +#if defined(_SC_TRACE) + rb_define_const(mod, "SC_TRACE", INTEGER2NUM(_SC_TRACE)); +#endif +#if defined(_SC_TRACE_EVENT_FILTER) + rb_define_const(mod, "SC_TRACE_EVENT_FILTER", INTEGER2NUM(_SC_TRACE_EVENT_FILTER)); +#endif +#if defined(_SC_TRACE_EVENT_NAME_MAX) + rb_define_const(mod, "SC_TRACE_EVENT_NAME_MAX", INTEGER2NUM(_SC_TRACE_EVENT_NAME_MAX)); +#endif +#if defined(_SC_TRACE_INHERIT) + rb_define_const(mod, "SC_TRACE_INHERIT", INTEGER2NUM(_SC_TRACE_INHERIT)); +#endif +#if defined(_SC_TRACE_LOG) + rb_define_const(mod, "SC_TRACE_LOG", INTEGER2NUM(_SC_TRACE_LOG)); +#endif +#if defined(_SC_TRACE_NAME_MAX) + rb_define_const(mod, "SC_TRACE_NAME_MAX", INTEGER2NUM(_SC_TRACE_NAME_MAX)); +#endif +#if defined(_SC_TRACE_SYS_MAX) + rb_define_const(mod, "SC_TRACE_SYS_MAX", INTEGER2NUM(_SC_TRACE_SYS_MAX)); +#endif +#if defined(_SC_TRACE_USER_EVENT_MAX) + rb_define_const(mod, "SC_TRACE_USER_EVENT_MAX", INTEGER2NUM(_SC_TRACE_USER_EVENT_MAX)); +#endif +#if defined(_SC_TYPED_MEMORY_OBJECTS) + rb_define_const(mod, "SC_TYPED_MEMORY_OBJECTS", INTEGER2NUM(_SC_TYPED_MEMORY_OBJECTS)); +#endif +#if defined(_SC_VERSION) + rb_define_const(mod, "SC_VERSION", INTEGER2NUM(_SC_VERSION)); +#endif +#if defined(_SC_V7_ILP32_OFF32) + rb_define_const(mod, "SC_V7_ILP32_OFF32", INTEGER2NUM(_SC_V7_ILP32_OFF32)); +#endif +#if defined(_SC_V7_ILP32_OFFBIG) + rb_define_const(mod, "SC_V7_ILP32_OFFBIG", INTEGER2NUM(_SC_V7_ILP32_OFFBIG)); +#endif +#if defined(_SC_V7_LP64_OFF64) + rb_define_const(mod, "SC_V7_LP64_OFF64", INTEGER2NUM(_SC_V7_LP64_OFF64)); +#endif +#if defined(_SC_V7_LPBIG_OFFBIG) + rb_define_const(mod, "SC_V7_LPBIG_OFFBIG", INTEGER2NUM(_SC_V7_LPBIG_OFFBIG)); +#endif +#if defined(_SC_V6_ILP32_OFF32) + rb_define_const(mod, "SC_V6_ILP32_OFF32", INTEGER2NUM(_SC_V6_ILP32_OFF32)); +#endif +#if defined(_SC_V6_ILP32_OFFBIG) + rb_define_const(mod, "SC_V6_ILP32_OFFBIG", INTEGER2NUM(_SC_V6_ILP32_OFFBIG)); +#endif +#if defined(_SC_V6_LP64_OFF64) + rb_define_const(mod, "SC_V6_LP64_OFF64", INTEGER2NUM(_SC_V6_LP64_OFF64)); +#endif +#if defined(_SC_V6_LPBIG_OFFBIG) + rb_define_const(mod, "SC_V6_LPBIG_OFFBIG", INTEGER2NUM(_SC_V6_LPBIG_OFFBIG)); +#endif +#if defined(_SC_2_C_BIND) + rb_define_const(mod, "SC_2_C_BIND", INTEGER2NUM(_SC_2_C_BIND)); +#endif +#if defined(_SC_2_C_DEV) + rb_define_const(mod, "SC_2_C_DEV", INTEGER2NUM(_SC_2_C_DEV)); +#endif +#if defined(_SC_2_CHAR_TERM) + rb_define_const(mod, "SC_2_CHAR_TERM", INTEGER2NUM(_SC_2_CHAR_TERM)); +#endif +#if defined(_SC_2_FORT_DEV) + rb_define_const(mod, "SC_2_FORT_DEV", INTEGER2NUM(_SC_2_FORT_DEV)); +#endif +#if defined(_SC_2_FORT_RUN) + rb_define_const(mod, "SC_2_FORT_RUN", INTEGER2NUM(_SC_2_FORT_RUN)); +#endif +#if defined(_SC_2_LOCALEDEF) + rb_define_const(mod, "SC_2_LOCALEDEF", INTEGER2NUM(_SC_2_LOCALEDEF)); +#endif +#if defined(_SC_2_PBS) + rb_define_const(mod, "SC_2_PBS", INTEGER2NUM(_SC_2_PBS)); +#endif +#if defined(_SC_2_PBS_ACCOUNTING) + rb_define_const(mod, "SC_2_PBS_ACCOUNTING", INTEGER2NUM(_SC_2_PBS_ACCOUNTING)); +#endif +#if defined(_SC_2_PBS_CHECKPOINT) + rb_define_const(mod, "SC_2_PBS_CHECKPOINT", INTEGER2NUM(_SC_2_PBS_CHECKPOINT)); +#endif +#if defined(_SC_2_PBS_LOCATE) + rb_define_const(mod, "SC_2_PBS_LOCATE", INTEGER2NUM(_SC_2_PBS_LOCATE)); +#endif +#if defined(_SC_2_PBS_MESSAGE) + rb_define_const(mod, "SC_2_PBS_MESSAGE", INTEGER2NUM(_SC_2_PBS_MESSAGE)); +#endif +#if defined(_SC_2_PBS_TRACK) + rb_define_const(mod, "SC_2_PBS_TRACK", INTEGER2NUM(_SC_2_PBS_TRACK)); +#endif +#if defined(_SC_2_SW_DEV) + rb_define_const(mod, "SC_2_SW_DEV", INTEGER2NUM(_SC_2_SW_DEV)); +#endif +#if defined(_SC_2_UPE) + rb_define_const(mod, "SC_2_UPE", INTEGER2NUM(_SC_2_UPE)); +#endif +#if defined(_SC_2_VERSION) + rb_define_const(mod, "SC_2_VERSION", INTEGER2NUM(_SC_2_VERSION)); +#endif +#if defined(_SC_PAGE_SIZE) + rb_define_const(mod, "SC_PAGE_SIZE", INTEGER2NUM(_SC_PAGE_SIZE)); +#endif +#if defined(_SC_PAGESIZE) + rb_define_const(mod, "SC_PAGESIZE", INTEGER2NUM(_SC_PAGESIZE)); +#endif +#if defined(_SC_THREAD_DESTRUCTOR_ITERATIONS) + rb_define_const(mod, "SC_THREAD_DESTRUCTOR_ITERATIONS", INTEGER2NUM(_SC_THREAD_DESTRUCTOR_ITERATIONS)); +#endif +#if defined(_SC_THREAD_KEYS_MAX) + rb_define_const(mod, "SC_THREAD_KEYS_MAX", INTEGER2NUM(_SC_THREAD_KEYS_MAX)); +#endif +#if defined(_SC_THREAD_STACK_MIN) + rb_define_const(mod, "SC_THREAD_STACK_MIN", INTEGER2NUM(_SC_THREAD_STACK_MIN)); +#endif +#if defined(_SC_THREAD_THREADS_MAX) + rb_define_const(mod, "SC_THREAD_THREADS_MAX", INTEGER2NUM(_SC_THREAD_THREADS_MAX)); +#endif +#if defined(_SC_RE_DUP_MAX) + rb_define_const(mod, "SC_RE_DUP_MAX", INTEGER2NUM(_SC_RE_DUP_MAX)); +#endif +#if defined(_SC_RTSIG_MAX) + rb_define_const(mod, "SC_RTSIG_MAX", INTEGER2NUM(_SC_RTSIG_MAX)); +#endif +#if defined(_SC_SEM_NSEMS_MAX) + rb_define_const(mod, "SC_SEM_NSEMS_MAX", INTEGER2NUM(_SC_SEM_NSEMS_MAX)); +#endif +#if defined(_SC_SEM_VALUE_MAX) + rb_define_const(mod, "SC_SEM_VALUE_MAX", INTEGER2NUM(_SC_SEM_VALUE_MAX)); +#endif +#if defined(_SC_SIGQUEUE_MAX) + rb_define_const(mod, "SC_SIGQUEUE_MAX", INTEGER2NUM(_SC_SIGQUEUE_MAX)); +#endif +#if defined(_SC_STREAM_MAX) + rb_define_const(mod, "SC_STREAM_MAX", INTEGER2NUM(_SC_STREAM_MAX)); +#endif +#if defined(_SC_SYMLOOP_MAX) + rb_define_const(mod, "SC_SYMLOOP_MAX", INTEGER2NUM(_SC_SYMLOOP_MAX)); +#endif +#if defined(_SC_TIMER_MAX) + rb_define_const(mod, "SC_TIMER_MAX", INTEGER2NUM(_SC_TIMER_MAX)); +#endif +#if defined(_SC_TTY_NAME_MAX) + rb_define_const(mod, "SC_TTY_NAME_MAX", INTEGER2NUM(_SC_TTY_NAME_MAX)); +#endif +#if defined(_SC_TZNAME_MAX) + rb_define_const(mod, "SC_TZNAME_MAX", INTEGER2NUM(_SC_TZNAME_MAX)); +#endif +#if defined(_SC_XOPEN_CRYPT) + rb_define_const(mod, "SC_XOPEN_CRYPT", INTEGER2NUM(_SC_XOPEN_CRYPT)); +#endif +#if defined(_SC_XOPEN_ENH_I18N) + rb_define_const(mod, "SC_XOPEN_ENH_I18N", INTEGER2NUM(_SC_XOPEN_ENH_I18N)); +#endif +#if defined(_SC_XOPEN_REALTIME) + rb_define_const(mod, "SC_XOPEN_REALTIME", INTEGER2NUM(_SC_XOPEN_REALTIME)); +#endif +#if defined(_SC_XOPEN_REALTIME_THREADS) + rb_define_const(mod, "SC_XOPEN_REALTIME_THREADS", INTEGER2NUM(_SC_XOPEN_REALTIME_THREADS)); +#endif +#if defined(_SC_XOPEN_SHM) + rb_define_const(mod, "SC_XOPEN_SHM", INTEGER2NUM(_SC_XOPEN_SHM)); +#endif +#if defined(_SC_XOPEN_STREAMS) + rb_define_const(mod, "SC_XOPEN_STREAMS", INTEGER2NUM(_SC_XOPEN_STREAMS)); +#endif +#if defined(_SC_XOPEN_UNIX) + rb_define_const(mod, "SC_XOPEN_UNIX", INTEGER2NUM(_SC_XOPEN_UNIX)); +#endif +#if defined(_SC_XOPEN_UUCP) + rb_define_const(mod, "SC_XOPEN_UUCP", INTEGER2NUM(_SC_XOPEN_UUCP)); +#endif +#if defined(_SC_XOPEN_VERSION) + rb_define_const(mod, "SC_XOPEN_VERSION", INTEGER2NUM(_SC_XOPEN_VERSION)); +#endif +#if defined(_SC_PHYS_PAGES) + rb_define_const(mod, "SC_PHYS_PAGES", INTEGER2NUM(_SC_PHYS_PAGES)); +#endif +#if defined(_SC_AVPHYS_PAGES) + rb_define_const(mod, "SC_AVPHYS_PAGES", INTEGER2NUM(_SC_AVPHYS_PAGES)); +#endif +#if defined(_SC_NPROCESSORS_CONF) + rb_define_const(mod, "SC_NPROCESSORS_CONF", INTEGER2NUM(_SC_NPROCESSORS_CONF)); +#endif +#if defined(_SC_NPROCESSORS_ONLN) + rb_define_const(mod, "SC_NPROCESSORS_ONLN", INTEGER2NUM(_SC_NPROCESSORS_ONLN)); +#endif +#if defined(_SC_CPUSET_SIZE) + rb_define_const(mod, "SC_CPUSET_SIZE", INTEGER2NUM(_SC_CPUSET_SIZE)); +#endif +#if defined(_CS_PATH) + rb_define_const(mod, "CS_PATH", INTEGER2NUM(_CS_PATH)); +#endif +#if defined(_CS_POSIX_V7_ILP32_OFF32_CFLAGS) + rb_define_const(mod, "CS_POSIX_V7_ILP32_OFF32_CFLAGS", INTEGER2NUM(_CS_POSIX_V7_ILP32_OFF32_CFLAGS)); +#endif +#if defined(_CS_POSIX_V7_ILP32_OFF32_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V7_ILP32_OFF32_LDFLAGS", INTEGER2NUM(_CS_POSIX_V7_ILP32_OFF32_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V7_ILP32_OFF32_LIBS) + rb_define_const(mod, "CS_POSIX_V7_ILP32_OFF32_LIBS", INTEGER2NUM(_CS_POSIX_V7_ILP32_OFF32_LIBS)); +#endif +#if defined(_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS) + rb_define_const(mod, "CS_POSIX_V7_ILP32_OFFBIG_CFLAGS", INTEGER2NUM(_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS)); +#endif +#if defined(_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS", INTEGER2NUM(_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V7_ILP32_OFFBIG_LIBS) + rb_define_const(mod, "CS_POSIX_V7_ILP32_OFFBIG_LIBS", INTEGER2NUM(_CS_POSIX_V7_ILP32_OFFBIG_LIBS)); +#endif +#if defined(_CS_POSIX_V7_LP64_OFF64_CFLAGS) + rb_define_const(mod, "CS_POSIX_V7_LP64_OFF64_CFLAGS", INTEGER2NUM(_CS_POSIX_V7_LP64_OFF64_CFLAGS)); +#endif +#if defined(_CS_POSIX_V7_LP64_OFF64_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V7_LP64_OFF64_LDFLAGS", INTEGER2NUM(_CS_POSIX_V7_LP64_OFF64_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V7_LP64_OFF64_LIBS) + rb_define_const(mod, "CS_POSIX_V7_LP64_OFF64_LIBS", INTEGER2NUM(_CS_POSIX_V7_LP64_OFF64_LIBS)); +#endif +#if defined(_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS) + rb_define_const(mod, "CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS", INTEGER2NUM(_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS)); +#endif +#if defined(_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS", INTEGER2NUM(_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V7_LPBIG_OFFBIG_LIBS) + rb_define_const(mod, "CS_POSIX_V7_LPBIG_OFFBIG_LIBS", INTEGER2NUM(_CS_POSIX_V7_LPBIG_OFFBIG_LIBS)); +#endif +#if defined(_CS_POSIX_V7_THREADS_CFLAGS) + rb_define_const(mod, "CS_POSIX_V7_THREADS_CFLAGS", INTEGER2NUM(_CS_POSIX_V7_THREADS_CFLAGS)); +#endif +#if defined(_CS_POSIX_V7_THREADS_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V7_THREADS_LDFLAGS", INTEGER2NUM(_CS_POSIX_V7_THREADS_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS) + rb_define_const(mod, "CS_POSIX_V7_WIDTH_RESTRICTED_ENVS", INTEGER2NUM(_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS)); +#endif +#if defined(_CS_V7_ENV) + rb_define_const(mod, "CS_V7_ENV", INTEGER2NUM(_CS_V7_ENV)); +#endif +#if defined(_CS_POSIX_V6_ILP32_OFF32_CFLAGS) + rb_define_const(mod, "CS_POSIX_V6_ILP32_OFF32_CFLAGS", INTEGER2NUM(_CS_POSIX_V6_ILP32_OFF32_CFLAGS)); +#endif +#if defined(_CS_POSIX_V6_ILP32_OFF32_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V6_ILP32_OFF32_LDFLAGS", INTEGER2NUM(_CS_POSIX_V6_ILP32_OFF32_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V6_ILP32_OFF32_LIBS) + rb_define_const(mod, "CS_POSIX_V6_ILP32_OFF32_LIBS", INTEGER2NUM(_CS_POSIX_V6_ILP32_OFF32_LIBS)); +#endif +#if defined(_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS) + rb_define_const(mod, "CS_POSIX_V6_ILP32_OFFBIG_CFLAGS", INTEGER2NUM(_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS)); +#endif +#if defined(_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS", INTEGER2NUM(_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V6_ILP32_OFFBIG_LIBS) + rb_define_const(mod, "CS_POSIX_V6_ILP32_OFFBIG_LIBS", INTEGER2NUM(_CS_POSIX_V6_ILP32_OFFBIG_LIBS)); +#endif +#if defined(_CS_POSIX_V6_LP64_OFF64_CFLAGS) + rb_define_const(mod, "CS_POSIX_V6_LP64_OFF64_CFLAGS", INTEGER2NUM(_CS_POSIX_V6_LP64_OFF64_CFLAGS)); +#endif +#if defined(_CS_POSIX_V6_LP64_OFF64_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V6_LP64_OFF64_LDFLAGS", INTEGER2NUM(_CS_POSIX_V6_LP64_OFF64_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V6_LP64_OFF64_LIBS) + rb_define_const(mod, "CS_POSIX_V6_LP64_OFF64_LIBS", INTEGER2NUM(_CS_POSIX_V6_LP64_OFF64_LIBS)); +#endif +#if defined(_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS) + rb_define_const(mod, "CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS", INTEGER2NUM(_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS)); +#endif +#if defined(_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS) + rb_define_const(mod, "CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS", INTEGER2NUM(_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS)); +#endif +#if defined(_CS_POSIX_V6_LPBIG_OFFBIG_LIBS) + rb_define_const(mod, "CS_POSIX_V6_LPBIG_OFFBIG_LIBS", INTEGER2NUM(_CS_POSIX_V6_LPBIG_OFFBIG_LIBS)); +#endif +#if defined(_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS) + rb_define_const(mod, "CS_POSIX_V6_WIDTH_RESTRICTED_ENVS", INTEGER2NUM(_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS)); +#endif +#if defined(_CS_V6_ENV) + rb_define_const(mod, "CS_V6_ENV", INTEGER2NUM(_CS_V6_ENV)); +#endif +#if defined(_CS_GNU_LIBC_VERSION) + rb_define_const(mod, "CS_GNU_LIBC_VERSION", INTEGER2NUM(_CS_GNU_LIBC_VERSION)); +#endif +#if defined(_CS_GNU_LIBPTHREAD_VERSION) + rb_define_const(mod, "CS_GNU_LIBPTHREAD_VERSION", INTEGER2NUM(_CS_GNU_LIBPTHREAD_VERSION)); +#endif +#if defined(_PC_FILESIZEBITS) + rb_define_const(mod, "PC_FILESIZEBITS", INTEGER2NUM(_PC_FILESIZEBITS)); +#endif +#if defined(_PC_LINK_MAX) + rb_define_const(mod, "PC_LINK_MAX", INTEGER2NUM(_PC_LINK_MAX)); +#endif +#if defined(_PC_MAX_CANON) + rb_define_const(mod, "PC_MAX_CANON", INTEGER2NUM(_PC_MAX_CANON)); +#endif +#if defined(_PC_MAX_INPUT) + rb_define_const(mod, "PC_MAX_INPUT", INTEGER2NUM(_PC_MAX_INPUT)); +#endif +#if defined(_PC_NAME_MAX) + rb_define_const(mod, "PC_NAME_MAX", INTEGER2NUM(_PC_NAME_MAX)); +#endif +#if defined(_PC_PATH_MAX) + rb_define_const(mod, "PC_PATH_MAX", INTEGER2NUM(_PC_PATH_MAX)); +#endif +#if defined(_PC_PIPE_BUF) + rb_define_const(mod, "PC_PIPE_BUF", INTEGER2NUM(_PC_PIPE_BUF)); +#endif +#if defined(_PC_2_SYMLINKS) + rb_define_const(mod, "PC_2_SYMLINKS", INTEGER2NUM(_PC_2_SYMLINKS)); +#endif +#if defined(_PC_ALLOC_SIZE_MIN) + rb_define_const(mod, "PC_ALLOC_SIZE_MIN", INTEGER2NUM(_PC_ALLOC_SIZE_MIN)); +#endif +#if defined(_PC_REC_INCR_XFER_SIZE) + rb_define_const(mod, "PC_REC_INCR_XFER_SIZE", INTEGER2NUM(_PC_REC_INCR_XFER_SIZE)); +#endif +#if defined(_PC_REC_MAX_XFER_SIZE) + rb_define_const(mod, "PC_REC_MAX_XFER_SIZE", INTEGER2NUM(_PC_REC_MAX_XFER_SIZE)); +#endif +#if defined(_PC_REC_MIN_XFER_SIZE) + rb_define_const(mod, "PC_REC_MIN_XFER_SIZE", INTEGER2NUM(_PC_REC_MIN_XFER_SIZE)); +#endif +#if defined(_PC_REC_XFER_ALIGN) + rb_define_const(mod, "PC_REC_XFER_ALIGN", INTEGER2NUM(_PC_REC_XFER_ALIGN)); +#endif +#if defined(_PC_SYMLINK_MAX) + rb_define_const(mod, "PC_SYMLINK_MAX", INTEGER2NUM(_PC_SYMLINK_MAX)); +#endif +#if defined(_PC_CHOWN_RESTRICTED) + rb_define_const(mod, "PC_CHOWN_RESTRICTED", INTEGER2NUM(_PC_CHOWN_RESTRICTED)); +#endif +#if defined(_PC_NO_TRUNC) + rb_define_const(mod, "PC_NO_TRUNC", INTEGER2NUM(_PC_NO_TRUNC)); +#endif +#if defined(_PC_VDISABLE) + rb_define_const(mod, "PC_VDISABLE", INTEGER2NUM(_PC_VDISABLE)); +#endif +#if defined(_PC_ASYNC_IO) + rb_define_const(mod, "PC_ASYNC_IO", INTEGER2NUM(_PC_ASYNC_IO)); +#endif +#if defined(_PC_PRIO_IO) + rb_define_const(mod, "PC_PRIO_IO", INTEGER2NUM(_PC_PRIO_IO)); +#endif +#if defined(_PC_SYNC_IO) + rb_define_const(mod, "PC_SYNC_IO", INTEGER2NUM(_PC_SYNC_IO)); +#endif +#if defined(_PC_TIMESTAMP_RESOLUTION) + rb_define_const(mod, "PC_TIMESTAMP_RESOLUTION", INTEGER2NUM(_PC_TIMESTAMP_RESOLUTION)); +#endif + +} diff --git a/jni/ruby/ext/etc/depend b/jni/ruby/ext/etc/depend new file mode 100644 index 0000000..a73a184 --- /dev/null +++ b/jni/ruby/ext/etc/depend @@ -0,0 +1,9 @@ +etc.o : etc.c constdefs.h $(HDRS) $(ruby_headers) \ + $(hdrdir)/ruby/io.h \ + $(hdrdir)/ruby/encoding.h \ + $(hdrdir)/ruby/oniguruma.h + +constdefs.h : $(srcdir)/mkconstants.rb + @echo "generating constant definitions" + @$(RUBY) $(srcdir)/mkconstants.rb -o constdefs.h + diff --git a/jni/ruby/ext/etc/etc.c b/jni/ruby/ext/etc/etc.c new file mode 100644 index 0000000..e25b586 --- /dev/null +++ b/jni/ruby/ext/etc/etc.c @@ -0,0 +1,1199 @@ +/************************************************ + + etc.c - + + $Author: nobu $ + created at: Tue Mar 22 18:39:19 JST 1994 + +************************************************/ + +#include "ruby.h" +#include "ruby/encoding.h" +#include "ruby/io.h" + +#include <sys/types.h> +#ifdef HAVE_UNISTD_H +#include <unistd.h> +#endif + +#ifdef HAVE_GETPWENT +#include <pwd.h> +#endif + +#ifdef HAVE_GETGRENT +#include <grp.h> +#endif + +#include <errno.h> + +#ifdef HAVE_SYS_UTSNAME_H +#include <sys/utsname.h> +#endif + +#ifdef HAVE_SCHED_GETAFFINITY +#include <sched.h> +#endif + +static VALUE sPasswd; +#ifdef HAVE_GETGRENT +static VALUE sGroup; +#endif + +#ifdef _WIN32 +#include <shlobj.h> +#ifndef CSIDL_COMMON_APPDATA +#define CSIDL_COMMON_APPDATA 35 +#endif +#define HAVE_UNAME 1 +#endif + +#ifndef _WIN32 +char *getenv(); +#endif +char *getlogin(); + +#include "constdefs.h" + +/* call-seq: + * getlogin -> String + * + * Returns the short user name of the currently logged in user. + * Unfortunately, it is often rather easy to fool ::getlogin. + * + * Avoid ::getlogin for security-related purposes. + * + * If ::getlogin fails, try ::getpwuid. + * + * See the unix manpage for <code>getpwuid(3)</code> for more detail. + * + * e.g. + * Etc.getlogin -> 'guest' + */ +static VALUE +etc_getlogin(VALUE obj) +{ + char *login; + +#ifdef HAVE_GETLOGIN + login = getlogin(); + if (!login) login = getenv("USER"); +#else + login = getenv("USER"); +#endif + + if (login) { +#ifdef _WIN32 + rb_encoding *extenc = rb_utf8_encoding(); +#else + rb_encoding *extenc = rb_locale_encoding(); +#endif + return rb_external_str_new_with_enc(login, strlen(login), extenc); + } + + return Qnil; +} + +#if defined(HAVE_GETPWENT) || defined(HAVE_GETGRENT) +static VALUE +safe_setup_str(const char *str) +{ + if (str == 0) str = ""; + return rb_tainted_str_new2(str); +} + +static VALUE +safe_setup_locale_str(const char *str) +{ + if (str == 0) str = ""; + return rb_locale_str_new_cstr(str); +} + +static VALUE +safe_setup_filesystem_str(const char *str) +{ + if (str == 0) str = ""; + return rb_filesystem_str_new_cstr(str); +} +#endif + +#ifdef HAVE_GETPWENT +static VALUE +setup_passwd(struct passwd *pwd) +{ + if (pwd == 0) rb_sys_fail("/etc/passwd"); + return rb_struct_new(sPasswd, + safe_setup_locale_str(pwd->pw_name), +#ifdef HAVE_STRUCT_PASSWD_PW_PASSWD + safe_setup_str(pwd->pw_passwd), +#endif + UIDT2NUM(pwd->pw_uid), + GIDT2NUM(pwd->pw_gid), +#ifdef HAVE_STRUCT_PASSWD_PW_GECOS + safe_setup_locale_str(pwd->pw_gecos), +#endif + safe_setup_filesystem_str(pwd->pw_dir), + safe_setup_filesystem_str(pwd->pw_shell), +#ifdef HAVE_STRUCT_PASSWD_PW_CHANGE + INT2NUM(pwd->pw_change), +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_QUOTA + INT2NUM(pwd->pw_quota), +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_AGE + PW_AGE2VAL(pwd->pw_age), +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_CLASS + safe_setup_locale_str(pwd->pw_class), +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_COMMENT + safe_setup_locale_str(pwd->pw_comment), +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE + INT2NUM(pwd->pw_expire), +#endif + 0 /*dummy*/ + ); +} +#endif + +/* call-seq: + * getpwuid(uid) -> Passwd + * + * Returns the /etc/passwd information for the user with the given integer +uid+. + * + * The information is returned as a Passwd struct. + * + * If +uid+ is omitted, the value from <code>Passwd[:uid]</code> is returned + * instead. + * + * See the unix manpage for <code>getpwuid(3)</code> for more detail. + * + * === Example: + * + * Etc.getpwuid(0) + * #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash"> + */ +static VALUE +etc_getpwuid(int argc, VALUE *argv, VALUE obj) +{ +#if defined(HAVE_GETPWENT) + VALUE id; + rb_uid_t uid; + struct passwd *pwd; + + if (rb_scan_args(argc, argv, "01", &id) == 1) { + uid = NUM2UIDT(id); + } + else { + uid = getuid(); + } + pwd = getpwuid(uid); + if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %d", (int)uid); + return setup_passwd(pwd); +#else + return Qnil; +#endif +} + +/* call-seq: + * getpwnam(name) -> Passwd + * + * Returns the /etc/passwd information for the user with specified login + * +name+. + * + * The information is returned as a Passwd struct. + * + * See the unix manpage for <code>getpwnam(3)</code> for more detail. + * + * === Example: + * + * Etc.getpwnam('root') + * #=> #<struct Etc::Passwd name="root", passwd="x", uid=0, gid=0, gecos="root",dir="/root", shell="/bin/bash"> + */ +static VALUE +etc_getpwnam(VALUE obj, VALUE nam) +{ +#ifdef HAVE_GETPWENT + struct passwd *pwd; + + SafeStringValue(nam); + pwd = getpwnam(RSTRING_PTR(nam)); + if (pwd == 0) rb_raise(rb_eArgError, "can't find user for %"PRIsVALUE, nam); + return setup_passwd(pwd); +#else + return Qnil; +#endif +} + +#ifdef HAVE_GETPWENT +static int passwd_blocking = 0; +static VALUE +passwd_ensure(void) +{ + endpwent(); + passwd_blocking = (int)Qfalse; + return Qnil; +} + +static VALUE +passwd_iterate(void) +{ + struct passwd *pw; + + setpwent(); + while (pw = getpwent()) { + rb_yield(setup_passwd(pw)); + } + return Qnil; +} + +static void +each_passwd(void) +{ + if (passwd_blocking) { + rb_raise(rb_eRuntimeError, "parallel passwd iteration"); + } + passwd_blocking = (int)Qtrue; + rb_ensure(passwd_iterate, 0, passwd_ensure, 0); +} +#endif + +/* call-seq: + * Etc.passwd { |struct| block } -> Passwd + * Etc.passwd -> Passwd + * + * Provides a convenient Ruby iterator which executes a block for each entry + * in the /etc/passwd file. + * + * The code block is passed an Passwd struct. + * + * See ::getpwent above for details. + * + * Example: + * + * require 'etc' + * + * Etc.passwd {|u| + * puts u.name + " = " + u.gecos + * } + * + */ +static VALUE +etc_passwd(VALUE obj) +{ +#ifdef HAVE_GETPWENT + struct passwd *pw; + + if (rb_block_given_p()) { + each_passwd(); + } + else if (pw = getpwent()) { + return setup_passwd(pw); + } +#endif + return Qnil; +} + +/* call-seq: + * Etc::Passwd.each { |struct| block } -> Passwd + * Etc::Passwd.each -> Enumerator + * + * Iterates for each entry in the /etc/passwd file if a block is given. + * + * If no block is given, returns the Enumerator. + * + * The code block is passed an Passwd struct. + * + * See ::getpwent above for details. + * + * Example: + * + * require 'etc' + * + * Etc::Passwd.each {|u| + * puts u.name + " = " + u.gecos + * } + * + * Etc::Passwd.collect {|u| u.gecos} + * Etc::Passwd.collect {|u| u.gecos} + * + */ +static VALUE +etc_each_passwd(VALUE obj) +{ +#ifdef HAVE_GETPWENT + RETURN_ENUMERATOR(obj, 0, 0); + each_passwd(); +#endif + return obj; +} + +/* Resets the process of reading the /etc/passwd file, so that the next call + * to ::getpwent will return the first entry again. + */ +static VALUE +etc_setpwent(VALUE obj) +{ +#ifdef HAVE_GETPWENT + setpwent(); +#endif + return Qnil; +} + +/* Ends the process of scanning through the /etc/passwd file begun with + * ::getpwent, and closes the file. + */ +static VALUE +etc_endpwent(VALUE obj) +{ +#ifdef HAVE_GETPWENT + endpwent(); +#endif + return Qnil; +} + +/* Returns an entry from the /etc/passwd file. + * + * The first time it is called it opens the file and returns the first entry; + * each successive call returns the next entry, or +nil+ if the end of the file + * has been reached. + * + * To close the file when processing is complete, call ::endpwent. + * + * Each entry is returned as a Passwd struct. + * + */ +static VALUE +etc_getpwent(VALUE obj) +{ +#ifdef HAVE_GETPWENT + struct passwd *pw; + + if (pw = getpwent()) { + return setup_passwd(pw); + } +#endif + return Qnil; +} + +#ifdef HAVE_GETGRENT +static VALUE +setup_group(struct group *grp) +{ + VALUE mem; + char **tbl; + + mem = rb_ary_new(); + tbl = grp->gr_mem; + while (*tbl) { + rb_ary_push(mem, safe_setup_locale_str(*tbl)); + tbl++; + } + return rb_struct_new(sGroup, + safe_setup_locale_str(grp->gr_name), +#ifdef HAVE_STRUCT_GROUP_GR_PASSWD + safe_setup_str(grp->gr_passwd), +#endif + GIDT2NUM(grp->gr_gid), + mem); +} +#endif + +/* call-seq: + * getgrgid(group_id) -> Group + * + * Returns information about the group with specified integer +group_id+, + * as found in /etc/group. + * + * The information is returned as a Group struct. + * + * See the unix manpage for <code>getgrgid(3)</code> for more detail. + * + * === Example: + * + * Etc.getgrgid(100) + * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]> + * + */ +static VALUE +etc_getgrgid(int argc, VALUE *argv, VALUE obj) +{ +#ifdef HAVE_GETGRENT + VALUE id; + gid_t gid; + struct group *grp; + + if (rb_scan_args(argc, argv, "01", &id) == 1) { + gid = NUM2GIDT(id); + } + else { + gid = getgid(); + } + grp = getgrgid(gid); + if (grp == 0) rb_raise(rb_eArgError, "can't find group for %d", (int)gid); + return setup_group(grp); +#else + return Qnil; +#endif +} + +/* call-seq: + * getgrnam(name) -> Group + * + * Returns information about the group with specified +name+, as found in + * /etc/group. + * + * The information is returned as a Group struct. + * + * See the unix manpage for <code>getgrnam(3)</code> for more detail. + * + * === Example: + * + * Etc.getgrnam('users') + * #=> #<struct Etc::Group name="users", passwd="x", gid=100, mem=["meta", "root"]> + * + */ +static VALUE +etc_getgrnam(VALUE obj, VALUE nam) +{ +#ifdef HAVE_GETGRENT + struct group *grp; + + SafeStringValue(nam); + grp = getgrnam(RSTRING_PTR(nam)); + if (grp == 0) rb_raise(rb_eArgError, "can't find group for %"PRIsVALUE, nam); + return setup_group(grp); +#else + return Qnil; +#endif +} + +#ifdef HAVE_GETGRENT +static int group_blocking = 0; +static VALUE +group_ensure(void) +{ + endgrent(); + group_blocking = (int)Qfalse; + return Qnil; +} + + +static VALUE +group_iterate(void) +{ + struct group *pw; + + setgrent(); + while (pw = getgrent()) { + rb_yield(setup_group(pw)); + } + return Qnil; +} + +static void +each_group(void) +{ + if (group_blocking) { + rb_raise(rb_eRuntimeError, "parallel group iteration"); + } + group_blocking = (int)Qtrue; + rb_ensure(group_iterate, 0, group_ensure, 0); +} +#endif + +/* Provides a convenient Ruby iterator which executes a block for each entry + * in the /etc/group file. + * + * The code block is passed an Group struct. + * + * See ::getgrent above for details. + * + * Example: + * + * require 'etc' + * + * Etc.group {|g| + * puts g.name + ": " + g.mem.join(', ') + * } + * + */ +static VALUE +etc_group(VALUE obj) +{ +#ifdef HAVE_GETGRENT + struct group *grp; + + if (rb_block_given_p()) { + each_group(); + } + else if (grp = getgrent()) { + return setup_group(grp); + } +#endif + return Qnil; +} + +#ifdef HAVE_GETGRENT +/* call-seq: + * Etc::Group.each { |group| block } -> obj + * Etc::Group.each -> Enumerator + * + * Iterates for each entry in the /etc/group file if a block is given. + * + * If no block is given, returns the Enumerator. + * + * The code block is passed a Group struct. + * + * Example: + * + * require 'etc' + * + * Etc::Group.each {|g| + * puts g.name + ": " + g.mem.join(', ') + * } + * + * Etc::Group.collect {|g| g.name} + * Etc::Group.select {|g| !g.mem.empty?} + * + */ +static VALUE +etc_each_group(VALUE obj) +{ + RETURN_ENUMERATOR(obj, 0, 0); + each_group(); + return obj; +} +#endif + +/* Resets the process of reading the /etc/group file, so that the next call + * to ::getgrent will return the first entry again. + */ +static VALUE +etc_setgrent(VALUE obj) +{ +#ifdef HAVE_GETGRENT + setgrent(); +#endif + return Qnil; +} + +/* Ends the process of scanning through the /etc/group file begun by + * ::getgrent, and closes the file. + */ +static VALUE +etc_endgrent(VALUE obj) +{ +#ifdef HAVE_GETGRENT + endgrent(); +#endif + return Qnil; +} + +/* Returns an entry from the /etc/group file. + * + * The first time it is called it opens the file and returns the first entry; + * each successive call returns the next entry, or +nil+ if the end of the file + * has been reached. + * + * To close the file when processing is complete, call ::endgrent. + * + * Each entry is returned as a Group struct + */ +static VALUE +etc_getgrent(VALUE obj) +{ +#ifdef HAVE_GETGRENT + struct group *gr; + + if (gr = getgrent()) { + return setup_group(gr); + } +#endif + return Qnil; +} + +#define numberof(array) (sizeof(array) / sizeof(*(array))) + +#ifdef _WIN32 +VALUE rb_w32_special_folder(int type); +UINT rb_w32_system_tmpdir(WCHAR *path, UINT len); +VALUE rb_w32_conv_from_wchar(const WCHAR *wstr, rb_encoding *enc); +#endif + +/* + * Returns system configuration directory. + * + * This is typically "/etc", but is modified by the prefix used when Ruby was + * compiled. For example, if Ruby is built and installed in /usr/local, returns + * "/usr/local/etc". + */ +static VALUE +etc_sysconfdir(VALUE obj) +{ +#ifdef _WIN32 + return rb_w32_special_folder(CSIDL_COMMON_APPDATA); +#else + return rb_filesystem_str_new_cstr(SYSCONFDIR); +#endif +} + +/* + * Returns system temporary directory; typically "/tmp". + */ +static VALUE +etc_systmpdir(void) +{ + VALUE tmpdir; +#ifdef _WIN32 + WCHAR path[_MAX_PATH]; + UINT len = rb_w32_system_tmpdir(path, numberof(path)); + if (!len) return Qnil; + tmpdir = rb_w32_conv_from_wchar(path, rb_filesystem_encoding()); +#else + const char default_tmp[] = "/tmp"; + const char *tmpstr = default_tmp; + size_t tmplen = strlen(default_tmp); +# if defined _CS_DARWIN_USER_TEMP_DIR + #ifndef MAXPATHLEN + #define MAXPATHLEN 1024 + #endif + char path[MAXPATHLEN]; + size_t len; + len = confstr(_CS_DARWIN_USER_TEMP_DIR, path, sizeof(path)); + if (len > 0) { + tmpstr = path; + tmplen = len - 1; + } +# endif + tmpdir = rb_filesystem_str_new(tmpstr, tmplen); +#endif + FL_UNSET(tmpdir, FL_TAINT); + return tmpdir; +} + +#ifdef HAVE_UNAME +/* + * Returns the system information obtained by uname system call. + * + * The return value is a hash which has 5 keys at least: + * :sysname, :nodename, :release, :version, :machine + * + * Example: + * + * require 'etc' + * require 'pp' + * + * pp Etc.uname + * #=> {:sysname=>"Linux", + * # :nodename=>"boron", + * # :release=>"2.6.18-6-xen-686", + * # :version=>"#1 SMP Thu Nov 5 19:54:42 UTC 2009", + * # :machine=>"i686"} + * + */ +static VALUE +etc_uname(VALUE obj) +{ +#ifdef _WIN32 + OSVERSIONINFOW v; + SYSTEM_INFO s; + const char *sysname, *mach; + VALUE result, release, version; + VALUE vbuf, nodename = Qnil; + DWORD len = 0; + WCHAR *buf; + + v.dwOSVersionInfoSize = sizeof(v); + if (!GetVersionExW(&v)) + rb_sys_fail("GetVersionEx"); + + result = rb_hash_new(); + switch (v.dwPlatformId) { + case VER_PLATFORM_WIN32s: + sysname = "Win32s"; + break; + case VER_PLATFORM_WIN32_NT: + sysname = "Windows_NT"; + break; + case VER_PLATFORM_WIN32_WINDOWS: + default: + sysname = "Windows"; + break; + } + rb_hash_aset(result, ID2SYM(rb_intern("sysname")), rb_str_new_cstr(sysname)); + release = rb_sprintf("%lu.%lu.%lu", v.dwMajorVersion, v.dwMinorVersion, v.dwBuildNumber); + rb_hash_aset(result, ID2SYM(rb_intern("release")), release); + version = rb_sprintf("%s Version %"PRIsVALUE": %"PRIsVALUE, sysname, release, + rb_w32_conv_from_wchar(v.szCSDVersion, rb_utf8_encoding())); + rb_hash_aset(result, ID2SYM(rb_intern("version")), version); + +# if defined _MSC_VER && _MSC_VER < 1300 +# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameW(ptr, plen) +# else +# define GET_COMPUTER_NAME(ptr, plen) GetComputerNameExW(ComputerNameDnsFullyQualified, ptr, plen) +# endif + GET_COMPUTER_NAME(NULL, &len); + buf = ALLOCV_N(WCHAR, vbuf, len); + if (GET_COMPUTER_NAME(buf, &len)) { + nodename = rb_w32_conv_from_wchar(buf, rb_utf8_encoding()); + } + ALLOCV_END(vbuf); + if (NIL_P(nodename)) nodename = rb_str_new(0, 0); + rb_hash_aset(result, ID2SYM(rb_intern("nodename")), nodename); + +# ifndef PROCESSOR_ARCHITECTURE_AMD64 +# define PROCESSOR_ARCHITECTURE_AMD64 9 +# endif +# ifndef PROCESSOR_ARCHITECTURE_IA64 +# define PROCESSOR_ARCHITECTURE_IA64 6 +# endif +# ifndef PROCESSOR_ARCHITECTURE_INTEL +# define PROCESSOR_ARCHITECTURE_INTEL 0 +# endif + GetSystemInfo(&s); + switch (s.wProcessorArchitecture) { + case PROCESSOR_ARCHITECTURE_AMD64: + mach = "x64"; + break; + case PROCESSOR_ARCHITECTURE_ARM: + mach = "ARM"; + break; + case PROCESSOR_ARCHITECTURE_IA64: + mach = "IA64"; + break; + case PROCESSOR_ARCHITECTURE_INTEL: + mach = "x86"; + break; + default: + mach = "unknown"; + break; + } + + rb_hash_aset(result, ID2SYM(rb_intern("machine")), rb_str_new_cstr(mach)); +#else + struct utsname u; + int ret; + VALUE result; + + ret = uname(&u); + if (ret == -1) + rb_sys_fail("uname"); + + result = rb_hash_new(); + rb_hash_aset(result, ID2SYM(rb_intern("sysname")), rb_str_new_cstr(u.sysname)); + rb_hash_aset(result, ID2SYM(rb_intern("nodename")), rb_str_new_cstr(u.nodename)); + rb_hash_aset(result, ID2SYM(rb_intern("release")), rb_str_new_cstr(u.release)); + rb_hash_aset(result, ID2SYM(rb_intern("version")), rb_str_new_cstr(u.version)); + rb_hash_aset(result, ID2SYM(rb_intern("machine")), rb_str_new_cstr(u.machine)); +#endif + + return result; +} +#else +#define etc_uname rb_f_notimplement +#endif + +#ifdef HAVE_SYSCONF +/* + * Returns system configuration variable using sysconf(). + * + * _name_ should be a constant under <code>Etc</code> which begins with <code>SC_</code>. + * + * The return value is an integer or nil. + * nil means indefinite limit. (sysconf() returns -1 but errno is not set.) + * + * Etc.sysconf(Etc::SC_ARG_MAX) #=> 2097152 + * Etc.sysconf(Etc::SC_LOGIN_NAME_MAX) #=> 256 + * + */ +static VALUE +etc_sysconf(VALUE obj, VALUE arg) +{ + int name; + long ret; + + name = NUM2INT(arg); + + errno = 0; + ret = sysconf(name); + if (ret == -1) { + if (errno == 0) /* no limit */ + return Qnil; + rb_sys_fail("sysconf"); + } + return LONG2NUM(ret); +} +#else +#define etc_sysconf rb_f_notimplement +#endif + +#ifdef HAVE_CONFSTR +/* + * Returns system configuration variable using confstr(). + * + * _name_ should be a constant under <code>Etc</code> which begins with <code>CS_</code>. + * + * The return value is a string or nil. + * nil means no configuration-defined value. (confstr() returns 0 but errno is not set.) + * + * Etc.confstr(Etc::CS_PATH) #=> "/bin:/usr/bin" + * + * # GNU/Linux + * Etc.confstr(Etc::CS_GNU_LIBC_VERSION) #=> "glibc 2.18" + * Etc.confstr(Etc::CS_GNU_LIBPTHREAD_VERSION) #=> "NPTL 2.18" + * + */ +static VALUE +etc_confstr(VALUE obj, VALUE arg) +{ + int name; + char localbuf[128], *buf = localbuf; + size_t bufsize = sizeof(localbuf), ret; + VALUE tmp; + + name = NUM2INT(arg); + + errno = 0; + ret = confstr(name, buf, bufsize); + if (bufsize < ret) { + bufsize = ret; + buf = ALLOCV_N(char, tmp, bufsize); + errno = 0; + ret = confstr(name, buf, bufsize); + } + if (bufsize < ret) + rb_bug("required buffer size for confstr() changed dynamically."); + if (ret == 0) { + if (errno == 0) /* no configuration-defined value */ + return Qnil; + rb_sys_fail("confstr"); + } + return rb_str_new_cstr(buf); +} +#else +#define etc_confstr rb_f_notimplement +#endif + +#ifdef HAVE_FPATHCONF +/* + * Returns pathname configuration variable using fpathconf(). + * + * _name_ should be a constant under <code>Etc</code> which begins with <code>PC_</code>. + * + * The return value is an integer or nil. + * nil means indefinite limit. (fpathconf() returns -1 but errno is not set.) + * + * require 'etc' + * IO.pipe {|r, w| + * p w.pathconf(Etc::PC_PIPE_BUF) #=> 4096 + * } + * + */ +static VALUE +io_pathconf(VALUE io, VALUE arg) +{ + int name; + long ret; + rb_io_t *fptr; + + name = NUM2INT(arg); + + GetOpenFile(io, fptr); + + errno = 0; + ret = fpathconf(fptr->fd, name); + if (ret == -1) { + if (errno == 0) /* no limit */ + return Qnil; + rb_sys_fail("fpathconf"); + } + return LONG2NUM(ret); +} +#else +#define io_pathconf rb_f_notimplement +#endif + +#if (defined(HAVE_SYSCONF) && defined(_SC_NPROCESSORS_ONLN)) || defined(_WIN32) + +#if defined(HAVE_SCHED_GETAFFINITY) && defined(CPU_ALLOC) +static int +etc_nprocessors_affin(void) +{ + cpu_set_t *cpuset; + size_t size; + int ret; + int n; + + /* + * XXX: + * man page says CPU_ALLOC takes number of cpus. But it is not accurate + * explanation. sched_getaffinity() returns EINVAL if cpuset bitmap is + * smaller than kernel internal bitmap. + * That said, sched_getaffinity() can fail when a kernel have sparse bitmap + * even if cpuset bitmap is larger than number of cpus. + * The precious way is to use /sys/devices/system/cpu/online. But there are + * two problems, + * - Costly calculation + * It is a minor issue, but possibly kill a benefit of a parallel processing. + * - No guarantee to exist /sys/devices/system/cpu/online + * This is an issue especially when using Linux containers. + * So, we use hardcode number for a workaround. Current linux kernel + * (Linux 3.17) support 8192 cpus at maximum. Then 16384 must be enough. + */ + for (n=64; n <= 16384; n *= 2) { + size = CPU_ALLOC_SIZE(n); + if (size >= 1024) { + cpuset = xcalloc(1, size); + if (!cpuset) + return -1; + } else { + cpuset = alloca(size); + CPU_ZERO_S(size, cpuset); + } + + ret = sched_getaffinity(0, size, cpuset); + if (ret == 0) { + /* On success, count number of cpus. */ + ret = CPU_COUNT_S(size, cpuset); + } + + if (size >= 1024) { + xfree(cpuset); + } + if (ret > 0) { + return ret; + } + } + + return ret; +} +#endif + +/* + * Returns the number of online processors. + * + * The result is intended as the number of processes to + * use all available processors. + * + * This method is implemented using: + * - sched_getaffinity(): Linux + * - sysconf(_SC_NPROCESSORS_ONLN): GNU/Linux, NetBSD, FreeBSD, OpenBSD, DragonFly BSD, OpenIndiana, Mac OS X, AIX + * + * Example: + * + * require 'etc' + * p Etc.nprocessors #=> 4 + * + * The result might be smaller number than physical cpus especially when ruby + * process is bound to specific cpus. This is intended for getting better + * parallel processing. + * + * Example: (Linux) + * + * linux$ taskset 0x3 ./ruby -retc -e "p Etc.nprocessors" #=> 2 + * + */ +static VALUE +etc_nprocessors(VALUE obj) +{ + long ret; + +#if !defined(_WIN32) + +#if defined(HAVE_SCHED_GETAFFINITY) && defined(CPU_ALLOC) + int ncpus; + + ncpus = etc_nprocessors_affin(); + if (ncpus != -1) { + return INT2NUM(ncpus); + } + /* fallback to _SC_NPROCESSORS_ONLN */ +#endif + + errno = 0; + ret = sysconf(_SC_NPROCESSORS_ONLN); + if (ret == -1) { + rb_sys_fail("sysconf(_SC_NPROCESSORS_ONLN)"); + } +#else + SYSTEM_INFO si; + GetSystemInfo(&si); + ret = (long)si.dwNumberOfProcessors; +#endif + return LONG2NUM(ret); +} +#else +#define etc_nprocessors rb_f_notimplement +#endif + +/* + * The Etc module provides access to information typically stored in + * files in the /etc directory on Unix systems. + * + * The information accessible consists of the information found in the + * /etc/passwd and /etc/group files, plus information about the system's + * temporary directory (/tmp) and configuration directory (/etc). + * + * The Etc module provides a more reliable way to access information about + * the logged in user than environment variables such as +$USER+. + * + * == Example: + * + * require 'etc' + * + * login = Etc.getlogin + * info = Etc.getpwnam(login) + * username = info.gecos.split(/,/).first + * puts "Hello #{username}, I see your login name is #{login}" + * + * Note that the methods provided by this module are not always secure. + * It should be used for informational purposes, and not for security. + * + * All operations defined in this module are class methods, so that you can + * include the Etc module into your class. + */ +void +Init_etc(void) +{ + VALUE mEtc; + + mEtc = rb_define_module("Etc"); + init_constants(mEtc); + + rb_define_module_function(mEtc, "getlogin", etc_getlogin, 0); + + rb_define_module_function(mEtc, "getpwuid", etc_getpwuid, -1); + rb_define_module_function(mEtc, "getpwnam", etc_getpwnam, 1); + rb_define_module_function(mEtc, "setpwent", etc_setpwent, 0); + rb_define_module_function(mEtc, "endpwent", etc_endpwent, 0); + rb_define_module_function(mEtc, "getpwent", etc_getpwent, 0); + rb_define_module_function(mEtc, "passwd", etc_passwd, 0); + + rb_define_module_function(mEtc, "getgrgid", etc_getgrgid, -1); + rb_define_module_function(mEtc, "getgrnam", etc_getgrnam, 1); + rb_define_module_function(mEtc, "group", etc_group, 0); + rb_define_module_function(mEtc, "setgrent", etc_setgrent, 0); + rb_define_module_function(mEtc, "endgrent", etc_endgrent, 0); + rb_define_module_function(mEtc, "getgrent", etc_getgrent, 0); + rb_define_module_function(mEtc, "sysconfdir", etc_sysconfdir, 0); + rb_define_module_function(mEtc, "systmpdir", etc_systmpdir, 0); + rb_define_module_function(mEtc, "uname", etc_uname, 0); + rb_define_module_function(mEtc, "sysconf", etc_sysconf, 1); + rb_define_module_function(mEtc, "confstr", etc_confstr, 1); + rb_define_method(rb_cIO, "pathconf", io_pathconf, 1); + rb_define_module_function(mEtc, "nprocessors", etc_nprocessors, 0); + + sPasswd = rb_struct_define_under(mEtc, "Passwd", + "name", +#ifdef HAVE_STRUCT_PASSWD_PW_PASSWD + "passwd", +#endif + "uid", + "gid", +#ifdef HAVE_STRUCT_PASSWD_PW_GECOS + "gecos", +#endif + "dir", + "shell", +#ifdef HAVE_STRUCT_PASSWD_PW_CHANGE + "change", +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_QUOTA + "quota", +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_AGE + "age", +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_CLASS + "uclass", +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_COMMENT + "comment", +#endif +#ifdef HAVE_STRUCT_PASSWD_PW_EXPIRE + "expire", +#endif + NULL); +#if 0 + /* Define-const: Passwd + * + * Passwd is a Struct that contains the following members: + * + * name:: + * contains the short login name of the user as a String. + * passwd:: + * contains the encrypted password of the user as a String. + * an 'x' is returned if shadow passwords are in use. An '*' is returned + * if the user cannot log in using a password. + * uid:: + * contains the integer user ID (uid) of the user. + * gid:: + * contains the integer group ID (gid) of the user's primary group. + * dir:: + * contains the path to the home directory of the user as a String. + * shell:: + * contains the path to the login shell of the user as a String. + * + * === The following members below are optional, and must be compiled with special flags: + * + * gecos:: + * contains a longer String description of the user, such as + * a full name. Some Unix systems provide structured information in the + * gecos field, but this is system-dependent. + * must be compiled with +HAVE_STRUCT_PASSWD_PW_GECOS+ + * change:: + * password change time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_CHANGE+ + * quota:: + * quota value(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_QUOTA+ + * age:: + * password age(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_AGE+ + * class:: + * user access class(string) must be compiled with +HAVE_STRUCT_PASSWD_PW_CLASS+ + * comment:: + * comment(string) must be compiled with +HAVE_STRUCT_PASSWD_PW_COMMENT+ + * expire:: + * account expiration time(integer) must be compiled with +HAVE_STRUCT_PASSWD_PW_EXPIRE+ + */ + rb_define_const(mEtc, "Passwd", sPasswd); +#endif + rb_define_const(rb_cStruct, "Passwd", sPasswd); /* deprecated name */ + rb_extend_object(sPasswd, rb_mEnumerable); + rb_define_singleton_method(sPasswd, "each", etc_each_passwd, 0); + +#ifdef HAVE_GETGRENT + sGroup = rb_struct_define_under(mEtc, "Group", "name", +#ifdef HAVE_STRUCT_GROUP_GR_PASSWD + "passwd", +#endif + "gid", "mem", NULL); + +#if 0 + /* Define-const: Group + * + * Group is a Struct that is only available when compiled with +HAVE_GETGRENT+. + * + * The struct contains the following members: + * + * name:: + * contains the name of the group as a String. + * passwd:: + * contains the encrypted password as a String. An 'x' is + * returned if password access to the group is not available; an empty + * string is returned if no password is needed to obtain membership of + * the group. + * + * Must be compiled with +HAVE_STRUCT_GROUP_GR_PASSWD+. + * gid:: + * contains the group's numeric ID as an integer. + * mem:: + * is an Array of Strings containing the short login names of the + * members of the group. + */ + rb_define_const(mEtc, "Group", sGroup); +#endif + rb_define_const(rb_cStruct, "Group", sGroup); /* deprecated name */ + rb_extend_object(sGroup, rb_mEnumerable); + rb_define_singleton_method(sGroup, "each", etc_each_group, 0); +#endif +} diff --git a/jni/ruby/ext/etc/extconf.h b/jni/ruby/ext/etc/extconf.h new file mode 100644 index 0000000..bf054fa --- /dev/null +++ b/jni/ruby/ext/etc/extconf.h @@ -0,0 +1,18 @@ +#ifndef EXTCONF_H +#define EXTCONF_H +#define HAVE_SYS_UTSNAME_H 1 +#define HAVE_UNAME 1 +#define HAVE_GETLOGIN 1 +#define HAVE_GETPWENT 1 +#define HAVE_GETGRENT 1 +#define SYSCONFDIR "/usr/local/etc" +#define HAVE_SYSCONF 1 +#define HAVE_CONFSTR 1 +#define HAVE_FPATHCONF 1 +#define HAVE_STRUCT_PASSWD_PW_GECOS 1 +#define HAVE_ST_PW_GECOS 1 +#define HAVE_STRUCT_PASSWD_PW_PASSWD 1 +#define HAVE_ST_PW_PASSWD 1 +#define HAVE_STRUCT_GROUP_GR_PASSWD 1 +#define HAVE_ST_GR_PASSWD 1 +#endif diff --git a/jni/ruby/ext/etc/extconf.rb b/jni/ruby/ext/etc/extconf.rb new file mode 100644 index 0000000..c6b41a4 --- /dev/null +++ b/jni/ruby/ext/etc/extconf.rb @@ -0,0 +1,43 @@ +require 'mkmf' + +headers = [] +%w[sys/utsname.h].each {|h| + if have_header(h, headers) + headers << h + end +} +have_library("sun", "getpwnam") # NIS (== YP) interface for IRIX 4 +have_func("uname((struct utsname *)NULL)", headers) +have_func("getlogin") +have_func("getpwent") +have_func("getgrent") +sysconfdir = RbConfig.expand(RbConfig::CONFIG["sysconfdir"].dup, "prefix"=>"", "DESTDIR"=>"") +$defs.push("-DSYSCONFDIR=#{Shellwords.escape(sysconfdir.dump)}") + +have_func("sysconf") +have_func("confstr") +have_func("fpathconf") + +have_struct_member('struct passwd', 'pw_gecos', 'pwd.h') +have_struct_member('struct passwd', 'pw_change', 'pwd.h') +have_struct_member('struct passwd', 'pw_quota', 'pwd.h') +if have_struct_member('struct passwd', 'pw_age', 'pwd.h') + case what_type?('struct passwd', 'pw_age', 'pwd.h') + when "string" + f = "safe_setup_str" + when "long long" + f = "LL2NUM" + else + f = "INT2NUM" + end + $defs.push("-DPW_AGE2VAL="+f) +end +have_struct_member('struct passwd', 'pw_class', 'pwd.h') +have_struct_member('struct passwd', 'pw_comment', 'pwd.h') unless /cygwin/ === RUBY_PLATFORM +have_struct_member('struct passwd', 'pw_expire', 'pwd.h') +have_struct_member('struct passwd', 'pw_passwd', 'pwd.h') +have_struct_member('struct group', 'gr_passwd', 'grp.h') + +$distcleanfiles << "constdefs.h" + +create_makefile("etc") diff --git a/jni/ruby/ext/etc/mkconstants.rb b/jni/ruby/ext/etc/mkconstants.rb new file mode 100644 index 0000000..c9fddfd --- /dev/null +++ b/jni/ruby/ext/etc/mkconstants.rb @@ -0,0 +1,331 @@ +require 'optparse' +require 'erb' + +C_ESC = { + "\\" => "\\\\", + '"' => '\"', + "\n" => '\n', +} + +0x00.upto(0x1f) {|ch| C_ESC[[ch].pack("C")] ||= "\\%03o" % ch } +0x7f.upto(0xff) {|ch| C_ESC[[ch].pack("C")] = "\\%03o" % ch } +C_ESC_PAT = Regexp.union(*C_ESC.keys) + +def c_str(str) + '"' + str.gsub(C_ESC_PAT) {|s| C_ESC[s]} + '"' +end + +opt = OptionParser.new + +opt.def_option('-h', 'help') { + puts opt + exit 0 +} + +opt_o = nil +opt.def_option('-o FILE', 'specify output file') {|filename| + opt_o = filename +} + +opt_H = nil +opt.def_option('-H FILE', 'specify output header file') {|filename| + opt_H = filename +} + +opt.parse! + +h = {} +COMMENTS = {} + +DATA.each_line {|s| + next if /\A\s*(\#|\z)/ =~ s + name, default_value, comment = s.chomp.split(/\s+/, 3) + + default_value = nil if default_value == 'nil' + + if h.has_key? name + warn "#{$.}: warning: duplicate name: #{name}" + next + end + h[name] = default_value + COMMENTS[name] = comment if comment +} +DEFS = h.to_a + +def each_const + DEFS.each {|name, default_value| + yield name, default_value + } +end + +def each_name(pat) + DEFS.each {|name, default_value| + next if pat !~ name + yield name + } +end + +ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_decls") +% each_const {|name, default_value| +#if !defined(<%=name%>) +# if defined(HAVE_CONST_<%=name.upcase%>) +# define <%=name%> <%=name%> +%if default_value +# else +# define <%=name%> <%=default_value%> +%end +# endif +#endif +% } +EOS + +ERB.new(<<'EOS', nil, '%').def_method(Object, "gen_const_defs") +% each_const {|name, default_value| +#if defined(<%=name%>) +% if comment = COMMENTS[name] + /* <%=comment%> */ +% end + rb_define_const(mod, <%=c_str name.sub(/\A_*/, '')%>, INTEGER2NUM(<%=name%>)); +#endif +% } +EOS + +header_result = ERB.new(<<'EOS', nil, '%').result(binding) +/* autogenerated file */ + +<%= gen_const_decls %> +EOS + +result = ERB.new(<<'EOS', nil, '%').result(binding) +/* autogenerated file */ + +#ifdef HAVE_LONG_LONG +#define INTEGER2NUM(n) \ + (FIXNUM_MAX < (n) ? ULL2NUM(n) : \ + FIXNUM_MIN > (LONG_LONG)(n) ? LL2NUM(n) : \ + LONG2FIX(n)) +#else +#define INTEGER2NUM(n) \ + (FIXNUM_MAX < (n) ? ULONG2NUM(n) : \ + FIXNUM_MIN > (long)(n) ? LONG2NUM(n) : \ + LONG2FIX(n)) +#endif + +static void +init_constants(VALUE mod) +{ +<%= gen_const_defs %> +} +EOS + +if opt_H + File.open(opt_H, 'w') {|f| + f << header_result + } +else + result = header_result + result +end + +if opt_o + File.open(opt_o, 'w') {|f| + f << result + } +else + $stdout << result +end + +__END__ +# SUSv4 +_SC_AIO_LISTIO_MAX +_SC_AIO_MAX +_SC_AIO_PRIO_DELTA_MAX +_SC_ARG_MAX +_SC_ATEXIT_MAX +_SC_BC_BASE_MAX +_SC_BC_DIM_MAX +_SC_BC_SCALE_MAX +_SC_BC_STRING_MAX +_SC_CHILD_MAX +_SC_CLK_TCK +_SC_COLL_WEIGHTS_MAX +_SC_DELAYTIMER_MAX +_SC_EXPR_NEST_MAX +_SC_HOST_NAME_MAX +_SC_IOV_MAX +_SC_LINE_MAX +_SC_LOGIN_NAME_MAX +_SC_NGROUPS_MAX +_SC_GETGR_R_SIZE_MAX +_SC_GETPW_R_SIZE_MAX +_SC_MQ_OPEN_MAX +_SC_MQ_PRIO_MAX +_SC_OPEN_MAX +_SC_ADVISORY_INFO +_SC_BARRIERS +_SC_ASYNCHRONOUS_IO +_SC_CLOCK_SELECTION +_SC_CPUTIME +_SC_FSYNC +_SC_IPV6 +_SC_JOB_CONTROL +_SC_MAPPED_FILES +_SC_MEMLOCK +_SC_MEMLOCK_RANGE +_SC_MEMORY_PROTECTION +_SC_MESSAGE_PASSING +_SC_MONOTONIC_CLOCK +_SC_PRIORITIZED_IO +_SC_PRIORITY_SCHEDULING +_SC_RAW_SOCKETS +_SC_READER_WRITER_LOCKS +_SC_REALTIME_SIGNALS +_SC_REGEXP +_SC_SAVED_IDS +_SC_SEMAPHORES +_SC_SHARED_MEMORY_OBJECTS +_SC_SHELL +_SC_SPAWN +_SC_SPIN_LOCKS +_SC_SPORADIC_SERVER +_SC_SS_REPL_MAX +_SC_SYNCHRONIZED_IO +_SC_THREAD_ATTR_STACKADDR +_SC_THREAD_ATTR_STACKSIZE +_SC_THREAD_CPUTIME +_SC_THREAD_PRIO_INHERIT +_SC_THREAD_PRIO_PROTECT +_SC_THREAD_PRIORITY_SCHEDULING +_SC_THREAD_PROCESS_SHARED +_SC_THREAD_ROBUST_PRIO_INHERIT +_SC_THREAD_ROBUST_PRIO_PROTECT +_SC_THREAD_SAFE_FUNCTIONS +_SC_THREAD_SPORADIC_SERVER +_SC_THREADS +_SC_TIMEOUTS +_SC_TIMERS +_SC_TRACE +_SC_TRACE_EVENT_FILTER +_SC_TRACE_EVENT_NAME_MAX +_SC_TRACE_INHERIT +_SC_TRACE_LOG +_SC_TRACE_NAME_MAX +_SC_TRACE_SYS_MAX +_SC_TRACE_USER_EVENT_MAX +_SC_TYPED_MEMORY_OBJECTS +_SC_VERSION +_SC_V7_ILP32_OFF32 +_SC_V7_ILP32_OFFBIG +_SC_V7_LP64_OFF64 +_SC_V7_LPBIG_OFFBIG +_SC_V6_ILP32_OFF32 +_SC_V6_ILP32_OFFBIG +_SC_V6_LP64_OFF64 +_SC_V6_LPBIG_OFFBIG +_SC_2_C_BIND +_SC_2_C_DEV +_SC_2_CHAR_TERM +_SC_2_FORT_DEV +_SC_2_FORT_RUN +_SC_2_LOCALEDEF +_SC_2_PBS +_SC_2_PBS_ACCOUNTING +_SC_2_PBS_CHECKPOINT +_SC_2_PBS_LOCATE +_SC_2_PBS_MESSAGE +_SC_2_PBS_TRACK +_SC_2_SW_DEV +_SC_2_UPE +_SC_2_VERSION +_SC_PAGE_SIZE +_SC_PAGESIZE +_SC_THREAD_DESTRUCTOR_ITERATIONS +_SC_THREAD_KEYS_MAX +_SC_THREAD_STACK_MIN +_SC_THREAD_THREADS_MAX +_SC_RE_DUP_MAX +_SC_RTSIG_MAX +_SC_SEM_NSEMS_MAX +_SC_SEM_VALUE_MAX +_SC_SIGQUEUE_MAX +_SC_STREAM_MAX +_SC_SYMLOOP_MAX +_SC_TIMER_MAX +_SC_TTY_NAME_MAX +_SC_TZNAME_MAX +_SC_XOPEN_CRYPT +_SC_XOPEN_ENH_I18N +_SC_XOPEN_REALTIME +_SC_XOPEN_REALTIME_THREADS +_SC_XOPEN_SHM +_SC_XOPEN_STREAMS +_SC_XOPEN_UNIX +_SC_XOPEN_UUCP +_SC_XOPEN_VERSION + +# non-standard +_SC_PHYS_PAGES +_SC_AVPHYS_PAGES +_SC_NPROCESSORS_CONF +_SC_NPROCESSORS_ONLN +_SC_CPUSET_SIZE + +# SUSv4 +_CS_PATH +_CS_POSIX_V7_ILP32_OFF32_CFLAGS +_CS_POSIX_V7_ILP32_OFF32_LDFLAGS +_CS_POSIX_V7_ILP32_OFF32_LIBS +_CS_POSIX_V7_ILP32_OFFBIG_CFLAGS +_CS_POSIX_V7_ILP32_OFFBIG_LDFLAGS +_CS_POSIX_V7_ILP32_OFFBIG_LIBS +_CS_POSIX_V7_LP64_OFF64_CFLAGS +_CS_POSIX_V7_LP64_OFF64_LDFLAGS +_CS_POSIX_V7_LP64_OFF64_LIBS +_CS_POSIX_V7_LPBIG_OFFBIG_CFLAGS +_CS_POSIX_V7_LPBIG_OFFBIG_LDFLAGS +_CS_POSIX_V7_LPBIG_OFFBIG_LIBS +_CS_POSIX_V7_THREADS_CFLAGS +_CS_POSIX_V7_THREADS_LDFLAGS +_CS_POSIX_V7_WIDTH_RESTRICTED_ENVS +_CS_V7_ENV +_CS_POSIX_V6_ILP32_OFF32_CFLAGS +_CS_POSIX_V6_ILP32_OFF32_LDFLAGS +_CS_POSIX_V6_ILP32_OFF32_LIBS +_CS_POSIX_V6_ILP32_OFFBIG_CFLAGS +_CS_POSIX_V6_ILP32_OFFBIG_LDFLAGS +_CS_POSIX_V6_ILP32_OFFBIG_LIBS +_CS_POSIX_V6_LP64_OFF64_CFLAGS +_CS_POSIX_V6_LP64_OFF64_LDFLAGS +_CS_POSIX_V6_LP64_OFF64_LIBS +_CS_POSIX_V6_LPBIG_OFFBIG_CFLAGS +_CS_POSIX_V6_LPBIG_OFFBIG_LDFLAGS +_CS_POSIX_V6_LPBIG_OFFBIG_LIBS +_CS_POSIX_V6_WIDTH_RESTRICTED_ENVS +_CS_V6_ENV + +# non-standard +_CS_GNU_LIBC_VERSION +_CS_GNU_LIBPTHREAD_VERSION + +# SUSv4 +_PC_FILESIZEBITS +_PC_LINK_MAX +_PC_MAX_CANON +_PC_MAX_INPUT +_PC_NAME_MAX +_PC_PATH_MAX +_PC_PIPE_BUF +_PC_2_SYMLINKS +_PC_ALLOC_SIZE_MIN +_PC_REC_INCR_XFER_SIZE +_PC_REC_MAX_XFER_SIZE +_PC_REC_MIN_XFER_SIZE +_PC_REC_XFER_ALIGN +_PC_SYMLINK_MAX +_PC_CHOWN_RESTRICTED +_PC_NO_TRUNC +_PC_VDISABLE +_PC_ASYNC_IO +_PC_PRIO_IO +_PC_SYNC_IO +_PC_TIMESTAMP_RESOLUTION + |