* ext/curses/extconf.rb: add dir_config.
quote> * missing/flock.c: use fcntl(2) instead of lockf(2). git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@1196 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
b2deafb277
commit
99ee3b0038
@ -1,3 +1,9 @@
|
|||||||
|
Sun Feb 18 15:42:38 2001 WATANABE Hirofumi <eban@ruby-lang.org>
|
||||||
|
|
||||||
|
* ext/curses/extconf.rb: add dir_config.
|
||||||
|
|
||||||
|
* missing/flock.c: use fcntl(2) instead of lockf(2).
|
||||||
|
|
||||||
Sun Feb 18 05:46:03 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
Sun Feb 18 05:46:03 2001 Minero Aoki <aamine@dp.u-netsurf.ne.jp>
|
||||||
|
|
||||||
* lib/net/http.rb: Response#range_length was not debugged.
|
* lib/net/http.rb: Response#range_length was not debugged.
|
||||||
|
@ -1,5 +1,9 @@
|
|||||||
require 'mkmf'
|
require 'mkmf'
|
||||||
|
|
||||||
|
dir_config('curses')
|
||||||
|
dir_config('ncurses')
|
||||||
|
dir_config('termcap')
|
||||||
|
|
||||||
make=false
|
make=false
|
||||||
have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
|
have_library("mytinfo", "tgetent") if /bow/ =~ RUBY_PLATFORM
|
||||||
if have_header("ncurses.h") and have_library("ncurses", "initscr")
|
if have_header("ncurses.h") and have_library("ncurses", "initscr")
|
||||||
|
@ -1,6 +1,55 @@
|
|||||||
#include "config.h"
|
#include "config.h"
|
||||||
|
|
||||||
#if defined(HAVE_LOCKF)
|
#if defined HAVE_FCNTL && defined HAVE_FCNTL_H
|
||||||
|
|
||||||
|
/* These are the flock() constants. Since this sytems doesn't have
|
||||||
|
flock(), the values of the constants are probably not available.
|
||||||
|
*/
|
||||||
|
# ifndef LOCK_SH
|
||||||
|
# define LOCK_SH 1
|
||||||
|
# endif
|
||||||
|
# ifndef LOCK_EX
|
||||||
|
# define LOCK_EX 2
|
||||||
|
# endif
|
||||||
|
# ifndef LOCK_NB
|
||||||
|
# define LOCK_NB 4
|
||||||
|
# endif
|
||||||
|
# ifndef LOCK_UN
|
||||||
|
# define LOCK_UN 8
|
||||||
|
# endif
|
||||||
|
|
||||||
|
#include <fcntl.h>
|
||||||
|
#include <unistd.h>
|
||||||
|
#include <errno.h>
|
||||||
|
|
||||||
|
int
|
||||||
|
flock(fd, operation)
|
||||||
|
int fd;
|
||||||
|
int operation;
|
||||||
|
{
|
||||||
|
struct flock lock;
|
||||||
|
|
||||||
|
switch (operation & ~LOCK_NB) {
|
||||||
|
case LOCK_SH:
|
||||||
|
lock.l_type = F_RDLCK;
|
||||||
|
break;
|
||||||
|
case LOCK_EX:
|
||||||
|
lock.l_type = F_WRLCK;
|
||||||
|
break;
|
||||||
|
case LOCK_UN:
|
||||||
|
lock.l_type = F_UNLCK;
|
||||||
|
break;
|
||||||
|
default:
|
||||||
|
errno = EINVAL;
|
||||||
|
return -1;
|
||||||
|
}
|
||||||
|
lock.l_whence = SEEK_SET;
|
||||||
|
lock.l_start = lock.l_len = 0L;
|
||||||
|
|
||||||
|
return fcntl(fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &lock);
|
||||||
|
}
|
||||||
|
|
||||||
|
#elif defined(HAVE_LOCKF)
|
||||||
|
|
||||||
#include <unistd.h>
|
#include <unistd.h>
|
||||||
#include <errno.h>
|
#include <errno.h>
|
||||||
@ -78,54 +127,6 @@ flock(fd, operation)
|
|||||||
}
|
}
|
||||||
return i;
|
return i;
|
||||||
}
|
}
|
||||||
#elif defined HAVE_FCNTL && defined HAVE_FCNTL_H
|
|
||||||
|
|
||||||
/* These are the flock() constants. Since this sytems doesn't have
|
|
||||||
flock(), the values of the constants are probably not available.
|
|
||||||
*/
|
|
||||||
# ifndef LOCK_SH
|
|
||||||
# define LOCK_SH 1
|
|
||||||
# endif
|
|
||||||
# ifndef LOCK_EX
|
|
||||||
# define LOCK_EX 2
|
|
||||||
# endif
|
|
||||||
# ifndef LOCK_NB
|
|
||||||
# define LOCK_NB 4
|
|
||||||
# endif
|
|
||||||
# ifndef LOCK_UN
|
|
||||||
# define LOCK_UN 8
|
|
||||||
# endif
|
|
||||||
|
|
||||||
#include <fcntl.h>
|
|
||||||
#include <unistd.h>
|
|
||||||
#include <errno.h>
|
|
||||||
|
|
||||||
int
|
|
||||||
flock(fd, operation)
|
|
||||||
int fd;
|
|
||||||
int operation;
|
|
||||||
{
|
|
||||||
struct flock lock;
|
|
||||||
|
|
||||||
switch (operation & ~LOCK_NB) {
|
|
||||||
case LOCK_SH:
|
|
||||||
lock.l_type = F_RDLCK;
|
|
||||||
break;
|
|
||||||
case LOCK_EX:
|
|
||||||
lock.l_type = F_WRLCK;
|
|
||||||
break;
|
|
||||||
case LOCK_UN:
|
|
||||||
lock.l_type = F_UNLCK;
|
|
||||||
break;
|
|
||||||
default:
|
|
||||||
errno = EINVAL;
|
|
||||||
return -1;
|
|
||||||
}
|
|
||||||
lock.l_whence = SEEK_SET;
|
|
||||||
lock.l_start = lock.l_len = 0L;
|
|
||||||
|
|
||||||
return fcntl(fd, (operation & LOCK_NB) ? F_SETLK : F_SETLKW, &lock);
|
|
||||||
}
|
|
||||||
#elif !defined NT
|
#elif !defined NT
|
||||||
int
|
int
|
||||||
flock(fd, operation)
|
flock(fd, operation)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user