Welcome to mirror list, hosted at ThFree Co, Russian Federation.

bdm-fstat.c « m68k « libgloss - cygwin.com/git/newlib-cygwin.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
blob: 63a60939b78c4a0d2c162c17fe6a713c15296cf6 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include "bdm-semihost.h"
#include "bdm-gdb.h"
#include <sys/types.h>
#include <sys/stat.h>
#include <unistd.h>
#include <errno.h>

/*
 * fstat -- get file information
 * input parameters:
 *   0 : file descriptor
 *   1 : stat buf ptr
 * output parameters:
 *   0 : result
 *   1 : errno
 */

int fstat (int fd, struct stat *buf)
{
  gdb_parambuf_t parameters;
  struct gdb_stat gbuf;
  parameters[0] = (uint32_t) fd;
  parameters[1] = (uint32_t) &gbuf;
  BDM_TRAP (BDM_FSTAT, (uint32_t)parameters);
  convert_from_gdb_stat (&gbuf, buf);
  errno = convert_from_gdb_errno (parameters[1]);
  return parameters[0];
}