| 1 | /* SPDX-License-Identifier: GPL-2.0-or-later */ |
| 2 | #ifndef ALPM_V_NATIVE_DOWNLOAD_H |
| 3 | #define ALPM_V_NATIVE_DOWNLOAD_H |
| 4 | #include <stdint.h> |
| 5 | #include <signal.h> |
| 6 | #include <sys/stat.h> |
| 7 | |
| 8 | typedef struct v_alpm_download_control { |
| 9 | volatile sig_atomic_t interrupted; |
| 10 | } v_alpm_download_control; |
| 11 | |
| 12 | static int v_alpm_download_stat(int fd, int64_t *size, uint32_t *mode, uint64_t *links) { |
| 13 | struct stat info; |
| 14 | if(fstat(fd, &info) != 0) { return -1; } |
| 15 | *size = info.st_size; |
| 16 | *mode = info.st_mode; |
| 17 | *links = info.st_nlink; |
| 18 | return 0; |
| 19 | } |
| 20 | #endif |
| 21 | |