darwin-dev Mailing List http://lists.apple.com/archives/darwin-dev/2009/Nov/index.html darwin-dev Mailing List Sat, 07 Nov 2009 16:00:31 +0000 Re: where are my code page-ins? http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00027.html Reply to list
My code page-ins are missing due to a stupid error in my analysis code.  
 I apologize for the noise!  
 	Thanks, Joel  
 On Nov 5, 2009, at 8:34 PM, Joel Reymont wrote:

[...]

firefox for android!
http://wagerlabs.com  
 
]]>
where are my code page-ins? http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00026.html Reply to list

I'm tracing page faults in a Firefox library (XUL) with a simple  
DTrace script that looks for vnode page-ins [1]. This is on Snow  
Leopard 10.6.1, 64 bits. 

 I run the script like this 'dtrace -Zqws page-fault.d'.  
I clear the cache beforehand by allocating 8Gb of memory (twice   [...]
]]>
Re: file offset of __DATA, __bss and __common http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00025.html Reply to list
[...]

Mea culpa. 'Uninitialized static variables' was staring me in the face  
but I totally missed it! 

 ---
firefox for android!
http://wagerlabs.com  
 
]]>
Re: file offset of __DATA, __bss and __common http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00024.html Reply to list
Yes, they do answer your question. Did you follow both pieces of advise? You would have seen the S_ZEROFILL section attribute with otool -lv, which you then could have looked up in the Mach-O file format reference.      Or, after reading the chapter on Segments, you'd see:      Segments that require more memory at runtime than they do at build time can specify a larger in-memory size than they actually have on disk. For example, the__PAGEZERO segment generated by the linker for PowerPC executable files has a virtual memory size of one page but an on-disk size of 0. Because __PAGEZEROcontains no data, there is no need for it to occupy any space in the executable file.   Note: Sections that are to be filled with zeros must always be placed at the end of the segment. Otherwise, the standard tools will not be able to successfully manipulate the Mach-O file.          Please try at least following the helpful information that people post.      
 Shantonu Sen  email@hidden     Sent from my Mac Pro 

   On Nov 5, 2009, at 8:25 AM, Joel Reymont wrote:   While I much appreciate the pointers so far, they don't answer my question.  Empirically, it looks like __DATA, __data = __bss + __common.  	Thanks, Joel  P.S. Here's a pointer of my own (wrote this a while ago):  http://tinyco.de/2009/01/26/creating-mac-binaries-on-any-platform.html  On Nov 5, 2009, at 4:21 PM, Shantonu Sen wrote:  > quoted text

[...]
]]>
Re: file offset of __DATA, __bss and __common http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00023.html Reply to list

While I much appreciate the pointers so far, they don't answer my  
question. 

 Empirically, it looks like __DATA, __data = __bss + __common.  
 	Thanks, Joel  
 P.S. Here's a pointer of my own (wrote this a while ago):  
 http://tinyco.de/2009/01/26/creating-mac-binaries-on-any-platform. [...]
]]>
Re: file offset of __DATA, __bss and __common http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00022.html Reply to list
[...]

Sent from my Mac Pro

On Nov 5, 2009, at 7:57 AM, Rustam Muginov wrote:

[...]
]]>
Re: file offset of __DATA, __bss and __common http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00021.html Reply to list
Had you tried "otool -lV"?  
 On Nov 5, 2009, at 6:26 PM, Joel Reymont wrote:

[...]

Sincerely, Rustam Muginov  

 
]]>
file offset of __DATA, __bss and __common http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00020.html Reply to list

Following is the output from 'size -m -l XUL'. For the life of me I  
cannot figure out the file offset of the __DATA, __bss and __DATA,  
__common sections. 

I tried to use heuristics to divine the file offsets but I seem to end  
up in the __LINKEDIT segment :-(. [...]
]]>
Interprocess Locking? http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00019.html Reply to list

I'm looking for a good solution for interprocess system wide locking.

I have two programs (with multiple users, it could be even more), that  
need to coordinate handling of a system wide event (disk mounting).

