github.com/iDigitalFlame/xmt@v0.5.4/device/os_other.go (about)

     1  //go:build js
     2  // +build js
     3  
     4  // Copyright (C) 2020 - 2023 iDigitalFlame
     5  //
     6  // This program is free software: you can redistribute it and/or modify
     7  // it under the terms of the GNU General Public License as published by
     8  // the Free Software Foundation, either version 3 of the License, or
     9  // any later version.
    10  //
    11  // This program is distributed in the hope that it will be useful,
    12  // but WITHOUT ANY WARRANTY; without even the implied warranty of
    13  // MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    14  // GNU General Public License for more details.
    15  //
    16  // You should have received a copy of the GNU General Public License
    17  // along with this program.  If not, see <https://www.gnu.org/licenses/>.
    18  //
    19  
    20  package device
    21  
    22  import (
    23  	"io"
    24  	"syscall"
    25  
    26  	"github.com/iDigitalFlame/xmt/cmd/filter"
    27  )
    28  
    29  // OS is the local machine's Operating System type.
    30  const OS = Unsupported
    31  
    32  const (
    33  	// Shell is the default machine specific command shell.
    34  	Shell = ""
    35  	// ShellArgs is the default machine specific command shell arguments to run
    36  	// commands.
    37  	ShellArgs = ""
    38  	// PowerShell is the path to the PowerShell binary, which is based on the
    39  	// underlying OS type.
    40  	PowerShell = ""
    41  )
    42  
    43  // IsDebugged returns true if the current process is attached by a debugger.
    44  func IsDebugged() bool {
    45  	return false
    46  }
    47  
    48  // UserHomeDir returns the current user's home directory.
    49  //
    50  // On Unix, including macOS, it returns the $HOME environment variable.
    51  // On Windows, it returns %USERPROFILE%.
    52  // On Plan 9, it returns the $home environment variable.
    53  // On JS/WASM it returns and empty string.
    54  //
    55  // Golang compatibility helper function.
    56  func UserHomeDir() string {
    57  	return ""
    58  }
    59  
    60  // Logins returns an array that contains information about current logged
    61  // in users.
    62  //
    63  // This call is OS-independent but many contain invalid session types.
    64  //
    65  // Always returns an EINVAL on WSAM/JS.
    66  func Logins() ([]Login, error) {
    67  	return nil, syscall.EINVAL
    68  }
    69  
    70  // Mounts attempts to get the mount points on the local device.
    71  //
    72  // On Windows devices, this is the drive letters available, otherwise on nix*
    73  // systems, this will be the mount points on the system.
    74  //
    75  // The return result (if no errors occurred) will be a string list of all the
    76  // mount points (or Windows drive letters).
    77  func Mounts() ([]string, error) {
    78  	return nil, syscall.EINVAL
    79  }
    80  
    81  // SetProcessName will attempt to override the process name on *nix systems
    82  // by overwriting the argv block. On Windows, this just overrides the command
    83  // line arguments.
    84  //
    85  // Linux support only allows for suppling a command line shorter the current
    86  // command line.
    87  //
    88  // Linux found here: https://stackoverflow.com/questions/14926020/setting-process-name-as-seen-by-ps-in-go
    89  //
    90  // Always returns an EINVAL on WSAM/JS.
    91  func SetProcessName(_ string) error {
    92  	return syscall.EINVAL
    93  }
    94  
    95  // DumpProcess will attempt to copy the memory of the targeted Filter to the
    96  // supplied Writer. This fill select the first process that matches the Filter.
    97  //
    98  // If the Filter is nil or empty or if an error occurs during reading/writing
    99  // an error will be returned.
   100  func DumpProcess(_ *filter.Filter, _ io.Writer) error {
   101  	return syscall.EINVAL
   102  }