system() call from a Linux perspective

Questions about Wine on Linux
Locked
bburk
Level 2
Level 2
Posts: 11
Joined: Tue Mar 31, 2020 9:36 am

system() call from a Linux perspective

Post by bburk »

So I'm using winelib trying to merge a Win32 GUI with Linux hardware access. This has been fraught with challenges.

Current problem is this... if I execute a system() call, it's being caught/redirected to wine/Windows (Can't recognize '/sbin/modprobe sg' as an internal or external command, or batch script.) instead of executing it via the Linux subsystem.

Is there a trick to doing these calls in the base environment? Linux_system() instead of system() or something? Or am I going to need to put the functionality into a batch file that the winesubsystem can call, then the batch file operates at the Linux level?
bburk
Level 2
Level 2
Posts: 11
Joined: Tue Mar 31, 2020 9:36 am

Re: system() call from a Linux perspective

Post by bburk »

While I'm at it...

Code: Select all

    fd = open(devname, O_RDWR | O_NONBLOCK);

    if(fd < 0)
      fd = open(devname, O_RDONLY | O_NONBLOCK);

    if(fd >= 0)   // hey, we found one!
    {  
      if(ioctl(fd, SG_GET_SCSI_ID, &SID)  < 0) 
      {
        ha        = 99;
        pathid    = 99;
        tid       = 99;
        lun       = idx;
      }
      else 
      {
        ha        = SID.host_no;
        pathid    = SID.channel;
        tid       = SID.scsi_id;
        lun       = SID.lun;
      }
  }

IOCtl is returning a failure. Is it impossible to use this Linux kernel functionality concurrent with winelib? I thought that was the point of winelib instead of just using wine on the windows exe directly?
Locked