I have a solution in mind using named semaphores. [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00018.html Reply to list

[...]

Yes, this is a known issue in the VFS layer (5633019),
and Alastair already pointed it out:

On Wed, Nov 04, 2009 at 10:12:42AM +0000, Alastair Houghton wrote:

[...]

Like UFS, NFS also does not return va_total_alloc - only va_data_size
and va_data_alloc. [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00017.html Reply to list

On 4 Nov 2009, at 08:41, rohan a wrote:

[...]

Sorry for the stat distraction, I only tried it on this linux system 
before making the suggestion: 
$ stat sparse (output snipped) 
  Size: 3221225472      Blocks: 8 

But I see this morning that when I mount the same file system over NFS,  [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00016.html Reply to list

Hi Alastair,
Thanks for the help. This worked like a gem :)
I am new with this and not much of a kernel guy yet.

The man page for getattrlist() says this :

 A sparse file may have an allocated size on disk that is less than
its logical length (that is, ATTR_FILE_ALLOCSIZE < ATTR_FILE_TOTALSIZE
). [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00015.html Reply to list

[...]

As I said before, the thing to do is to look at the kernel sources.   
It's amazing how much of their own time some people are prepared to  
waste... it took me less than five minutes to figure out the answer to  
your question, and in the meantime I bet you've spent a lot longer   [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00014.html Reply to list

Hi All,

I wrote another program to get the file stat size and its real size
using this program :
[...]

int main(int argc, char *argv[])
{
        struct stat statbuf;

        if (lstat(argv[1], &statbuf) == 0)
        {
                printf("Success\n"); [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00013.html Reply to list

[...]

That's up to each file system.

[...]

$ grep 512 /usr/include/sys/stat.h
#define S_BLKSIZE       512             /* block size used in the stat struct */

This email sent to email@hidden








  References:   

[...]

Re: Identifying sparse files using getattrlist()

 Previous by thread: [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00012.html Reply to list
Thanks a lot :) I will try this
Would st_blksize vary for every file ?
Also is there any macro I can use instead of directly using 512 ?

On Tue, Nov 3, 2009 at 9:42 PM, Mike Mackovitch <email@hidden> wrote:

[...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00011.html Reply to list

[...]

Perhaps reading the documentation would help?  From the stat(2) man page:

     The size-related fields of the structures are as follows:

     st_blksize     The optimal I/O block size for the file.

     st_blocks      The actual number of blocks allocated for the file in [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00010.html Reply to list

[...]

st_blksize isn't what you think.  Check the stat(2) man page, where  
you'll see it says: 

      The size-related fields of the structures are as follows:  
      st_blksize     The optimal I/O block size for the file.  
     st_blocks      The actual number of blocks allocated for the   [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00009.html Reply to list
Why the hard coded value 512 ?

To find the real size of the file I tried this :
RealSize = st_blocks * st_blksize;

st_blksize returned was 4096

And the real size far execeeded the stat size (should be the opposite
for sparse files)

Thanks

On Tue, Nov 3, 2009 at 9:25 PM, Peter O'Gorman <email@hidden> wrote:

[...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00008.html Reply to list

[...]

I think you should just be using stat(2) and comparing st_size with 
st_blocks*512. 

But UFS seems to have gone away, so I was unable to create a UFS disk 
image to check. 

 Peter  
  Thanks  
On Tue, Nov 3, 2009 at 4:34 PM, rohan a<email@hidden>  wrote:
 When I use
# mkfile -nv 4g sparse [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00007.html Reply to list

[...]

Asking once is enough.  People on these mailing lists are for the most  
part volunteering their own time and resources to help each other, and  
pestering because of *your* deadline is not going to endear you to them. 

If you need the information urgently, why not download the kernel   [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00006.html Reply to list
Hello All,

Please help me. Need it urgently.

Thanks

On Tue, Nov 3, 2009 at 4:34 PM, rohan a <email@hidden> wrote:

[...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00005.html Reply to list
When I use
# mkfile -nv 4g sparse
on a 7GB Apple_UFS partition

df -k gives me this :

#df -k
Filesystem   1024-blocks Used Available Capacity  Mounted on
/dev/disk2s3     7390568   40   7021000     1%    /Volumes/UFSVolume

This indicates that the file created is sparse since it shows Capacity as 1%

On Tue, Nov 3, 2009 at 4:27 PM, Alastair Houghton

[...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00004.html Reply to list

[...]

Does Apple UFS even support sparse files?  Remember, UFS is a name  
used by a fair number of totally different and usually incompatible  
filesystems.  I haven't really ever bothered investigating exactly  
what Apple's UFS can and can't do... [...]
]]>
Re: Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00003.html Reply to list

Hello All,
This is the program :

[...]

#include <sys/attr.h>
#include <unistd.h>
#include <string.h>

typedef struct FileAttributes
{
        unsigned long length;
        off_t TotalSize;
        off_t AllocSize;
}FileAttributes;

int main(int argc, char *argv[] [...]
]]>
IPFW forwarding on SnowLeopard http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00002.html Reply to list

Hi list,  
	please can You help me set up packet forwarding with ipfw on Snow  
Leopard? 

 I have this rule in my firewall:  
 ipfw add 1 set 1 forward 127.0.0.1,5555 from me to any 80 keep-state  
I have a simple test code accepting connections on INADDR_ANY port  
5555. [...]
]]>
Identifying sparse files using getattrlist() http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00001.html Reply to list

Hello All,

I am trying to identify if a particular file is a sparse file using
getattrlist()

I am using this :     attrList.fileattr    = ATTR_FILE_TOTALSIZE |
ATTR_FILE_ALLOCSIZE;

According to the man page if  ATTR_FILE_ALLOCSIZE <
ATTR_FILE_TOTALSIZE the file is a sparse file. [...]
]]>
Re: not seeing dynamic library page-ins http://lists.apple.com/archives/darwin-dev/2009/Nov/msg00000.html Reply to list

On Oct 31, 2009, at 12:05 PM, email@hidden wrote:  > quoted text
    Libraries are mapped; you can't disable caching for mapped data since the VM and the buffer cache are the same thing.    > quoted text
     The pages you're interested in are probably already resident. [...]
]]>