source: trunk/libtransmission/platform.h @ 10634

Last change on this file since 10634 was 10634, checked in by charles, 12 years ago

re-tweak the previous commit based on feedback from kklimonda

  • Property svn:keywords set to Date Rev Author Id
File size: 2.5 KB
Line 
1/*
2 * This file Copyright (C) 2009-2010 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 10634 2010-05-06 17:02:31Z charles $
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#if defined( WIN32 )
21 #define TR_PATH_DELIMITER '\\'
22 #define TR_PATH_DELIMITER_STR "\\"
23#else
24 #define TR_PATH_DELIMITER '/'
25 #define TR_PATH_DELIMITER_STR "/"
26#endif
27
28#ifdef WIN32
29 #include <windows.h> /* MAX_PATH */
30 #define TR_PATH_MAX MAX_PATH
31#else
32 #include <limits.h> /* PATH_MAX */
33 #ifdef PATH_MAX
34  #define TR_PATH_MAX PATH_MAX
35 #else
36  #define TR_PATH_MAX 4096
37 #endif
38#endif
39
40/**
41 * @addtogroup tr_session Session
42 * @{
43 */
44
45/**
46 * @brief invoked by tr_sessionInit() to set up the locations of the resume, torrent, and clutch directories.
47 * @see tr_getResumeDir()
48 * @see tr_getTorrentDir()
49 * @see tr_getWebClientDir()
50 */
51void tr_setConfigDir( tr_session * session, const char * configDir );
52
53/** @brief return the directory where .resume files are stored */
54const char * tr_getResumeDir( const tr_session * );
55
56/** @brief return the directory where .torrent files are stored */
57const char * tr_getTorrentDir( const tr_session * );
58
59/** @brief return the directory where the Web Client's web ui files are kept */
60const char * tr_getWebClientDir( const tr_session * );
61
62/** @} */
63
64
65/**
66 * @addtogroup utils Utilities
67 * @{
68 */
69
70typedef struct tr_thread tr_thread;
71
72/** @brief Instantiate a new process thread */
73tr_thread* tr_threadNew( void ( *func )(void *), void * arg );
74
75/** @brief Return nonzero if this function is being called from `thread'
76    @param thread the thread being tested */
77int tr_amInThread( const tr_thread * );
78
79/***
80****
81***/
82
83typedef struct tr_lock tr_lock;
84
85/** @brief Create a new thread mutex object */
86tr_lock * tr_lockNew( void );
87
88/** @brief Destroy a thread mutex object */
89void tr_lockFree( tr_lock * );
90
91/** @brief Attempt to lock a thread mutex object */
92void tr_lockLock( tr_lock * );
93
94/** @brief Unlock a thread mutex object */
95void tr_lockUnlock( tr_lock * );
96
97/** @brief return nonzero if the specified lock is locked */
98int tr_lockHave( const tr_lock * );
99
100#ifdef WIN32
101void * mmap( void *ptr, long  size, long  prot, long  type, long  handle, long  arg );
102
103long munmap( void *ptr, long  size );
104#endif
105
106/* @} */
107
108#endif
Note: See TracBrowser for help on using the repository browser.