ves_icall_System_IO_FSW_SupportsFSW ()
{
  gint D.19253;
  int (*<T34fe>) (void *, void *) FAMNextEvent.0;
  struct MonoDl * fam_module;
  int lib_used;
  int inotify_instance;
  void * iter;
  char * err;

  lib_used = 4;
  inotify_instance = ves_icall_System_IO_InotifyWatcher_GetInotifyInstance ();
  if (inotify_instance != -1) goto <D.19251>; else goto <D.19252>;
  <D.19251>:
  close (inotify_instance);
  D.19253 = 5;
  return D.19253;
  <D.19252>:
  iter = 0B;
  fam_module = mono_dl_open ("libgamin-1.so", 1, 0B);
  if (fam_module == 0B) goto <D.19254>; else goto <D.19255>;
  <D.19254>:
  lib_used = 2;
  iter = 0B;
  fam_module = mono_dl_open ("libfam.so", 1, 0B);
  <D.19255>:
  if (fam_module == 0B) goto <D.19256>; else goto <D.19257>;
  <D.19256>:
  D.19253 = 0;
  return D.19253;
  <D.19257>:
  err = mono_dl_symbol (fam_module, "FAMNextEvent", &FAMNextEvent);
  monoeg_g_free (err);
  FAMNextEvent.0 = FAMNextEvent;
  if (FAMNextEvent.0 == 0B) goto <D.19259>; else goto <D.19260>;
  <D.19259>:
  D.19253 = 0;
  return D.19253;
  <D.19260>:
  D.19253 = lib_used;
  return D.19253;
}


ves_icall_System_IO_FAMW_InternalFAMNextEvent (void * conn, struct MonoString * * filename, gint * code, gint * reqnum)
{
  int (*<T34fe>) (void *, void *) FAMNextEvent.1;
  int D.19263;
  struct MonoDomain * D.19266;
  struct MonoString * D.19267;
  int D.19268;
  int D.19269;
  gboolean D.19270;
  struct FAMEvent ev;

  try
    {
      FAMNextEvent.1 = FAMNextEvent;
      D.19263 = FAMNextEvent.1 (conn, &ev);
      if (D.19263 == 1) goto <D.19264>; else goto <D.19265>;
      <D.19264>:
      D.19266 = mono_domain_get ();
      D.19267 = mono_string_new (D.19266, &ev.filename);
      *filename = D.19267;
      D.19268 = ev.code;
      *code = D.19268;
      D.19269 = ev.fr.reqnum;
      *reqnum = D.19269;
      D.19270 = 1;
      return D.19270;
      <D.19265>:
      D.19270 = 0;
      return D.19270;
    }
  finally
    {
      ev = {CLOBBER};
    }
}


ves_icall_System_IO_InotifyWatcher_GetInotifyInstance ()
{
  int D.19273;

  D.19273 = inotify_init ();
  return D.19273;
}


ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, struct MonoString * name, gint32 mask)
{
  int D.19277;
  unsigned int mask.2;
  int * D.19283;
  int D.19284;
  char * str;
  char * path;
  int retval;

  if (name == 0B) goto <D.19275>; else goto <D.19276>;
  <D.19275>:
  D.19277 = -1;
  return D.19277;
  <D.19276>:
  str = mono_string_to_utf8 (name);
  path = mono_portability_find_file (str, 1);
  if (path == 0B) goto <D.19278>; else goto <D.19279>;
  <D.19278>:
  path = str;
  <D.19279>:
  mask.2 = (unsigned int) mask;
  retval = inotify_add_watch (fd, path, mask.2);
  if (retval < 0) goto <D.19281>; else goto <D.19282>;
  <D.19281>:
  D.19283 = __errno_location ();
  D.19284 = *D.19283;
  switch (D.19284) <default: <D.19243>, case 9: <D.19238>, case 12: <D.19241>, case 13: <D.19236>, case 14: <D.19239>, case 22: <D.19240>, case 28: <D.19242>>
  <D.19236>:
  D.19283 = __errno_location ();
  *D.19283 = 5;
  goto <D.19237>;
  <D.19238>:
  D.19283 = __errno_location ();
  *D.19283 = 6;
  goto <D.19237>;
  <D.19239>:
  D.19283 = __errno_location ();
  *D.19283 = 12;
  goto <D.19237>;
  <D.19240>:
  D.19283 = __errno_location ();
  *D.19283 = 13;
  goto <D.19237>;
  <D.19241>:
  D.19283 = __errno_location ();
  *D.19283 = 8;
  goto <D.19237>;
  <D.19242>:
  D.19283 = __errno_location ();
  *D.19283 = 4;
  goto <D.19237>;
  <D.19243>:
  D.19283 = __errno_location ();
  *D.19283 = 31;
  goto <D.19237>;
  <D.19237>:
  mono_marshal_set_last_error ();
  <D.19282>:
  if (path != str) goto <D.19285>; else goto <D.19286>;
  <D.19285>:
  monoeg_g_free (path);
  <D.19286>:
  monoeg_g_free (str);
  D.19277 = retval;
  return D.19277;
}


ves_icall_System_IO_InotifyWatcher_RemoveWatch (int fd, gint32 watch_descriptor)
{
  int D.19288;

  D.19288 = inotify_rm_watch (fd, watch_descriptor);
  return D.19288;
}


