source: trunk/libtransmission/platform.h @ 12918

Last change on this file since 12918 was 12204, checked in by jordan, 11 years ago

(trunk) #4138 "use stdbool.h instead of tr_bool" -- done.

  • Property svn:keywords set to Date Rev Author Id
File size: 2.6 KB
Line 
1/*
2 * This file Copyright (C) Mnemosyne LLC
3 *
4 * This file is licensed by the GPL version 2. Works owned by the
5 * Transmission project are granted a special exemption to clause 2(b)
6 * so that the bulk of its code can remain under the MIT license.
7 * This exemption does not extend to derived works not owned by
8 * the Transmission project.
9 *
10 * $Id: platform.h 12204 2011-03-22 15:19:54Z jordan $
11 */
12
13#ifndef __TRANSMISSION__
14 #error only libtransmission should #include this header.
15#endif
16
17#ifndef TR_PLATFORM_H
18#define TR_PLATFORM_H
19
20#define TR_PATH_DELIMITER '/'
21#define TR_PATH_DELIMITER_STR "/"
22
23#ifdef WIN32
24 #include <windef.h> /* MAX_PATH */
25 #define TR_PATH_MAX (MAX_PATH + 1)
26#else
27 #include <limits.h> /* PATH_MAX */
28 #ifdef PATH_MAX
29  #define TR_PATH_MAX PATH_MAX
30 #else
31  #define TR_PATH_MAX 4096
32 #endif
33#endif
34
35/**
36 * @addtogroup tr_session Session
37 * @{
38 */
39
40/**
41 * @brief invoked by tr_sessionInit() to set up the locations of the resume, torrent, and clutch directories.
42 * @see tr_getResumeDir()
43 * @see tr_getTorrentDir()
44 * @see tr_getWebClientDir()
45 */
46void tr_setConfigDir( tr_session * session, const char * configDir );
47
48/** @brief return the directory where .resume files are stored */
49const char * tr_getResumeDir( const tr_session * );
50
51/** @brief return the directory where .torrent files are stored */
52const char * tr_getTorrentDir( const tr_session * );
53
54/** @brief return the directory where the Web Client's web ui files are kept */
55const char * tr_getWebClientDir( const tr_session * );
56
57/** @brief return the number of bytes available for use in the specified path, or -1 on error */
58int64_t tr_getFreeSpace( const char * path );
59
60
61/** @} */
62
63
64/**
65 * @addtogroup utils Utilities
66 * @{
67 */
68
69typedef struct tr_thread tr_thread;
70
71/** @brief Instantiate a new process thread */
72tr_thread* tr_threadNew( void ( *func )(void *), void * arg );
73
74/** @brief Return nonzero if this function is being called from `thread'
75    @param thread the thread being tested */
76bool tr_amInThread( const tr_thread * );
77
78/***
79****
80***/
81
82typedef struct tr_lock tr_lock;
83
84/** @brief Create a new thread mutex object */
85tr_lock * tr_lockNew( void );
86
87/** @brief Destroy a thread mutex object */
88void tr_lockFree( tr_lock * );
89
90/** @brief Attempt to lock a thread mutex object */
91void tr_lockLock( tr_lock * );
92
93/** @brief Unlock a thread mutex object */
94void tr_lockUnlock( tr_lock * );
95
96/** @brief return nonzero if the specified lock is locked */
97int tr_lockHave( const tr_lock * );
98
99#ifdef WIN32
100void * mmap( void *ptr, long  size, long  prot, long  type, long  handle, long  arg );
101
102long munmap( void *ptr, long  size );
103#endif
104
105/* @} */
106
107#endif
Note: See TracBrowser for help on using the repository browser.