Sponsored Content
Operating Systems Linux C++ Code to Access Linux Hard Disk Sectors (with a LoopBack Virtual Hard Disk) Post 302491177 by shen747 on Wednesday 26th of January 2011 11:07:03 PM
Old 01-27-2011
Hi Corona688,

Could you please give me an example code sample using the above 03 methods. A pointer to get me started on them ?. Because I feel I'll have to deal with the file descriptor at some point & I feel it wouldn't be optimum to do so using the <stdio.h> methods. could you give me some help for me to get started with the : open()/read()/write() please ??.
 

10 More Discussions You Might Find Interesting

1. UNIX for Dummies Questions & Answers

hard disk problems

Hi all I am facing a strange problem. I am using a sun ultra10 spark machine. first i took a 20gb IDE hard disk and installed solaris 5.8. But due to some requirement i have to reinstall the OS but this time solaris 2.6. and now the hard disk capacity is only showing 8gb. Where the 12gb... (3 Replies)
Discussion started by: Prafulla
3 Replies

2. Filesystems, Disks and Memory

hard disk meltdown

I had an issue with a second hard disk in my machine. I have a sparc station running solaris 7. It was working fine but now it wont mount on boot up and when you try to mount it manually it gives an I/O error. I tried a different disk as a control which was fine. What I want to know is if my... (3 Replies)
Discussion started by: Henrik
3 Replies

3. Filesystems, Disks and Memory

Adding hard Disk

Hi all, I am using SCO Openserver V and I want to add one more harddisk (/dev/hd1) Hw can I do it? (1 Reply)
Discussion started by: skant
1 Replies

4. UNIX Desktop Questions & Answers

Hard Disk

I have a cuestion. How Can I to add other hard disk to my computer? I need to configurate anyone? (4 Replies)
Discussion started by: hmaraver
4 Replies

5. UNIX for Dummies Questions & Answers

Hard Disk Check

How can we check the number of hard disks (both internal & external) in a server, their capacity and serial number (5 Replies)
Discussion started by: muneebr
5 Replies

6. UNIX for Dummies Questions & Answers

Hard Disk at 99% Help!

:eek: I use this Solaris to run CMS a call acounting software package for my job. No one could run reports today because it said the this when you logged on "The following file systems are low, and could adversely affect server performance: File system /: 99%full" Can some one please explain... (9 Replies)
Discussion started by: mannyisme
9 Replies

7. UNIX for Dummies Questions & Answers

How to increase hard disk in linux

Hi guys i have created a linux machine in virtual box now i want to add some hard disk space into it. How would i do this. Please help. Machine details are as below # lsb_release -a LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch Distributor ID:... (7 Replies)
Discussion started by: pinga123
7 Replies

8. SCO

declare disk driver for IDE hard disk

hi I've a fresh installation of SCO 5.0.7 on the IDE hard disk. For SCSI hard disk I can declare, for example blc disk driver using: # mkdev hd 0 SCSI-0 0 blc 0but it works for IDE hard disk? (3 Replies)
Discussion started by: ccc
3 Replies

9. Red Hat

Need help for getting hard-disk traces

When we write a programme,we declare variables and compiler allocates memory to them.I want to get access to the physical block number of hard-disk where actually the data is stored by the programme " Some one help me out... (1 Reply)
Discussion started by: nagraz007
1 Replies

10. UNIX for Advanced & Expert Users

Need help for getting hard-disk traces

When we write a programme,we declare variables and compiler allocates memory to them.I want to get access to the physical block number of hard-disk where actually the data is stored by the programme " Some one help me out... (3 Replies)
Discussion started by: nagraz007
3 Replies
Warn(3pm)						User Contributed Perl Documentation						 Warn(3pm)

