00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029
00030
00031
00032
00033
00034 #include "ruby.h"
00035 #include <fcntl.h>
00036
00037
00038
00039
00040
00041
00042
00043
00044
00045
00046
00047
00048
00049
00050
00051
00052
00053
00054
00055
00056
00057
00058
00059
00060
00061
00062
00063
00064
00065
00066
00067
00068
00069
00070
00071
00072
00073
00074
00075
00076
00077
00078
00079
00080
00081
00082
00083
00084
00085
00086
00087
00088
00089
00090
00091
00092
00093
00094
00095
00096
00097
00098
00099
00100
00101
00102
00103
00104
00105
00106
00107
00108
00109
00110
00111
00112 void
00113 Init_fcntl()
00114 {
00115 VALUE mFcntl = rb_define_module("Fcntl");
00116 #ifdef F_DUPFD
00117 rb_define_const(mFcntl, "F_DUPFD", INT2NUM(F_DUPFD));
00118 #endif
00119 #ifdef F_GETFD
00120 rb_define_const(mFcntl, "F_GETFD", INT2NUM(F_GETFD));
00121 #endif
00122 #ifdef F_GETLK
00123 rb_define_const(mFcntl, "F_GETLK", INT2NUM(F_GETLK));
00124 #endif
00125 #ifdef F_SETFD
00126 rb_define_const(mFcntl, "F_SETFD", INT2NUM(F_SETFD));
00127 #endif
00128 #ifdef F_GETFL
00129 rb_define_const(mFcntl, "F_GETFL", INT2NUM(F_GETFL));
00130 #endif
00131 #ifdef F_SETFL
00132 rb_define_const(mFcntl, "F_SETFL", INT2NUM(F_SETFL));
00133 #endif
00134 #ifdef F_SETLK
00135 rb_define_const(mFcntl, "F_SETLK", INT2NUM(F_SETLK));
00136 #endif
00137 #ifdef F_SETLKW
00138 rb_define_const(mFcntl, "F_SETLKW", INT2NUM(F_SETLKW));
00139 #endif
00140 #ifdef FD_CLOEXEC
00141 rb_define_const(mFcntl, "FD_CLOEXEC", INT2NUM(FD_CLOEXEC));
00142 #endif
00143 #ifdef F_RDLCK
00144 rb_define_const(mFcntl, "F_RDLCK", INT2NUM(F_RDLCK));
00145 #endif
00146 #ifdef F_UNLCK
00147 rb_define_const(mFcntl, "F_UNLCK", INT2NUM(F_UNLCK));
00148 #endif
00149 #ifdef F_WRLCK
00150 rb_define_const(mFcntl, "F_WRLCK", INT2NUM(F_WRLCK));
00151 #endif
00152 #ifdef O_CREAT
00153 rb_define_const(mFcntl, "O_CREAT", INT2NUM(O_CREAT));
00154 #endif
00155 #ifdef O_EXCL
00156 rb_define_const(mFcntl, "O_EXCL", INT2NUM(O_EXCL));
00157 #endif
00158 #ifdef O_NOCTTY
00159 rb_define_const(mFcntl, "O_NOCTTY", INT2NUM(O_NOCTTY));
00160 #endif
00161 #ifdef O_TRUNC
00162 rb_define_const(mFcntl, "O_TRUNC", INT2NUM(O_TRUNC));
00163 #endif
00164 #ifdef O_APPEND
00165 rb_define_const(mFcntl, "O_APPEND", INT2NUM(O_APPEND));
00166 #endif
00167 #ifdef O_NONBLOCK
00168 rb_define_const(mFcntl, "O_NONBLOCK", INT2NUM(O_NONBLOCK));
00169 #endif
00170 #ifdef O_NDELAY
00171 rb_define_const(mFcntl, "O_NDELAY", INT2NUM(O_NDELAY));
00172 #endif
00173 #ifdef O_RDONLY
00174 rb_define_const(mFcntl, "O_RDONLY", INT2NUM(O_RDONLY));
00175 #endif
00176 #ifdef O_RDWR
00177 rb_define_const(mFcntl, "O_RDWR", INT2NUM(O_RDWR));
00178 #endif
00179 #ifdef O_WRONLY
00180 rb_define_const(mFcntl, "O_WRONLY", INT2NUM(O_WRONLY));
00181 #endif
00182 #ifdef O_ACCMODE
00183 rb_define_const(mFcntl, "O_ACCMODE", INT2FIX(O_ACCMODE));
00184 #else
00185 rb_define_const(mFcntl, "O_ACCMODE", INT2FIX(O_RDONLY | O_WRONLY | O_RDWR));
00186 #endif
00187 }
00188