source: trunk/libtransmission/fdlimit.h @ 1420

Last change on this file since 1420 was 1420, checked in by titer, 15 years ago

Officially give up on making libT reentrant, and simplify our code instead

  • Property svn:keywords set to Date Rev Author Id
File size: 3.6 KB
Line 
1/******************************************************************************
2 * $Id: fdlimit.h 1420 2007-01-21 07:16:18Z titer $
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/***********************************************************************
26 * tr_fdInit
27 ***********************************************************************
28 * Detect the maximum number of open files and initializes things.
29 **********************************************************************/
30void tr_fdInit();
31
32/***********************************************************************
33 * tr_fdFileOpen
34 ***********************************************************************
35 * If it isn't open already, tries to open the file 'name' in the
36 * directory 'folder'. If 'name' itself contains '/'s, required
37 * subfolders are created. The file is open read-write if 'write' is 1
38 * (created if necessary), read-only if 0.
39 * Returns the file descriptor if successful, otherwise returns
40 * one of the TR_ERROR_IO_*.
41 **********************************************************************/
42int tr_fdFileOpen( char * folder, char * name, int write );
43
44/***********************************************************************
45 * tr_fdFileRelease
46 ***********************************************************************
47 * Indicates that the file whose descriptor is 'file' is unused at the
48 * moment and can safely be closed.
49 **********************************************************************/
50void tr_fdFileRelease( int file );
51
52/***********************************************************************
53 * tr_fdFileClose
54 ***********************************************************************
55 * If the file 'name' in directory 'folder' was open, closes it,
56 * flushing data on disk.
57 **********************************************************************/
58void tr_fdFileClose( char * folder, char * name );
59
60/***********************************************************************
61 * tr_fdSocketWillCreate
62 **********************************************************************/
63int tr_fdSocketWillCreate( int );
64
65/***********************************************************************
66 * tr_fdSocketClosed
67 **********************************************************************/
68void tr_fdSocketClosed( int );
69
70
71/***********************************************************************
72 * tr_fdClose
73 ***********************************************************************
74 * Frees resources allocated by tr_fdInit.
75 **********************************************************************/
76void tr_fdClose();
77
Note: See TracBrowser for help on using the repository browser.