| 1 |
#ifndef PROTON_PLATFORM_H |
| 2 |
#define PROTON_PLATFORM_H 1 |
| 3 |
|
| 4 |
/* |
| 5 |
* |
| 6 |
* Licensed to the Apache Software Foundation (ASF) under one |
| 7 |
* or more contributor license agreements. See the NOTICE file |
| 8 |
* distributed with this work for additional information |
| 9 |
* regarding copyright ownership. The ASF licenses this file |
| 10 |
* to you under the Apache License, Version 2.0 (the |
| 11 |
* "License"); you may not use this file except in compliance |
| 12 |
* with the License. You may obtain a copy of the License at |
| 13 |
* |
| 14 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 15 |
* |
| 16 |
* Unless required by applicable law or agreed to in writing, |
| 17 |
* software distributed under the License is distributed on an |
| 18 |
* "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| 19 |
* KIND, either express or implied. See the License for the |
| 20 |
* specific language governing permissions and limitations |
| 21 |
* under the License. |
| 22 |
* |
| 23 |
*/ |
| 24 |
|
| 25 |
#include "proton/types.h" |
| 26 |
#include "proton/error.h" |
| 27 |
|
| 28 |
#if __cplusplus |
| 29 |
extern "C" { |
| 30 |
#endif |
| 31 |
|
| 32 |
/** Get the current PID |
| 33 |
* |
| 34 |
* @return process id |
| 35 |
* @internal |
| 36 |
*/ |
| 37 |
int pn_i_getpid(void); |
| 38 |
|
| 39 |
|
| 40 |
/** Get the current time in pn_timestamp_t format. |
| 41 |
* |
| 42 |
* Returns current time in milliseconds since Unix Epoch, |
| 43 |
* as defined by AMQP 1.0 |
| 44 |
* |
| 45 |
* @return current time |
| 46 |
* @internal |
| 47 |
*/ |
| 48 |
pn_timestamp_t pn_i_now(void); |
| 49 |
|
| 50 |
/** Generate system error message. |
| 51 |
* |
| 52 |
* Populate the proton error structure based on the last system error |
| 53 |
* code. |
| 54 |
* |
| 55 |
* @param[in] error the proton error structure |
| 56 |
* @param[in] msg the descriptive context message |
| 57 |
* @return error->code |
| 58 |
* |
| 59 |
* @internal |
| 60 |
*/ |
| 61 |
int pn_i_error_from_errno(pn_error_t *error, const char *msg); |
| 62 |
|
| 63 |
#ifdef _MSC_VER |
| 64 |
|
| 65 |
#if !defined(S_ISDIR) |
| 66 |
# define S_ISDIR(X) ((X) & _S_IFDIR) |
| 67 |
#endif |
| 68 |
|
| 69 |
#endif |
| 70 |
|
| 71 |
#if defined _MSC_VER || defined _OPENVMS |
| 72 |
#if !defined(va_copy) |
| 73 |
#define va_copy(d,s) ((d) = (s)) |
| 74 |
#endif |
| 75 |
#endif |
| 76 |
|
| 77 |
#if __cplusplus |
| 78 |
} |
| 79 |
#endif |
| 80 |
|
| 81 |
#endif /* platform.h */ |