]> Chaos Git - corbenik/ctrulib.git/commitdiff
devkitARM r46 changes
authorDave Murphy <davem@devkitpro.org>
Sun, 18 Dec 2016 05:07:14 +0000 (05:07 +0000)
committerDave Murphy <davem@devkitpro.org>
Mon, 16 Jan 2017 15:39:06 +0000 (15:39 +0000)
libctru/include/sys/select.h
libctru/source/console.c
libctru/source/romfs_dev.c
libctru/source/sdmc_dev.c
libctru/source/services/soc/soc_common.h
libctru/source/services/soc/soc_init.c

index d75f9d0862e1c705dbae16edaff1c4165fd918a4..f6f61547303e5ac05a878eb2a3c5706a2be5b82c 100644 (file)
@@ -1,13 +1 @@
-#pragma once
-
-#include <sys/time.h>
-
-#ifdef __cplusplus
-extern "C" {
-#endif
-
-       int     select(int nfds, fd_set *readfds, fd_set *writefds, fd_set *exceptfds, struct timeval *timeout);
-
-#ifdef __cplusplus
-}
-#endif
+#include_next <sys/select.h>
\ No newline at end of file
index ca940db6a22d4c00db99fc439da2bb6480da3bc2..7f084ae0c0c08b1bd294abd9ceb83fa3df857fba 100644 (file)
@@ -179,7 +179,7 @@ static void consoleClearLine(char mode) {
 
 
 //---------------------------------------------------------------------------------
-ssize_t con_write(struct _reent *r,int fd,const char *ptr, size_t len) {
+ssize_t con_write(struct _reent *r,void *fd,const char *ptr, size_t len) {
 //---------------------------------------------------------------------------------
 
        char chr;
@@ -471,7 +471,7 @@ static const devoptab_t dotab_stdout = {
 };
 
 //---------------------------------------------------------------------------------
-ssize_t debug_write(struct _reent *r, int fd, const char *ptr, size_t len) {
+ssize_t debug_write(struct _reent *r, void *fd, const char *ptr, size_t len) {
 //---------------------------------------------------------------------------------
        svcOutputDebugString(ptr,len);
        return len;
index 072f24c28807a1d886f4e2475f809347f901e021..ba324afdc14a957ae032665600cd29d93773f4f6 100644 (file)
@@ -58,10 +58,10 @@ static bool _romfs_read_chk(romfs_mount *mount, u64 offset, void* buffer, u32 si
 //-----------------------------------------------------------------------------
 
 static int       romfs_open(struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
-static int       romfs_close(struct _reent *r, int fd);
-static ssize_t   romfs_read(struct _reent *r, int fd, char *ptr, size_t len);
-static off_t     romfs_seek(struct _reent *r, int fd, off_t pos, int dir);
-static int       romfs_fstat(struct _reent *r, int fd, struct stat *st);
+static int       romfs_close(struct _reent *r, void *fd);
+static ssize_t   romfs_read(struct _reent *r, void *fd, char *ptr, size_t len);
+static off_t     romfs_seek(struct _reent *r, void *fd, off_t pos, int dir);
+static int       romfs_fstat(struct _reent *r, void *fd, struct stat *st);
 static int       romfs_stat(struct _reent *r, const char *path, struct stat *st);
 static int       romfs_chdir(struct _reent *r, const char *path);
 static DIR_ITER* romfs_diropen(struct _reent *r, DIR_ITER *dirState, const char *path);
@@ -101,7 +101,7 @@ static devoptab_t romFS_devoptab =
        .dirreset_r   = romfs_dirreset,
        .dirnext_r    = romfs_dirnext,
        .dirclose_r   = romfs_dirclose,
-       .deviceData   = NULL,
+       .deviceData   = 0,
 };
 
 //-----------------------------------------------------------------------------
@@ -594,12 +594,12 @@ int romfs_open(struct _reent *r, void *fileStruct, const char *path, int flags,
        return 0;
 }
 
-int romfs_close(struct _reent *r, int fd)
+int romfs_close(struct _reent *r, void *fd)
 {
        return 0;
 }
 
-ssize_t romfs_read(struct _reent *r, int fd, char *ptr, size_t len)
+ssize_t romfs_read(struct _reent *r, void *fd, char *ptr, size_t len)
 {
        romfs_fileobj* file = (romfs_fileobj*)fd;
        u64 endPos = file->pos + len;
@@ -624,7 +624,7 @@ ssize_t romfs_read(struct _reent *r, int fd, char *ptr, size_t len)
        return -1;
 }
 
-off_t romfs_seek(struct _reent *r, int fd, off_t pos, int dir)
+off_t romfs_seek(struct _reent *r, void *fd, off_t pos, int dir)
 {
        romfs_fileobj* file = (romfs_fileobj*)fd;
        off_t          start;
@@ -667,7 +667,7 @@ off_t romfs_seek(struct _reent *r, int fd, off_t pos, int dir)
        return file->pos;
 }
 
-int romfs_fstat(struct _reent *r, int fd, struct stat *st)
+int romfs_fstat(struct _reent *r, void *fd, struct stat *st)
 {
        romfs_fileobj* file = (romfs_fileobj*)fd;
        memset(st, 0, sizeof(struct stat));
index b3bd0086dd8356b6efc0e7f8a92b5644c3fc0f0d..2523f39e5b876923729e65e46e69f7947c9ddd49 100644 (file)
 static int sdmc_translate_error(Result error);
 
 static int       sdmc_open(struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
-static int       sdmc_close(struct _reent *r, int fd);
-static ssize_t   sdmc_write(struct _reent *r, int fd, const char *ptr, size_t len);
-static ssize_t   sdmc_write_safe(struct _reent *r, int fd, const char *ptr, size_t len);
-static ssize_t   sdmc_read(struct _reent *r, int fd, char *ptr, size_t len);
-static off_t     sdmc_seek(struct _reent *r, int fd, off_t pos, int dir);
-static int       sdmc_fstat(struct _reent *r, int fd, struct stat *st);
+static int       sdmc_close(struct _reent *r, void *fd);
+static ssize_t   sdmc_write(struct _reent *r, void *fd, const char *ptr, size_t len);
+static ssize_t   sdmc_write_safe(struct _reent *r, void *fd, const char *ptr, size_t len);
+static ssize_t   sdmc_read(struct _reent *r, void *fd, char *ptr, size_t len);
+static off_t     sdmc_seek(struct _reent *r, void *fd, off_t pos, int dir);
+static int       sdmc_fstat(struct _reent *r, void *fd, struct stat *st);
 static int       sdmc_stat(struct _reent *r, const char *file, struct stat *st);
 static int       sdmc_link(struct _reent *r, const char *existing, const char  *newLink);
 static int       sdmc_unlink(struct _reent *r, const char *name);
@@ -42,10 +42,10 @@ static int       sdmc_dirreset(struct _reent *r, DIR_ITER *dirState);
 static int       sdmc_dirnext(struct _reent *r, DIR_ITER *dirState, char *filename, struct stat *filestat);
 static int       sdmc_dirclose(struct _reent *r, DIR_ITER *dirState);
 static int       sdmc_statvfs(struct _reent *r, const char *path, struct statvfs *buf);
-static int       sdmc_ftruncate(struct _reent *r, int fd, off_t len);
-static int       sdmc_fsync(struct _reent *r, int fd);
+static int       sdmc_ftruncate(struct _reent *r, void *fd, off_t len);
+static int       sdmc_fsync(struct _reent *r, void *fd);
 static int       sdmc_chmod(struct _reent *r, const char *path, mode_t mode);
-static int       sdmc_fchmod(struct _reent *r, int fd, mode_t mode);
+static int       sdmc_fchmod(struct _reent *r, void *fd, mode_t mode);
 static int       sdmc_rmdir(struct _reent *r, const char *name);
 
 /*! @cond INTERNAL */
@@ -84,7 +84,7 @@ sdmc_devoptab =
   .statvfs_r    = sdmc_statvfs,
   .ftruncate_r  = sdmc_ftruncate,
   .fsync_r      = sdmc_fsync,
-  .deviceData   = NULL,
+  .deviceData   = 0,
   .chmod_r      = sdmc_chmod,
   .fchmod_r     = sdmc_fchmod,
   .rmdir_r      = sdmc_rmdir,
@@ -416,7 +416,7 @@ sdmc_open(struct _reent *r,
  */
 static int
 sdmc_close(struct _reent *r,
-           int           fd)
+           void          *fd)
 {
   Result      rc;
 
@@ -443,7 +443,7 @@ sdmc_close(struct _reent *r,
  */
 static ssize_t
 sdmc_write(struct _reent *r,
-           int           fd,
+           void          *fd,
            const char    *ptr,
            size_t        len)
 {
@@ -501,7 +501,7 @@ sdmc_write(struct _reent *r,
  */
 static ssize_t
 sdmc_write_safe(struct _reent *r,
-                int           fd,
+                void          *fd,
                 const char    *ptr,
                 size_t        len)
 {
@@ -581,7 +581,7 @@ sdmc_write_safe(struct _reent *r,
  */
 static ssize_t
 sdmc_read(struct _reent *r,
-          int           fd,
+          void          *fd,
           char          *ptr,
           size_t         len)
 {
@@ -623,7 +623,7 @@ sdmc_read(struct _reent *r,
  */
 static off_t
 sdmc_seek(struct _reent *r,
-          int           fd,
+          void          *fd,
           off_t         pos,
           int           whence)
 {
@@ -686,7 +686,7 @@ sdmc_seek(struct _reent *r,
  */
 static int
 sdmc_fstat(struct _reent *r,
-           int           fd,
+           void          *fd,
            struct stat   *st)
 {
   Result      rc;
@@ -732,7 +732,7 @@ sdmc_stat(struct _reent *r,
   if(R_SUCCEEDED(rc = FSUSER_OpenFile(&fd, sdmcArchive, fs_path, FS_OPEN_READ, 0)))
   {
     sdmc_file_t tmpfd = { .fd = fd };
-    rc = sdmc_fstat(r, (int)&tmpfd, st);
+    rc = sdmc_fstat(r, &tmpfd, st);
     FSFILE_Close(fd);
 
     return rc;
@@ -1131,7 +1131,7 @@ sdmc_statvfs(struct _reent  *r,
  */
 static int
 sdmc_ftruncate(struct _reent *r,
-               int           fd,
+               void          *fd,
                off_t         len)
 {
   Result      rc;
@@ -1165,7 +1165,7 @@ sdmc_ftruncate(struct _reent *r,
  */
 static int
 sdmc_fsync(struct _reent *r,
-           int           fd)
+           void          *fd)
 {
   Result rc;
 
@@ -1209,7 +1209,7 @@ sdmc_chmod(struct _reent *r,
  */
 static int
 sdmc_fchmod(struct _reent *r,
-            int           fd,
+            void          *fd,
             mode_t        mode)
 {
   r->_errno = ENOSYS;
index a9fd779efefaa188c4ae08a97a5f9cf41da6dc64..e859ac5c44a7f1e04e200c4f2f7aeb4402b0a14f 100644 (file)
 
 #define SYNC_ERROR ENODEV
 
-int __alloc_handle(size_t size);
-__handle *__get_handle(int fd);
-void __release_handle(int fd);
-
 extern Handle  SOCU_handle;
 extern Handle  socMemhandle;
 
index 2edc9ae069c3643c42a9347576002ea92a65a3a4..790042c73b7017046cde1df44f6bdd1f34701451 100644 (file)
@@ -4,9 +4,9 @@
 #include <3ds/ipc.h>
 
 static int     soc_open(struct _reent *r, void *fileStruct, const char *path, int flags, int mode);
-static int     soc_close(struct _reent *r, int fd);
-static ssize_t soc_write(struct _reent *r, int fd, const char *ptr, size_t len);
-static ssize_t soc_read(struct _reent *r, int fd, char *ptr, size_t len);
+static int     soc_close(struct _reent *r, void *fd);
+static ssize_t soc_write(struct _reent *r, void *fd, const char *ptr, size_t len);
+static ssize_t soc_read(struct _reent *r, void *fd, char *ptr, size_t len);
 
 static devoptab_t
 soc_devoptab =
@@ -33,7 +33,7 @@ soc_devoptab =
   .statvfs_r    = NULL,
   .ftruncate_r  = NULL,
   .fsync_r      = NULL,
-  .deviceData   = NULL,
+  .deviceData   = 0,
   .chmod_r      = NULL,
   .fchmod_r     = NULL,
 };
@@ -151,7 +151,7 @@ soc_open(struct _reent *r,
 
 static int
 soc_close(struct _reent *r,
-          int           fd)
+          void           *fd)
 {
        Handle sockfd = *(Handle*)fd;
 
@@ -182,7 +182,7 @@ soc_close(struct _reent *r,
 
 static ssize_t
 soc_write(struct _reent *r,
-          int           fd,
+          void          *fd,
           const char    *ptr,
           size_t        len)
 {
@@ -192,7 +192,7 @@ soc_write(struct _reent *r,
 
 static ssize_t
 soc_read(struct _reent *r,
-         int           fd,
+         void          *fd,
          char          *ptr,
          size_t        len)
 {