mirror of
https://github.com/transmission/transmission
synced 2024-12-25 17:17:31 +00:00
* add O_LARGEFILE support to fdlimit for the benefit of 32-bit posix machines
* minor tweaks
This commit is contained in:
parent
4a5125cc53
commit
5da8a977c6
3 changed files with 9 additions and 8 deletions
|
@ -33,11 +33,9 @@
|
|||
#include <sys/stat.h>
|
||||
#include <unistd.h>
|
||||
#include <libgen.h> /* basename, dirname */
|
||||
#include <fcntl.h>
|
||||
#include <fcntl.h> /* O_LARGEFILE */
|
||||
|
||||
#include <sys/queue.h> /* evhttp.h needs this */
|
||||
#include <event.h>
|
||||
#include <evhttp.h>
|
||||
#include <evutil.h>
|
||||
|
||||
#include "transmission.h"
|
||||
|
@ -88,7 +86,7 @@ myDebug( const char * file, int line, const char * fmt, ... )
|
|||
|
||||
enum
|
||||
{
|
||||
TR_MAX_SOCKETS = 1024,
|
||||
TR_MAX_SOCKETS = 512,
|
||||
|
||||
TR_MAX_OPEN_FILES = 16, /* real files, not sockets */
|
||||
|
||||
|
@ -141,6 +139,9 @@ TrOpenFile( int i, const char * filename, int write )
|
|||
|
||||
/* open the file */
|
||||
flags = write ? (O_RDWR | O_CREAT) : O_RDONLY;
|
||||
#ifdef O_LARGEFILE
|
||||
flags |= O_LARGEFILE;
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
flags |= O_BINARY;
|
||||
#endif
|
||||
|
|
|
@ -71,7 +71,7 @@ readOrWriteBytes( const tr_torrent * tor,
|
|||
else if( lseek( fd, (off_t)fileOffset, SEEK_SET ) == ((off_t)-1) )
|
||||
ret = TR_ERROR_IO_OTHER;
|
||||
else if( func( fd, buf, buflen ) != buflen )
|
||||
ret = tr_ioErrorFromErrno ();
|
||||
ret = tr_ioErrorFromErrno( );
|
||||
else
|
||||
ret = TR_OK;
|
||||
|
||||
|
|
|
@ -71,7 +71,7 @@ struct tr_peerIo
|
|||
static void
|
||||
didWriteWrapper( struct bufferevent * e, void * userData )
|
||||
{
|
||||
tr_peerIo * c = (tr_peerIo *) userData;
|
||||
tr_peerIo * c = userData;
|
||||
if( c->didWrite != NULL )
|
||||
(*c->didWrite)( e, c->userData );
|
||||
}
|
||||
|
@ -80,7 +80,7 @@ static void
|
|||
canReadWrapper( struct bufferevent * e, void * userData )
|
||||
{
|
||||
int done = 0;
|
||||
tr_peerIo * c = (tr_peerIo *) userData;
|
||||
tr_peerIo * c = userData;
|
||||
tr_handle * handle = c->handle;
|
||||
|
||||
if( c->canRead == NULL )
|
||||
|
@ -110,7 +110,7 @@ canReadWrapper( struct bufferevent * e, void * userData )
|
|||
static void
|
||||
gotErrorWrapper( struct bufferevent * e, short what, void * userData )
|
||||
{
|
||||
tr_peerIo * c = (tr_peerIo *) userData;
|
||||
tr_peerIo * c = userData;
|
||||
if( c->gotError != NULL )
|
||||
(*c->gotError)( e, what, c->userData );
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue