//! System call function definitions
use crate::primitive_enum;

primitive_enum!(
    #[doc = "Describes a system call issued to the kernel"]
    pub enum SyscallFunction: usize {
        #[doc = "Suspend the caller task for some time"]
        Nanosleep = 1,
        #[doc = "Map a virtual memory region"]
        MapMemory = 2,
        #[doc = "Release a virtual memory region"]
        UnmapMemory = 3,
        #[doc = "Write data to a file descriptor"]
        Write = 4,
        #[doc = "Read data from a file descriptor"]
        Read = 5,
        #[doc = "Open a file"]
        Open = 6,
        #[doc = "Close a file descriptor"]
        Close = 7,
        #[doc = "Open a directory for reading"]
        OpenDirectory = 8,
        #[doc = "Read entries from a directory descriptor"]
        ReadDirectory = 9,
        #[doc = "Create a directory"]
        CreateDirectory = 10,
        #[doc = "Remove a file"]
        Remove = 11,
        #[doc = "Remove a directory"]
        RemoveDirectory = 12,
        #[doc = "Retrieves metadata for a filesystem entry"]
        GetMetadata = 13,
        #[doc = "Seek a file descriptor to the specified position"]
        Seek = 14,
        #[doc = "Perform a device-specific request"]
        DeviceRequest = 15,
        #[doc = "Create an anonymous pipe"]
        CreatePipe = 16,
        #[doc = "Create a file descriptor poll channel"]
        CreatePoll = 17,
        #[doc = "Add/remove/modify poll channel entries of interest"]
        PollControl = 18,
        #[doc = "Poll a channel for descriptor readiness"]
        PollWait = 19,

        #[doc = "Create or get an existing messaging channel"]
        OpenChannel = 20,
        #[doc = "Receive a message from channel subscription"]
        ReceiveMessage = 21,
        #[doc = "Send a message to a channel"]
        SendMessage = 22,

        #[doc = "Creates a buffer of shared memory and returns a FD to it"]
        CreateSharedMemory = 23,

        #[doc = "Creates a pair of pseudo-terminal master/slave"]
        CreatePty = 24,

        #[doc = "Clones a file descriptor"]
        CloneFd = 25,

        #[doc = "Changes file metadata"]
        UpdateMetadata = 26,

        #[doc = "Creates a event-generator file descriptor"]
        CreateTimer = 27,

        #[doc = "Create and start a new process"]
        SpawnProcess = 40,
        #[doc = "Wait for a process to exit"]
        WaitProcess = 41,
        #[doc = "Get the caller process ID"]
        GetPid = 42,
        #[doc = "Get the caller process session ID"]
        GetSessionId = 43,
        #[doc = "Get the caller process group ID"]
        GetProcessGroupId = 44,
        #[doc = "Put the caller process into given group ID"]
        SetProcessGroupId = 45,
        #[doc = "Start a new session and set the caller process as its leader"]
        StartSession = 46,
        #[doc = "Create and start a new thread within the caller's process"]
        SpawnThread = 47,
        #[doc = "Mutex operation: wait, wake, etc."]
        Mutex = 48,

        #[doc = "Send a signal to a process"]
        SendSignal = 50,
        #[doc = "Setup a signal entry for the caller process"]
        SetSignalEntry = 51,
        #[doc = "Exit from a syscall handler"]
        ExitSignal = 52,
        #[doc = "Terminate the caller thread"]
        ExitThread = 53,
        #[doc = "Terminate the caller process"]
        ExitProcess = 54,

        // C compat
        #[doc = "Fork a process, creating an identical copy of its address space (C compat)"]
        Fork = 55,
        #[doc = "Replace the process address space with a new loaded program"]
        Exec = 56,

        #[doc = "Get information about the calling process"]
        GetProcessInfo = 57,
        #[doc = "Update information about the calling process"]
        SetProcessInfo = 58,

        #[doc = "Mount a filesystem"]
        Mount = 101,
        #[doc = "Unmount a filesystem"]
        Unmount = 102,

        #[doc = "Print a message to the kernel's debug trace output"]
        DebugTrace = 128,
        #[doc = "Fetches bytes of random data"]
        GetRandom = 129,
        #[doc = "Retrieves system information"]
        GetSystemInfo = 130,

        #[doc = "Bind a socket for listening"]
        BindSocket = 256,
        #[doc = "Connect a socket to a remote host"]
        ConnectSocket = 257,
        #[doc = "Send a message to a socket"]
        SendTo = 258,
        #[doc = "Receive a message from a socket"]
        ReceiveFrom = 259,
        #[doc = "Get socket option value"]
        GetSocketOption = 260,
        #[doc = "Update socket option value"]
        SetSocketOption = 261,
        #[doc = "Accept an incoming stream connection"]
        Accept = 262,
    }
);
