Skip to content

Commit 37829d3

Browse files
author
Jonathan Pryor
committed
* dirent.c, errno.c, fcntl.c, fstab.c, grp.c, macros.c, pwd.c, signal.c,
stdio.c, stdlib.c, string.c, sys-mman.c, sys-sendfile.c, sys-stat.c, sys-statvfs.c, sys-time.c, sys-xattr.c syslog.c, time.c, unistd.c, utime.c: Remove structure definitions, and use the create-native-map generated definitions within map.h. Update function prototypes to match current map.h declarations. * map.c, map.h: Flush (current create-native-map output). * mph.h: Don't include "map-icalls.h"; "icalls" are now in map.h. * create-native-map.exe: Added; cached version of create-native-map.exe used to update map.c, map.h. (create-native-map.exe source within mono-tools/create-native-map.) * Makefile.am: Added update-create-native-map target to update create-native-map.exe using pkg-config & the create-native-map.pc package. Use create-native-map.exe to generate map.* files instead of make-map.exe. * sys-statvfs.c: Add Mono_Posix_ToStatvfs, Mono_Posix_FromStatvfs exports. svn path=/trunk/mono/; revision=66946
1 parent f2cb628 commit 37829d3

28 files changed

+5263
-8776
lines changed

support/ChangeLog

+18
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,21 @@
1+
2006-10-24 Jonathan Pryor <jonpryor@vt.edu>
2+
3+
* dirent.c, errno.c, fcntl.c, fstab.c, grp.c, macros.c, pwd.c, signal.c,
4+
stdio.c, stdlib.c, string.c, sys-mman.c, sys-sendfile.c, sys-stat.c,
5+
sys-statvfs.c, sys-time.c, sys-xattr.c syslog.c, time.c, unistd.c,
6+
utime.c: Remove structure definitions, and use the
7+
create-native-map generated definitions within map.h. Update function
8+
prototypes to match current map.h declarations.
9+
* map.c, map.h: Flush (current create-native-map output).
10+
* mph.h: Don't include "map-icalls.h"; "icalls" are now in map.h.
11+
* create-native-map.exe: Added; cached version of create-native-map.exe
12+
used to update map.c, map.h. (create-native-map.exe source within
13+
mono-tools/create-native-map.)
14+
* Makefile.am: Added update-create-native-map target to update
15+
create-native-map.exe using pkg-config & the create-native-map.pc package.
16+
Use create-native-map.exe to generate map.* files instead of make-map.exe.
17+
* sys-statvfs.c: Add Mono_Posix_ToStatvfs, Mono_Posix_FromStatvfs exports.
18+
119
2006-09-15 Jonathan Pryor <jonpryor@vt.edu>
220

321
* Makefile.am: Remove CRYPT_LIBS use; we no longer rely on libcrypt.

support/Makefile.am

+32-1
Original file line numberDiff line numberDiff line change
@@ -86,9 +86,40 @@ libMonoSupportW_la_SOURCES = \
8686
libMonoSupportW_la_LIBADD = \
8787
$(GLIB_LIBS)
8888

