Exemplo n.º 1
0
int fileinfo(const char *name)
{
    printf("Filename : %s\n", name);
    message m;

    struct stat filestat;
    if (stat(name, &filestat) == -1)
    {
        if (errno == ENOENT) printf("File not found\n");
        else printf("Unable to access the file");

        return 2;
    }

    printf("Inode : %llu\n", filestat.st_ino);
    m.m1_i2 = filestat.st_ino;

    char *pids = (char *) malloc(1024);
    memset(pids, 0, 1024);
    m.m1_p2 = pids;

    _syscall(VFS_PROC_NR, FILEINFO, &m);

    printf("PID : %s\n", pids);

    blockinfo(name);

    return SUCCESS;
}
		void *allocate ( size_t sz, block_construction_locker_base *lock )
		{
			assert ( sz > 0 );
			assert ( lock );

			if ( m_current_heap_bytes >= m_next_collection_heap_size )
			{
				// It's time to collect.
				collect_garbage ( NULL );
			}

			gc_object_generic_base *block = static_cast<gc_object_generic_base *> ( operator new ( sz /* + overhead? */ ) );
			m_heap_blocks.insert ( std::make_pair ( block, blockinfo ( block, sz ) ) );
			m_current_heap_bytes += sz;
			// Keep this block from being collected during
			// construction, before it has a chance to be
			// assigned to a gc_ptr.
			m_floating_blocks.insert ( block );
			block_ref ( lock ) = block;
			return block;
		}