ves_icall_System_IO_FSW_SupportsFSW ()
{
  gint D.16702;
  int (*<T2a91>) (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.16700>; else goto <D.16701>;
  <D.16700>:
  close (inotify_instance);
  D.16702 = 5;
  return D.16702;
  <D.16701>:
  iter = 0B;
  fam_module = mono_dl_open ("libgamin-1.so", 1, 0B);
  if (fam_module == 0B) goto <D.16703>; else goto <D.16704>;
  <D.16703>:
  lib_used = 2;
  iter = 0B;
  fam_module = mono_dl_open ("libfam.so", 1, 0B);
  <D.16704>:
  if (fam_module == 0B) goto <D.16705>; else goto <D.16706>;
  <D.16705>:
  D.16702 = 0;
  return D.16702;
  <D.16706>:
  err = mono_dl_symbol (fam_module, "FAMNextEvent", &FAMNextEvent);
  monoeg_g_free (err);
  FAMNextEvent.0 = FAMNextEvent;
  if (FAMNextEvent.0 == 0B) goto <D.16708>; else goto <D.16709>;
  <D.16708>:
  D.16702 = 0;
  return D.16702;
  <D.16709>:
  D.16702 = lib_used;
  return D.16702;
}


ves_icall_System_IO_FAMW_InternalFAMNextEvent (void * conn, struct MonoString * * filename, gint * code, gint * reqnum)
{
  int (*<T2a91>) (void *, void *) FAMNextEvent.1;
  int D.16712;
  struct MonoDomain * D.16715;
  struct MonoString * D.16716;
  int D.16717;
  int D.16718;
  gboolean D.16719;
  struct FAMEvent ev;

  try
    {
      FAMNextEvent.1 = FAMNextEvent;
      D.16712 = FAMNextEvent.1 (conn, &ev);
      if (D.16712 == 1) goto <D.16713>; else goto <D.16714>;
      <D.16713>:
      D.16715 = mono_domain_get ();
      D.16716 = mono_string_new (D.16715, &ev.filename);
      *filename = D.16716;
      D.16717 = ev.code;
      *code = D.16717;
      D.16718 = ev.fr.reqnum;
      *reqnum = D.16718;
      D.16719 = 1;
      return D.16719;
      <D.16714>:
      D.16719 = 0;
      return D.16719;
    }
  finally
    {
      ev = {CLOBBER};
    }
}


ves_icall_System_IO_InotifyWatcher_GetInotifyInstance ()
{
  int D.16722;

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


ves_icall_System_IO_InotifyWatcher_AddWatch (int fd, struct MonoString * name, gint32 mask)
{
  int D.16726;
  unsigned int mask.2;
  int * D.16732;
  int D.16733;
  char * str;
  char * path;
  int retval;

  if (name == 0B) goto <D.16724>; else goto <D.16725>;
  <D.16724>:
  D.16726 = -1;
  return D.16726;
  <D.16725>:
  str = mono_string_to_utf8 (name);
  path = mono_portability_find_file (str, 1);
  if (path == 0B) goto <D.16727>; else goto <D.16728>;
  <D.16727>:
  path = str;
  <D.16728>:
  mask.2 = (unsigned int) mask;
  retval = inotify_add_watch (fd, path, mask.2);
  if (retval < 0) goto <D.16730>; else goto <D.16731>;
  <D.16730>:
  D.16732 = __errno_location ();
  D.16733 = *D.16732;
  switch (D.16733) <default: <D.16694>, case 9: <D.16689>, case 12: <D.16692>, case 13: <D.16687>, case 14: <D.16690>, case 22: <D.16691>, case 28: <D.16693>>
  <D.16687>:
  D.16732 = __errno_location ();
  *D.16732 = 5;
  goto <D.16688>;
  <D.16689>:
  D.16732 = __errno_location ();
  *D.16732 = 6;
  goto <D.16688>;
  <D.16690>:
  D.16732 = __errno_location ();
  *D.16732 = 12;
  goto <D.16688>;
  <D.16691>:
  D.16732 = __errno_location ();
  *D.16732 = 13;
  goto <D.16688>;
  <D.16692>:
  D.16732 = __errno_location ();
  *D.16732 = 8;
  goto <D.16688>;
  <D.16693>:
  D.16732 = __errno_location ();
  *D.16732 = 4;
  goto <D.16688>;
  <D.16694>:
  D.16732 = __errno_location ();
  *D.16732 = 31;
  goto <D.16688>;
  <D.16688>:
  mono_marshal_set_last_error ();
  <D.16731>:
  if (path != str) goto <D.16734>; else goto <D.16735>;
  <D.16734>:
  monoeg_g_free (path);
  <D.16735>:
  monoeg_g_free (str);
  D.16726 = retval;
  return D.16726;
}


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

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