89+
update-create-native-map:
90+
cp `pkg-config --variable=Programs create-native-map` .
91+
8992
#
9093
# Use this target to refresh the values in map.[ch]
9194
#
9295
refresh:
93-
$(top_builddir)/runtime/mono-wrapper $(mcs_topdir)/class/Mono.Posix/Mono.Unix.Native/make-map.exe $(mcs_topdir)/class/lib/default/Mono.Posix.dll map
96+
$(top_builddir)/runtime/mono-wrapper create-native-map.exe \
97+
--autoconf-member=d_off \
98+
--autoconf-member=d_reclen \
99+
--autoconf-member=d_type \
100+
--exclude-native-symbol=Mono_Posix_Stdlib_snprintf \
101+
--impl-macro=_GNU_SOURCE --impl-macro=_XOPEN_SOURCE \
102+
--impl-header="<sys/types.h>" \
103+
--impl-header="<sys/stat.h>" \
104+
--impl-header="<sys/time.h>" \
105+
--autoconf-header="<sys/poll.h>" \
106+
--autoconf-header="<sys/wait.h>" \
107+
--autoconf-header="<sys/statvfs.h>" \
108+
--autoconf-header="<sys/xattr.h>" \
109+
--autoconf-header="<sys/mman.h>" \
110+
--impl-header="<unistd.h>" \
111+
--impl-header="<fcntl.h>" \
112+
--impl-header="<signal.h>" \
113+
--autoconf-header="<poll.h>" \
114+
--autoconf-header="<grp.h>" \
115+
--impl-header="<errno.h>" \
116+
--autoconf-header="<syslog.h>" \
117+
--impl-header="<dirent.h>" \
118+
--impl-header="<utime.h>" \
119+
--rename-member=st_atime=st_atime_ \
120+
--rename-member=st_ctime=st_ctime_ \
121+
--rename-member=st_mtime=st_mtime_ \
122+
--rename-namespace=Mono.Unix.Native=Mono.Posix \
123+
--library=MonoPosixHelper \
124+
$(mcs_topdir)/class/lib/net_2_0/Mono.Posix.dll map
94125

support/create-native-map.exe

58 KB
Binary file not shown.

support/dirent.c

+1-8
Original file line numberDiff line numberDiff line change
@@ -13,18 +13,11 @@
1313
#include <stdlib.h>
1414
#include <unistd.h>
1515

16+
#include "map.h"
1617
#include "mph.h"
1718

1819
G_BEGIN_DECLS
1920

