From: Michael Wallner Date: Tue, 26 Jan 2016 09:52:46 +0000 (+0100) Subject: fcntl X-Git-Url: https://git.m6w6.name/?a=commitdiff_plain;h=89b5359ee32bc4c90e2e3259f9565d2705f36c6b;p=m6w6%2Fext-psi fcntl --- diff --git a/config.m4 b/config.m4 index 9666b1b..e2a28dd 100644 --- a/config.m4 +++ b/config.m4 @@ -19,6 +19,7 @@ m4_foreach(incfile, [ [psi_macro.m4], [psi_struct.m4], [errno.m4], + [fcntl.m4], [glob.m4], [locale.m4], [stddef.m4], @@ -64,6 +65,7 @@ if test "$PHP_PSI" != no; then PSI_CHECK_STDDEF PSI_CHECK_SYS_TYPES PSI_CHECK_ERRNO + PSI_CHECK_FCNTL PSI_CHECK_GLOB PSI_CHECK_LOCALE PSI_CHECK_STDIO diff --git a/m4/fcntl.m4 b/m4/fcntl.m4 new file mode 100644 index 0000000..a9b59d4 --- /dev/null +++ b/m4/fcntl.m4 @@ -0,0 +1,73 @@ +PSI_CHECK_FCNTL() { + AC_CHECK_HEADERS(fcntl.h) + + PSI_CONST(F_DUPFD, int) + PSI_CONST(F_DUPFD_CLOEXEC, int) + PSI_CONST(F_GETFD, int) + PSI_CONST(F_SETFD, int) + PSI_CONST(F_GETFL, int) + PSI_CONST(F_SETFL, int) + PSI_CONST(F_GETLK, int) + PSI_CONST(F_SETLK, int) + PSI_CONST(F_SETLKW, int) + PSI_CONST(F_GETOWN, int) + PSI_CONST(F_SETOWN, int) + + PSI_CONST(FD_CLOEXEC, int) + + PSI_CONST(F_RDLCK, int) + PSI_CONST(F_UNLCK, int) + PSI_CONST(F_WRLCK, int) + + PSI_CONST(O_CLOEXEC, int) + PSI_CONST(O_CREAT, int) + PSI_CONST(O_DIRECTORY, int) + PSI_CONST(O_EXCL, int) + PSI_CONST(O_NOCTTY, int) + PSI_CONST(O_NOFOLLOW, int) + PSI_CONST(O_TRUNC, int) + PSI_CONST(O_TTY_INIT, int) + + PSI_CONST(O_APPEND, int) + PSI_CONST(O_DSYNC, int) + PSI_CONST(O_NONBLOCK, int) + PSI_CONST(O_RSYNC, int) + PSI_CONST(O_SYNC, int) + + PSI_CONST(O_ACCMODE, int) + + PSI_CONST(O_EXEC, int) + PSI_CONST(O_RDONLY, int) + PSI_CONST(O_RDWR, int) + PSI_CONST(O_SEARCH, int) + PSI_CONST(O_WRONLY, int) + + PSI_CONST(AT_FDCWD, int) + PSI_CONST(AT_EACCESS, int) + PSI_CONST(AT_SYMLINK_NOFOLLOW, int) + PSI_CONST(AT_SYMLINK_FOLLOW, int) + PSI_CONST(AT_REMOVEDIR, int) + + PSI_CONST(POSIX_FADV_DONTNEED, int) + PSI_CONST(POSIX_FADV_NOREUSE, int) + PSI_CONST(POSIX_FADV_NORMAL, int) + PSI_CONST(POSIX_FADV_RANDOM, int) + PSI_CONST(POSIX_FADV_SEQUENTUAL, int) + PSI_CONST(POSIX_FADV_WILLNEED, int) + + PSI_STRUCT(struct flock, [ + short l_type, + short l_whence, + off_t l_start, + off_t l_len, + pid_t l_pid] + ) + + PSI_DECL(int creat, [(const char *path, mode_t mode)]) + PSI_DECL(int fcntl, [(int fd, int cmd, mode_t mode)]) + PSI_DECL(int open, [(const char *path, int flags, mode_t mode)]) + PSI_DECL(int openat, [(int dirfd, const char *path, int flags, mode_t mode)]) + + PSI_DECL(int posix_fadvise, [(int fd, off_t offset, off_t len, int advice)]) + PSI_DECL(int posix_fallocate, [(int fd, off_t offset, off_t len)]) +} diff --git a/m4/psi.m4 b/m4/psi.m4 index 37864d0..1f6af02 100644 --- a/m4/psi.m4 +++ b/m4/psi.m4 @@ -14,6 +14,7 @@ dnl These headers are included by src/context.c. dnl This macro must be called prior any checks for a type, struct, decl etc. AC_DEFUN(PSI_CONFIG_INIT, [ cat >$PSI_TYPES <@ = { EOF cat >$PSI_STRUCTS <@ = { EOF cat >$PSI_CONSTS <@ = { EOF cat >$PSI_REDIRS <$PSI_MACROS $PSI_DECLS <@ = { EOF cat >$PSI_VA_DECLS <@ = { EOF ]) @@ -65,6 +71,7 @@ dnl PSI_CONFIG_DONE() dnl Finish the headers with the pre-defined types etc. AC_DEFUN(PSI_CONFIG_DONE, [ cat >$PSI_STDINC < #endif +#ifdef HAVE_FCNTL_H +# include +#endif #ifdef HAVE_NDBM_H # include #endif @@ -154,7 +164,7 @@ AC_DEFUN(PSI_LEMON, [ dnl PSI_PKG_CONFIG() dnl Check for `pkg-config` and add possible libjit and libffi directories to -dnl $PKG_CONFIG_PATH, because those libs often ship with headers etc. in +dnl $PKG_CONFIG_PATH, because those libs often ship with headers etc. in dnl arch-dependent locations. AC_DEFUN([PSI_PKG_CONFIG], [ if test -z "$PKG_CONFIG" @@ -247,11 +257,11 @@ AC_DEFUN(PSI_CHECK_LIBJIT, [ dnl PSI_CHECK_LIBFFI() dnl Check for libffi with `pkg-config`. If that fails, `configure` looks into dnl $PHP_PSI_LIBFFI or standard locations to find libjit deps. -dnl Checks for availability of recent closure API: +dnl Checks for availability of recent closure API: dnl \ffi_closure_alloc and \ffi_prep_closure. dnl Checks for availability of recent vararg API: dnl \ffi_prep_cif_var. -dnl AC_DEFINEs HAVE_LIBFFI, PSI_HAVE_FFI_CLOSURE_ALLOC, +dnl AC_DEFINEs HAVE_LIBFFI, PSI_HAVE_FFI_CLOSURE_ALLOC, dnl PSI_HAVE_FFI_PREP_CLOSURE and PSI_HAVE_FFO_PREP_VIF_VAR. AC_DEFUN(PSI_CHECK_LIBFFI, [ AC_REQUIRE([PSI_PKG_CONFIG])dnl @@ -263,7 +273,7 @@ AC_DEFUN(PSI_CHECK_LIBFFI, [ else psi_cv_libffi=false fi]) - + if $psi_cv_libffi then AC_MSG_CHECKING(for libffi)