source: branches/0.9x/libtransmission/fdlimit.h @ 3649

Last change on this file since 3649 was 3649, checked in by charles, 15 years ago

part 1 of the data corruption fix: plug the leaky abstraction in fdlimit

  • Property svn:keywords set to Date Rev Author Id
File size: 3.2 KB
Line 
1/******************************************************************************
2 * $Id: fdlimit.h 3649 2007-10-30 18:35:04Z charles $
3 *
4 * Copyright (c) 2005-2006 Transmission authors and contributors
5 *
6 * Permission is hereby granted, free of charge, to any person obtaining a
7 * copy of this software and associated documentation files (the "Software"),
8 * to deal in the Software without restriction, including without limitation
9 * the rights to use, copy, modify, merge, publish, distribute, sublicense,
10 * and/or sell copies of the Software, and to permit persons to whom the
11 * Software is furnished to do so, subject to the following conditions:
12 *
13 * The above copyright notice and this permission notice shall be included in
14 * all copies or substantial portions of the Software.
15 *
16 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
17 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
18 * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
19 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
20 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
21 * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
22 * DEALINGS IN THE SOFTWARE.
23 *****************************************************************************/
24
25#include "net.h"
26
27/***********************************************************************
28 * tr_fdInit
29 ***********************************************************************
30 * Detect the maximum number of open files and initializes things.
31 **********************************************************************/
32void tr_fdInit( void );
33
34void tr_fdClose( void );
35
36/***********************************************************************
37 * tr_fdFileOpen
38 ***********************************************************************
39 * If it isn't open already, tries to open the file 'name' in the
40 * directory 'folder'. If 'name' itself contains '/'s, required
41 * subfolders are created. The file is open read-write if 'write' is 1
42 * (created if necessary), read-only if 0.
43 * Returns the file descriptor if successful, otherwise returns
44 * one of the TR_ERROR_IO_*.
45 **********************************************************************/
46int tr_fdFileOpen( const char * filename, int write );
47
48/***********************************************************************
49 * tr_fdFileRelease
50 ***********************************************************************
51 * Indicates that the file whose descriptor is 'file' is unused at the
52 * moment and can safely be closed.
53 **********************************************************************/
54void tr_fdFileRelease( int file );
55
56/***********************************************************************
57 * Sockets
58 **********************************************************************/
59int  tr_fdSocketCreate( int type, int priority );
60int  tr_fdSocketAccept( int b, struct in_addr * addr, tr_port_t * port );
61void tr_fdSocketClose( int s );
62
63/***********************************************************************
64 * tr_fdClose
65 ***********************************************************************
66 * Frees resources allocated by tr_fdInit.
67 **********************************************************************/
68void tr_fdClose( void );
69
Note: See TracBrowser for help on using the repository browser.