NAME
Test::Warn - Perl extension to test methods for warnings SYNOPSIS
use Test::Warn; warning_is {foo(-dri => "/")} "Unknown Parameter 'dri'", "dri != dir gives warning"; warnings_are {bar(1,1)} ["Width very small", "Height very small"]; warning_is {add(2,2)} undef, "No warnings for calc 2+2"; # or warnings_are {add(2,2)} [], "No warnings for calc 2+2"; # what reads better :-) warning_like {foo(-dri => "/")} qr/unknown param/i, "an unknown parameter test"; warnings_like {bar(1,1)} [qr/width.*small/i, qr/height.*small/i]; warning_is {foo()} {carped => "didn't find the right parameters"}; warnings_like {foo()} [qr/undefined/,qr/undefined/,{carped => qr/no result/i}]; warning_like {foo(undef)} 'uninitialized'; warning_like {bar(file => '/etc/passwd')} 'io'; warning_like {eval q/"$x"; $x;/} [qw/void uninitialized/], "some warnings at compile time"; warnings_exist {...} [qr/expected warning/], "Expected warning is thrown"; DESCRIPTION
A good style of Perl programming calls for a lot of diverse regression tests. This module provides a few convenience methods for testing warning based-code. If you are not already familiar with the Test::More manpage, now would be the time to go take a look. FUNCTIONS warning_is BLOCK STRING, TEST_NAME Tests that BLOCK gives the specified warning exactly once. The test fails if the BLOCK warns more than once or does not warn at all. If the string is undef, then the tests succeeds if the BLOCK doesn't give any warning. Another way to say that there are no warnings in the block is "warnings_are {foo()} [], "no warnings"". If you want to test for a warning given by Carp you have to write something like: "warning_is {carp "msg"} {carped => 'msg'}, "Test for a carped warning"". The test will fail if a "normal" warning is found instead of a "carped" one. Note: "warn "foo"" would print something like "foo at -e line 1". This method ignores everything after the "at". Thus to match this warning you would have to call "warning_is {warn "foo"} "foo", "Foo succeeded"". If you need to test for a warning at an exactly line, try something like "warning_like {warn "foo"} qr/at XYZ.dat line 5/". warning_is and warning_are are only aliases to the same method. So you also could write "warning_is {foo()} [], "no warning"" or something similar. I decided to give two methods the same name to improve readability. A true value is returned if the test succeeds, false otherwise. The test name is optional, but recommended. warnings_are BLOCK ARRAYREF, TEST_NAME Tests to see that BLOCK gives exactly the specified warnings. The test fails if the warnings from BLOCK are not exactly the ones in ARRAYREF. If the ARRAYREF is equal to [], then the test succeeds if the BLOCK doesn't give any warning. Please read also the notes to warning_is as these methods are only aliases. If you want more than one test for carped warnings, try this: "warnings_are {carp "c1"; carp "c2"} {carped =" ['c1','c2'];> or "warnings_are {foo()} ["Warning 1", {carped =" ["Carp 1", "Carp 2"]}, "Warning 2"]>. Note that "{carped =" ...}> must always be a hash ref. warning_like BLOCK REGEXP, TEST_NAME Tests that BLOCK gives exactly one warning and it can be matched by the given regexp. If the string is undef, then the tests succeeds iff the BLOCK doesn't give any warning. The REGEXP is matched against the whole warning line, which in general has the form "WARNING at __FILE__ line __LINE__". So you can check for a warning in the file Foo.pm on line 5 with "warning_like {bar()} qr/at Foo.pm line 5/, "Testname"". Perhaps it is not sensible to perform such a test; however, you should be aware that matching on a sweeping regular expression or similar will always pass. Consider qr/^foo/ if you want to test for warning "foo something" in file foo.pl. You can also write the regexp in a string as "/.../" instead of using the qr/.../ syntax. Note that the slashes are important in the string, as strings without slashes are reserved for warning categories (to match warning categories as can be seen in the perllexwarn man page). As with "warning_is", you can test for warnings via "carp" with: "warning_like {bar()} {carped =" qr/bar called too early/i};> Similar to "warning_is"/"warnings_are", "warning_like" and "warnings_like" are only aliases to the same methods. A true value is returned if the test succeeds, false otherwise. The test name is optional, but recommended. warning_like BLOCK STRING, TEST_NAME Tests whether a BLOCK gives exactly one warning of the passed category. The categories are grouped in a tree, like it is expressed in perllexwarn. Note that they have the hierarchical structure from perl 5.8.0, you can access the internal hierarchy with $Test::Warn::Categorization::tree, although it isn't recommended). Thanks to the grouping in a tree, it's possible to test simply for an 'io' warning, instead of testing for a 'closed|exec|layer|newline|pipe|unopened' warning. Note that compile-time warnings can only be caught in an eval block. So warning_like {eval q/"$x"; $x;/} [qw/void uninitialized/], "some warnings at compile time"; will work, while it wouldn't work without the eval. Note also that it isn't yet possible to test for categories you created yourself with "warnings::register". warnings_like BLOCK ARRAYREF, TEST_NAME Tests to see that BLOCK gives exactly the number of the specified warnings and all the warnings have to match in the defined order to the passed regexes. Please read also the notes to warning_like as these methods are only aliases. Similar to "warnings_are", you can test for multiple warnings via "carp" and for warning categories, too: warnings_like {foo()} [qr/bar warning/, qr/bar warning/, {carped => qr/bar warning/i}, 'io' ], "I hope you'll never have to write a test for so many warnings :-)"; warnings_exist BLOCK STRING|ARRAYREF, TEST_NAME Same as warning_like, but will warn() all warnings that do not match the supplied regex/category, instead of registering an error. Use this test when you just want to make sure that specific warnings were generated, and couldn't care less if other warnings happened in the same block of code. warnings_exist {...} [qr/expected warning/], "Expected warning is thrown"; warnings_exist {...} ['uninitialized'], "Expected warning is thrown"; EXPORT "warning_is", "warnings_are", "warning_like", "warnings_like", "warnings_exist" by default. BUGS
Please note that warnings with newlines inside are very awkward. The only sensible way to handle them is to use the "warning_like" or "warnings_like" methods. The background is that there is no really safe way to distinguish between warnings with newlines and a stacktrace. If a method has its own warn handler, overwriting $SIG{__WARN__}, my test warning methods won't get these warnings. The "warning_like BLOCK CATEGORY, TEST_NAME" method isn't fully tested. Please take note if you use this this calling style, and report any bugs you find. TODO
Improve this documentation. The code has some parts doubled - especially in the test scripts. This is really awkward and must be changed. Please feel free to suggest improvements. SEE ALSO
Have a look to the similar Test::Exception module. Test::Trap THANKS
Many thanks to Adrian Howard, chromatic and Michael G. Schwern, who have given me a lot of ideas. AUTHOR
Janek Schleicher, <bigj AT kamelfreund.de> COPYRIGHT AND LICENSE
Copyright 2002 by Janek Schleicher Copyright 2007-2011 by Alexandr Ciornii, <http://chorny.net/> This library is free software; you can redistribute it and/or modify it under the same terms as Perl itself. perl v5.12.3 2011-06-16 Warn(3pm)
All times are GMT -4. The time now is 06:31 AM.
Unix & Linux Forums Content Copyright 1993-2022. All Rights Reserved.
Privacy Policy