瀏覽代碼

LibC: Make sysbeep return int instead of void

Since the beep syscall may fail it is strange that the error is
discarded by the LibC wrapper.
Junior Rantila 3 年之前
父節點
當前提交
1f7c196788
共有 2 個文件被更改,包括 4 次插入3 次删除
  1. 3 2
      Userland/Libraries/LibC/unistd.cpp
  2. 1 1
      Userland/Libraries/LibC/unistd.h

+ 3 - 2
Userland/Libraries/LibC/unistd.cpp

@@ -700,9 +700,10 @@ int gettid()
     return cached_tid;
 }
 
-void sysbeep()
+int sysbeep()
 {
-    syscall(SC_beep);
+    int rc = syscall(SC_beep);
+    __RETURN_WITH_ERRNO(rc, rc, -1);
 }
 
 int fsync(int fd)

+ 1 - 1
Userland/Libraries/LibC/unistd.h

@@ -34,7 +34,7 @@ int get_process_name(char* buffer, int buffer_size);
 int set_process_name(const char* name, size_t name_length);
 void dump_backtrace();
 int fsync(int fd);
-void sysbeep();
+int sysbeep();
 int gettid();
 int getpagesize();
 pid_t fork();