20-
struct Mono_Posix_Syscall__Dirent {
21-
/* ino_t */ mph_ino_t d_ino;
22-
/* off_t */ mph_off_t d_off;
23-
/* ushort */ unsigned short d_reclen;
24-
/* byte */ unsigned char d_type;
25-
/* string */ char *d_name;
26-
};
27-
2821
gint32
2922
Mono_Posix_Syscall_seekdir (void *dir, mph_off_t offset)
3023
{

support/errno.c

+1
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44

55
#include <errno.h>
66
#include <string.h>
7+
#include "map.h"
78
#include "mph.h"
89
#include <stdio.h>
910

support/fcntl.c

+1-9
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Authors:
55
* Jonathan Pryor (jonpryor@vt.edu)
66
*
7-
* Copyright (C) 2004 Jonathan Pryor
7+
* Copyright (C) 2004, 2006 Jonathan Pryor
88
*/
99

1010
#ifndef _GNU_SOURCE
@@ -22,14 +22,6 @@
2222

2323
G_BEGIN_DECLS
2424

25-
struct Mono_Posix_Flock {
26-
gint16 l_type;
27-
gint16 l_whence;
28-
mph_off_t l_start;
29-
mph_off_t l_len;
30-
mph_pid_t l_pid;
31-
};
32-
3325
gint32
3426
Mono_Posix_Syscall_fcntl (gint32 fd, gint32 cmd)
3527
{

support/fstab.c

+3-13
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <stdlib.h>
1414
#include <stddef.h>
1515

16+
#include "map.h"
1617
#include "mph.h"
1718

1819
#if defined (HAVE_CHECKLIST_H)
@@ -27,18 +28,6 @@
2728

2829
G_BEGIN_DECLS
2930

30-
struct Mono_Posix_Syscall__Fstab {
31-
char *fs_spec; /* block device name */
32-
char *fs_file; /* mount point */
33-
char *fs_vfstype; /* filesystem type */
34-
char *fs_mntops; /* mount options */
35-
char *fs_type; /* rw/rq/ro/sw/xx option */
36-
int fs_freq; /* dump frequency, in days */
37-
int fs_passno; /* pass number on parallel dump */
38-
39-
char *_fs_buf_;
40-
};
41-
4231
#ifdef HAVE_CHECKLIST_H
4332

4433
typedef struct checklist mph_fstab;
@@ -245,10 +234,11 @@ getfsspec (const char *special_file)
245234

246235
#if defined (HAVE_FSTAB_H) || defined (HAVE_CHECKPOINT_H) || defined (HAVE_SYS_VFSTAB_H)
247236

248-
void
237+
int
249238
Mono_Posix_Syscall_endfsent (void)
250239
{
251240
endfsent ();
241+
return 0;
252242
}
253243

254244
gint32

support/grp.c

+5-13
Original file line numberDiff line numberDiff line change
@@ -16,19 +16,11 @@
1616
#include <string.h>
1717
#include <unistd.h> /* for setgroups on Mac OS X */
1818

19+
#include "map.h"
1920
#include "mph.h"
2021

2122
G_BEGIN_DECLS
2223

23-
struct Mono_Posix_Syscall__Group {
24-
/* string */ char *gr_name;
25-
/* string */ char *gr_passwd;
26-
/* gid_t */ mph_gid_t gr_gid;
27-
/* int */ int _gr_nmem_;
28-
/* string */ char **gr_mem;
29-
/* string */ char *_gr_buf_; /* holds all but gr_mem */
30-
};
31-
3224
static void
3325
count_members (char **gr_mem, int *count, size_t *mem)
3426
{
@@ -56,7 +48,7 @@ copy_group (struct Mono_Posix_Syscall__Group *to, struct group *from)
5648
{
5749
size_t nlen, plen, buflen;
5850
int i, count;
59-
char *cur;
51+
char *cur, **to_mem;
6052

6153
to->gr_gid = from->gr_gid;
6254

@@ -83,7 +75,7 @@ copy_group (struct Mono_Posix_Syscall__Group *to, struct group *from)
8375

8476
to->_gr_nmem_ = count;
8577
cur = to->_gr_buf_ = (char*) malloc (buflen);
86-
to->gr_mem = (char **) malloc (sizeof(char*)*(count+1));
78+
to_mem = to->gr_mem = malloc (sizeof(char*)*(count+1));
8779
if (to->_gr_buf_ == NULL || to->gr_mem == NULL) {
8880
free (to->_gr_buf_);
8981
free (to->gr_mem);
@@ -96,10 +88,10 @@ copy_group (struct Mono_Posix_Syscall__Group *to, struct group *from)
9688
cur += (plen + 1);
9789

9890
for (i = 0; i != count; ++i) {
99-
to->gr_mem[i] = strcpy (cur, from->gr_mem[i]);
91+
to_mem [i] = strcpy (cur, from->gr_mem[i]);
10092
cur += (strlen (from->gr_mem[i])+1);
10193
}
102-
to->gr_mem[i] = NULL;
94+
to_mem [i] = NULL;
10395

10496
return 0;
10597
}

support/macros.c

+3-3
Original file line numberDiff line numberDiff line change
@@ -81,18 +81,18 @@ int helper_Mono_Posix_Stat(const char *filename, int dereference,
8181
return 0;
8282
}
8383

84-
const char *helper_Mono_Posix_GetUserName(int uid) {
84+
char *helper_Mono_Posix_GetUserName(int uid) {
8585
struct passwd *p = getpwuid(uid);
8686
if (p == NULL) return NULL;
8787
return strdup (p->pw_name);
8888
}
89-
const char *helper_Mono_Posix_GetGroupName(int gid) {
89+
char *helper_Mono_Posix_GetGroupName(int gid) {
9090
struct group *p = getgrgid(gid);
9191
if (p == NULL) return NULL;
9292
return strdup (p->gr_name);
9393
}
9494

95-
const char *helper_Mono_Posix_readdir(void *dir) {
95+
char *helper_Mono_Posix_readdir(void *dir) {
9696
struct dirent* e = readdir((DIR*) dir);
9797
if (e == NULL) return NULL;
9898
return strdup (e->d_name);

0 commit comments

Comments
 (0)