Skip to content

Commit

Permalink
sigwinch
Browse files Browse the repository at this point in the history
  • Loading branch information
HendrikMennen committed Jul 17, 2024
1 parent 87bc710 commit c66a319
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/OneWare.Terminal/Provider/Unix/Native.cs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,8 @@ public delegate void execve([MarshalAs(UnmanagedType.LPStr)] string path,
public delegate int grantpt(int fd);

public delegate int ioctl(int fd, ulong ctl, IntPtr arg);

public delegate int kill(int pid, int sig);

public delegate int open([MarshalAs(UnmanagedType.LPStr)] string file, int flags);

Expand Down Expand Up @@ -113,7 +115,11 @@ internal static class Native
public const int EINTR = 4; /* Interrupted system call */

public const int ENOENT = 2;

public const int SIGWINCH = 28;

public static readonly ulong TIOCSWINSZ = RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? 0x80087467 : 0x5414;


public static readonly ulong TIOCSCTTY =
RuntimeInformation.IsOSPlatform(OSPlatform.OSX) ? (ulong)0x20007484 : 0x540E;
Expand Down Expand Up @@ -142,6 +148,7 @@ internal static class Native
public static NativeDelegates.dup2 dup2 = NativeDelegates.GetProc<NativeDelegates.dup2>();
public static NativeDelegates.setsid setsid = NativeDelegates.GetProc<NativeDelegates.setsid>();
public static NativeDelegates.ioctl ioctl = NativeDelegates.GetProc<NativeDelegates.ioctl>();
public static NativeDelegates.kill kill = NativeDelegates.GetProc<NativeDelegates.kill>();
public static NativeDelegates.execve execve = NativeDelegates.GetProc<NativeDelegates.execve>();
public static NativeDelegates.fork fork = NativeDelegates.GetProc<NativeDelegates.fork>();

Expand Down
2 changes: 2 additions & 0 deletions src/OneWare.Terminal/Provider/Unix/UnixPseudoTerminal.cs
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,8 @@ public void SetSize(int columns, int rows)
var ptr = Native.StructToPtr(size);
Native.ioctl(_cfg, Native.TIOCSWINSZ, ptr);
Marshal.FreeHGlobal(ptr);

Native.kill(Process.Id, Native.SIGWINCH);
}
catch (Exception e)
{
Expand Down

0 comments on commit c66a319

Please sign in to comment.