diff options
author | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-08-27 13:11:50 +0200 |
---|---|---|
committer | Samuel Thibault <samuel.thibault@ens-lyon.org> | 2010-08-27 13:11:50 +0200 |
commit | f0653b71200d01ea35ec1b5b675764e67097567f (patch) | |
tree | 5e7f8f435afaaba14fbd434f06b77c41c18e47f5 | |
parent | fb188836835c08d19dbfec303493d52b086fe192 (diff) | |
parent | f085b730622dfb7b535d391296cc0a5d8969b18c (diff) |
Merge branch 'upstream-merged'
-rw-r--r-- | procfs/procfs_dir.c | 3 | ||||
-rw-r--r-- | procfs/procfs_nonpid_files.c | 13 | ||||
-rw-r--r-- | procfs/procfs_pid_files.c | 19 | ||||
-rw-r--r-- | serverboot/default_pager.c | 24 |
4 files changed, 49 insertions, 10 deletions
diff --git a/procfs/procfs_dir.c b/procfs/procfs_dir.c index f76e6a4b..bd1e49d6 100644 --- a/procfs/procfs_dir.c +++ b/procfs/procfs_dir.c @@ -654,6 +654,9 @@ procfs_fill_root_dir(struct procfs_dir *dir, time_t timestamp) if ((err = procfs_create_loadavg (dir, &node, timestamp)) != 0) return err; + if ((err = procfs_create_mounts (dir, &node, timestamp)) != 0) + return err; + return 0; } diff --git a/procfs/procfs_nonpid_files.c b/procfs/procfs_nonpid_files.c index 2c1209ee..f1300666 100644 --- a/procfs/procfs_nonpid_files.c +++ b/procfs/procfs_nonpid_files.c @@ -166,6 +166,19 @@ error_t procfs_create_loadavg (struct procfs_dir *dir, return err; } +error_t procfs_create_mounts (struct procfs_dir *dir, + struct node **node, + time_t timestamp) +{ + struct procfs_dir_entry *dir_entry; + int err; + + dir_entry = update_pid_entries (dir, "mounts", timestamp, "/etc/mtab"); + err = procfs_create_node (dir_entry, "mounts", node); + + return err; +} + error_t get_uptime (struct timeval *uptime) { struct timeval boot_time, now; diff --git a/procfs/procfs_pid_files.c b/procfs/procfs_pid_files.c index 46861531..26a0af33 100644 --- a/procfs/procfs_pid_files.c +++ b/procfs/procfs_pid_files.c @@ -46,14 +46,21 @@ update_pid_entries (struct procfs_dir *dir, const char *name, time_t timestamp, const char *symlink_target) { - struct procfs_dir_entry *dir_entry; - struct stat *stat = (struct stat *) malloc (sizeof (struct stat)); - stat->st_mode = S_IFREG | S_IRUSR | S_IRGRP | S_IROTH; + struct stat stat; - dir_entry = update_entries_list (dir, name, stat, - timestamp, symlink_target); + memset (&stat, 0, sizeof stat); + if (symlink_target) + { + stat.st_size = strlen (symlink_target); + stat.st_mode = S_IFLNK | 0777; + } + else + { + stat.st_size = 0; + stat.st_mode = S_IFREG | 0444; + } - return dir_entry; + return update_entries_list (dir, name, &stat, timestamp, symlink_target); } /* Creates files to store process information for DIR diff --git a/serverboot/default_pager.c b/serverboot/default_pager.c index c40f7181..41c2768d 100644 --- a/serverboot/default_pager.c +++ b/serverboot/default_pager.c @@ -1154,6 +1154,7 @@ pager_read_offset(pager, offset) { ddprintf ("%spager_read_offset pager %x: bad page %d >= size %d", my_name, pager, f_page, pager->size); + mutex_unlock(&pager->lock); return (union dp_map) (union dp_map *) NO_BLOCK; #if 0 panic("%spager_read_offset",my_name); @@ -1667,7 +1668,7 @@ ok: * if it is different from <addr>, it must be deallocated after use. */ int -default_read(ds, addr, size, offset, out_addr, deallocate) +default_read(ds, addr, size, offset, out_addr, deallocate, external) register dpager_t ds; vm_offset_t addr; /* pointer to block to fill */ register vm_size_t size; @@ -1675,6 +1676,7 @@ default_read(ds, addr, size, offset, out_addr, deallocate) vm_offset_t *out_addr; /* returns pointer to data */ boolean_t deallocate; + boolean_t external; { register union dp_map block; vm_offset_t raddr; @@ -1691,8 +1693,18 @@ default_read(ds, addr, size, offset, out_addr, deallocate) * Find the block in the paging partition */ block = pager_read_offset(ds, offset); - if ( no_block(block) ) + if ( no_block(block) ) { + if (external) { + /* + * An external object is requesting unswapped data, + * zero fill the page and return. + */ + bzero((char *) addr, vm_page_size); + *out_addr = addr; + return (PAGER_SUCCESS); + } return (PAGER_ABSENT); + } /* * Read it, trying for the entire page. @@ -1843,6 +1855,7 @@ struct dstruct { mach_port_urefs_t request_refs; /* Request port user-refs */ mach_port_t pager_name; /* Name port */ mach_port_urefs_t name_refs; /* Name port user-refs */ + boolean_t external; /* Is an external object? */ unsigned int readers; /* Reads in progress */ unsigned int writers; /* Writes in progress */ @@ -2300,10 +2313,12 @@ void default_pager_add(ds, internal) /* possibly generate an immediate no-senders notification */ sync = 0; pset = default_pager_internal_set; + ds->external = FALSE; } else { /* delay notification till send right is created */ sync = 1; pset = default_pager_external_set; + ds->external = TRUE; } kr = mach_port_request_notification(default_pager_self, pager, @@ -2654,7 +2669,8 @@ ddprintf ("seqnos_memory_object_data_request <%p>: pager_port_unlock: <%p>[s:%d, else rc = default_read(&ds->dpager, dpt->dpt_buffer, vm_page_size, offset, - &addr, protection_required & VM_PROT_WRITE); + &addr, protection_required & VM_PROT_WRITE, + ds->external); switch (rc) { case PAGER_SUCCESS: @@ -3708,8 +3724,8 @@ S_default_pager_object_pages (mach_port_t pager, kern_return_t S_default_pager_object_set_size (mach_port_t pager, - mach_port_seqno_t seqno, mach_port_t reply_to, + mach_port_seqno_t seqno, vm_size_t limit) { kern_return_t kr; |