1
Fork 0
mirror of https://github.com/RGBCube/serenity synced 2025-07-26 07:27:45 +00:00

Get nyancat nyanning in Serenity.

I found a cute program that renders an animated nyancat in the terminal.
This patch adds enough hackery to get it working correctly. :^)
This commit is contained in:
Andreas Kling 2019-02-03 16:11:28 +01:00
parent 3944c00f23
commit dddd0e7b03
15 changed files with 341 additions and 64 deletions

View file

@ -1425,6 +1425,20 @@ int Process::sys$kill(pid_t pid, int signal)
return 0;
}
int Process::sys$usleep(useconds_t usec)
{
if (!usec)
return 0;
sleep(usec / 1000);
if (m_wakeup_time > system.uptime) {
ASSERT(m_was_interrupted_while_blocked);
dword ticks_left_until_original_wakeup_time = m_wakeup_time - system.uptime;
return ticks_left_until_original_wakeup_time / TICKS_PER_SECOND;
}
return 0;
}
int Process::sys$sleep(unsigned seconds)
{
if (!seconds)

View file

@ -166,6 +166,7 @@ public:
int sys$getcwd(char*, size_t);
int sys$chdir(const char*);
int sys$sleep(unsigned seconds);
int sys$usleep(useconds_t usec);
int sys$gettimeofday(timeval*);
int sys$gethostname(char* name, size_t length);
int sys$get_arguments(int* argc, char*** argv);

View file

@ -62,6 +62,8 @@ static dword handle(RegisterDump& regs, dword function, dword arg1, dword arg2,
break;
case Syscall::SC_sleep:
return current->sys$sleep((unsigned)arg1);
case Syscall::SC_usleep:
return current->sys$usleep((unsigned)arg1);
case Syscall::SC_gettimeofday:
return current->sys$gettimeofday((timeval*)arg1);
case Syscall::SC_get_dir_entries:

View file

@ -84,6 +84,7 @@
__ENUMERATE_SYSCALL(gui_set_global_cursor_tracking_enabled) \
__ENUMERATE_SYSCALL(rmdir) \
__ENUMERATE_SYSCALL(chmod) \
__ENUMERATE_SYSCALL(usleep) \
#ifdef SERENITY

View file

@ -16,6 +16,7 @@ typedef dword uid_t;
typedef dword gid_t;
typedef signed_word pid_t;
typedef dword time_t;
typedef dword useconds_t;
typedef dword suseconds_t;
struct timeval {